blob: 526770c70c628dcd4d400bf9bf69a9522ffabe32 [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])
Deepak Kodihalli2a9f9342017-02-03 05:02:27 -060024PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,
25 AC_MSG_ERROR(["Requires sdbusplus package."]))
Brad Bishop03f4cd92017-02-03 15:17:21 -050026PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],,
27 AC_MSG_ERROR(["Requires phosphor-dbus-interfaces package."]))
Brad Bishop49aefb32016-10-19 11:54:14 -040028
Brad Bishop73b776b2016-10-19 07:50:28 -040029# Checks for typedefs, structures, and compiler characteristics.
30AX_CXX_COMPILE_STDCXX_14([noext])
31AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
32
Brad Bishopaa7e6bf2016-11-09 21:06:14 -050033# Checks for header files.
34AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd developement package required])])
35AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...sdbusplus developement package required])])
36
Brad Bishop73b776b2016-10-19 07:50:28 -040037# Checks for library functions.
38LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot'
Brad Bishopb9fa4332016-10-31 13:40:47 -050039# Check/set gtest specific functions.
40AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
41AC_SUBST(GTEST_CPPFLAGS)
42
43AC_ARG_ENABLE([oe-sdk],
44 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
45)
46AC_ARG_VAR(OECORE_TARGET_SYSROOT,
47 [Path to the OE SDK SYSROOT])
48AS_IF([test "x$enable_oe_sdk" == "xyes"],
49 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
50 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
51 )
52 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
53 [
54 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
55 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
56 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
57 ]
58 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
59)
Brad Bishop73b776b2016-10-19 07:50:28 -040060
Brad Bishopa6fcd562017-02-03 11:00:27 -050061AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
62AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
63 AC_MSG_ERROR([Cannot find sdbus++]))
64
Brad Bishop49aefb32016-10-19 11:54:14 -040065AC_ARG_VAR(BUSNAME, [The DBus busname to own.])
66AC_ARG_VAR(INVENTORY_ROOT, [The DBus inventory namespace root.])
67AC_ARG_VAR(IFACE, [The manager DBus interface.])
Brad Bishop1a886e32016-11-11 16:02:10 -050068AC_ARG_VAR(YAML_PATH, [The path to the yaml config files.])
Brad Bishop49aefb32016-10-19 11:54:14 -040069AS_IF([test "x$BUSNAME" == "x"], [BUSNAME="xyz.openbmc_project.Inventory.Manager"])
70AS_IF([test "x$INVENTORY_ROOT" == "x"], [INVENTORY_ROOT="/xyz/openbmc_project/Inventory"])
71AS_IF([test "x$IFACE" == "x"], [IFACE="xyz.openbmc_project.Inventory.Manager"])
Brad Bishop1a886e32016-11-11 16:02:10 -050072AS_IF([test "x$YAML_PATH" == "x"], [YAML_PATH="$srcdir/example"])
Brad Bishop49aefb32016-10-19 11:54:14 -040073AC_DEFINE_UNQUOTED([BUSNAME], ["$BUSNAME"], [The DBus busname to own.])
74AC_DEFINE_UNQUOTED([INVENTORY_ROOT], ["$INVENTORY_ROOT"], [The DBus inventory namespace root.])
75AC_DEFINE_UNQUOTED([IFACE], ["$IFACE"], [The manager DBus interface.])
76
Brad Bishop73b776b2016-10-19 07:50:28 -040077# Create configured output
Brad Bishopa6fcd562017-02-03 11:00:27 -050078AC_CONFIG_FILES([Makefile.extra],
79 [${srcdir}/generate_makefile.sh $yaml > Makefile.extra],
80 [yaml=${YAML_PATH}/extra_interfaces.d])
81AC_CONFIG_FILES([test/Makefile.extra],
82 [${srcdir}/generate_makefile.sh $test_yaml > test/Makefile.extra],
83 [test_yaml=$srcdir/example/extra_interfaces.d])
Brad Bishop49aefb32016-10-19 11:54:14 -040084AC_CONFIG_FILES([Makefile test/Makefile])
Brad Bishop73b776b2016-10-19 07:50:28 -040085AC_OUTPUT