blob: e411825cd2433640b98319cd769812dd7555537d [file] [log] [blame]
Vishwanatha Subbannaaffea8b2017-04-04 14:02:16 +05301# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-gpio-monitor], [1.0], [https://github.com/openbmc/phosphor-gpio-monitor/issues])
4AC_LANG([C++])
5AC_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
11AC_PROG_INSTALL
Vishwanatha Subbannaaffea8b2017-04-04 14:02:16 +053012
13# Checks for typedefs, structures, and compiler characteristics.
Vernon Mauerybd0904b2018-10-04 09:26:29 -070014AX_CXX_COMPILE_STDCXX_17([noext])
Vishwanatha Subbannaaffea8b2017-04-04 14:02:16 +053015AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
16
17# For linking
18LT_INIT
19
Vishwanatha Subbanna4902a102017-04-04 14:05:09 +053020# Checks for modules
Patrick Venture47044e62019-02-13 15:34:39 -080021PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
22PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
23PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
24PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
25PKG_CHECK_MODULES([LIBEVDEV], [libevdev])
Vishwanatha Subbanna4902a102017-04-04 14:05:09 +053026
Matt Spinler36df1972017-05-25 10:23:05 -050027# Download gpio.h from github if necessary.
28AC_CHECK_HEADER(linux/gpio.h,[HAVE_LINUX_GPIO_H=""],[HAVE_LINUX_GPIO_H="-I linux/gpio.h"])
29AS_IF([test "$HAVE_LINUX_GPIO_H" != ""],
30 AC_MSG_WARN([Could not find linux/gpio.h: Attempting to download locally for building from https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/gpio.h])
31 AC_SUBST([BT_BMC_DL],[`mkdir -p linux;wget https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/gpio.h -O linux/gpio.h`])
32)
33
Vishwanatha Subbanna32c97272017-04-04 14:10:08 +053034# Check/set gtest specific functions.
35AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
36AC_SUBST(GTEST_CPPFLAGS)
37AC_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)
40AC_ARG_VAR(OECORE_TARGET_SYSROOT,
41 [Path to the OE SDK SYSROOT])
42AS_IF([test "x$enable_oe_sdk" == "xyes"],
43 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
44 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
45 )
46 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
47 [
48 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
49 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
50 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
51 ]
52 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
53)
54
Vishwanatha Subbannaaffea8b2017-04-04 14:02:16 +053055# Create configured output
Gunnar Mills72639152017-06-22 15:06:21 -050056AC_CONFIG_FILES([Makefile gpio-util/Makefile presence/Makefile test/Makefile])
Vishwanatha Subbannaaffea8b2017-04-04 14:02:16 +053057AC_OUTPUT