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