Add test script for new supplicant interface
[framework/connectivity/connman.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(connman, 0.47)
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 AC_PROG_SED
27 AC_PROG_AWK
28 AM_PROG_MKDIR_P
29
30 m4_define([_LT_AC_TAGCONFIG], [])
31 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
32
33 AC_DISABLE_STATIC
34 AC_PROG_LIBTOOL
35 AC_PROG_NM
36
37 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
38                         [disable code optimization through compiler]), [
39         if (test "${enableval}" = "no"); then
40                 CFLAGS="$CFLAGS -O0"
41         fi
42 ])
43
44 GTK_DOC_CHECK
45
46 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
47                         [enable compiling with debugging information]), [
48         if (test "${enableval}" = "yes" &&
49                                 test "${ac_cv_prog_cc_g}" = "yes"); then
50                 CFLAGS="$CFLAGS -g"
51         fi
52 ])
53
54 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
55                         [enable position independent executables flag]), [
56         if (test "${enableval}" = "yes" &&
57                                 test "${ac_cv_prog_cc_pie}" = "yes"); then
58                 CFLAGS="$CFLAGS -fPIE"
59                 LDFLAGS="$LDFLAGS -pie"
60         fi
61 ])
62
63 AC_ARG_ENABLE(threads,
64         AC_HELP_STRING([--enable-threads], [enable threading support]),
65                         [enable_threads=${enableval}], [enable_threads="no"])
66
67 AC_ARG_ENABLE(ethernet,
68         AC_HELP_STRING([--enable-ethernet], [enable Ethernet support]),
69                         [enable_ethernet=${enableval}], [enable_ethernet="no"])
70 AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
71 AM_CONDITIONAL(ETHERNET_BUILTIN, test "${enable_ethernet}" = "builtin")
72
73 AC_ARG_ENABLE(wifi,
74         AC_HELP_STRING([--enable-wifi], [enable WiFi support]),
75                         [enable_wifi=${enableval}], [enable_wifi="no"])
76 if (test "${enable_wifi}" != "no"); then
77         AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
78                                                 $PATH:/sbin:/usr/sbin)
79 fi
80 AM_CONDITIONAL(WIFI, test "${enable_wifi}" != "no")
81 AM_CONDITIONAL(WIFI_BUILTIN, test "${enable_wifi}" = "builtin")
82
83 AC_ARG_ENABLE(bluetooth,
84         AC_HELP_STRING([--enable-bluetooth], [enable Bluetooth support]),
85                         [enable_bluetooth=${enableval}], [enable_bluetooth="no"])
86 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
87 AM_CONDITIONAL(BLUETOOTH_BUILTIN, test "${enable_bluetooth}" = "builtin")
88
89 AC_ARG_ENABLE(ofono,
90         AC_HELP_STRING([--enable-ofono], [enable oFono support]),
91                         [enable_ofono=${enableval}], [enable_ofono="no"])
92 AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
93 AM_CONDITIONAL(OFONO_BUILTIN, test "${enable_ofono}" = "builtin")
94
95 AC_ARG_WITH(udhcpc, AC_HELP_STRING([--with-udhcpc=PROGRAM],
96         [specify location of udhcpc binary]), [path_udhcpc=${withval}])
97
98 AC_ARG_ENABLE(udhcp,
99         AC_HELP_STRING([--enable-udhcp], [enable uDHCP support]),
100                         [enable_udhcp=${enableval}], [enable_udhcp="no"])
101 if (test "${enable_udhcp}" != "no"); then
102         if (test -z "${path_udhcpc}"); then
103                 AC_PATH_PROG(UDHCPC, [udhcpc], [], $PATH:/sbin:/usr/sbin)
104         else
105                 UDHCPC="${path_udhcpc}"
106                 AC_SUBST(UDHCPC)
107         fi
108 fi
109 AM_CONDITIONAL(UDHCP, test "${enable_udhcp}" != "no")
110 AM_CONDITIONAL(UDHCP_BUILTIN, test "${enable_udhcp}" = "builtin")
111
112 AC_ARG_WITH(dhclient, AC_HELP_STRING([--with-dhclient=PROGRAM],
113         [specify location of dhclient binary]), [path_dhclient=${withval}])
114
115 AC_ARG_ENABLE(dhclient,
116         AC_HELP_STRING([--enable-dhclient], [enable dhclient support]),
117                         [enable_dhclient=${enableval}], [enable_dhclient="no"])
118 if (test "${enable_dhclient}" != "no"); then
119         if (test -z "${path_dhclient}"); then
120                 AC_PATH_PROG(DHCLIENT, [dhclient], [], $PATH:/sbin:/usr/sbin)
121         else
122                 DHCLIENT="${path_dhclient}"
123                 AC_SUBST(DHCLIENT)
124         fi
125 fi
126 AM_CONDITIONAL(DHCLIENT, test "${enable_dhclient}" != "no")
127 AM_CONDITIONAL(DHCLIENT_BUILTIN, test "${enable_dhclient}" = "builtin")
128
129 AC_ARG_WITH(resolvconf, AC_HELP_STRING([--with-resolvconf=PROGRAM],
130         [specify location of resolvconf binary]), [path_resolvconf=${withval}])
131
132 AC_ARG_ENABLE(resolvconf,
133         AC_HELP_STRING([--enable-resolvconf], [enable resolvconf support]),
134                         [enable_resolvconf=${enableval}], [enable_resolvconf="no"])
135 if (test "${enable_resolvconf}" != "no"); then
136         if (test -z "${path_resolvconf}"); then
137                 AC_PATH_PROG(RESOLVCONF, [resolvconf], [], $PATH:/sbin:/usr/sbin)
138         else
139                 RESOLVCONF="${path_resolvconf}"
140                 AC_SUBST(RESOLVCONF)
141         fi
142 fi
143 AM_CONDITIONAL(RESOLVCONF, test "${enable_resolvconf}" != "no")
144 AM_CONDITIONAL(RESOLVCONF_BUILTIN, test "${enable_resolvconf}" = "builtin")
145
146 AC_ARG_WITH(openconnect, AC_HELP_STRING([--with-openconnect=PROGRAM],
147         [specify location of openconnect binary]), [path_openconnect=${withval}])
148
149 AC_ARG_ENABLE(openconnect,
150         AC_HELP_STRING([--enable-openconnect], [enable openconnect support]),
151                         [enable_openconnect=${enableval}], [enable_openconnect="no"])
152 if (test "${enable_openconnect}" != "no"); then
153         if (test -z "${path_openconnect}"); then
154                 AC_PATH_PROG(OPENCONNECT, [openconnect], [], $PATH:/sbin:/usr/sbin)
155         else
156                 OPENCONNECT="${path_openconnect}"
157                 AC_SUBST(OPENCONNECT)
158         fi
159 fi
160 AM_CONDITIONAL(OPENCONNECT, test "${enable_openconnect}" != "no")
161 AM_CONDITIONAL(OPENCONNECT_BUILTIN, test "${enable_openconnect}" = "builtin")
162
163 AC_ARG_ENABLE(loopback,
164         AC_HELP_STRING([--enable-loopback], [enable loopback support]),
165                         [enable_loopback=${enableval}], [enable_loopback="no"])
166 if (test "${enable_loopback}" != "no"); then
167         AC_CHECK_HEADERS(sys/inotify.h, dummy=yes,
168                         AC_MSG_ERROR(inotify header files are required))
169
170         AC_CHECK_LIB(c, inotify_init, dummy=yes,
171                         AC_MSG_ERROR(inotify library support is required))
172 fi
173 AM_CONDITIONAL(LOOPBACK, test "${enable_loopback}" != "no")
174 AM_CONDITIONAL(LOOPBACK_BUILTIN, test "${enable_loopback}" = "builtin")
175
176 AC_ARG_ENABLE(dnsproxy,
177         AC_HELP_STRING([--enable-dnsproxy], [enable DNS proxy support]),
178                         [enable_dnsproxy=${enableval}], [enable_dnsproxy="no"])
179 AM_CONDITIONAL(DNSPROXY, test "${enable_dnsproxy}" != "no")
180 AM_CONDITIONAL(DNSPROXY_BUILTIN, test "${enable_dnsproxy}" = "builtin")
181
182 AC_ARG_ENABLE(google,
183         AC_HELP_STRING([--enable-google], [enable Google Public DNS support]),
184                         [enable_google=${enableval}], [enable_google="no"])
185 AM_CONDITIONAL(GOOGLE, test "${enable_google}" != "no")
186 AM_CONDITIONAL(GOOGLE_BUILTIN, test "${enable_google}" = "builtin")
187
188 AC_ARG_ENABLE(moblin,
189         AC_HELP_STRING([--enable-moblin], [enable Moblin features support]),
190                         [enable_moblin=${enableval}], [enable_moblin="no"])
191 AM_CONDITIONAL(MOBLIN, test "${enable_moblin}" != "no")
192 AM_CONDITIONAL(MOBLIN_BUILTIN, test "${enable_moblin}" = "builtin")
193
194 AC_ARG_ENABLE(hso,
195         AC_HELP_STRING([--enable-hso], [enable HSO support]),
196                         [enable_hso=${enableval}], [enable_hso="no"])
197 AM_CONDITIONAL(HSO, test "${enable_hso}" != "no")
198 AM_CONDITIONAL(HSO_BUILTIN, test "${enable_hso}" = "builtin")
199
200 AC_ARG_ENABLE(mbm,
201         AC_HELP_STRING([--enable-mbm], [enable MBM support]),
202                         [enable_mbm=${enableval}], [enable_mbm="no"])
203 AM_CONDITIONAL(MBM, test "${enable_mbm}" != "no")
204 AM_CONDITIONAL(MBM_BUILTIN, test "${enable_mbm}" = "builtin")
205
206 AC_CHECK_LIB(dl, dlopen, dummy=yes,
207                         AC_MSG_ERROR(dynamic linking loader is required))
208
209 AC_ARG_WITH(iwmxsdk, AC_HELP_STRING([--with-iwmxsdk=PATH],
210                                                 [path to Intel WiMAX SDK]),
211                                 [pkgconfig_iwmxsdk=${withval}/lib/pkgconfig])
212
213 AC_ARG_ENABLE(iwmx, AC_HELP_STRING([--enable-iwmx],
214                 [enable Intel WiMAX support]), [enable_iwmx=${enableval}])
215 if (test "${enable_iwmx}" = "yes"); then
216         enable_threads="yes"
217         export PKG_CONFIG_PATH="${pkgconfig_iwmxsdk}"
218         PKG_CHECK_MODULES(IWMXSDK, libiWmxSdk-0, dummy=yes,
219                                 AC_MSG_ERROR(Intel WiMAX SDK is required))
220         PKG_CONFIG_PATH=""
221         AC_SUBST(IWMXSDK_CFLAGS)
222         AC_SUBST(IWMXSDK_LIBS)
223
224         # Fix API compat breakage from 1.4 to 1.5...
225         CPPFLAGS_save=$CPPFLAGS
226         CPPFLAGS="$IWMXSDK_CFLAGS $CPPFLAGS"
227         AH_TEMPLATE([HAVE_IWMXSDK_STATUS_IDLE],
228                     [WIMAX_API_DEVICE_STATUS_Connection_Idle is present])
229         AC_CHECK_DECL(WIMAX_API_DEVICE_STATUS_Connection_Idle,
230                       [AC_DEFINE([HAVE_IWMXSDK_STATUS_IDLE], [1], [])],
231                       [],
232                       [[#include <WiMaxType.h>]])
233
234         AH_TEMPLATE([HAVE_WIMAX_API_DEVICE_ID],
235                     [WIMAX_API_DEVICE_ID is present])
236         AC_CHECK_TYPE(WIMAX_API_DEVICE_ID,
237                       [AC_DEFINE([HAVE_WIMAX_API_DEVICE_ID], [1], [])],
238                       [],
239                       [[#include <WiMaxType.h>]])
240
241         AH_TEMPLATE([HAVE_WIMAX_API_HW_DEVICE_ID],
242                     [WIMAX_API_HW_DEVICE_ID is present])
243         AC_CHECK_TYPE(WIMAX_API_HW_DEVICE_ID,
244                       [AC_DEFINE([HAVE_WIMAX_API_HW_DEVICE_ID], [1], [])],
245                       [],
246                       [[#include <WiMaxType.h>]])
247
248         AH_TEMPLATE([HAVE_WIMAX_API_NSP_INFO_EX],
249                     [WIMAX_API_NSP_INFO_EX is present])
250         AC_CHECK_TYPE(WIMAX_API_NSP_INFO_EX,
251                       [AC_DEFINE([HAVE_WIMAX_API_NSP_INFO_EX], [1], [])],
252                       [],
253                       [[#include <WiMaxType.h>] 
254                        [#include <WiMaxTypesEx.h>]])
255
256         AH_TEMPLATE([HAVE_WIMAX_API_CONNECTED_NSP_INFO],
257                     [WIMAX_API_CONNECTED_NSP_INFO is present])
258         AC_CHECK_TYPE(WIMAX_API_CONNECTED_NSP_INFO,
259                       [AC_DEFINE([HAVE_WIMAX_API_CONNECTED_NSP_INFO], [1], [])],
260                       [],
261                       [[#include <WiMaxType.h>]])
262
263         CPPFLAGS=$CPPFLAGS_save
264 fi
265 AM_CONDITIONAL(IWMX, test "${enable_iwmx}" = "yes")
266
267 AC_ARG_ENABLE(iospm, AC_HELP_STRING([--enable-iospm],
268                 [enable Intel OSPM support]), [enable_iospm=${enableval}])
269 AM_CONDITIONAL(IOSPM, test "${enable_iospm}" = "yes")
270
271 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes,
272                                 AC_MSG_ERROR(GLib >= 2.16 is required))
273 AC_SUBST(GLIB_CFLAGS)
274 AC_SUBST(GLIB_LIBS)
275
276 if (test "${enable_threads}" = "yes"); then
277         AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
278         PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
279                                 AC_MSG_ERROR(GThread >= 2.16 is required))
280         GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
281         GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
282 fi
283
284 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
285                                 AC_MSG_ERROR(D-Bus >= 1.0 is required))
286 AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
287         AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
288                 [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
289 AC_SUBST(DBUS_CFLAGS)
290 AC_SUBST(DBUS_LIBS)
291
292 AC_ARG_WITH(dbusconf, AC_HELP_STRING([--with-dbusconf=PATH],
293         [path to D-Bus config directory]), [path_dbusconf=${withval}],
294                 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
295 if (test -z "${path_dbusconf}"); then
296         DBUS_DATADIR="${sysconfdir}/dbus-1/system.d"
297 else
298         DBUS_DATADIR="${path_dbusconf}/dbus-1/system.d"
299 fi
300 AC_SUBST(DBUS_DATADIR)
301
302 AC_ARG_ENABLE(polkit,
303         AC_HELP_STRING([--enable-polkit], [enable PolicyKit support]),
304                         [enable_polkit=${enableval}], [enable_polkit="no"])
305 if (test "${enable_polkit}" != "no"); then
306         PKG_CHECK_MODULES(POLKIT, polkit-dbus >= 0.7, dummy=yes,
307                                 AC_MSG_ERROR(PolicyKit >= 0.7 is required))
308         AC_SUBST(POLKIT_CFLAGS)
309         AC_SUBST(POLKIT_LIBS)
310         POLKIT_DATADIR="`$PKG_CONFIG --variable=policydir polkit`"
311         if (test -z "${POLKIT_DATADIR}"); then
312                 POLKIT_DATADIR="${datadir}/PolicyKit/policy"
313         fi
314         AC_SUBST(POLKIT_DATADIR)
315 fi
316 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" != "no")
317 AM_CONDITIONAL(POLKIT_BUILTIN, test "${enable_polkit}" = "builtin")
318
319 AC_ARG_ENABLE(client, AC_HELP_STRING([--enable-client],
320                 [enable command line client]), [enable_client=${enableval}])
321 AM_CONDITIONAL(CLIENT, test "${enable_client}" = "yes")
322
323 AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools],
324                 [enable testing tools]), [enable_tools=${enableval}])
325 if (test "${enable_tools}" = "yes"); then
326         PKG_CHECK_MODULES(NETLINK, libnl-1, dummy=yes,
327                                 AC_MSG_ERROR(Netlink library is required))
328         AC_SUBST(NETLINK_CFLAGS)
329         AC_SUBST(NETLINK_LIBS)
330 fi
331 AM_CONDITIONAL(TOOLS, test "${enable_tools}" = "yes")
332
333 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
334                 [enable test/example scripts]), [enable_test=${enableval}])
335 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
336
337 AC_ARG_ENABLE(fake, AC_HELP_STRING([--enable-fake],
338                 [enable fake device support]), [enable_fake=${enableval}])
339 AM_CONDITIONAL(FAKE, test "${enable_fake}" = "yes")
340
341 AC_ARG_ENABLE(capng, AC_HELP_STRING([--enable-capng],
342                 [enable capabilities support]), [enable_capng=${enableval}])
343 if (test "${enable_capng}" = "yes"); then
344         PKG_CHECK_MODULES(CAPNG, libcap-ng, dummy=yes,
345                                 AC_MSG_ERROR(Capabilities library is required))
346         AC_SUBST(CAPNG_CFLAGS)
347         AC_SUBST(CAPNG_LIBS)
348         AC_DEFINE(HAVE_CAPNG, 1, [Define to 1 if you have capabilities library.])
349 fi
350
351 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
352                         [don't use udev support even if available]),
353                                                 [enable_udev=${enableval}])
354 if (test "${enable_udev}" != "no"); then
355         PKG_CHECK_MODULES(UDEV, libudev >= 143,
356                                 [enable_udev="yes"], [enable_udev="no"])
357 fi
358 if (test "${enable_udev}" = "yes"); then
359         UDEV_DATADIR="`$PKG_CONFIG --variable=udevdir udev`"
360         if (test -z "${UDEV_DATADIR}"); then
361                 UDEV_DATADIR="${sysconfdir}/udev/rules.d"
362         else
363                 UDEV_DATADIR="${UDEV_DATADIR}/rules.d"
364         fi
365         AC_SUBST(UDEV_DATADIR)
366 fi
367 AC_SUBST(UDEV_CFLAGS)
368 AC_SUBST(UDEV_LIBS)
369 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
370
371 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
372                         [don't install configuration and data files]),
373                                         [enable_datafiles=${enableval}])
374 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
375
376 AC_OUTPUT(Makefile include/version.h src/connman.service
377                                 scripts/connman doc/version.xml connman.pc)