-
Notifications
You must be signed in to change notification settings - Fork 7
/
configure.ac
275 lines (229 loc) · 7.72 KB
/
configure.ac
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# Package name and version
AC_INIT(dsme, 0.84.4)
AM_INIT_AUTOMAKE([foreign subdir-objects])
AM_EXTRA_RECURSIVE_TARGETS([dbus-gmain])
AC_PREREQ([2.61])
AC_CONFIG_SRCDIR([dsme/dsme-wdd-wd.c])
#AC_CONFIG_HEADERS([config.h])
#
# CONFIG OPTIONS
#
#
# powerontimer
#
AC_ARG_ENABLE([poweron-timer],
[AS_HELP_STRING([--disable-poweron-timer],
[disable power-on timer plugin (libpowerontimer)])])
AS_IF([test "x$enable_poweron_timer" != xno],
[AC_DEFINE([DSME_POWERON_TIMER], [1], [Enable power-on timer plugin])
AC_CHECK_LIB([cal], [cal_init], [],
[AC_MSG_FAILURE([libcal not found (needed by poweron-timer plugin)])])
])
AM_CONDITIONAL([WANT_POWERON_TIMER], [test x$enable_poweron_timer != xno])
#
# runlevel
#
AC_ARG_ENABLE([runlevel],
[AS_HELP_STRING([--enable-runlevel],
[enable runlevel plugin (librunlevel) - for systems with SysV init])],
[],
[enable_runlevel=no])
AS_IF([test "x$enable_runlevel" != xno],
[AC_DEFINE([DSME_WANT_LIBRUNLEVEL], [1], [Enable runlevel plugin])])
AM_CONDITIONAL([WANT_RUNLEVEL], [test x$enable_runlevel != xno])
#
# upstart
#
AC_ARG_ENABLE([upstart],
[AS_HELP_STRING([--disable-upstart],
[disable upstart plugin (libupstart)])])
AS_IF([test "x$enable_upstart" != xno],
[AC_DEFINE([DSME_WANT_LIBUPSTART], [1])])
AM_CONDITIONAL([WANT_UPSTART], [test x$enable_upstart != xno])
#
# systemd
#
AC_ARG_ENABLE([systemd],
[AS_HELP_STRING([--enable-systemd],
[enable systemd start feedback])],
[],
[enable_systemd=no])
AS_IF([test "x$enable_systemd" != xno],
[AC_DEFINE([DSME_SYSTEMD_ENABLE], [1])])
AM_CONDITIONAL([WANT_SYSTEMD], [test x$enable_systemd != xno])
#
# validatorlistener
#
AC_ARG_ENABLE([validatorlistener],
[AS_HELP_STRING([--disable-validatorlistener],
[disable validatorlistener plugin (validatorlistener)])],
[],
[enable_validatorlistener=yes])
AS_IF([test "x$enable_validatorlistener" != xno],
[AC_DEFINE([DSME_VALIDATOR_LISTENER], [1])])
AM_CONDITIONAL([WANT_VALIDATOR_LISTENER], [test x$enable_validatorlistener != xno])
#
# Generic thermal mgmt
#
AC_ARG_ENABLE([generic-thermal-mgmt],
[AS_HELP_STRING([--disable-generic-thermal-mgmt],
[disable generic thermal management (libthermalobject_generic)])],
[],
[enable_generic_thermal_mgmt=yes])
AS_IF([test "x$enable_generic_thermal_mgmt" != xno],
[AC_DEFINE([DSME_GENERIC_THERMAL_MGMT], [1])])
AM_CONDITIONAL([WANT_GENERIC_THERMAL_MGMT], [test x$enable_generic_thermal_mgmt != xno])
#
# pwrkeymonitor
#
AC_ARG_ENABLE([pwrkeymonitor],
[AS_HELP_STRING([--enable-pwrkeymonitor],
[enable pwrkeymonitor plugin (pwrkeymonitor)])],
[],
[enable_pwrkeymonitor=no])
AS_IF([test "x$enable_pwrkeymonitor" != xno],
[AC_DEFINE([DSME_PWRKEY_MONITOR], [1], [Enable pwrkeymonitor plugin])])
AM_CONDITIONAL([WANT_PWRKEY_MONITOR], [test x$enable_pwrkeymonitor != xno])
#
# Battery tracker
#
AC_ARG_ENABLE([battery-tracker],
[AS_HELP_STRING([--disable-battery-tracker],
[disable battery tracker (libbatterytracker)])],
[],
[enable_battery_tracker=yes])
AS_IF([test "x$enable_battery_tracker" != xno],
[AC_DEFINE([DSME_BATTERY_TRACKER], [1])])
AM_CONDITIONAL([WANT_BATTERY_TRACKER], [test x$enable_battery_tracker != xno])
#
# Bootreason logger
#
AC_ARG_ENABLE([bootreason-logger],
[AS_HELP_STRING([--disable-bootreason-logger],
[disable bootreason logger (libbootreasonlogger)])],
[],
[enable_bootreason_logger=yes])
AS_IF([test "x$enable_bootreason_logger" != xno],
[AC_DEFINE([DSME_BOOTREASON_LOGGER], [1])])
AM_CONDITIONAL([WANT_BOOTREASON_LOGGER], [test x$enable_bootreason_logger != xno])
#
# Shutdown feedback
#
AC_ARG_ENABLE([vibra-feedback],
[AS_HELP_STRING([--disable-vibra-feedback],
[disable vibra feedback (libshutdownfeedback)])],
[],
[enable_vibra_feedback=yes])
AS_IF([test "x$enable_vibra_feedback" != xno],
[AC_DEFINE([DSME_VIBRA_FEEDBACK], [1])])
AM_CONDITIONAL([WANT_VIBRA_FEEDBACK], [test x$enable_vibra_feedback != xno])
#
# WLAN loader
#
AC_ARG_ENABLE([wlanloader],
[AS_HELP_STRING([--disable-wlan-loader],
[disable wlan loader (libwlanloader)])],
[enable_wlan_loader=no],
[enable_wlan_loader=yes])
AS_IF([test "x$enable_wlan_loader" != xno],
[AC_DEFINE([DSME_WLAN_LOADER], [1])])
AM_CONDITIONAL([WANT_WLAN_LOADER], [test x$enable_wlan_loader != xno])
#
# Aboot settings
#
AC_ARG_ENABLE([abootsettings],
[AS_HELP_STRING([--enable-abootsettings],
[enable aboot settings plugin (libabootsettings)])])
AS_IF([test "x$enable_abootsettings" != xno],
[AC_DEFINE([DSME_ABOOTSETTINGS], [1], [Enable aboot settings plugin]) ])
AM_CONDITIONAL([WANT_ABOOTSETTINGS], [test x$enable_abootsettings != xno])
#
# Wheel is privileged
#
AC_ARG_ENABLE([usewheel],
[AS_HELP_STRING([--enable-usewheel],
[Users in wheel group are considered privileged])])
AS_IF([test "x$enable_usewheel" = xyes],
[AC_DEFINE([DSME_USEWHEEL], [1], [Users in wheel group are considered privileged])])
#
# Compiler and linker flags
#
AC_DEFINE_UNQUOTED([PRG_VERSION],[$VERSION],[Version for DSME])
# Work around autotool: in some autotool versions $exec_prefix is
# not parsed in the $sbindir variable. Thus, we get an invalid path.
if test "$sbindir" = '${exec_prefix}/sbin'; then
# Fix the path
AC_DEFINE_UNQUOTED([DSME_SBIN_PATH],["$exec_prefix/sbin"],[Installation dir for DSME executables])
else
# Use the sbindir provided by autotool
AC_DEFINE_UNQUOTED([DSME_SBIN_PATH],["$sbindir"],[Installation dir for DSME executables])
fi
AC_SUBST(CPP_GENFLAGS, ["-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"])
AC_SUBST(C_GENFLAGS, ["-pthread -g -std=c99 -Wall -Wwrite-strings -Wmissing-prototypes -Werror -Wshadow"])
AC_SUBST(C_OPTFLAGS, ["-O2"])
AC_SUBST(C_DBGFLAGS, ["-g -DDEBUG"])
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
LT_INIT
PKG_PROG_PKG_CONFIG
# Specify dir for local macros
AC_CONFIG_MACRO_DIR([m4])
# Enable per-target compiler options
AM_PROG_CC_C_O()
# Pkgconf checks
PKG_CHECK_MODULES(LIBCRYPTSETUP, libcryptsetup)
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.40)
PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.8)
PKG_CHECK_MODULES(MCE_DEV, mce,
[],
AC_MSG_ERROR(Development files for mce are missing. Install mce-headers / mce-dev.))
if test "x$enable_vibra_feedback" != xno; then
PKG_CHECK_MODULES(LIBNGF, libngf0 >= 0.24)
fi
if test "x$enable_systemd" != xno; then
PKG_CHECK_MODULES(LIBSYSTEMD, libsystemd)
fi
# Check libs (that are not yet checked)
# Whitespaces in 'action-if-found' fields in order to not (auto)update LIBS variable
AC_CHECK_LIB([rt], [clock_nanosleep], [AC_MSG_NOTICE([got librt])], AC_MSG_FAILURE([librt required!]))
AC_CHECK_LIB([dsme], [dsmesock_init], [AC_MSG_NOTICE([got libdsme])], AC_MSG_FAILURE([libdsme required!]), [$GLIB_LIBS])
# Check headers
AC_CHECK_HEADERS([arpa/inet.h fcntl.h ftw.h inttypes.h limits.h stdint.h stdlib.h \
string.h strings.h sys/ioctl.h sys/socket.h sys/time.h time.h \
syslog.h unistd.h utmpx.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
# Check common library functions
AC_FUNC_ALLOCA
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRTOD
AC_CHECK_FUNCS([atexit clock_gettime dup2 ftw64 gettimeofday inet_ntoa memmove \
memset realpath select setenv socket strcasecmp strdup strerror \
strndup strpbrk strrchr strstr strtoul uname utmpxname])
# Create files
AC_CONFIG_FILES([Makefile
dbus-gmain/Makefile
dsme/Makefile
modules/Makefile
util/Makefile
getbootstate/Makefile
test/Makefile
tests/Makefile
dsme.init])
AC_CONFIG_FILES([dsme-plugin.pc])
AC_OUTPUT