Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([phosphor-fan-presence], [1.0], |
| 4 | [https://github.com/openbmc/phosphor-fan-presence/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 |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 15 | |
Matthew Barth | 681c98d | 2017-02-17 16:05:57 -0600 | [diff] [blame] | 16 | # Python |
| 17 | AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])], |
| 18 | [AC_MSG_ERROR([Could not find python-2.7 installed...python-2.7 is required])]) |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 19 | |
| 20 | # Checks for typedefs, structures, and compiler characteristics. |
| 21 | AX_CXX_COMPILE_STDCXX_14([noext]) |
| 22 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
| 23 | |
| 24 | # Checks for libraries. |
Matthew Barth | 293477d | 2017-02-17 15:39:36 -0600 | [diff] [blame] | 25 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], , |
| 26 | [AC_MSG_ERROR([The openbmc/sdbusplus package is required])]) |
Matthew Barth | fefdc45 | 2017-02-22 11:15:56 -0600 | [diff] [blame] | 27 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging], , |
| 28 | [AC_MSG_ERROR([The openbmc/phosphor-logging package is required])]) |
Matthew Barth | 293477d | 2017-02-17 15:39:36 -0600 | [diff] [blame] | 29 | |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 30 | # Checks for library functions. |
| 31 | LT_INIT # Required for systemd linking |
| 32 | |
Matt Spinler | 59c29c7 | 2017-04-27 11:17:28 -0500 | [diff] [blame] | 33 | # Check/set gtest specific functions. |
| 34 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 35 | AC_SUBST(GTEST_CPPFLAGS) |
| 36 | AC_ARG_ENABLE([oe-sdk], |
| 37 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 38 | ) |
| 39 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 40 | [Path to the OE SDK SYSROOT]) |
| 41 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 42 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 43 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 44 | ) |
| 45 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 46 | [ |
| 47 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 48 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 49 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 50 | ] |
| 51 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 52 | ) |
| 53 | |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 54 | AC_ARG_ENABLE([presence], |
| 55 | AS_HELP_STRING([--disable-presence], [Disable fan presence package.])) |
| 56 | AC_ARG_ENABLE([control], |
| 57 | AS_HELP_STRING([--disable-control], [Disable fan control package.])) |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 58 | AC_ARG_ENABLE([cooling-type], |
| 59 | AS_HELP_STRING([--disable-cooling-type], [Disable cooling-type package.])) |
Matt Spinler | af5d4c5 | 2017-05-16 10:38:43 -0500 | [diff] [blame^] | 60 | AC_ARG_ENABLE([monitor], |
| 61 | AS_HELP_STRING([--disable-monitor], [Disable monitor])) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 62 | |
| 63 | AM_CONDITIONAL([WANT_PRESENCE], [test "x$enable_presence" != "xno"]) |
| 64 | AM_CONDITIONAL([WANT_CONTROL], [test "x$enable_control" != "xno"]) |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 65 | AM_CONDITIONAL([WANT_COOLING_TYPE], [test "x$enable_cooling-type" != "xno"]) |
Matt Spinler | e567dd2 | 2017-04-27 12:27:17 -0500 | [diff] [blame] | 66 | AM_CONDITIONAL([WANT_MONITOR], [test "x$enable_monitor" != "xno"]) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 67 | |
| 68 | # Package specific checks. |
| 69 | AS_IF([test "x$enable_presence" != "xno"], [ |
| 70 | # Add optional yaml file argument |
| 71 | AC_ARG_VAR(FAN_DETECT_YAML_FILE, |
| 72 | [The fan presence detection definition file to use]) |
| 73 | AS_IF([test "x$FAN_DETECT_YAML_FILE" == "x"], |
| 74 | [FAN_DETECT_YAML_FILE="${srcdir}/presence/example/fan-detect.yaml"]) |
| 75 | AC_DEFINE_UNQUOTED([FAN_DETECT_YAML_FILE], ["$FAN_DETECT_YAML_FILE"], |
| 76 | [The fan presence detection definition file to use]) |
| 77 | |
| 78 | AC_SUBST([GEN_FAN_DETECT_DEFS], |
| 79 | [$PYTHON ${srcdir}/presence/gen-fan-detect-defs.py -y $FAN_DETECT_YAML_FILE]) |
| 80 | AC_CONFIG_FILES([presence/Makefile]) |
| 81 | ]) |
| 82 | |
| 83 | AS_IF([test "x$enable_control" != "xno"], [ |
Matt Spinler | 77d32d1 | 2017-04-12 09:51:41 -0500 | [diff] [blame] | 84 | # Add optional yaml file arguments |
| 85 | AC_ARG_VAR(FAN_DEF_YAML_FILE, |
| 86 | [The fan definition file to use]) |
| 87 | AS_IF([test "x$FAN_DEF_YAML_FILE" == "x"], |
| 88 | [FAN_DEF_YAML_FILE="${srcdir}/control/example/fans.yaml"]) |
| 89 | AC_DEFINE_UNQUOTED([FAN_DEF_YAML_FILE], ["$FAN_DEF_YAML_FILE"], |
| 90 | [The fan definition file to use]) |
| 91 | |
| 92 | AC_ARG_VAR(FAN_ZONE_YAML_FILE, |
| 93 | [The fan zone definition file to use]) |
| 94 | AS_IF([test "x$FAN_ZONE_YAML_FILE" == "x"], |
| 95 | [FAN_ZONE_YAML_FILE="${srcdir}/control/example/zones.yaml"]) |
| 96 | AC_DEFINE_UNQUOTED([FAN_ZONE_YAML_FILE], ["$FAN_ZONE_YAML_FILE"], |
| 97 | [The fan zone definition file to use]) |
| 98 | |
| 99 | AC_ARG_VAR(FAN_ZONE_OUTPUT_DIR, |
| 100 | [The output directory for the generated fan zone data file]) |
| 101 | AS_IF([test "x$FAN_ZONE_OUTPUT_DIR" == "x"], |
| 102 | [FAN_ZONE_OUTPUT_DIR="${srcdir}/control/"]) |
| 103 | AC_DEFINE_UNQUOTED([FAN_ZONE_OUTPUT_DIR], ["$FAN_ZONE_OUTPUT_DIR"], |
| 104 | [The output directory for the generated fan zone data file]) |
| 105 | |
| 106 | AC_SUBST([GEN_FAN_ZONE_DEFS], |
| 107 | [$PYTHON ${srcdir}/control/gen-fan-zone-defs.py \ |
| 108 | -f $FAN_DEF_YAML_FILE \ |
| 109 | -z $FAN_ZONE_YAML_FILE \ |
| 110 | -o $FAN_ZONE_OUTPUT_DIR]) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 111 | AC_CONFIG_FILES([control/Makefile]) |
| 112 | ]) |
Matthew Barth | 681c98d | 2017-02-17 16:05:57 -0600 | [diff] [blame] | 113 | |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 114 | AS_IF([test "x$enable_cooling-type" != "xno"], [ |
| 115 | PKG_CHECK_MODULES([LIBEVDEV], [libevdev], , |
| 116 | [AC_MSG_ERROR([The libevdev package is required])]) |
| 117 | AC_CONFIG_FILES([chassis-cooling-type/Makefile]) |
| 118 | ]) |
Matt Spinler | e567dd2 | 2017-04-27 12:27:17 -0500 | [diff] [blame] | 119 | AS_IF([test "x$enable_monitor" != "xno"], [ |
Matt Spinler | 1432184 | 2017-04-28 15:27:43 -0500 | [diff] [blame] | 120 | |
| 121 | AC_ARG_VAR(FAN_MONITOR_YAML_FILE, |
| 122 | [The fan monitor definition file to use]) |
| 123 | AS_IF([test "x$FAN_MONITOR_YAML_FILE" == "x"], |
| 124 | [FAN_MONITOR_YAML_FILE="${srcdir}/monitor/example/monitor.yaml"]) |
| 125 | AC_DEFINE_UNQUOTED([FAN_MONITOR_YAML_FILE], ["$FAN_MONITOR_YAML_FILE"], |
| 126 | [The fan monitor definition file to use]) |
| 127 | |
| 128 | AC_ARG_VAR(FAN_MONITOR_OUTPUT_DIR, |
| 129 | [The output directory for the generated fan monitor data file]) |
| 130 | AS_IF([test "x$FAN_MONITOR_OUTPUT_DIR" == "x"], |
| 131 | [FAN_MONITOR_OUTPUT_DIR="${srcdir}/monitor/"]) |
| 132 | AC_DEFINE_UNQUOTED([FAN_MONITOR_OUTPUT_DIR], ["$FAN_MONITOR_OUTPUT_DIR"], |
| 133 | [The output directory for the generated fan monitor data file]) |
| 134 | |
| 135 | AC_SUBST([GEN_FAN_MONITOR_DEFS], |
| 136 | [$PYTHON ${srcdir}/monitor/gen-fan-monitor-defs.py \ |
| 137 | -m $FAN_MONITOR_YAML_FILE \ |
| 138 | -o $FAN_MONITOR_OUTPUT_DIR]) |
| 139 | |
Matt Spinler | e567dd2 | 2017-04-27 12:27:17 -0500 | [diff] [blame] | 140 | AC_CONFIG_FILES([monitor/Makefile]) |
| 141 | ]) |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 142 | |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 143 | # Create configured output |
Matt Spinler | 59c29c7 | 2017-04-27 11:17:28 -0500 | [diff] [blame] | 144 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 145 | AC_OUTPUT |