Matt Spinler | d82a5f4 | 2017-07-24 13:40:37 -0500 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([witherspoon-pfault-analysis], [1.0], |
| 4 | [https://github.com/openbmc/witherspoon-pfault-analysis/issues]) |
| 5 | AC_LANG([C++]) |
| 6 | AC_CONFIG_HEADERS([config.h]) |
| 7 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 8 | AM_SILENT_RULES([yes]) |
| 9 | |
| 10 | # Checks for programs. |
| 11 | AC_PROG_CXX |
| 12 | AM_PROG_AR |
| 13 | AC_PROG_INSTALL |
| 14 | AC_PROG_MAKE_SET |
| 15 | |
| 16 | # Checks for typedefs, structures, and compiler characteristics. |
Vernon Mauery | f4d72d8 | 2018-10-04 10:25:25 -0700 | [diff] [blame] | 17 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Matt Spinler | d82a5f4 | 2017-07-24 13:40:37 -0500 | [diff] [blame] | 18 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
| 19 | |
Matt Spinler | ee7adb7 | 2017-08-21 15:17:19 -0500 | [diff] [blame] | 20 | # Download gpio.h from github if necessary. |
| 21 | AC_CHECK_HEADER(linux/gpio.h,[HAVE_LINUX_GPIO_H=""],[HAVE_LINUX_GPIO_H="-I linux/gpio.h"]) |
| 22 | AS_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 | |
Patrick Venture | 61a0419 | 2019-02-13 15:37:22 -0800 | [diff] [blame] | 27 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
| 28 | PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus]) |
| 29 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) |
| 30 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
| 31 | PKG_CHECK_MODULES([OPENPOWER_DBUS_INTERFACES], [openpower-dbus-interfaces]) |
Matt Spinler | 84cd0a5 | 2017-08-04 08:53:30 -0500 | [diff] [blame] | 32 | # Check for sdbus++ |
| 33 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
| 34 | AS_IF([test "x$SDBUSPLUSPLUS" == "x"], |
| 35 | AC_MSG_ERROR(["Requires sdbus++"])) |
Matt Spinler | d82a5f4 | 2017-07-24 13:40:37 -0500 | [diff] [blame] | 36 | |
| 37 | # Checks for library functions. |
| 38 | LT_INIT # Required for systemd linking |
| 39 | |
Matt Spinler | 2f13544 | 2017-09-18 13:52:10 -0500 | [diff] [blame] | 40 | # Check/set gtest specific functions. |
| 41 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 42 | AC_SUBST(GTEST_CPPFLAGS) |
| 43 | |
| 44 | # Test cases require SDK so only build if we're told to (and SDK is available) |
| 45 | AC_ARG_ENABLE([oe-sdk], |
| 46 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 47 | ) |
| 48 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 49 | [Path to the OE SDK SYSROOT]) |
| 50 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 51 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 52 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 53 | ) |
| 54 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 55 | [ |
| 56 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 57 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 58 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 59 | ] |
| 60 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 61 | ) |
| 62 | |
Matt Spinler | 45a054a | 2017-08-22 15:07:07 -0500 | [diff] [blame] | 63 | AC_ARG_ENABLE([turn-off-ucd90160-access], |
| 64 | AS_HELP_STRING([--enable-turn-off-ucd90160-access], [Turn off UCD90160 hardware access]) |
| 65 | ) |
| 66 | |
| 67 | AC_ARG_VAR(UCD90160_DEVICE_ACCESS, [Turn off UCD90160 hardware access]) |
| 68 | |
| 69 | # Always define UCD90160_DEVICE_ACCESS unless explicitly turned off |
| 70 | AS_IF([test "x$enable_turn_off_ucd90160_access" != "xyes"], |
| 71 | [UCD90160_DEVICE_ACCESS="yes"] |
| 72 | AC_DEFINE_UNQUOTED([UCD90160_DEVICE_ACCESS], ["$UCD90160_DEVICE_ACCESS"], [Turn off UCD90160 hardware access]) |
| 73 | ) |
| 74 | |
Brandon Wyman | 34e257b | 2019-03-28 17:39:18 -0500 | [diff] [blame] | 75 | AC_ARG_VAR(UCD90160_DEF_YAML_FILE, |
| 76 | [The sequencer definition file to use]) |
| 77 | AS_IF([test "x$UCD90160_DEF_YAML_FILE" == "x"], |
| 78 | [UCD90160_DEF_YAML_FILE="\${top_srcdir}/power-sequencer/example/ucd90160.yaml"]) |
| 79 | AC_DEFINE_UNQUOTED([UCD90160_DEF_YAML_FILE], ["$UCD90160_DEF_YAML_FILE"], |
| 80 | [The sequencer definition file to use]) |
| 81 | |
| 82 | AC_ARG_VAR(UCD90160_DEF_OUTPUT_DIR, |
| 83 | [The output directory for the generated UCD90160 definition file]) |
| 84 | AS_IF([test "x$UCD90160_DEF_OUTPUT_DIR" == "x"], |
| 85 | [UCD90160_DEF_OUTPUT_DIR="\${top_srcdir}/power-sequencer/"]) |
| 86 | AC_DEFINE_UNQUOTED([UCD90160_DEF_OUTPUT_DIR], ["$UCD90160_DEF_OUTPUT_DIR"], |
| 87 | [The output directory for the generated UCD90160 definition file]) |
| 88 | |
| 89 | AC_SUBST([GEN_UCD90160_DEFS], |
| 90 | ["$PYTHON \${top_srcdir}/power-sequencer/gen-ucd90160-defs.py \ |
| 91 | -i $UCD90160_DEF_YAML_FILE \ |
| 92 | -o $UCD90160_DEF_OUTPUT_DIR"]) |
| 93 | |
| 94 | |
Matt Spinler | c87eb82 | 2018-01-18 14:44:47 -0600 | [diff] [blame] | 95 | AC_ARG_VAR(INPUT_HISTORY_BUSNAME_ROOT, [The D-Bus busname root for the PS input history.]) |
| 96 | AS_IF([test "x$INPUT_HISTORY_BUSNAME_ROOT" == "x"], |
| 97 | [INPUT_HISTORY_BUSNAME_ROOT="org.open_power.powersupply"]) |
| 98 | AC_DEFINE_UNQUOTED([INPUT_HISTORY_BUSNAME_ROOT], |
| 99 | ["$INPUT_HISTORY_BUSNAME_ROOT"], |
| 100 | [The D-Bus busname root for the PS input history.]) |
| 101 | |
| 102 | AC_ARG_VAR(INPUT_HISTORY_SENSOR_ROOT, [The D-Bus power sensors namespace root]) |
| 103 | AS_IF([test "x$INPUT_HISTORY_SENSOR_ROOT" == "x"], |
| 104 | [INPUT_HISTORY_SENSOR_ROOT="/org/open_power/sensors/aggregation/per_30s"]) |
| 105 | AC_DEFINE_UNQUOTED([INPUT_HISTORY_SENSOR_ROOT], |
| 106 | ["$INPUT_HISTORY_SENSOR_ROOT"], |
| 107 | [The D-Bus power sensors namespace root]) |
| 108 | |
Matt Spinler | d82a5f4 | 2017-07-24 13:40:37 -0500 | [diff] [blame] | 109 | # Create configured output |
Matt Spinler | c180a18 | 2018-01-18 14:27:13 -0600 | [diff] [blame] | 110 | AC_CONFIG_FILES([Makefile power-sequencer/Makefile power-supply/Makefile test/Makefile power-supply/test/Makefile]) |
Matt Spinler | d82a5f4 | 2017-07-24 13:40:37 -0500 | [diff] [blame] | 111 | AC_OUTPUT |