blob: 5e6bb8ba1e308a2009246b81c1a6e5b379ea9120 [file] [log] [blame]
Deepak Kodihalli2bba75d2016-11-30 00:46:49 -06001AC_PREREQ([2.69])
2AC_INIT([openpower-vpd-parser], [1.0], [https://github.com/openbmc/openpower-vpd-parser/issues])
3
4AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
5AM_SILENT_RULES([yes])
Patrick Venture6c830e92018-10-29 19:02:29 -07006AC_LANG([C++])
Deepak Kodihalli2bba75d2016-11-30 00:46:49 -06007
8# Checks for programs
9AC_PROG_CXX
10AM_PROG_AR
11AC_PROG_INSTALL
12AC_PROG_MAKE_SET
Santosh Puranik3d7b4fe2020-04-02 23:27:22 +053013AM_PATH_PYTHON([3],
Deepak Kodihalli2bba75d2016-11-30 00:46:49 -060014 [AC_SUBST([PYTHON], [echo "$PYTHON"])],
Santosh Puranik3d7b4fe2020-04-02 23:27:22 +053015 [AC_MSG_ERROR([Could not find python-3 installed...python-3 is required])])
Deepak Kodihalli2bba75d2016-11-30 00:46:49 -060016
Patrick Venture1bdf22f2019-02-13 15:09:17 -080017PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
18PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
Deepak Kodihalliae7b5452017-02-06 05:05:56 -060019
Alpana Kumari26a74af2019-09-10 23:53:58 -050020
Gunnar Millsb29fb682017-10-25 16:23:31 -050021# Suppress the --with-libtool-sysroot error
Deepak Kodihalli2bba75d2016-11-30 00:46:49 -060022LT_INIT
23
24# Checks for typedefs, structures, and compiler characteristics.
Vernon Mauery6e3c2b72018-10-04 09:17:52 -070025AX_CXX_COMPILE_STDCXX_17([noext])
Deepak Kodihalli2bba75d2016-11-30 00:46:49 -060026AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
27
28# Test cases require SDK so only build if we're told to (and SDK is available)
29AC_ARG_ENABLE([oe-sdk],
30 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
31)
32AC_ARG_VAR(OECORE_TARGET_SYSROOT,
33 [Path to the OE SDK SYSROOT])
34AS_IF([test "x$enable_oe_sdk" == "xyes"],
35 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
36 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
37 )
38 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
39 [
40 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
41 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
42 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
43 ]
44 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
45)
46
Deepak Kodihallicd6d2412017-02-06 07:35:32 -060047AS_IF([test "x$FRU_YAML" == "x"], [FRU_YAML="writefru.yaml"])
48FRUGEN="$PYTHON $srcdir/writefru.py -i $FRU_YAML"
49AC_SUBST(FRUGEN)
Deepak Kodihallic7b2a712017-02-17 00:58:39 -060050AS_IF([test "x$PROP_YAML" == "x"], [PROP_YAML="extra-properties-example.yaml"])
51PROPGEN="$PYTHON $srcdir/extra-properties.py -e $PROP_YAML"
52AC_SUBST(PROPGEN)
Deepak Kodihallicd6d2412017-02-06 07:35:32 -060053
Alpana Kumari26a74af2019-09-10 23:53:58 -050054# Setup option for IBM VPD formats.
55AC_ARG_ENABLE([ibm-parser],
56 AS_HELP_STRING([--enable-ibm-parser ],
57 [Enable IBM IPZ and Keyword format VPD parser support.
58 ]))
59
60AM_CONDITIONAL([IBM_PARSER], [test "x$enable_ibm_parser" = "xyes"])
61AS_IF([test "x$enable_ibm_parser" == "xyes"], [
62# Check necessary header files
63 AC_CHECK_HEADER(
64 [CLI/CLI.hpp],
65 [],
66 [AC_MSG_ERROR([Could not find CLI11 CLI.hpp])]
67 )
68 AC_CHECK_HEADER(
69 [nlohmann/json.hpp],
70 [],
71 [AC_MSG_ERROR([Could not find nlohmann/json.hpp. Require nlohmann/json package])]
72 )
73 AX_APPEND_COMPILE_FLAGS([-DIPZ_PARSER], [CXXFLAGS])
74 AC_DEFINE(INVENTORY_JSON, "/usr/share/vpd/vpd_inventory.json", [JSON file that defines inventory blueprint])
75 ])
76
77# Check/set gtest specific functions.
78AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
79AC_SUBST(GTEST_CPPFLAGS)
80
Deepak Kodihalli2bba75d2016-11-30 00:46:49 -060081AC_CONFIG_HEADERS([config.h])
Deepak Kodihalli901c5d92016-11-30 05:19:45 -060082AC_CONFIG_FILES([Makefile test/Makefile])
Deepak Kodihalli2bba75d2016-11-30 00:46:49 -060083AC_OUTPUT