blob: 3a6cff84ec7083138956084d34096c1041cf0db3 [file] [log] [blame]
Matt Spinlerd82a5f42017-07-24 13:40:37 -05001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([witherspoon-pfault-analysis], [1.0],
4[https://github.com/openbmc/witherspoon-pfault-analysis/issues])
5AC_LANG([C++])
6AC_CONFIG_HEADERS([config.h])
7AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
8AM_SILENT_RULES([yes])
9
10# Checks for programs.
11AC_PROG_CXX
12AM_PROG_AR
13AC_PROG_INSTALL
14AC_PROG_MAKE_SET
15
16# Checks for typedefs, structures, and compiler characteristics.
Vernon Maueryf4d72d82018-10-04 10:25:25 -070017AX_CXX_COMPILE_STDCXX_17([noext])
Matt Spinlerd82a5f42017-07-24 13:40:37 -050018AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
19
Matt Spinleree7adb72017-08-21 15:17:19 -050020# Download gpio.h from github if necessary.
21AC_CHECK_HEADER(linux/gpio.h,[HAVE_LINUX_GPIO_H=""],[HAVE_LINUX_GPIO_H="-I linux/gpio.h"])
22AS_IF([test "$HAVE_LINUX_GPIO_H" != ""],
23 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])
24 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`])
25)
26
Matt Spinlerd82a5f42017-07-24 13:40:37 -050027PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,
28 AC_MSG_ERROR(["Requires sdbusplus package."]))
William A. Kennington IIIe5a8b472018-10-18 00:40:04 -070029PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus],,
30 AC_MSG_ERROR(["Requires sdeventplus package."]))
Matt Spinlerd82a5f42017-07-24 13:40:37 -050031PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],,\
32 AC_MSG_ERROR(["Requires phosphor-logging package."]))
33PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],,\
34 AC_MSG_ERROR(["Requires phosphor-dbus-interfaces package."]))
Matt Spinler7d24ee82018-01-18 13:56:12 -060035PKG_CHECK_MODULES([OPENPOWER_DBUS_INTERFACES], [openpower-dbus-interfaces],,\
36 AC_MSG_ERROR(["Requires openpower-dbus-interfaces package."]))
Matt Spinler84cd0a52017-08-04 08:53:30 -050037# Check for sdbus++
38AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
39AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
40 AC_MSG_ERROR(["Requires sdbus++"]))
Matt Spinlerd82a5f42017-07-24 13:40:37 -050041
42# Checks for library functions.
43LT_INIT # Required for systemd linking
44
Matt Spinler2f135442017-09-18 13:52:10 -050045# Check/set gtest specific functions.
46AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
47AC_SUBST(GTEST_CPPFLAGS)
48
49# Test cases require SDK so only build if we're told to (and SDK is available)
50AC_ARG_ENABLE([oe-sdk],
51 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
52)
53AC_ARG_VAR(OECORE_TARGET_SYSROOT,
54 [Path to the OE SDK SYSROOT])
55AS_IF([test "x$enable_oe_sdk" == "xyes"],
56 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
57 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
58 )
59 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
60 [
61 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
62 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
63 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
64 ]
65 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
66)
67
Matt Spinler45a054a2017-08-22 15:07:07 -050068AC_ARG_ENABLE([turn-off-ucd90160-access],
69 AS_HELP_STRING([--enable-turn-off-ucd90160-access], [Turn off UCD90160 hardware access])
70)
71
72AC_ARG_VAR(UCD90160_DEVICE_ACCESS, [Turn off UCD90160 hardware access])
73
74# Always define UCD90160_DEVICE_ACCESS unless explicitly turned off
75AS_IF([test "x$enable_turn_off_ucd90160_access" != "xyes"],
76 [UCD90160_DEVICE_ACCESS="yes"]
77 AC_DEFINE_UNQUOTED([UCD90160_DEVICE_ACCESS], ["$UCD90160_DEVICE_ACCESS"], [Turn off UCD90160 hardware access])
78)
79
Matt Spinlerc87eb822018-01-18 14:44:47 -060080AC_ARG_VAR(INPUT_HISTORY_BUSNAME_ROOT, [The D-Bus busname root for the PS input history.])
81AS_IF([test "x$INPUT_HISTORY_BUSNAME_ROOT" == "x"],
82 [INPUT_HISTORY_BUSNAME_ROOT="org.open_power.powersupply"])
83AC_DEFINE_UNQUOTED([INPUT_HISTORY_BUSNAME_ROOT],
84 ["$INPUT_HISTORY_BUSNAME_ROOT"],
85 [The D-Bus busname root for the PS input history.])
86
87AC_ARG_VAR(INPUT_HISTORY_SENSOR_ROOT, [The D-Bus power sensors namespace root])
88AS_IF([test "x$INPUT_HISTORY_SENSOR_ROOT" == "x"],
89 [INPUT_HISTORY_SENSOR_ROOT="/org/open_power/sensors/aggregation/per_30s"])
90AC_DEFINE_UNQUOTED([INPUT_HISTORY_SENSOR_ROOT],
91 ["$INPUT_HISTORY_SENSOR_ROOT"],
92 [The D-Bus power sensors namespace root])
93
Matt Spinlerd82a5f42017-07-24 13:40:37 -050094# Create configured output
Matt Spinlerc180a182018-01-18 14:27:13 -060095AC_CONFIG_FILES([Makefile power-sequencer/Makefile power-supply/Makefile test/Makefile power-supply/test/Makefile])
Matt Spinlerd82a5f42017-07-24 13:40:37 -050096AC_OUTPUT