gdbus: explicitly compare pointers to NULL
[platform/upstream/connman.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(connman, 0.64)
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_ENABLE(loopback,
139         AC_HELP_STRING([--enable-loopback], [enable loopback support]),
140                         [enable_loopback=${enableval}], [enable_loopback="no"])
141 if (test "${enable_loopback}" != "no"); then
142         AC_CHECK_HEADERS(sys/inotify.h, dummy=yes,
143                         AC_MSG_ERROR(inotify header files are required))
144
145         AC_CHECK_LIB(c, inotify_init, dummy=yes,
146                         AC_MSG_ERROR(inotify library support is required))
147 fi
148 AM_CONDITIONAL(LOOPBACK, test "${enable_loopback}" != "no")
149 AM_CONDITIONAL(LOOPBACK_BUILTIN, test "${enable_loopback}" = "builtin")
150
151 AC_ARG_ENABLE(dnsproxy,
152         AC_HELP_STRING([--enable-dnsproxy], [enable DNS proxy support]),
153                         [enable_dnsproxy=${enableval}], [enable_dnsproxy="no"])
154
155 AM_CONDITIONAL(DNSPROXY, test "${enable_dnsproxy}" != "no")
156 AM_CONDITIONAL(DNSPROXY_BUILTIN, test "${enable_dnsproxy}" = "builtin")
157
158 AC_ARG_ENABLE(pacrunner,
159         AC_HELP_STRING([--enable-pacrunner], [enable PAC runner support]),
160                         [enable_pacrunner=${enableval}], [enable_pacrunner="no"])
161
162 AM_CONDITIONAL(PACRUNNER, test "${enable_pacrunner}" != "no")
163 AM_CONDITIONAL(PACRUNNER_BUILTIN, test "${enable_pacrunner}" = "builtin")
164
165 AC_ARG_ENABLE(google,
166         AC_HELP_STRING([--enable-google], [enable Google Public DNS support]),
167                         [enable_google=${enableval}], [enable_google="no"])
168 AM_CONDITIONAL(GOOGLE, test "${enable_google}" != "no")
169 AM_CONDITIONAL(GOOGLE_BUILTIN, test "${enable_google}" = "builtin")
170
171 AC_ARG_ENABLE(meego,
172         AC_HELP_STRING([--enable-meego], [enable MeeGo features support]),
173                         [enable_meego=${enableval}], [enable_meego="no"])
174 AM_CONDITIONAL(MEEGO, test "${enable_meego}" != "no")
175 AM_CONDITIONAL(MEEGO_BUILTIN, test "${enable_meego}" = "builtin")
176
177 AC_CHECK_HEADERS(resolv.h, dummy=yes,
178         AC_MSG_ERROR(resolver header files are required))
179 AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
180         AC_CHECK_LIB(resolv, __ns_initparse, dummy=yes,
181                 AC_MSG_ERROR(resolver library support is required))
182 ])
183
184 AC_CHECK_LIB(dl, dlopen, dummy=yes,
185                         AC_MSG_ERROR(dynamic linking loader is required))
186
187 AC_ARG_WITH(iwmxsdk, AC_HELP_STRING([--with-iwmxsdk=PATH],
188                                                 [path to Intel WiMAX SDK]),
189                                 [pkgconfig_iwmxsdk=${withval}/lib/pkgconfig])
190
191 AC_ARG_ENABLE(iwmx, AC_HELP_STRING([--enable-iwmx],
192                 [enable Intel WiMAX support]), [enable_iwmx=${enableval}])
193 if (test "${enable_iwmx}" = "yes"); then
194         enable_threads="yes"
195         export PKG_CONFIG_PATH="${pkgconfig_iwmxsdk}"
196         PKG_CHECK_MODULES(IWMXSDK, libiWmxSdk-0, dummy=yes,
197                                 AC_MSG_ERROR(Intel WiMAX SDK is required))
198         PKG_CONFIG_PATH=""
199         AC_SUBST(IWMXSDK_CFLAGS)
200         AC_SUBST(IWMXSDK_LIBS)
201
202         # Fix API compat breakage from 1.4 to 1.5...
203         CPPFLAGS_save=$CPPFLAGS
204         CPPFLAGS="$IWMXSDK_CFLAGS $CPPFLAGS"
205         AH_TEMPLATE([HAVE_IWMXSDK_STATUS_IDLE],
206                     [WIMAX_API_DEVICE_STATUS_Connection_Idle is present])
207         AC_CHECK_DECL(WIMAX_API_DEVICE_STATUS_Connection_Idle,
208                       [AC_DEFINE([HAVE_IWMXSDK_STATUS_IDLE], [1], [])],
209                       [],
210                       [[#include <WiMaxType.h>]])
211
212         AH_TEMPLATE([HAVE_WIMAX_API_DEVICE_ID],
213                     [WIMAX_API_DEVICE_ID is present])
214         AC_CHECK_TYPE(WIMAX_API_DEVICE_ID,
215                       [AC_DEFINE([HAVE_WIMAX_API_DEVICE_ID], [1], [])],
216                       [],
217                       [[#include <WiMaxType.h>]])
218
219         AH_TEMPLATE([HAVE_WIMAX_API_HW_DEVICE_ID],
220                     [WIMAX_API_HW_DEVICE_ID is present])
221         AC_CHECK_TYPE(WIMAX_API_HW_DEVICE_ID,
222                       [AC_DEFINE([HAVE_WIMAX_API_HW_DEVICE_ID], [1], [])],
223                       [],
224                       [[#include <WiMaxType.h>]])
225
226         AH_TEMPLATE([HAVE_WIMAX_API_NSP_INFO_EX],
227                     [WIMAX_API_NSP_INFO_EX is present])
228         AC_CHECK_TYPE(WIMAX_API_NSP_INFO_EX,
229                       [AC_DEFINE([HAVE_WIMAX_API_NSP_INFO_EX], [1], [])],
230                       [],
231                       [[#include <WiMaxType.h>] 
232                        [#include <WiMaxTypesEx.h>]])
233
234         AH_TEMPLATE([HAVE_WIMAX_API_CONNECTED_NSP_INFO],
235                     [WIMAX_API_CONNECTED_NSP_INFO is present])
236         AC_CHECK_TYPE(WIMAX_API_CONNECTED_NSP_INFO,
237                       [AC_DEFINE([HAVE_WIMAX_API_CONNECTED_NSP_INFO], [1], [])],
238                       [],
239                       [[#include <WiMaxType.h>]])
240
241         CPPFLAGS=$CPPFLAGS_save
242 fi
243 AM_CONDITIONAL(IWMX, test "${enable_iwmx}" = "yes")
244
245 AC_ARG_ENABLE(iospm, AC_HELP_STRING([--enable-iospm],
246                 [enable Intel OSPM support]), [enable_iospm=${enableval}])
247 AM_CONDITIONAL(IOSPM, test "${enable_iospm}" = "yes")
248
249 AC_ARG_WITH(ntpd, AC_HELP_STRING([--with-ntpd=PROGRAM],
250         [specify ntpd binary location]), [path_ntpd=${withval}])
251
252 AC_ARG_ENABLE(ntpd,
253         AC_HELP_STRING([--enable-ntpd], [enable ntpd support]),
254                         [enable_ntpd=${enableval}], [enable_ntpd="no"])
255
256 if (test "${enable_ntpd}" != "no"); then
257         if (test -z "${path_ntpd}"); then
258                 AC_PATH_PROG(NTPD, [ntpd], [], $PATH:/sbin:/usr/sbin)
259         else
260                 NTPD="${path_ntpd}"
261                 AC_SUBST(NTPD)
262         fi
263 fi
264 AM_CONDITIONAL(NTPD, test "${enable_ntpd}" != "no")
265 AM_CONDITIONAL(NTPD_BUILTIN, test "${enable_ntpd}" = "builtin")
266
267 AC_ARG_WITH(stats-max-file-size, AC_HELP_STRING([--with-stats-max-file-size=SIZE],
268                         [Maximal size of a statistics round robin file]),
269                         [stats_max_file_size=${withval}])
270
271 if (test -z "${stats_max_file_size}"); then
272    # default size is 512 kByte
273    stats_max_file_size="512 * 8 * 128"
274 fi
275
276 AC_DEFINE_UNQUOTED([STATS_MAX_FILE_SIZE], (${stats_max_file_size}), [Maximal size of a statistics round robin file])
277
278 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes,
279                                 AC_MSG_ERROR(GLib >= 2.16 is required))
280 AC_SUBST(GLIB_CFLAGS)
281 AC_SUBST(GLIB_LIBS)
282
283 if (test "${enable_threads}" = "yes"); then
284         AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
285         PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
286                                 AC_MSG_ERROR(GThread >= 2.16 is required))
287         GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
288         GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
289 fi
290
291 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
292                                 AC_MSG_ERROR(D-Bus >= 1.0 is required))
293 AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
294         AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
295                 [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
296 AC_SUBST(DBUS_CFLAGS)
297 AC_SUBST(DBUS_LIBS)
298
299 AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
300         [path to D-Bus config directory]), [path_dbusconf=${withval}],
301                 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
302 if (test -z "${path_dbusconf}"); then
303         DBUS_CONFDIR="${sysconfdir}/dbus-1/system.d"
304 else
305         DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d"
306 fi
307 AC_SUBST(DBUS_CONFDIR)
308
309 AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
310         [path to D-Bus data directory]), [path_dbusdata=${withval}],
311                 [path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
312 if (test -z "${path_dbusdata}"); then
313         DBUS_DATADIR="${datadir}/dbus-1/system-services"
314 else
315         DBUS_DATADIR="${path_dbusdata}/dbus-1/system-services"
316 fi
317 AC_SUBST(DBUS_DATADIR)
318
319 PKG_CHECK_MODULES(XTABLES, xtables, dummy=yes,
320                                 AC_MSG_ERROR(Xtables library is required))
321 AC_SUBST(XTABLES_CFLAGS)
322 AC_SUBST(XTABLES_LIBS)
323
324
325 AC_ARG_ENABLE(systemd, AC_HELP_STRING([--enable-systemd],
326                 [enable systemd support]), [enable_systemd=${enableval}])
327 if (test "${enable_systemd}" = "yes"); then
328         PKG_CHECK_MODULES(SYSTEMD, systemd, dummy=yes,
329                                 AC_MSG_ERROR(systemd is required))
330         SYSTEMD_UNITDIR="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
331         if (test -z "${SYSTEMD_UNITDIR}"); then
332                 SYSTEMD_UNITDIR="/lib/systemd/system"
333         fi
334         AC_SUBST(SYSTEMD_UNITDIR)
335 fi
336 AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" = "yes")
337
338 AC_ARG_ENABLE(polkit,
339         AC_HELP_STRING([--enable-polkit], [enable PolicyKit support]),
340                         [enable_polkit=${enableval}], [enable_polkit="no"])
341 if (test "${enable_polkit}" != "no"); then
342         POLKIT_DATADIR="`$PKG_CONFIG --variable=actiondir polkit`"
343         POLKIT_DATADIR=""
344         if (test -z "${POLKIT_DATADIR}"); then
345                 POLKIT_DATADIR="${datadir}/polkit-1/actions"
346         fi
347         AC_SUBST(POLKIT_DATADIR)
348 fi
349 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" != "no")
350 AM_CONDITIONAL(POLKIT_BUILTIN, test "${enable_polkit}" = "builtin")
351
352 AC_ARG_ENABLE(client, AC_HELP_STRING([--enable-client],
353                 [enable command line client]), [enable_client=${enableval}])
354 AM_CONDITIONAL(CLIENT, test "${enable_client}" = "yes")
355
356 AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools],
357                 [enable testing tools]), [enable_tools=${enableval}])
358 if (test "${enable_tools}" = "yes"); then
359         PKG_CHECK_MODULES(NETLINK, libnl-1, dummy=yes,
360                                 AC_MSG_ERROR(Netlink library is required))
361         AC_SUBST(NETLINK_CFLAGS)
362         AC_SUBST(NETLINK_LIBS)
363
364         PKG_CHECK_MODULES(GNUTLS, gnutls, dummy=yes,
365                                 AC_MSG_ERROR(GnuTLS library is required))
366         AC_SUBST(GNUTLS_CFLAGS)
367         AC_SUBST(GNUTLS_LIBS)
368 fi
369 AM_CONDITIONAL(TOOLS, test "${enable_tools}" = "yes")
370
371 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
372                 [enable test/example scripts]), [enable_test=${enableval}])
373 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
374
375 AC_ARG_ENABLE(fake, AC_HELP_STRING([--enable-fake],
376                 [enable fake device support]), [enable_fake=${enableval}])
377 AM_CONDITIONAL(FAKE, test "${enable_fake}" = "yes")
378
379 AC_ARG_ENABLE(capng, AC_HELP_STRING([--enable-capng],
380                 [enable capabilities support]), [enable_capng=${enableval}])
381 if (test "${enable_capng}" = "yes"); then
382         PKG_CHECK_MODULES(CAPNG, libcap-ng, dummy=yes,
383                                 AC_MSG_ERROR(Capabilities library is required))
384         AC_SUBST(CAPNG_CFLAGS)
385         AC_SUBST(CAPNG_LIBS)
386         AC_DEFINE(HAVE_CAPNG, 1, [Define to 1 if you have capabilities library.])
387 fi
388
389 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
390                         [don't install configuration and data files]),
391                                         [enable_datafiles=${enableval}])
392 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
393
394 AC_OUTPUT(Makefile include/version.h src/connman.service
395                                 scripts/connman doc/version.xml connman.pc)