blob: 12337c30fd6558633624877c2f275dc3af027610 [file] [log] [blame]
Matthew Barthae0e96c2017-01-20 13:54:59 -06001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-fan-presence], [1.0],
4[https://github.com/openbmc/phosphor-fan-presence/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
Brad Bishop93919bb2017-04-22 14:58:29 -040015
Matthew Barth681c98d2017-02-17 16:05:57 -060016# Python
17AM_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 Barthae0e96c2017-01-20 13:54:59 -060019
20# Checks for typedefs, structures, and compiler characteristics.
21AX_CXX_COMPILE_STDCXX_14([noext])
22AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
23
24# Checks for libraries.
Matthew Barth293477d2017-02-17 15:39:36 -060025PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], ,
26[AC_MSG_ERROR([The openbmc/sdbusplus package is required])])
Matthew Barthfefdc452017-02-22 11:15:56 -060027PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging], ,
28[AC_MSG_ERROR([The openbmc/phosphor-logging package is required])])
Matthew Barth293477d2017-02-17 15:39:36 -060029
Matthew Barthae0e96c2017-01-20 13:54:59 -060030# Checks for library functions.
31LT_INIT # Required for systemd linking
32
Brad Bishop93919bb2017-04-22 14:58:29 -040033AC_ARG_ENABLE([presence],
34 AS_HELP_STRING([--disable-presence], [Disable fan presence package.]))
35AC_ARG_ENABLE([control],
36 AS_HELP_STRING([--disable-control], [Disable fan control package.]))
Brandon Wymanca60e102017-03-29 17:06:02 -050037AC_ARG_ENABLE([cooling-type],
38 AS_HELP_STRING([--disable-cooling-type], [Disable cooling-type package.]))
Brad Bishop93919bb2017-04-22 14:58:29 -040039
40AM_CONDITIONAL([WANT_PRESENCE], [test "x$enable_presence" != "xno"])
41AM_CONDITIONAL([WANT_CONTROL], [test "x$enable_control" != "xno"])
Brandon Wymanca60e102017-03-29 17:06:02 -050042AM_CONDITIONAL([WANT_COOLING_TYPE], [test "x$enable_cooling-type" != "xno"])
Brad Bishop93919bb2017-04-22 14:58:29 -040043
44# Package specific checks.
45AS_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
59AS_IF([test "x$enable_control" != "xno"], [
60 AC_CONFIG_FILES([control/Makefile])
61])
Matthew Barth681c98d2017-02-17 16:05:57 -060062
Brandon Wymanca60e102017-03-29 17:06:02 -050063AS_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 Barthae0e96c2017-01-20 13:54:59 -060069# Create configured output
Brad Bishop93919bb2017-04-22 14:58:29 -040070AC_CONFIG_FILES([Makefile])
Matthew Barthae0e96c2017-01-20 13:54:59 -060071AC_OUTPUT