blob: 845b186c6daee857fbb74c07a517dee178835187 [file] [log] [blame]
Matthew Barth6292aee2016-10-06 10:15:48 -05001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-hwmon], [1.0], [https://github.com/openbmc/phosphor-hwmon/issues])
Brad Bishop20938e42016-12-19 08:58:31 -05004AC_LANG([C++])
Matthew Barth6292aee2016-10-06 10:15:48 -05005AC_CONFIG_HEADERS([config.h])
6AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
7AM_SILENT_RULES([yes])
8
9# Checks for programs.
10AC_PROG_CXX
11AM_PROG_AR
12AC_PROG_INSTALL
13AC_PROG_MAKE_SET
14
15# Checks for libraries.
Brad Bishop20938e42016-12-19 08:58:31 -050016PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
Matthew Barth6292aee2016-10-06 10:15:48 -050017
18# Checks for typedefs, structures, and compiler characteristics.
19AX_CXX_COMPILE_STDCXX_14([noext])
Brad Bishop3b1b5d42016-12-05 15:05:57 -050020AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
Matthew Barth6292aee2016-10-06 10:15:48 -050021
Brad Bishop20938e42016-12-19 08:58:31 -050022# Checks for header files.
23AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...sdbusplus developement package required])])
24
Matthew Barth6292aee2016-10-06 10:15:48 -050025# Checks for library functions.
26LT_INIT([shared])
27
28# Check/set gtest specific functions.
29AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
30AC_SUBST(GTEST_CPPFLAGS)
31
32AC_ARG_ENABLE([oe-sdk],
33 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
34)
35AC_ARG_VAR(OECORE_TARGET_SYSROOT,
36 [Path to the OE SDK SYSROOT])
37AS_IF([test "x$enable_oe_sdk" == "xyes"],
38 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
39 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
40 )
41 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
42 [
43 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
44 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
45 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
46 ]
47 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
48)
49
Brad Bishopb9e2b072016-12-19 13:47:10 -050050AC_ARG_VAR(BUSNAME_PREFIX, [The DBus busname prefix.])
51AC_ARG_VAR(SENSOR_ROOT, [The DBus sensors namespace root.])
52AS_IF([test "x$BUSNAME_PREFIX" == "x"], [BUSNAME_PREFIX="xyz.openbmc_project.Hwmon"])
53AS_IF([test "x$SENSOR_ROOT" == "x"], [SENSOR_ROOT="/xyz/openbmc_project/Sensors"])
54AC_DEFINE_UNQUOTED([BUSNAME_PREFIX], ["$BUSNAME_PREFIX"], [The DBus busname prefix.])
55AC_DEFINE_UNQUOTED([SENSOR_ROOT], ["$SENSOR_ROOT"], [The DBus sensors namespace root.])
56
Matthew Barth6292aee2016-10-06 10:15:48 -050057# Create configured output
Brad Bishope9ac8b42016-12-19 09:30:40 -050058AC_CONFIG_FILES([Makefile test/Makefile])
Matthew Barth6292aee2016-10-06 10:15:48 -050059AC_OUTPUT