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 | |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 33 | AC_ARG_ENABLE([presence], |
| 34 | AS_HELP_STRING([--disable-presence], [Disable fan presence package.])) |
| 35 | AC_ARG_ENABLE([control], |
| 36 | AS_HELP_STRING([--disable-control], [Disable fan control package.])) |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 37 | AC_ARG_ENABLE([cooling-type], |
| 38 | AS_HELP_STRING([--disable-cooling-type], [Disable cooling-type package.])) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 39 | |
| 40 | AM_CONDITIONAL([WANT_PRESENCE], [test "x$enable_presence" != "xno"]) |
| 41 | AM_CONDITIONAL([WANT_CONTROL], [test "x$enable_control" != "xno"]) |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 42 | AM_CONDITIONAL([WANT_COOLING_TYPE], [test "x$enable_cooling-type" != "xno"]) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 43 | |
| 44 | # Package specific checks. |
| 45 | AS_IF([test "x$enable_presence" != "xno"], [ |
| 46 | # Add optional yaml file argument |
| 47 | AC_ARG_VAR(FAN_DETECT_YAML_FILE, |
| 48 | [The fan presence detection definition file to use]) |
| 49 | AS_IF([test "x$FAN_DETECT_YAML_FILE" == "x"], |
| 50 | [FAN_DETECT_YAML_FILE="${srcdir}/presence/example/fan-detect.yaml"]) |
| 51 | AC_DEFINE_UNQUOTED([FAN_DETECT_YAML_FILE], ["$FAN_DETECT_YAML_FILE"], |
| 52 | [The fan presence detection definition file to use]) |
| 53 | |
| 54 | AC_SUBST([GEN_FAN_DETECT_DEFS], |
| 55 | [$PYTHON ${srcdir}/presence/gen-fan-detect-defs.py -y $FAN_DETECT_YAML_FILE]) |
| 56 | AC_CONFIG_FILES([presence/Makefile]) |
| 57 | ]) |
| 58 | |
| 59 | AS_IF([test "x$enable_control" != "xno"], [ |
| 60 | AC_CONFIG_FILES([control/Makefile]) |
| 61 | ]) |
Matthew Barth | 681c98d | 2017-02-17 16:05:57 -0600 | [diff] [blame] | 62 | |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 63 | AS_IF([test "x$enable_cooling-type" != "xno"], [ |
| 64 | PKG_CHECK_MODULES([LIBEVDEV], [libevdev], , |
| 65 | [AC_MSG_ERROR([The libevdev package is required])]) |
| 66 | AC_CONFIG_FILES([chassis-cooling-type/Makefile]) |
| 67 | ]) |
| 68 | |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 69 | # Create configured output |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 70 | AC_CONFIG_FILES([Makefile]) |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 71 | AC_OUTPUT |