Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([phosphor-hwmon], [1.0], [https://github.com/openbmc/phosphor-hwmon/issues]) |
Brad Bishop | 20938e4 | 2016-12-19 08:58:31 -0500 | [diff] [blame] | 4 | AC_LANG([C++]) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 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 | # Checks for libraries. |
Brad Bishop | bf86e72 | 2017-02-16 11:10:40 -0500 | [diff] [blame] | 16 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [], [AC_MSG_ERROR(["sdbusplus required and not found."])]) |
| 17 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])]) |
Brad Bishop | 4db6442 | 2017-02-16 11:33:32 -0500 | [diff] [blame] | 18 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging], [], [AC_MSG_ERROR(["phosphor-logging required and not found."])]) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 19 | |
| 20 | # Checks for typedefs, structures, and compiler characteristics. |
| 21 | AX_CXX_COMPILE_STDCXX_14([noext]) |
Brad Bishop | 3b1b5d4 | 2016-12-05 15:05:57 -0500 | [diff] [blame] | 22 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 23 | |
Brad Bishop | 20938e4 | 2016-12-19 08:58:31 -0500 | [diff] [blame] | 24 | # Checks for header files. |
Gunnar Mills | ca64c25 | 2017-10-25 17:13:45 -0500 | [diff] [blame] | 25 | AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...sdbusplus development package required])]) |
| 26 | AC_CHECK_HEADER(experimental/filesystem, ,[AC_MSG_ERROR([Could not find experimental/filesystem...libstdc++fs development package required])]) |
Brad Bishop | 20938e4 | 2016-12-19 08:58:31 -0500 | [diff] [blame] | 27 | |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 28 | # Checks for library functions. |
Brad Bishop | 0be1f8d | 2017-03-06 21:52:00 -0500 | [diff] [blame] | 29 | LT_INIT |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 30 | |
| 31 | # Check/set gtest specific functions. |
Patrick Venture | caac77d | 2018-04-17 17:38:02 -0700 | [diff] [blame^] | 32 | PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])]) |
| 33 | PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])]) |
| 34 | AX_PTHREAD([GTEST_CFLAGS+=" -DGTEST_HAS_PTHREAD=1 "],[GTEST_CFLAGS+=" -DGTEST_HAS_PTHREAD=0 "]) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 35 | |
Patrick Venture | caac77d | 2018-04-17 17:38:02 -0700 | [diff] [blame^] | 36 | # Add --enable-oe-sdk flag to configure script |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 37 | AC_ARG_ENABLE([oe-sdk], |
| 38 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 39 | ) |
Patrick Venture | caac77d | 2018-04-17 17:38:02 -0700 | [diff] [blame^] | 40 | |
| 41 | # Check for OECORE_TARGET_SYSROOT in the environment. |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 42 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 43 | [Path to the OE SDK SYSROOT]) |
Patrick Venture | caac77d | 2018-04-17 17:38:02 -0700 | [diff] [blame^] | 44 | |
| 45 | # Configure OESDK_TESTCASE_FLAGS environment variable, which will be later |
| 46 | # used in test/Makefile.am |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 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 | |
Patrick Venture | c1cece7 | 2017-11-07 12:09:49 -0800 | [diff] [blame] | 60 | # When a sensor access fails, just remove the sensor from dbus instead of exiting the daemon. |
Matt Spinler | f9c83c4 | 2017-08-10 08:51:45 -0500 | [diff] [blame] | 61 | AC_ARG_ENABLE([remove-from-dbus-on-fail], |
| 62 | AS_HELP_STRING([--enable-remove-from-dbus-on-fail], [Remove properties from D-Bus on access failures]) |
| 63 | ) |
| 64 | |
| 65 | AC_ARG_VAR(REMOVE_ON_FAIL, [Remove properties from D-Bus on access failures]) |
| 66 | |
| 67 | AS_IF([test "x$enable_remove_from_dbus_on_fail" == "xyes"], |
| 68 | [REMOVE_ON_FAIL="yes"] |
| 69 | AC_DEFINE_UNQUOTED([REMOVE_ON_FAIL], ["$REMOVE_ON_FAIL"], [Remove properties from D-Bus on access failures]) |
| 70 | ) |
| 71 | |
Patrick Venture | c1cece7 | 2017-11-07 12:09:49 -0800 | [diff] [blame] | 72 | # When a sensor read fails, set the Value on dbus with -errno. |
| 73 | # Incompatible with remove-from-dbus-on-fail. |
| 74 | AC_ARG_ENABLE([negative-errno-on-fail], |
| 75 | AS_HELP_STRING([--enable-negative-errno-on-fail], [Set sensor value to -errno on read failures]) |
| 76 | ) |
| 77 | |
| 78 | AC_ARG_VAR(NEGATIVE_ERRNO_ON_FAIL, [Set sensor value to -errno on read failures]) |
| 79 | |
| 80 | AS_IF([test "x$enable_negative_errno_on_fail" == "xyes"], |
| 81 | [NEGATIVE_ERRNO_ON_FAIL="yes"] |
| 82 | AC_DEFINE_UNQUOTED([NEGATIVE_ERRNO_ON_FAIL], ["$NEGATIVE_ERRNO_ON_FAIL"], [Set sensor value to -errno on read failures]) |
| 83 | ) |
| 84 | |
Brad Bishop | b9e2b07 | 2016-12-19 13:47:10 -0500 | [diff] [blame] | 85 | AC_ARG_VAR(BUSNAME_PREFIX, [The DBus busname prefix.]) |
| 86 | AC_ARG_VAR(SENSOR_ROOT, [The DBus sensors namespace root.]) |
| 87 | AS_IF([test "x$BUSNAME_PREFIX" == "x"], [BUSNAME_PREFIX="xyz.openbmc_project.Hwmon"]) |
Leonel Gonzalez | 2260efb | 2017-02-23 10:40:40 -0600 | [diff] [blame] | 88 | AS_IF([test "x$SENSOR_ROOT" == "x"], [SENSOR_ROOT="/xyz/openbmc_project/sensors"]) |
Brad Bishop | b9e2b07 | 2016-12-19 13:47:10 -0500 | [diff] [blame] | 89 | AC_DEFINE_UNQUOTED([BUSNAME_PREFIX], ["$BUSNAME_PREFIX"], [The DBus busname prefix.]) |
| 90 | AC_DEFINE_UNQUOTED([SENSOR_ROOT], ["$SENSOR_ROOT"], [The DBus sensors namespace root.]) |
| 91 | |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 92 | # Create configured output |
Brad Bishop | 7b58737 | 2017-08-01 21:13:28 -0400 | [diff] [blame] | 93 | AC_CONFIG_FILES([Makefile test/Makefile msl/Makefile]) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 94 | AC_OUTPUT |