blob: 20767778bb278b2d506565e65d4be2d278f28110 [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
15AM_PATH_PYTHON([2.7],
16 [AC_SUBST([PYTHON], [echo "$PYTHON"])],
17 [AC_MSG_ERROR([Could not find python-2.7 installed...python-2.7 is required])])
Brad Bishop73b776b2016-10-19 07:50:28 -040018
Brad Bishop49aefb32016-10-19 11:54:14 -040019# Checks for libraries.
20PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
21
Brad Bishop73b776b2016-10-19 07:50:28 -040022# Checks for typedefs, structures, and compiler characteristics.
23AX_CXX_COMPILE_STDCXX_14([noext])
24AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
25
Brad Bishopaa7e6bf2016-11-09 21:06:14 -050026# Checks for header files.
27AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd developement package required])])
28AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...sdbusplus developement package required])])
29
Brad Bishop73b776b2016-10-19 07:50:28 -040030# Checks for library functions.
31LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot'
Brad Bishopb9fa4332016-10-31 13:40:47 -050032# Check/set gtest specific functions.
33AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
34AC_SUBST(GTEST_CPPFLAGS)
35
36AC_ARG_ENABLE([oe-sdk],
37 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
38)
39AC_ARG_VAR(OECORE_TARGET_SYSROOT,
40 [Path to the OE SDK SYSROOT])
41AS_IF([test "x$enable_oe_sdk" == "xyes"],
42 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
43 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
44 )
45 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
46 [
47 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
48 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
49 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
50 ]
51 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
52)
Brad Bishop73b776b2016-10-19 07:50:28 -040053
Brad Bishop49aefb32016-10-19 11:54:14 -040054AC_ARG_VAR(BUSNAME, [The DBus busname to own.])
55AC_ARG_VAR(INVENTORY_ROOT, [The DBus inventory namespace root.])
56AC_ARG_VAR(IFACE, [The manager DBus interface.])
Brad Bishop1a886e32016-11-11 16:02:10 -050057AC_ARG_VAR(YAML_PATH, [The path to the yaml config files.])
Brad Bishop49aefb32016-10-19 11:54:14 -040058AS_IF([test "x$BUSNAME" == "x"], [BUSNAME="xyz.openbmc_project.Inventory.Manager"])
59AS_IF([test "x$INVENTORY_ROOT" == "x"], [INVENTORY_ROOT="/xyz/openbmc_project/Inventory"])
60AS_IF([test "x$IFACE" == "x"], [IFACE="xyz.openbmc_project.Inventory.Manager"])
Brad Bishop1a886e32016-11-11 16:02:10 -050061AS_IF([test "x$YAML_PATH" == "x"], [YAML_PATH="$srcdir/example"])
Brad Bishop49aefb32016-10-19 11:54:14 -040062AC_DEFINE_UNQUOTED([BUSNAME], ["$BUSNAME"], [The DBus busname to own.])
63AC_DEFINE_UNQUOTED([INVENTORY_ROOT], ["$INVENTORY_ROOT"], [The DBus inventory namespace root.])
64AC_DEFINE_UNQUOTED([IFACE], ["$IFACE"], [The manager DBus interface.])
Brad Bishop1a886e32016-11-11 16:02:10 -050065PIMGEN="$PYTHON $srcdir/pimgen.py -d $YAML_PATH"
66EXTRAIFACES_LO="`$PIMGEN list-interfaces|awk '{ for(i=1;i<=NF;i++){printf $i".lo ";}}'`"
67EXTRAIFACES_C="`$PIMGEN list-interfaces|awk '{ for(i=1;i<=NF;i++){printf $i".cpp ";}}'`"
68AC_SUBST(EXTRAIFACES_LO)
69AC_SUBST(EXTRAIFACES_C)
70AC_SUBST(PIMGEN)
Brad Bishop49aefb32016-10-19 11:54:14 -040071
Brad Bishop73b776b2016-10-19 07:50:28 -040072# Create configured output
Brad Bishop49aefb32016-10-19 11:54:14 -040073AC_CONFIG_FILES([Makefile test/Makefile])
Brad Bishop73b776b2016-10-19 07:50:28 -040074AC_OUTPUT