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 | |
Lei YU | bd2e80a | 2018-09-19 11:17:09 +0800 | [diff] [blame] | 10 | # Use gcc-ar and gcc-ranlib for static libraries built with -flto |
| 11 | AC_SUBST([AR], [${ac_tool_prefix}gcc-ar]) |
| 12 | AC_SUBST([RANLIB], [${ac_tool_prefix}gcc-ranlib]) |
| 13 | |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 14 | # Checks for programs. |
| 15 | AC_PROG_CXX |
| 16 | AM_PROG_AR |
| 17 | AC_PROG_INSTALL |
| 18 | AC_PROG_MAKE_SET |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 19 | |
Matthew Barth | 681c98d | 2017-02-17 16:05:57 -0600 | [diff] [blame] | 20 | # Python |
| 21 | AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])], |
| 22 | [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] | 23 | |
| 24 | # Checks for typedefs, structures, and compiler characteristics. |
Vernon Mauery | 48df959 | 2018-10-04 10:08:13 -0700 | [diff] [blame] | 25 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 26 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
| 27 | |
| 28 | # Checks for libraries. |
Patrick Venture | 4b258ac | 2019-02-13 14:48:21 -0800 | [diff] [blame] | 29 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
| 30 | PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus]) |
| 31 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) |
| 32 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221]) |
| 33 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
| 34 | PKG_CHECK_MODULES([LIBEVDEV], [libevdev]) |
Matthew Barth | 293477d | 2017-02-17 15:39:36 -0600 | [diff] [blame] | 35 | |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 36 | # Checks for library functions. |
| 37 | LT_INIT # Required for systemd linking |
| 38 | |
Matt Spinler | 59c29c7 | 2017-04-27 11:17:28 -0500 | [diff] [blame] | 39 | # Check/set gtest specific functions. |
| 40 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 41 | AC_SUBST(GTEST_CPPFLAGS) |
| 42 | AC_ARG_ENABLE([oe-sdk], |
| 43 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 44 | ) |
| 45 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 46 | [Path to the OE SDK SYSROOT]) |
| 47 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 48 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 49 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 50 | ) |
| 51 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 52 | [ |
| 53 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 54 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 55 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 56 | ] |
| 57 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 58 | ) |
| 59 | |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 60 | AC_ARG_ENABLE([presence], |
| 61 | AS_HELP_STRING([--disable-presence], [Disable fan presence package.])) |
| 62 | AC_ARG_ENABLE([control], |
| 63 | AS_HELP_STRING([--disable-control], [Disable fan control package.])) |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 64 | AC_ARG_ENABLE([cooling-type], |
| 65 | AS_HELP_STRING([--disable-cooling-type], [Disable cooling-type package.])) |
Matt Spinler | af5d4c5 | 2017-05-16 10:38:43 -0500 | [diff] [blame] | 66 | AC_ARG_ENABLE([monitor], |
| 67 | AS_HELP_STRING([--disable-monitor], [Disable monitor])) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 68 | |
| 69 | AM_CONDITIONAL([WANT_PRESENCE], [test "x$enable_presence" != "xno"]) |
| 70 | AM_CONDITIONAL([WANT_CONTROL], [test "x$enable_control" != "xno"]) |
Brandon Wyman | ce82244 | 2017-04-10 17:48:02 -0500 | [diff] [blame] | 71 | AM_CONDITIONAL([WANT_COOLING_TYPE], [test "x$enable_cooling_type" != "xno"]) |
Matt Spinler | e567dd2 | 2017-04-27 12:27:17 -0500 | [diff] [blame] | 72 | AM_CONDITIONAL([WANT_MONITOR], [test "x$enable_monitor" != "xno"]) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 73 | |
| 74 | # Package specific checks. |
| 75 | AS_IF([test "x$enable_presence" != "xno"], [ |
| 76 | # Add optional yaml file argument |
Brad Bishop | 76596b2 | 2017-06-13 14:39:13 -0400 | [diff] [blame] | 77 | AC_ARG_VAR(PRESENCE_CONFIG, |
| 78 | [The fan presence config file.]) |
| 79 | |
Brad Bishop | 76596b2 | 2017-06-13 14:39:13 -0400 | [diff] [blame] | 80 | AS_IF([test "x$PRESENCE_CONFIG" == "x"], |
| 81 | [PRESENCE_CONFIG="\${top_srcdir}/presence/example/example.yaml"]) |
| 82 | |
Brad Bishop | 76596b2 | 2017-06-13 14:39:13 -0400 | [diff] [blame] | 83 | AC_DEFINE_UNQUOTED([PRESENCE_CONFIG], ["$PRESENCE_CONFIG"], |
| 84 | [The fan presence config file.]) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 85 | |
Brad Bishop | 76596b2 | 2017-06-13 14:39:13 -0400 | [diff] [blame] | 86 | AC_SUBST([PFPGEN], |
| 87 | ["$PYTHON \${top_srcdir}/presence/pfpgen.py generate-cpp -i $PRESENCE_CONFIG"]) |
| 88 | |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 89 | AC_CONFIG_FILES([presence/Makefile]) |
| 90 | ]) |
| 91 | |
| 92 | AS_IF([test "x$enable_control" != "xno"], [ |
Matthew Barth | 14cc043 | 2019-01-16 15:06:41 -0600 | [diff] [blame] | 93 | # Add fan control Dbus attributes |
| 94 | AC_ARG_VAR(CONTROL_BUSNAME, [The fan control busname to own]) |
| 95 | AS_IF([test "x$CONTROL_BUSNAME" == "x"], |
| 96 | [CONTROL_BUSNAME="xyz.openbmc_project.Control.Thermal"]) |
| 97 | AC_DEFINE_UNQUOTED([CONTROL_BUSNAME], ["$CONTROL_BUSNAME"], |
| 98 | [The fan control busname to own]) |
| 99 | |
| 100 | AC_ARG_VAR(CONTROL_OBJPATH, [The fan control root object path]) |
| 101 | AS_IF([test "x$CONTROL_OBJPATH" == "x"], |
| 102 | [CONTROL_OBJPATH="/xyz/openbmc_project/control/thermal"]) |
| 103 | AC_DEFINE_UNQUOTED([CONTROL_OBJPATH], ["$CONTROL_OBJPATH"], |
| 104 | [The fan control root object path]) |
| 105 | |
Matthew Barth | cc8912e | 2019-01-21 11:35:27 -0600 | [diff] [blame] | 106 | AC_ARG_VAR(CONTROL_PERSIST_ROOT_PATH, [Root path for persisting zone property states]) |
| 107 | AS_IF([test "x$CONTROL_PERSIST_ROOT_PATH" == "x"], |
| 108 | [CONTROL_PERSIST_ROOT_PATH="/var/lib/phosphor-fan-presence/control"]) |
| 109 | AC_DEFINE_UNQUOTED([CONTROL_PERSIST_ROOT_PATH], ["$CONTROL_PERSIST_ROOT_PATH"], |
| 110 | [Root path for persisting zone property states]) |
| 111 | |
Matt Spinler | 77d32d1 | 2017-04-12 09:51:41 -0500 | [diff] [blame] | 112 | # Add optional yaml file arguments |
| 113 | AC_ARG_VAR(FAN_DEF_YAML_FILE, |
| 114 | [The fan definition file to use]) |
| 115 | AS_IF([test "x$FAN_DEF_YAML_FILE" == "x"], |
Brandon Wyman | c5f5351 | 2017-07-25 16:31:57 -0500 | [diff] [blame] | 116 | [FAN_DEF_YAML_FILE="\${top_srcdir}/control/example/fans.yaml"]) |
Matt Spinler | 77d32d1 | 2017-04-12 09:51:41 -0500 | [diff] [blame] | 117 | AC_DEFINE_UNQUOTED([FAN_DEF_YAML_FILE], ["$FAN_DEF_YAML_FILE"], |
| 118 | [The fan definition file to use]) |
| 119 | |
| 120 | AC_ARG_VAR(FAN_ZONE_YAML_FILE, |
| 121 | [The fan zone definition file to use]) |
| 122 | AS_IF([test "x$FAN_ZONE_YAML_FILE" == "x"], |
Brandon Wyman | c5f5351 | 2017-07-25 16:31:57 -0500 | [diff] [blame] | 123 | [FAN_ZONE_YAML_FILE="\${top_srcdir}/control/example/zones.yaml"]) |
Matt Spinler | 77d32d1 | 2017-04-12 09:51:41 -0500 | [diff] [blame] | 124 | AC_DEFINE_UNQUOTED([FAN_ZONE_YAML_FILE], ["$FAN_ZONE_YAML_FILE"], |
| 125 | [The fan zone definition file to use]) |
| 126 | |
Matthew Barth | d4d0f08 | 2017-05-16 13:51:10 -0500 | [diff] [blame] | 127 | AC_ARG_VAR(ZONE_EVENTS_YAML_FILE, |
| 128 | [The zone events definition file to use]) |
Brandon Wyman | c5f5351 | 2017-07-25 16:31:57 -0500 | [diff] [blame] | 129 | AS_IF([test "x$ZONE_EVENTS_YAML_FILE" == "x"], |
| 130 | [ZONE_EVENTS_YAML_FILE="\${top_srcdir}/control/example/events.yaml"]) |
| 131 | AC_DEFINE_UNQUOTED([ZONE_EVENTS_YAML_FILE], ["$ZONE_EVENTS_YAML_FILE"], |
| 132 | [The zone events definition file to use]) |
Matthew Barth | d4d0f08 | 2017-05-16 13:51:10 -0500 | [diff] [blame] | 133 | |
Gunnar Mills | 28c1a09 | 2017-06-26 11:16:41 -0500 | [diff] [blame] | 134 | AC_ARG_VAR(ZONE_CONDITIONS_YAML_FILE, |
| 135 | [The zone conditions definition file to use]) |
Brandon Wyman | c5f5351 | 2017-07-25 16:31:57 -0500 | [diff] [blame] | 136 | AS_IF([test "x$ZONE_CONDITIONS_YAML_FILE" == "x"], |
| 137 | [ZONE_CONDITIONS_YAML_FILE="\${top_srcdir}/control/example/zone_conditions.yaml"]) |
| 138 | AC_DEFINE_UNQUOTED([ZONE_CONDITIONS_YAML_FILE], ["$ZONE_CONDITIONS_YAML_FILE"], |
| 139 | [The zone conditions definition file to use]) |
Gunnar Mills | 28c1a09 | 2017-06-26 11:16:41 -0500 | [diff] [blame] | 140 | |
Matt Spinler | 77d32d1 | 2017-04-12 09:51:41 -0500 | [diff] [blame] | 141 | AC_ARG_VAR(FAN_ZONE_OUTPUT_DIR, |
| 142 | [The output directory for the generated fan zone data file]) |
| 143 | AS_IF([test "x$FAN_ZONE_OUTPUT_DIR" == "x"], |
Brandon Wyman | c5f5351 | 2017-07-25 16:31:57 -0500 | [diff] [blame] | 144 | [FAN_ZONE_OUTPUT_DIR="\${top_srcdir}/control/"]) |
Matt Spinler | 77d32d1 | 2017-04-12 09:51:41 -0500 | [diff] [blame] | 145 | AC_DEFINE_UNQUOTED([FAN_ZONE_OUTPUT_DIR], ["$FAN_ZONE_OUTPUT_DIR"], |
| 146 | [The output directory for the generated fan zone data file]) |
| 147 | |
| 148 | AC_SUBST([GEN_FAN_ZONE_DEFS], |
Brandon Wyman | c5f5351 | 2017-07-25 16:31:57 -0500 | [diff] [blame] | 149 | ["$PYTHON \${top_srcdir}/control/gen-fan-zone-defs.py \ |
Matt Spinler | 77d32d1 | 2017-04-12 09:51:41 -0500 | [diff] [blame] | 150 | -f $FAN_DEF_YAML_FILE \ |
| 151 | -z $FAN_ZONE_YAML_FILE \ |
Brandon Wyman | c5f5351 | 2017-07-25 16:31:57 -0500 | [diff] [blame] | 152 | -e $ZONE_EVENTS_YAML_FILE \ |
| 153 | -c $ZONE_CONDITIONS_YAML_FILE \ |
| 154 | -o $FAN_ZONE_OUTPUT_DIR"]) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 155 | AC_CONFIG_FILES([control/Makefile]) |
| 156 | ]) |
Matthew Barth | 681c98d | 2017-02-17 16:05:57 -0600 | [diff] [blame] | 157 | |
Brandon Wyman | ce82244 | 2017-04-10 17:48:02 -0500 | [diff] [blame] | 158 | AS_IF([test "x$enable_cooling_type" != "xno"], [ |
Brandon Wyman | fef0295 | 2017-03-31 18:13:21 -0500 | [diff] [blame] | 159 | AC_CONFIG_FILES([cooling-type/Makefile]) |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 160 | ]) |
Matt Spinler | e567dd2 | 2017-04-27 12:27:17 -0500 | [diff] [blame] | 161 | AS_IF([test "x$enable_monitor" != "xno"], [ |
Matt Spinler | 1432184 | 2017-04-28 15:27:43 -0500 | [diff] [blame] | 162 | |
| 163 | AC_ARG_VAR(FAN_MONITOR_YAML_FILE, |
| 164 | [The fan monitor definition file to use]) |
| 165 | AS_IF([test "x$FAN_MONITOR_YAML_FILE" == "x"], |
| 166 | [FAN_MONITOR_YAML_FILE="${srcdir}/monitor/example/monitor.yaml"]) |
| 167 | AC_DEFINE_UNQUOTED([FAN_MONITOR_YAML_FILE], ["$FAN_MONITOR_YAML_FILE"], |
| 168 | [The fan monitor definition file to use]) |
| 169 | |
| 170 | AC_ARG_VAR(FAN_MONITOR_OUTPUT_DIR, |
| 171 | [The output directory for the generated fan monitor data file]) |
| 172 | AS_IF([test "x$FAN_MONITOR_OUTPUT_DIR" == "x"], |
| 173 | [FAN_MONITOR_OUTPUT_DIR="${srcdir}/monitor/"]) |
| 174 | AC_DEFINE_UNQUOTED([FAN_MONITOR_OUTPUT_DIR], ["$FAN_MONITOR_OUTPUT_DIR"], |
| 175 | [The output directory for the generated fan monitor data file]) |
| 176 | |
| 177 | AC_SUBST([GEN_FAN_MONITOR_DEFS], |
| 178 | [$PYTHON ${srcdir}/monitor/gen-fan-monitor-defs.py \ |
| 179 | -m $FAN_MONITOR_YAML_FILE \ |
| 180 | -o $FAN_MONITOR_OUTPUT_DIR]) |
| 181 | |
Matt Spinler | e567dd2 | 2017-04-27 12:27:17 -0500 | [diff] [blame] | 182 | AC_CONFIG_FILES([monitor/Makefile]) |
| 183 | ]) |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 184 | |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 185 | # Create configured output |
William A. Kennington III | 8fd879f | 2018-10-30 19:49:29 -0700 | [diff] [blame] | 186 | AC_CONFIG_FILES([Makefile sdevent/test/Makefile evdevpp/test/Makefile presence/test/Makefile]) |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 187 | AC_OUTPUT |