Brad Bishop | 73b776b | 2016-10-19 07:50:28 -0400 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([phosphor-inventory-manager], [1.0], [https://github.com/openbmc/phosphor-inventory-manager/issues]) |
Brad Bishop | aa7e6bf | 2016-11-09 21:06:14 -0500 | [diff] [blame] | 4 | AC_LANG([C++]) |
Brad Bishop | 73b776b | 2016-10-19 07:50:28 -0400 | [diff] [blame] | 5 | AC_CONFIG_HEADERS([config.h]) |
| 6 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 7 | AM_SILENT_RULES([yes]) |
| 8 | |
| 9 | # Checks for programs. |
| 10 | AC_PROG_CXX |
| 11 | AM_PROG_AR |
| 12 | AC_PROG_INSTALL |
| 13 | AC_PROG_MAKE_SET |
Brad Bishop | 1a886e3 | 2016-11-11 16:02:10 -0500 | [diff] [blame] | 14 | AC_PROG_AWK |
Brad Bishop | a6fcd56 | 2017-02-03 11:00:27 -0500 | [diff] [blame] | 15 | AC_CHECK_PROG([FIND], find, find) |
| 16 | AC_CHECK_PROG([BASENAME], basename, basename) |
| 17 | AC_CHECK_PROG([DIRNAME], dirname, dirname) |
Brad Bishop | 1a886e3 | 2016-11-11 16:02:10 -0500 | [diff] [blame] | 18 | AM_PATH_PYTHON([2.7], |
| 19 | [AC_SUBST([PYTHON], [echo "$PYTHON"])], |
| 20 | [AC_MSG_ERROR([Could not find python-2.7 installed...python-2.7 is required])]) |
Brad Bishop | 73b776b | 2016-10-19 07:50:28 -0400 | [diff] [blame] | 21 | |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 22 | # Checks for libraries. |
| 23 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221]) |
Brad Bishop | 79ccaf7 | 2017-01-22 16:00:50 -0500 | [diff] [blame] | 24 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],, AC_MSG_ERROR(["Requires sdbusplus package."])) |
| 25 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],, AC_MSG_ERROR(["Requires phosphor-dbus-interfaces package."])) |
| 26 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],, AC_MSG_ERROR(["Requires phosphor-logging."])) |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 27 | |
Brad Bishop | 73b776b | 2016-10-19 07:50:28 -0400 | [diff] [blame] | 28 | # Checks for typedefs, structures, and compiler characteristics. |
Vernon Mauery | 889c2df | 2018-10-04 10:37:33 -0700 | [diff] [blame] | 29 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Brad Bishop | 73b776b | 2016-10-19 07:50:28 -0400 | [diff] [blame] | 30 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) |
| 31 | |
Brad Bishop | aa7e6bf | 2016-11-09 21:06:14 -0500 | [diff] [blame] | 32 | # Checks for header files. |
Gunnar Mills | 33e2179 | 2017-10-25 17:15:56 -0500 | [diff] [blame] | 33 | AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])]) |
| 34 | AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...sdbusplus development package required])]) |
Brad Bishop | aa7e6bf | 2016-11-09 21:06:14 -0500 | [diff] [blame] | 35 | |
Brad Bishop | 73b776b | 2016-10-19 07:50:28 -0400 | [diff] [blame] | 36 | # Checks for library functions. |
| 37 | LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot' |
Brad Bishop | 35aba23 | 2019-01-07 20:54:34 +0000 | [diff] [blame] | 38 | |
| 39 | # Make it possible for users to choose if they want test support |
| 40 | # explicitly or not at all |
| 41 | AC_ARG_ENABLE([tests], [Whether we should build test cases]) |
| 42 | |
Brad Bishop | b9fa433 | 2016-10-31 13:40:47 -0500 | [diff] [blame] | 43 | # Check/set gtest specific functions. |
Brad Bishop | 35aba23 | 2019-01-07 20:54:34 +0000 | [diff] [blame] | 44 | AS_IF([test "x$enable_tests" != "xno"], [ |
| 45 | PKG_CHECK_MODULES([GMOCK], [gtest_main],,) |
| 46 | PKG_CHECK_MODULES([GTEST], [gmock],,) |
| 47 | AX_PTHREAD |
| 48 | ]) |
Brad Bishop | b9fa433 | 2016-10-31 13:40:47 -0500 | [diff] [blame] | 49 | |
| 50 | AC_ARG_ENABLE([oe-sdk], |
| 51 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 52 | ) |
| 53 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 54 | [Path to the OE SDK SYSROOT]) |
| 55 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 56 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 57 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 58 | ) |
| 59 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 60 | [ |
| 61 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 62 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 63 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 64 | ] |
| 65 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 66 | ) |
Brad Bishop | 73b776b | 2016-10-19 07:50:28 -0400 | [diff] [blame] | 67 | |
Brad Bishop | a6fcd56 | 2017-02-03 11:00:27 -0500 | [diff] [blame] | 68 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
| 69 | AS_IF([test "x$SDBUSPLUSPLUS" == "x"], |
| 70 | AC_MSG_ERROR([Cannot find sdbus++])) |
| 71 | |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 72 | AC_ARG_VAR(BUSNAME, [The DBus busname to own.]) |
| 73 | AC_ARG_VAR(INVENTORY_ROOT, [The DBus inventory namespace root.]) |
| 74 | AC_ARG_VAR(IFACE, [The manager DBus interface.]) |
Brad Bishop | 1a886e3 | 2016-11-11 16:02:10 -0500 | [diff] [blame] | 75 | AC_ARG_VAR(YAML_PATH, [The path to the yaml config files.]) |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 76 | AC_ARG_VAR(IFACES_PATH, [The path to the interfaces PIM can create.]) |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 77 | AS_IF([test "x$BUSNAME" == "x"], [BUSNAME="xyz.openbmc_project.Inventory.Manager"]) |
Brad Bishop | 0a3d060 | 2017-02-23 11:36:21 -0500 | [diff] [blame] | 78 | AS_IF([test "x$INVENTORY_ROOT" == "x"], [INVENTORY_ROOT="/xyz/openbmc_project/inventory"]) |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 79 | AS_IF([test "x$IFACE" == "x"], [IFACE="xyz.openbmc_project.Inventory.Manager"]) |
Brad Bishop | 1a886e3 | 2016-11-11 16:02:10 -0500 | [diff] [blame] | 80 | AS_IF([test "x$YAML_PATH" == "x"], [YAML_PATH="$srcdir/example"]) |
Brad Bishop | 834989f | 2017-02-06 12:08:20 -0500 | [diff] [blame] | 81 | AM_CONDITIONAL(IFACES_PATH, [test x"$IFACES_PATH" != "x"]) |
| 82 | |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 83 | AC_DEFINE_UNQUOTED([BUSNAME], ["$BUSNAME"], [The DBus busname to own.]) |
| 84 | AC_DEFINE_UNQUOTED([INVENTORY_ROOT], ["$INVENTORY_ROOT"], [The DBus inventory namespace root.]) |
| 85 | AC_DEFINE_UNQUOTED([IFACE], ["$IFACE"], [The manager DBus interface.]) |
| 86 | |
Deepak Kodihalli | 6620e98 | 2017-08-05 13:09:54 -0500 | [diff] [blame] | 87 | AC_ARG_VAR(PIM_PERSIST_PATH, [Path of directory housing persisted inventory.]) |
| 88 | AS_IF([test "x$PIM_PERSIST_PATH" == "x"], \ |
| 89 | [PIM_PERSIST_PATH="/var/lib/phosphor-inventory-manager"]) |
| 90 | AC_DEFINE_UNQUOTED([PIM_PERSIST_PATH], ["$PIM_PERSIST_PATH"], \ |
| 91 | [Path of directory housing persisted inventory]) |
| 92 | |
Vishwanatha Subbanna | 2c4425e | 2017-09-29 22:53:53 +0530 | [diff] [blame] | 93 | AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal]) |
| 94 | AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=1]) |
| 95 | AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal]) |
| 96 | |
Brad Bishop | 73b776b | 2016-10-19 07:50:28 -0400 | [diff] [blame] | 97 | # Create configured output |
Brad Bishop | a6fcd56 | 2017-02-03 11:00:27 -0500 | [diff] [blame] | 98 | AC_CONFIG_FILES([Makefile.extra], |
| 99 | [${srcdir}/generate_makefile.sh $yaml > Makefile.extra], |
| 100 | [yaml=${YAML_PATH}/extra_interfaces.d]) |
| 101 | AC_CONFIG_FILES([test/Makefile.extra], |
| 102 | [${srcdir}/generate_makefile.sh $test_yaml > test/Makefile.extra], |
| 103 | [test_yaml=$srcdir/example/extra_interfaces.d]) |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 104 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Brad Bishop | 73b776b | 2016-10-19 07:50:28 -0400 | [diff] [blame] | 105 | AC_OUTPUT |