blob: 482fa5bfaa32b49b9b0c325beadb2a93da6300fa [file] [log] [blame]
Brad Bishop73b776b2016-10-19 07:50:28 -04001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-inventory-manager], [1.0], [https://github.com/openbmc/phosphor-inventory-manager/issues])
Brad Bishopaa7e6bf2016-11-09 21:06:14 -05004AC_LANG([C++])
Brad Bishop73b776b2016-10-19 07:50:28 -04005AC_CONFIG_HEADERS([config.h])
6AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
7AM_SILENT_RULES([yes])
8
9# Checks for programs.
10AC_PROG_CXX
11AM_PROG_AR
12AC_PROG_INSTALL
13AC_PROG_MAKE_SET
Brad Bishop1a886e32016-11-11 16:02:10 -050014AC_PROG_AWK
Brad Bishopa6fcd562017-02-03 11:00:27 -050015AC_CHECK_PROG([FIND], find, find)
16AC_CHECK_PROG([BASENAME], basename, basename)
17AC_CHECK_PROG([DIRNAME], dirname, dirname)
Brad Bishop1a886e32016-11-11 16:02:10 -050018AM_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 Bishop73b776b2016-10-19 07:50:28 -040021
Brad Bishop49aefb32016-10-19 11:54:14 -040022# Checks for libraries.
23PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
Patrick Venture1384cde2019-02-13 15:10:50 -080024PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
25PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
26PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
Brad Bishop49aefb32016-10-19 11:54:14 -040027
Brad Bishop73b776b2016-10-19 07:50:28 -040028# Checks for typedefs, structures, and compiler characteristics.
Vernon Mauery889c2df2018-10-04 10:37:33 -070029AX_CXX_COMPILE_STDCXX_17([noext])
Brad Bishop73b776b2016-10-19 07:50:28 -040030AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
31
Brad Bishopaa7e6bf2016-11-09 21:06:14 -050032# Checks for header files.
Gunnar Mills33e21792017-10-25 17:15:56 -050033AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])
34AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...sdbusplus development package required])])
Brad Bishopaa7e6bf2016-11-09 21:06:14 -050035
Brad Bishop73b776b2016-10-19 07:50:28 -040036# Checks for library functions.
37LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot'
Brad Bishop35aba232019-01-07 20:54:34 +000038
39# Make it possible for users to choose if they want test support
40# explicitly or not at all
41AC_ARG_ENABLE([tests], [Whether we should build test cases])
42
Brad Bishopb9fa4332016-10-31 13:40:47 -050043# Check/set gtest specific functions.
Brad Bishop6b22dbb2019-01-07 20:42:45 -050044AS_IF([test "x$enable_tests" = "xyes"], [
Brad Bishop35aba232019-01-07 20:54:34 +000045 PKG_CHECK_MODULES([GMOCK], [gtest_main],,)
46 PKG_CHECK_MODULES([GTEST], [gmock],,)
Brad Bishop35aba232019-01-07 20:54:34 +000047])
Brad Bishop6b22dbb2019-01-07 20:42:45 -050048AX_PTHREAD
Brad Bishopb9fa4332016-10-31 13:40:47 -050049
50AC_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)
53AC_ARG_VAR(OECORE_TARGET_SYSROOT,
54 [Path to the OE SDK SYSROOT])
55AS_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 Bishop73b776b2016-10-19 07:50:28 -040067
Brad Bishopa6fcd562017-02-03 11:00:27 -050068AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
69AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
70 AC_MSG_ERROR([Cannot find sdbus++]))
71
Brad Bishop49aefb32016-10-19 11:54:14 -040072AC_ARG_VAR(BUSNAME, [The DBus busname to own.])
73AC_ARG_VAR(INVENTORY_ROOT, [The DBus inventory namespace root.])
74AC_ARG_VAR(IFACE, [The manager DBus interface.])
Brad Bishop1a886e32016-11-11 16:02:10 -050075AC_ARG_VAR(YAML_PATH, [The path to the yaml config files.])
Brad Bishop834989f2017-02-06 12:08:20 -050076AC_ARG_VAR(IFACES_PATH, [The path to the interfaces PIM can create.])
Brad Bishop49aefb32016-10-19 11:54:14 -040077AS_IF([test "x$BUSNAME" == "x"], [BUSNAME="xyz.openbmc_project.Inventory.Manager"])
Brad Bishop0a3d0602017-02-23 11:36:21 -050078AS_IF([test "x$INVENTORY_ROOT" == "x"], [INVENTORY_ROOT="/xyz/openbmc_project/inventory"])
Brad Bishop49aefb32016-10-19 11:54:14 -040079AS_IF([test "x$IFACE" == "x"], [IFACE="xyz.openbmc_project.Inventory.Manager"])
Brad Bishop1a886e32016-11-11 16:02:10 -050080AS_IF([test "x$YAML_PATH" == "x"], [YAML_PATH="$srcdir/example"])
Brad Bishop834989f2017-02-06 12:08:20 -050081AM_CONDITIONAL(IFACES_PATH, [test x"$IFACES_PATH" != "x"])
82
Brad Bishop49aefb32016-10-19 11:54:14 -040083AC_DEFINE_UNQUOTED([BUSNAME], ["$BUSNAME"], [The DBus busname to own.])
84AC_DEFINE_UNQUOTED([INVENTORY_ROOT], ["$INVENTORY_ROOT"], [The DBus inventory namespace root.])
85AC_DEFINE_UNQUOTED([IFACE], ["$IFACE"], [The manager DBus interface.])
86
Deepak Kodihalli6620e982017-08-05 13:09:54 -050087AC_ARG_VAR(PIM_PERSIST_PATH, [Path of directory housing persisted inventory.])
88AS_IF([test "x$PIM_PERSIST_PATH" == "x"], \
89 [PIM_PERSIST_PATH="/var/lib/phosphor-inventory-manager"])
90AC_DEFINE_UNQUOTED([PIM_PERSIST_PATH], ["$PIM_PERSIST_PATH"], \
91 [Path of directory housing persisted inventory])
92
Vishwanatha Subbanna2c4425e2017-09-29 22:53:53 +053093AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal])
94AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=1])
95AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal])
96
Brad Bishop73b776b2016-10-19 07:50:28 -040097# Create configured output
Brad Bishopa6fcd562017-02-03 11:00:27 -050098AC_CONFIG_FILES([Makefile.extra],
99 [${srcdir}/generate_makefile.sh $yaml > Makefile.extra],
100 [yaml=${YAML_PATH}/extra_interfaces.d])
101AC_CONFIG_FILES([test/Makefile.extra],
102 [${srcdir}/generate_makefile.sh $test_yaml > test/Makefile.extra],
103 [test_yaml=$srcdir/example/extra_interfaces.d])
Brad Bishop49aefb32016-10-19 11:54:14 -0400104AC_CONFIG_FILES([Makefile test/Makefile])
Brad Bishop73b776b2016-10-19 07:50:28 -0400105AC_OUTPUT