forked from nemomobile/dsme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
206 lines (169 loc) · 5.7 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
# Package name and version
AC_INIT(dsme, 0.62.11)
AM_INIT_AUTOMAKE
AC_PREREQ([2.61])
AC_CONFIG_SRCDIR([dsme/dsme-wdd-wd.c])
#AC_CONFIG_HEADERS([config.h])
#
# CONFIG OPTIONS
#
# bmeipc
AC_ARG_WITH([bmeipc],
[AS_HELP_STRING([--without-bmeipc],
[disable BME ipc communication])])
AS_IF([test "x$with_bmeipc" != xno],
[AC_CHECK_LIB([bmeipc], [bmeipc_open],
[AC_SUBST([LIBBMEIPC], ["-lbmeipc"])
AC_DEFINE([DSME_BMEIPC], [1])
],
[AC_MSG_FAILURE([libbmeipc not found (--without-bmeipc to disable)])])
])
AM_CONDITIONAL([WANT_BMEIPC], [test x$with_bmeipc != xno])
#
# 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])
#
# memory thermal mgmt
#
AC_ARG_ENABLE([memory-thermal-mgmt],
[AS_HELP_STRING([--enable-memory-thermal-mgmt],
[enable memory thermal management (libthermalobject_memory)])],
[],
[enable_memory_thermal_mgmt=no])
AS_IF([test "x$enable_memory_thermal_mgmt" != xno],
[AC_DEFINE([DSME_MEMORY_THERMAL_MGMT], [1])])
AM_CONDITIONAL([WANT_MEMORY_THERMAL_MGMT], [test x$enable_memory_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])
#
# 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
# FIXME: DSME_LOG_ENABLE should be proper&working configure option
#AC_DEFINE([DSME_LOG_ENABLE], [1])
AC_SUBST(C_GENFLAGS, ["-pthread -g -std=c99 -Wall -Wwrite-strings -Wmissing-prototypes -Werror"])
AC_SUBST(C_OPTFLAGS, ["-O2"])
AC_SUBST(C_DBGFLAGS, ["-g -DDEBUG -DDSME_LOG_ENABLE"])
AC_SUBST(CPP_GENFLAGS, '-I$(top_srcdir) -I$(top_srcdir)/include')
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
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(GLIB, glib-2.0)
PKG_CHECK_MODULES(DBUS, dbus-1)
PKG_CHECK_MODULES(DBUSGLIB, dbus-glib-1)
# 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 \
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
dsme/Makefile
modules/Makefile
util/Makefile
getbootstate/Makefile
test/Makefile
dsme.init])
AC_OUTPUT