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. |
Patrick Venture | 9a7ef7c | 2018-11-21 21:37:23 -0800 | [diff] [blame] | 16 | PKG_CHECK_MODULES( |
| 17 | [SDBUSPLUS], |
| 18 | [sdbusplus], |
| 19 | [], |
| 20 | [AC_MSG_ERROR(["sdbusplus required and not found."])] |
| 21 | ) |
| 22 | PKG_CHECK_MODULES( |
| 23 | [SDEVENTPLUS], |
| 24 | [sdeventplus], |
| 25 | [], |
| 26 | [AC_MSG_ERROR(["sdeventplus required and not found."])] |
| 27 | ) |
| 28 | PKG_CHECK_MODULES( |
| 29 | [PHOSPHOR_DBUS_INTERFACES], |
| 30 | [phosphor-dbus-interfaces], |
| 31 | [], |
| 32 | [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])] |
| 33 | ) |
| 34 | PKG_CHECK_MODULES( |
| 35 | [PHOSPHOR_LOGGING], |
| 36 | [phosphor-logging], |
| 37 | [], |
| 38 | [AC_MSG_ERROR(["phosphor-logging required and not found."])] |
| 39 | ) |
| 40 | PKG_CHECK_MODULES( |
| 41 | [GPIOPLUS], |
| 42 | [gpioplus], |
| 43 | [], |
| 44 | [AC_MSG_ERROR([Could not find gpioplus...openbmc/gpioplus package required])] |
| 45 | ) |
Patrick Venture | 9f51481 | 2018-06-27 10:19:32 -0700 | [diff] [blame] | 46 | AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])]) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 47 | |
| 48 | # Checks for typedefs, structures, and compiler characteristics. |
Patrick Venture | 619190d | 2018-09-10 13:07:40 -0700 | [diff] [blame] | 49 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Brad Bishop | 3b1b5d4 | 2016-12-05 15:05:57 -0500 | [diff] [blame] | 50 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 51 | |
Brad Bishop | 20938e4 | 2016-12-19 08:58:31 -0500 | [diff] [blame] | 52 | # Checks for header files. |
Patrick Venture | 9a7ef7c | 2018-11-21 21:37:23 -0800 | [diff] [blame] | 53 | AC_CHECK_HEADER( |
| 54 | experimental/filesystem, |
| 55 | [], |
| 56 | [AC_MSG_ERROR( |
| 57 | [Could not find experimental/filesystem...libstdc++fs development package required]) |
| 58 | ] |
| 59 | ) |
Brad Bishop | 20938e4 | 2016-12-19 08:58:31 -0500 | [diff] [blame] | 60 | |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 61 | # Checks for library functions. |
Brad Bishop | 0be1f8d | 2017-03-06 21:52:00 -0500 | [diff] [blame] | 62 | LT_INIT |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 63 | |
| 64 | # Check/set gtest specific functions. |
Patrick Venture | 9a7ef7c | 2018-11-21 21:37:23 -0800 | [diff] [blame] | 65 | PKG_CHECK_MODULES( |
| 66 | [GTEST], |
| 67 | [gtest], |
| 68 | [], |
| 69 | [AC_MSG_NOTICE([gtest not found, tests will not build])] |
| 70 | ) |
| 71 | PKG_CHECK_MODULES( |
| 72 | [GMOCK], |
| 73 | [gmock], |
| 74 | [], |
| 75 | [AC_MSG_NOTICE([gmock not found, tests will not build])] |
| 76 | ) |
| 77 | PKG_CHECK_MODULES( |
| 78 | [GTEST_MAIN], |
| 79 | [gtest_main], |
| 80 | [], |
| 81 | [AC_MSG_NOTICE([gtest_main not found, tests will not build])] |
| 82 | ) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 83 | |
Patrick Venture | caac77d | 2018-04-17 17:38:02 -0700 | [diff] [blame] | 84 | # Add --enable-oe-sdk flag to configure script |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 85 | AC_ARG_ENABLE([oe-sdk], |
Patrick Venture | 9a7ef7c | 2018-11-21 21:37:23 -0800 | [diff] [blame] | 86 | AS_HELP_STRING( |
| 87 | [--enable-oe-sdk], |
| 88 | [Link testcases absolutely against OE SDK so they can be ran within it.] |
| 89 | ) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 90 | ) |
Patrick Venture | caac77d | 2018-04-17 17:38:02 -0700 | [diff] [blame] | 91 | |
| 92 | # Check for OECORE_TARGET_SYSROOT in the environment. |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 93 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
Patrick Venture | 9a7ef7c | 2018-11-21 21:37:23 -0800 | [diff] [blame] | 94 | [Path to the OE SDK SYSROOT] |
| 95 | ) |
Patrick Venture | caac77d | 2018-04-17 17:38:02 -0700 | [diff] [blame] | 96 | |
| 97 | # Configure OESDK_TESTCASE_FLAGS environment variable, which will be later |
| 98 | # used in test/Makefile.am |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 99 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 100 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 101 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 102 | ) |
| 103 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 104 | [ |
| 105 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 106 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 107 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 108 | ] |
| 109 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 110 | ) |
| 111 | |
Patrick Venture | c1cece7 | 2017-11-07 12:09:49 -0800 | [diff] [blame] | 112 | # 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] | 113 | AC_ARG_ENABLE([remove-from-dbus-on-fail], |
Patrick Venture | 9a7ef7c | 2018-11-21 21:37:23 -0800 | [diff] [blame] | 114 | AS_HELP_STRING( |
| 115 | [--enable-remove-from-dbus-on-fail], |
| 116 | [Remove properties from D-Bus on access failures] |
| 117 | ) |
Matt Spinler | f9c83c4 | 2017-08-10 08:51:45 -0500 | [diff] [blame] | 118 | ) |
| 119 | |
| 120 | AC_ARG_VAR(REMOVE_ON_FAIL, [Remove properties from D-Bus on access failures]) |
| 121 | |
Patrick Venture | 9a7ef7c | 2018-11-21 21:37:23 -0800 | [diff] [blame] | 122 | AS_IF( |
| 123 | [test "x$enable_remove_from_dbus_on_fail" == "xyes"], |
| 124 | [REMOVE_ON_FAIL="yes"] |
| 125 | AC_DEFINE_UNQUOTED( |
| 126 | [REMOVE_ON_FAIL], |
| 127 | ["$REMOVE_ON_FAIL"], |
| 128 | [Remove properties from D-Bus on access failures] |
| 129 | ) |
Matt Spinler | f9c83c4 | 2017-08-10 08:51:45 -0500 | [diff] [blame] | 130 | ) |
| 131 | |
Patrick Venture | c1cece7 | 2017-11-07 12:09:49 -0800 | [diff] [blame] | 132 | # When a sensor read fails, set the Value on dbus with -errno. |
| 133 | # Incompatible with remove-from-dbus-on-fail. |
| 134 | AC_ARG_ENABLE([negative-errno-on-fail], |
| 135 | AS_HELP_STRING([--enable-negative-errno-on-fail], [Set sensor value to -errno on read failures]) |
| 136 | ) |
| 137 | |
| 138 | AC_ARG_VAR(NEGATIVE_ERRNO_ON_FAIL, [Set sensor value to -errno on read failures]) |
Patrick Venture | 9a7ef7c | 2018-11-21 21:37:23 -0800 | [diff] [blame] | 139 | AS_IF( |
| 140 | [test "x$enable_negative_errno_on_fail" == "xyes"], |
| 141 | [NEGATIVE_ERRNO_ON_FAIL="yes"] |
| 142 | AC_DEFINE_UNQUOTED( |
| 143 | [NEGATIVE_ERRNO_ON_FAIL], |
| 144 | ["$NEGATIVE_ERRNO_ON_FAIL"], [Set sensor value to -errno on read failures] |
| 145 | ) |
Patrick Venture | c1cece7 | 2017-11-07 12:09:49 -0800 | [diff] [blame] | 146 | ) |
| 147 | |
Brad Bishop | b9e2b07 | 2016-12-19 13:47:10 -0500 | [diff] [blame] | 148 | AC_ARG_VAR(BUSNAME_PREFIX, [The DBus busname prefix.]) |
| 149 | AC_ARG_VAR(SENSOR_ROOT, [The DBus sensors namespace root.]) |
Patrick Venture | 9a7ef7c | 2018-11-21 21:37:23 -0800 | [diff] [blame] | 150 | AS_IF( |
| 151 | [test "x$BUSNAME_PREFIX" == "x"], |
| 152 | [BUSNAME_PREFIX="xyz.openbmc_project.Hwmon"] |
| 153 | ) |
| 154 | AS_IF( |
| 155 | [test "x$SENSOR_ROOT" == "x"], |
| 156 | [SENSOR_ROOT="/xyz/openbmc_project/sensors"] |
| 157 | ) |
| 158 | AC_DEFINE_UNQUOTED( |
| 159 | [BUSNAME_PREFIX], |
| 160 | ["$BUSNAME_PREFIX"], |
| 161 | [The DBus busname prefix.] |
| 162 | ) |
| 163 | AC_DEFINE_UNQUOTED( |
| 164 | [SENSOR_ROOT], |
| 165 | ["$SENSOR_ROOT"], |
| 166 | [The DBus sensors namespace root.] |
| 167 | ) |
Brad Bishop | b9e2b07 | 2016-12-19 13:47:10 -0500 | [diff] [blame] | 168 | |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 169 | # Create configured output |
Patrick Venture | 609fe98 | 2018-04-17 17:51:56 -0700 | [diff] [blame] | 170 | AC_CONFIG_FILES([Makefile test/Makefile tools/Makefile msl/Makefile]) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 171 | AC_OUTPUT |