Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([swampd], [1.0], [https://www.google.com]) |
| 4 | AC_LANG([C++]) |
| 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 |
| 14 | |
| 15 | # Python |
| 16 | AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])], |
| 17 | [AC_MSG_ERROR([Could not find python-2.7 installed...python-2.7 is required])]) |
| 18 | |
| 19 | # Checks for typedefs, structures, and compiler characteristics. |
Patrick Venture | 54c2e5e | 2018-09-10 13:06:38 -0700 | [diff] [blame] | 20 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Patrick Venture | ab28cb3 | 2018-06-20 18:37:48 -0700 | [diff] [blame] | 21 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 22 | |
| 23 | # Checks for libraries. |
| 24 | # AC_CHECK_LIB([mapper], [mapper_get_service], ,[AC_MSG_ERROR([Could not find libmapper...openbmc/phosphor-objmgr package required])]) |
| 25 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found"])]) |
| 26 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], ,[AC_MSG_ERROR([The openbmc/sdbusplus package is required])]) |
| 27 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging], ,[AC_MSG_ERROR([The openbmc/phosphor-logging package is required])]) |
| 28 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])]) |
Patrick Venture | ba00343 | 2018-07-27 06:59:05 -0700 | [diff] [blame] | 29 | AC_CHECK_HEADER([host-ipmid], [AC_MSG_ERROR(["phosphor-host-ipmid required and not found."])]) |
Patrick Venture | d73af2b | 2018-10-11 15:51:03 -0700 | [diff] [blame] | 30 | AC_CHECK_HEADER(experimental/filesystem, ,[AC_MSG_ERROR([Could not find experimental/filesystem...libstdc++fs development package required])]) |
Patrick Venture | 2917247 | 2018-05-10 08:50:35 -0700 | [diff] [blame] | 31 | PKG_CHECK_MODULES([LIBCONFIGXX], [libconfig++ >= 1.5], ,AC_MSG_ERROR([libconfig++ 1.5 or newer not found.])) |
Patrick Venture | 2e3ecb5 | 2018-06-22 08:18:19 -0700 | [diff] [blame] | 32 | AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])]) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 33 | |
| 34 | # Checks for library functions. |
| 35 | LT_INIT # Required for systemd linking |
| 36 | |
| 37 | # Check/set gtest specific functions. |
Patrick Venture | 7a841b6 | 2018-06-13 09:39:46 -0700 | [diff] [blame] | 38 | PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])]) |
| 39 | PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])]) |
Patrick Venture | 2e3ecb5 | 2018-06-22 08:18:19 -0700 | [diff] [blame] | 40 | PKG_CHECK_MODULES([GTEST_MAIN], [gtest_main], [], [AC_MSG_NOTICE([gtest_main not found, tests will not build])]) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 41 | |
| 42 | AC_ARG_ENABLE([oe-sdk], |
| 43 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 44 | ) |
| 45 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 46 | [Path to the OE SDK SYSROOT]) |
| 47 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 48 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 49 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 50 | ) |
| 51 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 52 | [ |
| 53 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 54 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 55 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 56 | ] |
| 57 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 58 | ) |
| 59 | |
| 60 | AS_IF([test "x$SENSOR_YAML_GEN" == "x"], [SENSOR_YAML_GEN="sensor-example.yaml"]) |
| 61 | SENSORGEN="$PYTHON ${srcdir}/scripts/sensor_gen.py -i $SENSOR_YAML_GEN" |
| 62 | AC_SUBST(SENSORGEN) |
| 63 | |
| 64 | AS_IF([test "x$PID_YAML_GEN" == "x"], [PID_YAML_GEN="pid-example.yaml"]) |
| 65 | PIDGEN="$PYTHON ${srcdir}/scripts/pid_gen.py -i $PID_YAML_GEN" |
| 66 | AC_SUBST(PIDGEN) |
| 67 | |
| 68 | AS_IF([test "x$ZONE_YAML_GEN" == "x"], [ZONE_YAML_GEN="zone-example.yaml"]) |
| 69 | ZONEGEN="$PYTHON ${srcdir}/scripts/zone_gen.py -i $ZONE_YAML_GEN" |
| 70 | AC_SUBST(ZONEGEN) |
| 71 | |
James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 72 | AC_ARG_ENABLE([configure-dbus], |
| 73 | AS_HELP_STRING([--enable-configure-dbus], [Enable configuring pid from D-Bus.])) |
| 74 | AM_CONDITIONAL(CONFIGURE_DBUS, [test "x$enable_configure_dbus" = "xyes"]) |
| 75 | AS_IF([test "x$enable_configure_dbus" = "xyes"], |
James Feist | ce15e02 | 2018-09-26 10:01:33 -0700 | [diff] [blame] | 76 | [AC_DEFINE(CONFIGURE_DBUS, [1], [Read configuration from D-Bus.])], |
| 77 | [AC_DEFINE(CONFIGURE_DBUS, [0], [Do not read configuration from D-Bus.])] |
James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 78 | ) |
| 79 | |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 80 | # Create configured output |
Patrick Venture | 7a841b6 | 2018-06-13 09:39:46 -0700 | [diff] [blame] | 81 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 82 | AC_OUTPUT |