AUTHORS: Mention Grant's contributions
[platform/upstream/connman.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(connman, 0.68)
3
4 AM_INIT_AUTOMAKE([foreign subdir-objects])
5 AM_CONFIG_HEADER(config.h)
6
7 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
8
9 AM_MAINTAINER_MODE
10
11 AC_PREFIX_DEFAULT(/usr/local)
12
13 PKG_PROG_PKG_CONFIG
14
15 COMPILER_FLAGS
16
17 AC_SUBST(abs_top_srcdir)
18 AC_SUBST(abs_top_builddir)
19
20 AC_LANG_C
21
22 AC_PROG_CC
23 AM_PROG_CC_C_O
24 AC_PROG_CC_PIE
25 AC_PROG_INSTALL
26 AM_PROG_MKDIR_P
27
28 m4_define([_LT_AC_TAGCONFIG], [])
29 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
30
31 AC_DISABLE_STATIC
32 AC_PROG_LIBTOOL
33
34 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
35                         [disable code optimization through compiler]), [
36         if (test "${enableval}" = "no"); then
37                 CFLAGS="$CFLAGS -O0"
38         fi
39 ])
40
41 GTK_DOC_CHECK
42
43 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
44                         [enable compiling with debugging information]), [
45         if (test "${enableval}" = "yes" &&
46                                 test "${ac_cv_prog_cc_g}" = "yes"); then
47                 CFLAGS="$CFLAGS -g"
48         fi
49 ])
50
51 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
52                         [enable position independent executables flag]), [
53         if (test "${enableval}" = "yes" &&
54                                 test "${ac_cv_prog_cc_pie}" = "yes"); then
55                 CFLAGS="$CFLAGS -fPIE"
56                 LDFLAGS="$LDFLAGS -pie"
57         fi
58 ])
59
60 AC_ARG_ENABLE(threads,
61         AC_HELP_STRING([--enable-threads], [enable threading support]),
62                         [enable_threads=${enableval}], [enable_threads="no"])
63
64 AC_ARG_ENABLE(ethernet,
65         AC_HELP_STRING([--enable-ethernet], [enable Ethernet support]),
66                         [enable_ethernet=${enableval}], [enable_ethernet="no"])
67 AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
68 AM_CONDITIONAL(ETHERNET_BUILTIN, test "${enable_ethernet}" = "builtin")
69
70 AC_ARG_ENABLE(wifi,
71         AC_HELP_STRING([--enable-wifi], [enable WiFi support]),
72                         [enable_wifi=${enableval}], [enable_wifi="no"])
73 if (test "${enable_wifi}" != "no"); then
74         AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
75                                                 $PATH:/sbin:/usr/sbin)
76 fi
77 AM_CONDITIONAL(WIFI, test "${enable_wifi}" != "no")
78 AM_CONDITIONAL(WIFI_BUILTIN, test "${enable_wifi}" = "builtin")
79
80 AC_ARG_ENABLE(bluetooth,
81         AC_HELP_STRING([--enable-bluetooth], [enable Bluetooth support]),
82                         [enable_bluetooth=${enableval}], [enable_bluetooth="no"])
83 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
84 AM_CONDITIONAL(BLUETOOTH_BUILTIN, test "${enable_bluetooth}" = "builtin")
85
86 AC_ARG_ENABLE(hh2serial-gps,
87         AC_HELP_STRING([--enable-hh2serial-gps], [enable hh2serial GPS support]),
88                         [enable_hh2serial_gps=${enableval}], [enable_hh2serial_gps="no"])
89 AM_CONDITIONAL(HH2SERIAL_GPS, test "${enable_hh2serial_gps}" != "no")
90 AM_CONDITIONAL(HH2SERIAL_GPS_BUILTIN, test "${enable_hh2serial_gps}" = "builtin")
91
92 AC_ARG_ENABLE(ofono,
93         AC_HELP_STRING([--enable-ofono], [enable oFono support]),
94                         [enable_ofono=${enableval}], [enable_ofono="no"])
95 AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
96 AM_CONDITIONAL(OFONO_BUILTIN, test "${enable_ofono}" = "builtin")
97
98 AC_ARG_WITH(openconnect, AC_HELP_STRING([--with-openconnect=PROGRAM],
99         [specify location of openconnect binary]), [path_openconnect=${withval}])
100
101 AC_ARG_ENABLE(openconnect,
102         AC_HELP_STRING([--enable-openconnect], [enable openconnect support]),
103                         [enable_openconnect=${enableval}], [enable_openconnect="no"])
104 if (test "${enable_openconnect}" != "no"); then
105         if (test -z "${path_openconnect}"); then
106                 AC_PATH_PROG(OPENCONNECT, [openconnect], [], $PATH:/sbin:/usr/sbin)
107         else
108                 OPENCONNECT="${path_openconnect}"
109                 AC_SUBST(OPENCONNECT)
110         fi
111 fi
112 AM_CONDITIONAL(OPENCONNECT, test "${enable_openconnect}" != "no")
113 AM_CONDITIONAL(OPENCONNECT_BUILTIN, test "${enable_openconnect}" = "builtin")
114
115 AC_ARG_ENABLE(portal,
116         AC_HELP_STRING([--enable-portal], [enable portal detection support]),
117                         [enable_portal=${enableval}], [enable_portal="no"])
118 AM_CONDITIONAL(PORTAL, test "${enable_portal}" != "no")
119 AM_CONDITIONAL(PORTAL_BUILTIN, test "${enable_portal}" = "builtin")
120
121 AC_ARG_WITH(openvpn, AC_HELP_STRING([--with-openvpn=PROGRAM],
122         [specify location of openvpn binary]), [path_openvpn=${withval}])
123
124 AC_ARG_ENABLE(openvpn,
125         AC_HELP_STRING([--enable-openvpn], [enable openvpn support]),
126                         [enable_openvpn=${enableval}], [enable_openvpn="no"])
127 if (test "${enable_openvpn}" != "no"); then
128         if (test -z "${path_openvpn}"); then
129                 AC_PATH_PROG(OPENVPN, [openvpn], [], $PATH:/sbin:/usr/sbin)
130         else
131                 OPENVPN="${path_openvpn}"
132                 AC_SUBST(OPENVPN)
133         fi
134 fi
135 AM_CONDITIONAL(OPENVPN, test "${enable_openvpn}" != "no")
136 AM_CONDITIONAL(OPENVPN_BUILTIN, test "${enable_openvpn}" = "builtin")
137
138 AC_ARG_WITH(vpnc, AC_HELP_STRING([--with-vpnc=PROGRAM],
139         [specify location of vpnc binary]), [path_vpnc=${withval}])
140
141 AC_ARG_ENABLE(vpnc,
142         AC_HELP_STRING([--enable-vpnc], [enable vpnc support]),
143                 [enable_vpnc=${enableval}], [enable_vpnc="no"])
144 if (test "${enable_vpnc}" != "no"); then
145         if (test -z "${path_vpnc}"); then
146                 AC_PATH_PROG(VPNC, [vpnc], [], $PATH:/sbin:/usr/sbin)
147         else
148                 VPNC="${path_vpnc}"
149                 AC_SUBST(VPNC)
150         fi
151 fi
152 AM_CONDITIONAL(VPNC, test "${enable_vpnc}" != "no")
153 AM_CONDITIONAL(VPNC_BUILTIN, test "${enable_vpnc}" = "builtin")
154
155 AC_ARG_ENABLE(loopback,
156         AC_HELP_STRING([--enable-loopback], [enable loopback support]),
157                         [enable_loopback=${enableval}], [enable_loopback="no"])
158 if (test "${enable_loopback}" != "no"); then
159         AC_CHECK_HEADERS(sys/inotify.h, dummy=yes,
160                         AC_MSG_ERROR(inotify header files are required))
161
162         AC_CHECK_LIB(c, inotify_init, dummy=yes,
163                         AC_MSG_ERROR(inotify library support is required))
164 fi
165 AM_CONDITIONAL(LOOPBACK, test "${enable_loopback}" != "no")
166 AM_CONDITIONAL(LOOPBACK_BUILTIN, test "${enable_loopback}" = "builtin")
167
168 AC_ARG_ENABLE(pacrunner,
169         AC_HELP_STRING([--enable-pacrunner], [enable PAC runner support]),
170                         [enable_pacrunner=${enableval}], [enable_pacrunner="no"])
171
172 AM_CONDITIONAL(PACRUNNER, test "${enable_pacrunner}" != "no")
173 AM_CONDITIONAL(PACRUNNER_BUILTIN, test "${enable_pacrunner}" = "builtin")
174
175 AC_ARG_ENABLE(google,
176         AC_HELP_STRING([--enable-google], [enable Google Public DNS support]),
177                         [enable_google=${enableval}], [enable_google="no"])
178 AM_CONDITIONAL(GOOGLE, test "${enable_google}" != "no")
179 AM_CONDITIONAL(GOOGLE_BUILTIN, test "${enable_google}" = "builtin")
180
181 AC_ARG_ENABLE(meego,
182         AC_HELP_STRING([--enable-meego], [enable MeeGo features support]),
183                         [enable_meego=${enableval}], [enable_meego="no"])
184 AM_CONDITIONAL(MEEGO, test "${enable_meego}" != "no")
185 AM_CONDITIONAL(MEEGO_BUILTIN, test "${enable_meego}" = "builtin")
186
187 AC_CHECK_HEADERS(resolv.h, dummy=yes,
188         AC_MSG_ERROR(resolver header files are required))
189 AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
190         AC_CHECK_LIB(resolv, __ns_initparse, dummy=yes,
191                 AC_MSG_ERROR(resolver library support is required))
192 ])
193
194 AC_CHECK_LIB(dl, dlopen, dummy=yes,
195                         AC_MSG_ERROR(dynamic linking loader is required))
196
197 AC_ARG_WITH(iwmxsdk, AC_HELP_STRING([--with-iwmxsdk=PATH],
198                                                 [path to Intel WiMAX SDK]),
199                                 [pkgconfig_iwmxsdk=${withval}/lib/pkgconfig])
200
201 AC_ARG_ENABLE(iwmx, AC_HELP_STRING([--enable-iwmx],
202                 [enable Intel WiMAX support]), [enable_iwmx=${enableval}])
203 if (test "${enable_iwmx}" = "yes"); then
204         enable_threads="yes"
205         export PKG_CONFIG_PATH="${pkgconfig_iwmxsdk}"
206         PKG_CHECK_MODULES(IWMXSDK, libiWmxSdk-0, dummy=yes,
207                                 AC_MSG_ERROR(Intel WiMAX SDK is required))
208         PKG_CONFIG_PATH=""
209         AC_SUBST(IWMXSDK_CFLAGS)
210         AC_SUBST(IWMXSDK_LIBS)
211
212         # Fix API compat breakage from 1.4 to 1.5...
213         CPPFLAGS_save=$CPPFLAGS
214         CPPFLAGS="$IWMXSDK_CFLAGS $CPPFLAGS"
215         AH_TEMPLATE([HAVE_IWMXSDK_STATUS_IDLE],
216                     [WIMAX_API_DEVICE_STATUS_Connection_Idle is present])
217         AC_CHECK_DECL(WIMAX_API_DEVICE_STATUS_Connection_Idle,
218                       [AC_DEFINE([HAVE_IWMXSDK_STATUS_IDLE], [1], [])],
219                       [],
220                       [[#include <WiMaxType.h>]])
221
222         AH_TEMPLATE([HAVE_WIMAX_API_DEVICE_ID],
223                     [WIMAX_API_DEVICE_ID is present])
224         AC_CHECK_TYPE(WIMAX_API_DEVICE_ID,
225                       [AC_DEFINE([HAVE_WIMAX_API_DEVICE_ID], [1], [])],
226                       [],
227                       [[#include <WiMaxType.h>]])
228
229         AH_TEMPLATE([HAVE_WIMAX_API_HW_DEVICE_ID],
230                     [WIMAX_API_HW_DEVICE_ID is present])
231         AC_CHECK_TYPE(WIMAX_API_HW_DEVICE_ID,
232                       [AC_DEFINE([HAVE_WIMAX_API_HW_DEVICE_ID], [1], [])],
233                       [],
234                       [[#include <WiMaxType.h>]])
235
236         AH_TEMPLATE([HAVE_WIMAX_API_NSP_INFO_EX],
237                     [WIMAX_API_NSP_INFO_EX is present])
238         AC_CHECK_TYPE(WIMAX_API_NSP_INFO_EX,
239                       [AC_DEFINE([HAVE_WIMAX_API_NSP_INFO_EX], [1], [])],
240                       [],
241                       [[#include <WiMaxType.h>] 
242                        [#include <WiMaxTypesEx.h>]])
243
244         AH_TEMPLATE([HAVE_WIMAX_API_CONNECTED_NSP_INFO],
245                     [WIMAX_API_CONNECTED_NSP_INFO is present])
246         AC_CHECK_TYPE(WIMAX_API_CONNECTED_NSP_INFO,
247                       [AC_DEFINE([HAVE_WIMAX_API_CONNECTED_NSP_INFO], [1], [])],
248                       [],
249                       [[#include <WiMaxType.h>]])
250
251         CPPFLAGS=$CPPFLAGS_save
252 fi
253 AM_CONDITIONAL(IWMX, test "${enable_iwmx}" = "yes")
254
255 AC_ARG_ENABLE(iospm, AC_HELP_STRING([--enable-iospm],
256                 [enable Intel OSPM support]), [enable_iospm=${enableval}])
257 AM_CONDITIONAL(IOSPM, test "${enable_iospm}" = "yes")
258
259 AC_ARG_WITH(ntpd, AC_HELP_STRING([--with-ntpd=PROGRAM],
260         [specify ntpd binary location]), [path_ntpd=${withval}])
261
262 AC_ARG_ENABLE(ntpd,
263         AC_HELP_STRING([--enable-ntpd], [enable ntpd support]),
264                         [enable_ntpd=${enableval}], [enable_ntpd="no"])
265
266 if (test "${enable_ntpd}" != "no"); then
267         if (test -z "${path_ntpd}"); then
268                 AC_PATH_PROG(NTPD, [ntpd], [], $PATH:/sbin:/usr/sbin)
269         else
270                 NTPD="${path_ntpd}"
271                 AC_SUBST(NTPD)
272         fi
273 fi
274 AM_CONDITIONAL(NTPD, test "${enable_ntpd}" != "no")
275 AM_CONDITIONAL(NTPD_BUILTIN, test "${enable_ntpd}" = "builtin")
276
277 AC_ARG_ENABLE(nmcompat,
278         AC_HELP_STRING([--enable-nmcompat], [enable nmcompat support]),
279                         [enable_nmcompat=${enableval}], [enable_nmcompat="no"])
280 AM_CONDITIONAL(NMCOMPAT, test "${enable_nmcompat}" != "no")
281 AM_CONDITIONAL(NMCOMPAT_BUILTIN, test "${enable_nmcompat}" = "builtin")
282
283 AC_ARG_WITH(stats-max-file-size, AC_HELP_STRING([--with-stats-max-file-size=SIZE],
284                         [Maximal size of a statistics round robin file]),
285                         [stats_max_file_size=${withval}])
286
287 if (test -z "${stats_max_file_size}"); then
288    # default size is 16 kByte
289    stats_max_file_size="16 * 8 * 128"
290 fi
291
292 AC_DEFINE_UNQUOTED([STATS_MAX_FILE_SIZE], (${stats_max_file_size}), [Maximal size of a statistics round robin file])
293
294 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.22, dummy=yes,
295                                 AC_MSG_ERROR(GLib >= 2.22 is required))
296 AC_SUBST(GLIB_CFLAGS)
297 AC_SUBST(GLIB_LIBS)
298
299 if (test "${enable_threads}" = "yes"); then
300         AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
301         PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
302                                 AC_MSG_ERROR(GThread >= 2.16 is required))
303         GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
304         GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
305 fi
306
307 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
308                                 AC_MSG_ERROR(D-Bus >= 1.0 is required))
309 AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
310         AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
311                 [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
312 AC_SUBST(DBUS_CFLAGS)
313 AC_SUBST(DBUS_LIBS)
314
315 AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
316         [path to D-Bus config directory]), [path_dbusconf=${withval}],
317                 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
318 if (test -z "${path_dbusconf}"); then
319         DBUS_CONFDIR="${sysconfdir}/dbus-1/system.d"
320 else
321         DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d"
322 fi
323 AC_SUBST(DBUS_CONFDIR)
324
325 AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
326         [path to D-Bus data directory]), [path_dbusdata=${withval}],
327                 [path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
328 if (test -z "${path_dbusdata}"); then
329         DBUS_DATADIR="${datadir}/dbus-1/system-services"
330 else
331         DBUS_DATADIR="${path_dbusdata}/dbus-1/system-services"
332 fi
333 AC_SUBST(DBUS_DATADIR)
334
335 AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
336         [path to systemd service directory]), [path_systemdunit=${withval}],
337                 [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
338 if (test -n "${path_systemdunit}"); then
339         SYSTEMD_UNITDIR="${path_systemdunit}"
340         AC_SUBST(SYSTEMD_UNITDIR)
341 fi
342 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
343
344 PKG_CHECK_MODULES(XTABLES, xtables, dummy=yes,
345                                 AC_MSG_ERROR(Xtables library is required))
346 AC_SUBST(XTABLES_CFLAGS)
347 AC_SUBST(XTABLES_LIBS)
348
349 AC_ARG_ENABLE(polkit,
350         AC_HELP_STRING([--enable-polkit], [enable PolicyKit support]),
351                         [enable_polkit=${enableval}], [enable_polkit="no"])
352 if (test "${enable_polkit}" != "no"); then
353         POLKIT_DATADIR="`$PKG_CONFIG --variable=actiondir polkit`"
354         POLKIT_DATADIR=""
355         if (test -z "${POLKIT_DATADIR}"); then
356                 POLKIT_DATADIR="${datadir}/polkit-1/actions"
357         fi
358         AC_SUBST(POLKIT_DATADIR)
359 fi
360 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" != "no")
361 AM_CONDITIONAL(POLKIT_BUILTIN, test "${enable_polkit}" = "builtin")
362
363 AC_ARG_ENABLE(client, AC_HELP_STRING([--enable-client],
364                 [enable command line client]), [enable_client=${enableval}])
365 AM_CONDITIONAL(CLIENT, test "${enable_client}" = "yes")
366
367 AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools],
368                 [enable testing tools]), [enable_tools=${enableval}])
369 if (test "${enable_tools}" = "yes"); then
370         PKG_CHECK_MODULES(NETLINK, libnl-1, dummy=yes,
371                                 AC_MSG_ERROR(Netlink library is required))
372         AC_SUBST(NETLINK_CFLAGS)
373         AC_SUBST(NETLINK_LIBS)
374
375         PKG_CHECK_MODULES(GNUTLS, gnutls, dummy=yes,
376                                 AC_MSG_ERROR(GnuTLS library is required))
377         AC_SUBST(GNUTLS_CFLAGS)
378         AC_SUBST(GNUTLS_LIBS)
379 fi
380 AM_CONDITIONAL(TOOLS, test "${enable_tools}" = "yes")
381
382 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
383                 [enable test/example scripts]), [enable_test=${enableval}])
384 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
385
386 AC_ARG_ENABLE(fake, AC_HELP_STRING([--enable-fake],
387                 [enable fake device support]), [enable_fake=${enableval}])
388 AM_CONDITIONAL(FAKE, test "${enable_fake}" = "yes")
389
390 AC_ARG_ENABLE(capng, AC_HELP_STRING([--enable-capng],
391                 [enable capabilities support]), [enable_capng=${enableval}])
392 if (test "${enable_capng}" = "yes"); then
393         PKG_CHECK_MODULES(CAPNG, libcap-ng, dummy=yes,
394                                 AC_MSG_ERROR(Capabilities library is required))
395         AC_SUBST(CAPNG_CFLAGS)
396         AC_SUBST(CAPNG_LIBS)
397         AC_DEFINE(HAVE_CAPNG, 1, [Define to 1 if you have capabilities library.])
398 fi
399
400 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
401                         [don't install configuration and data files]),
402                                         [enable_datafiles=${enableval}])
403 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
404
405 AC_OUTPUT(Makefile include/version.h src/connman.service
406                                 scripts/connman doc/version.xml connman.pc)