Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
Patrick Venture | d752357 | 2018-11-26 09:01:54 -0800 | [diff] [blame] | 3 | AC_INIT([swampd], [0.1], [https://github.com/openbmc/phosphor-pid-control/issues]) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 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. |
Patrick Venture | e54c7ff | 2018-11-21 21:30:56 -0800 | [diff] [blame] | 24 | PKG_CHECK_MODULES( |
| 25 | [SYSTEMD], |
| 26 | [libsystemd >= 221], |
| 27 | [], |
| 28 | [AC_MSG_ERROR(["systemd required and not found"])] |
| 29 | ) |
| 30 | PKG_CHECK_MODULES( |
| 31 | [SDBUSPLUS], |
| 32 | [sdbusplus], |
| 33 | [], |
| 34 | [AC_MSG_ERROR([The openbmc/sdbusplus package is required])] |
| 35 | ) |
| 36 | PKG_CHECK_MODULES( |
| 37 | [PHOSPHOR_LOGGING], |
| 38 | [phosphor-logging], |
| 39 | [], |
| 40 | [AC_MSG_ERROR([The openbmc/phosphor-logging package is required])] |
| 41 | ) |
| 42 | PKG_CHECK_MODULES( |
| 43 | [PHOSPHOR_DBUS_INTERFACES], |
| 44 | [phosphor-dbus-interfaces], |
| 45 | [], |
| 46 | [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])] |
| 47 | ) |
| 48 | PKG_CHECK_MODULES( |
| 49 | [LIBCONFIGXX], |
| 50 | [libconfig++ >= 1.5], |
| 51 | [], |
| 52 | [AC_MSG_ERROR([libconfig++ 1.5 or newer not found.])] |
| 53 | ) |
| 54 | AC_CHECK_HEADER( |
| 55 | [host-ipmid], |
| 56 | [AC_MSG_ERROR(["phosphor-host-ipmid required and not found."])] |
| 57 | ) |
| 58 | AC_CHECK_HEADER( |
| 59 | experimental/filesystem, |
| 60 | [], |
| 61 | [AC_MSG_ERROR([Could not find experimental/filesystem...libstdc++fs development package required])] |
| 62 | ) |
Patrick Venture | 2e3ecb5 | 2018-06-22 08:18:19 -0700 | [diff] [blame] | 63 | AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])]) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 64 | |
| 65 | # Checks for library functions. |
| 66 | LT_INIT # Required for systemd linking |
| 67 | |
| 68 | # Check/set gtest specific functions. |
Patrick Venture | f77ecc7 | 2018-11-26 09:08:49 -0800 | [diff] [blame] | 69 | PKG_CHECK_MODULES( |
| 70 | [GTEST], |
| 71 | [gtest], |
| 72 | [], |
| 73 | [AC_MSG_NOTICE([gtest not found, tests will not build])] |
| 74 | ) |
| 75 | PKG_CHECK_MODULES( |
| 76 | [GMOCK], |
| 77 | [gmock], |
| 78 | [], |
| 79 | [AC_MSG_NOTICE([gmock not found, tests will not build])] |
| 80 | ) |
| 81 | PKG_CHECK_MODULES( |
| 82 | [GTEST_MAIN], |
| 83 | [gtest_main], |
| 84 | [], |
| 85 | [AC_MSG_NOTICE([gtest_main not found, tests will not build])] |
| 86 | ) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 87 | |
| 88 | AC_ARG_ENABLE([oe-sdk], |
Patrick Venture | f77ecc7 | 2018-11-26 09:08:49 -0800 | [diff] [blame] | 89 | AS_HELP_STRING( |
| 90 | [--enable-oe-sdk], |
| 91 | [Link testcases absolutely against OE SDK so they can be ran within it.] |
| 92 | ) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 93 | ) |
| 94 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
Patrick Venture | f77ecc7 | 2018-11-26 09:08:49 -0800 | [diff] [blame] | 95 | [Path to the OE SDK SYSROOT] |
| 96 | ) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 97 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 98 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 99 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 100 | ) |
| 101 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 102 | [ |
| 103 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 104 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 105 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 106 | ] |
| 107 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 108 | ) |
| 109 | |
| 110 | AS_IF([test "x$SENSOR_YAML_GEN" == "x"], [SENSOR_YAML_GEN="sensor-example.yaml"]) |
| 111 | SENSORGEN="$PYTHON ${srcdir}/scripts/sensor_gen.py -i $SENSOR_YAML_GEN" |
| 112 | AC_SUBST(SENSORGEN) |
| 113 | |
| 114 | AS_IF([test "x$PID_YAML_GEN" == "x"], [PID_YAML_GEN="pid-example.yaml"]) |
| 115 | PIDGEN="$PYTHON ${srcdir}/scripts/pid_gen.py -i $PID_YAML_GEN" |
| 116 | AC_SUBST(PIDGEN) |
| 117 | |
| 118 | AS_IF([test "x$ZONE_YAML_GEN" == "x"], [ZONE_YAML_GEN="zone-example.yaml"]) |
| 119 | ZONEGEN="$PYTHON ${srcdir}/scripts/zone_gen.py -i $ZONE_YAML_GEN" |
| 120 | AC_SUBST(ZONEGEN) |
| 121 | |
James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 122 | AC_ARG_ENABLE([configure-dbus], |
Patrick Venture | f77ecc7 | 2018-11-26 09:08:49 -0800 | [diff] [blame] | 123 | AS_HELP_STRING( |
| 124 | [--enable-configure-dbus], [Enable configuring pid from D-Bus.] |
| 125 | ) |
| 126 | ) |
James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 127 | AM_CONDITIONAL(CONFIGURE_DBUS, [test "x$enable_configure_dbus" = "xyes"]) |
| 128 | AS_IF([test "x$enable_configure_dbus" = "xyes"], |
James Feist | ce15e02 | 2018-09-26 10:01:33 -0700 | [diff] [blame] | 129 | [AC_DEFINE(CONFIGURE_DBUS, [1], [Read configuration from D-Bus.])], |
| 130 | [AC_DEFINE(CONFIGURE_DBUS, [0], [Do not read configuration from D-Bus.])] |
James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 131 | ) |
| 132 | |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 133 | # Create configured output |
Patrick Venture | 7a841b6 | 2018-06-13 09:39:46 -0700 | [diff] [blame] | 134 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 135 | AC_OUTPUT |