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."])]) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 18 | |
| 19 | # Checks for typedefs, structures, and compiler characteristics. |
| 20 | AX_CXX_COMPILE_STDCXX_14([noext]) |
Brad Bishop | 3b1b5d4 | 2016-12-05 15:05:57 -0500 | [diff] [blame] | 21 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 22 | |
Brad Bishop | 20938e4 | 2016-12-19 08:58:31 -0500 | [diff] [blame] | 23 | # Checks for header files. |
| 24 | AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...sdbusplus developement package required])]) |
| 25 | |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 26 | # Checks for library functions. |
| 27 | LT_INIT([shared]) |
| 28 | |
| 29 | # Check/set gtest specific functions. |
| 30 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 31 | AC_SUBST(GTEST_CPPFLAGS) |
| 32 | |
| 33 | AC_ARG_ENABLE([oe-sdk], |
| 34 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 35 | ) |
| 36 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 37 | [Path to the OE SDK SYSROOT]) |
| 38 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 39 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 40 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 41 | ) |
| 42 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 43 | [ |
| 44 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 45 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 46 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 47 | ] |
| 48 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 49 | ) |
| 50 | |
Brad Bishop | b9e2b07 | 2016-12-19 13:47:10 -0500 | [diff] [blame] | 51 | AC_ARG_VAR(BUSNAME_PREFIX, [The DBus busname prefix.]) |
| 52 | AC_ARG_VAR(SENSOR_ROOT, [The DBus sensors namespace root.]) |
| 53 | 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^] | 54 | 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] | 55 | AC_DEFINE_UNQUOTED([BUSNAME_PREFIX], ["$BUSNAME_PREFIX"], [The DBus busname prefix.]) |
| 56 | AC_DEFINE_UNQUOTED([SENSOR_ROOT], ["$SENSOR_ROOT"], [The DBus sensors namespace root.]) |
| 57 | |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 58 | # Create configured output |
Brad Bishop | e9ac8b4 | 2016-12-19 09:30:40 -0500 | [diff] [blame] | 59 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Matthew Barth | 6292aee | 2016-10-06 10:15:48 -0500 | [diff] [blame] | 60 | AC_OUTPUT |