Deepak Kodihalli | 2bba75d | 2016-11-30 00:46:49 -0600 | [diff] [blame] | 1 | AC_PREREQ([2.69]) |
| 2 | AC_INIT([openpower-vpd-parser], [1.0], [https://github.com/openbmc/openpower-vpd-parser/issues]) |
| 3 | |
| 4 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 5 | AM_SILENT_RULES([yes]) |
Patrick Venture | 6c830e9 | 2018-10-29 19:02:29 -0700 | [diff] [blame] | 6 | AC_LANG([C++]) |
Deepak Kodihalli | 2bba75d | 2016-11-30 00:46:49 -0600 | [diff] [blame] | 7 | |
| 8 | # Checks for programs |
| 9 | AC_PROG_CXX |
| 10 | AM_PROG_AR |
| 11 | AC_PROG_INSTALL |
| 12 | AC_PROG_MAKE_SET |
Santosh Puranik | 3d7b4fe | 2020-04-02 23:27:22 +0530 | [diff] [blame] | 13 | AM_PATH_PYTHON([3], |
Deepak Kodihalli | 2bba75d | 2016-11-30 00:46:49 -0600 | [diff] [blame] | 14 | [AC_SUBST([PYTHON], [echo "$PYTHON"])], |
Santosh Puranik | 3d7b4fe | 2020-04-02 23:27:22 +0530 | [diff] [blame] | 15 | [AC_MSG_ERROR([Could not find python-3 installed...python-3 is required])]) |
Deepak Kodihalli | 2bba75d | 2016-11-30 00:46:49 -0600 | [diff] [blame] | 16 | |
Patrick Venture | 1bdf22f | 2019-02-13 15:09:17 -0800 | [diff] [blame] | 17 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
| 18 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) |
Deepak Kodihalli | ae7b545 | 2017-02-06 05:05:56 -0600 | [diff] [blame] | 19 | |
Gunnar Mills | b29fb68 | 2017-10-25 16:23:31 -0500 | [diff] [blame] | 20 | # Suppress the --with-libtool-sysroot error |
Deepak Kodihalli | 2bba75d | 2016-11-30 00:46:49 -0600 | [diff] [blame] | 21 | LT_INIT |
| 22 | |
| 23 | # Checks for typedefs, structures, and compiler characteristics. |
Vernon Mauery | 6e3c2b7 | 2018-10-04 09:17:52 -0700 | [diff] [blame] | 24 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Deepak Kodihalli | 2bba75d | 2016-11-30 00:46:49 -0600 | [diff] [blame] | 25 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
| 26 | |
| 27 | # Test cases require SDK so only build if we're told to (and SDK is available) |
| 28 | AC_ARG_ENABLE([oe-sdk], |
| 29 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 30 | ) |
| 31 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 32 | [Path to the OE SDK SYSROOT]) |
| 33 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 34 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 35 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 36 | ) |
| 37 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 38 | [ |
| 39 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 40 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 41 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 42 | ] |
| 43 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 44 | ) |
| 45 | |
Deepak Kodihalli | cd6d241 | 2017-02-06 07:35:32 -0600 | [diff] [blame] | 46 | AS_IF([test "x$FRU_YAML" == "x"], [FRU_YAML="writefru.yaml"]) |
| 47 | FRUGEN="$PYTHON $srcdir/writefru.py -i $FRU_YAML" |
| 48 | AC_SUBST(FRUGEN) |
Deepak Kodihalli | c7b2a71 | 2017-02-17 00:58:39 -0600 | [diff] [blame] | 49 | AS_IF([test "x$PROP_YAML" == "x"], [PROP_YAML="extra-properties-example.yaml"]) |
| 50 | PROPGEN="$PYTHON $srcdir/extra-properties.py -e $PROP_YAML" |
| 51 | AC_SUBST(PROPGEN) |
Deepak Kodihalli | cd6d241 | 2017-02-06 07:35:32 -0600 | [diff] [blame] | 52 | |
Alpana Kumari | 26a74af | 2019-09-10 23:53:58 -0500 | [diff] [blame] | 53 | # Setup option for IBM VPD formats. |
| 54 | AC_ARG_ENABLE([ibm-parser], |
| 55 | AS_HELP_STRING([--enable-ibm-parser ], |
| 56 | [Enable IBM IPZ and Keyword format VPD parser support. |
| 57 | ])) |
| 58 | |
| 59 | AM_CONDITIONAL([IBM_PARSER], [test "x$enable_ibm_parser" = "xyes"]) |
| 60 | AS_IF([test "x$enable_ibm_parser" == "xyes"], [ |
| 61 | # Check necessary header files |
| 62 | AC_CHECK_HEADER( |
| 63 | [CLI/CLI.hpp], |
| 64 | [], |
| 65 | [AC_MSG_ERROR([Could not find CLI11 CLI.hpp])] |
PriyangaRamasamy | 1f0b1e6 | 2020-02-20 20:48:25 +0530 | [diff] [blame] | 66 | ) |
Alpana Kumari | 26a74af | 2019-09-10 23:53:58 -0500 | [diff] [blame] | 67 | AC_CHECK_HEADER( |
| 68 | [nlohmann/json.hpp], |
| 69 | [], |
| 70 | [AC_MSG_ERROR([Could not find nlohmann/json.hpp. Require nlohmann/json package])] |
| 71 | ) |
| 72 | AX_APPEND_COMPILE_FLAGS([-DIPZ_PARSER], [CXXFLAGS]) |
| 73 | AC_DEFINE(INVENTORY_JSON, "/usr/share/vpd/vpd_inventory.json", [JSON file that defines inventory blueprint]) |
| 74 | ]) |
PriyangaRamasamy | 1f0b1e6 | 2020-02-20 20:48:25 +0530 | [diff] [blame] | 75 | AC_DEFINE(INVENTORY_PATH, "/xyz/openbmc_project/inventory", [Prefix for inventory D-Bus objects]) |
| 76 | AC_DEFINE(INVENTORY_MANAGER_SERVICE, "xyz.openbmc_project.Inventory.Manager", [Inventory manager service]) |
Alpana Kumari | 26a74af | 2019-09-10 23:53:58 -0500 | [diff] [blame] | 77 | |
| 78 | # Check/set gtest specific functions. |
| 79 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 80 | AC_SUBST(GTEST_CPPFLAGS) |
| 81 | |
PriyangaRamasamy | abb87ed | 2019-11-19 17:25:35 +0530 | [diff] [blame] | 82 | # Configure option to enable debug information for keyword VPD parser |
| 83 | AC_ARG_ENABLE([debug-kw-vpd], |
| 84 | AS_HELP_STRING([--enable-debug-kw-vpd ], |
| 85 | [Debug statements for Keyword VPD Parser . |
| 86 | ])) |
| 87 | AS_IF([ test "$enable_debug_kw_vpd" = "yes"], |
| 88 | [ |
| 89 | AC_MSG_NOTICE([Enabling debug information for keyword vpd parser application]) |
| 90 | kw_vpd_debug_flags=-DDEBUG_KW_VPD |
| 91 | AC_SUBST([KW_VPD_DEBUG_FLAGS], [$kw_vpd_debug_flags]) |
| 92 | ] |
| 93 | ) |
| 94 | |
Deepak Kodihalli | 2bba75d | 2016-11-30 00:46:49 -0600 | [diff] [blame] | 95 | AC_CONFIG_HEADERS([config.h]) |
Deepak Kodihalli | 901c5d9 | 2016-11-30 05:19:45 -0600 | [diff] [blame] | 96 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Deepak Kodihalli | 2bba75d | 2016-11-30 00:46:49 -0600 | [diff] [blame] | 97 | AC_OUTPUT |