Release 0.39
[platform/upstream/connman.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(connman, 0.39)
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
29 m4_define([_LT_AC_TAGCONFIG], [])
30 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
31
32 AC_DISABLE_STATIC
33 AC_PROG_LIBTOOL
34 AC_PROG_NM
35
36 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
37                         [disable code optimization through compiler]), [
38         if (test "${enableval}" = "no"); then
39                 CFLAGS="$CFLAGS -O0"
40         fi
41 ])
42
43 GTK_DOC_CHECK
44
45 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
46                         [enable compiling with debugging information]), [
47         if (test "${enableval}" = "yes" &&
48                                 test "${ac_cv_prog_cc_g}" = "yes"); then
49                 CFLAGS="$CFLAGS -g"
50         fi
51 ])
52
53 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
54                         [enable position independent executables flag]), [
55         if (test "${enableval}" = "yes" &&
56                                 test "${ac_cv_prog_cc_pie}" = "yes"); then
57                 CFLAGS="$CFLAGS -fPIE"
58                 LDFLAGS="$LDFLAGS -pie"
59         fi
60 ])
61
62 AC_ARG_ENABLE(threads,
63         AC_HELP_STRING([--enable-threads], [enable threading support]),
64                         [enable_threads=${enableval}], [enable_threads="no"])
65
66 AC_ARG_ENABLE(ethernet,
67         AC_HELP_STRING([--enable-ethernet], [enable Ethernet support]),
68                         [enable_ethernet=${enableval}], [enable_ethernet="no"])
69 AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
70 AM_CONDITIONAL(ETHERNET_BUILTIN, test "${enable_ethernet}" = "builtin")
71
72 AC_ARG_ENABLE(wifi,
73         AC_HELP_STRING([--enable-wifi], [enable WiFi support]),
74                         [enable_wifi=${enableval}], [enable_wifi="no"])
75 if (test "${enable_wifi}" != "no"); then
76         AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
77                                                 $PATH:/sbin:/usr/sbin)
78 fi
79 AM_CONDITIONAL(WIFI, test "${enable_wifi}" != "no")
80 AM_CONDITIONAL(WIFI_BUILTIN, test "${enable_wifi}" = "builtin")
81
82 AC_ARG_ENABLE(bluetooth,
83         AC_HELP_STRING([--enable-bluetooth], [enable Bluetooth support]),
84                         [enable_bluetooth=${enableval}], [enable_bluetooth="no"])
85 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
86 AM_CONDITIONAL(BLUETOOTH_BUILTIN, test "${enable_bluetooth}" = "builtin")
87
88 AC_ARG_ENABLE(ofono,
89         AC_HELP_STRING([--enable-ofono], [enable oFono support]),
90                         [enable_ofono=${enableval}], [enable_ofono="no"])
91 AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
92 AM_CONDITIONAL(OFONO_BUILTIN, test "${enable_ofono}" = "builtin")
93
94 AC_ARG_ENABLE(modemmgr,
95         AC_HELP_STRING([--enable-modemmgr], [enable Modem Manager support]),
96                         [enable_modemmgr=${enableval}], [enable_modemmgr="no"])
97 AM_CONDITIONAL(MODEMMGR, test "${enable_modemmgr}" != "no")
98 AM_CONDITIONAL(MODEMMGR_BUILTIN, test "${enable_modemmgr}" = "builtin")
99
100 AC_ARG_WITH(udhcpc, AC_HELP_STRING([--with-udhcpc=PROGRAM],
101         [specify location of udhcpc binary]), [path_udhcpc=${withval}])
102
103 AC_ARG_ENABLE(udhcp,
104         AC_HELP_STRING([--enable-udhcp], [enable uDHCP support]),
105                         [enable_udhcp=${enableval}], [enable_udhcp="no"])
106 if (test "${enable_udhcp}" != "no"); then
107         if (test -z "${path_udhcpc}"); then
108                 AC_PATH_PROG(UDHCPC, [udhcpc], [], $PATH:/sbin:/usr/sbin)
109         else
110                 UDHCPC="${path_udhcpc}"
111                 AC_SUBST(UDHCPC)
112         fi
113 fi
114 AM_CONDITIONAL(UDHCP, test "${enable_udhcp}" != "no")
115 AM_CONDITIONAL(UDHCP_BUILTIN, test "${enable_udhcp}" = "builtin")
116
117 AC_ARG_WITH(dhclient, AC_HELP_STRING([--with-dhclient=PROGRAM],
118         [specify location of dhclient binary]), [path_dhclient=${withval}])
119
120 AC_ARG_ENABLE(dhclient,
121         AC_HELP_STRING([--enable-dhclient], [enable dhclient support]),
122                         [enable_dhclient=${enableval}], [enable_dhclient="no"])
123 if (test "${enable_dhclient}" != "no"); then
124         if (test -z "${path_dhclient}"); then
125                 AC_PATH_PROG(DHCLIENT, [dhclient], [], $PATH:/sbin:/usr/sbin)
126         else
127                 DHCLIENT="${path_dhclient}"
128                 AC_SUBST(DHCLIENT)
129         fi
130 fi
131 AM_CONDITIONAL(DHCLIENT, test "${enable_dhclient}" != "no")
132 AM_CONDITIONAL(DHCLIENT_BUILTIN, test "${enable_dhclient}" = "builtin")
133
134 AC_ARG_WITH(resolvconf, AC_HELP_STRING([--with-resolvconf=PROGRAM],
135         [specify location of resolvconf binary]), [path_resolvconf=${withval}])
136
137 AC_ARG_ENABLE(resolvconf,
138         AC_HELP_STRING([--enable-resolvconf], [enable resolvconf support]),
139                         [enable_resolvconf=${enableval}], [enable_resolvconf="no"])
140 if (test "${enable_resolvconf}" != "no"); then
141         if (test -z "${path_resolvconf}"); then
142                 AC_PATH_PROG(RESOLVCONF, [resolvconf], [], $PATH:/sbin:/usr/sbin)
143         else
144                 RESOLVCONF="${path_resolvconf}"
145                 AC_SUBST(RESOLVCONF)
146         fi
147 fi
148 AM_CONDITIONAL(RESOLVCONF, test "${enable_resolvconf}" != "no")
149 AM_CONDITIONAL(RESOLVCONF_BUILTIN, test "${enable_resolvconf}" = "builtin")
150
151 AC_ARG_ENABLE(loopback,
152         AC_HELP_STRING([--enable-loopback], [enable loopback support]),
153                         [enable_loopback=${enableval}], [enable_loopback="no"])
154 if (test "${enable_loopback}" != "no"); then
155         AC_CHECK_HEADERS(sys/inotify.h, dummy=yes,
156                         AC_MSG_ERROR(inotify header files are required))
157
158         AC_CHECK_LIB(c, inotify_init, dummy=yes,
159                         AC_MSG_ERROR(inotify library support is required))
160 fi
161 AM_CONDITIONAL(LOOPBACK, test "${enable_loopback}" != "no")
162 AM_CONDITIONAL(LOOPBACK_BUILTIN, test "${enable_loopback}" = "builtin")
163
164 AC_ARG_ENABLE(dnsproxy,
165         AC_HELP_STRING([--enable-dnsproxy], [enable DNS proxy support]),
166                         [enable_dnsproxy=${enableval}], [enable_dnsproxy="no"])
167 AM_CONDITIONAL(DNSPROXY, test "${enable_dnsproxy}" != "no")
168 AM_CONDITIONAL(DNSPROXY_BUILTIN, test "${enable_dnsproxy}" = "builtin")
169
170 AC_ARG_ENABLE(novatel, AC_HELP_STRING([--enable-novatel],
171                 [enable Novatel support]), [enable_novatel=${enableval}])
172 AM_CONDITIONAL(NOVATEL, test "${enable_novatel}" = "yes")
173
174 AC_ARG_ENABLE(huawei, AC_HELP_STRING([--enable-huawei],
175                 [enable HUAWEI support]), [enable_huawei=${enableval}])
176 AM_CONDITIONAL(HUAWEI, test "${enable_huawei}" = "yes")
177
178 AC_ARG_ENABLE(hso,
179         AC_HELP_STRING([--enable-hso], [enable HSO support]),
180                         [enable_hso=${enableval}], [enable_hso="no"])
181 AM_CONDITIONAL(HSO, test "${enable_hso}" != "no")
182 AM_CONDITIONAL(HSO_BUILTIN, test "${enable_hso}" = "builtin")
183
184 AC_ARG_ENABLE(mbm,
185         AC_HELP_STRING([--enable-mbm], [enable MBM support]),
186                         [enable_mbm=${enableval}], [enable_mbm="no"])
187 AM_CONDITIONAL(MBM, test "${enable_mbm}" != "no")
188 AM_CONDITIONAL(MBM_BUILTIN, test "${enable_mbm}" = "builtin")
189
190 AC_ARG_WITH(pppd, AC_HELP_STRING([--with-pppd=PROGRAM],
191         [specify location of pppd binary]), [path_pppd=${withval}])
192
193 AC_ARG_ENABLE(ppp, AC_HELP_STRING([--enable-ppp],
194                 [enable PPP support]), [enable_ppp=${enableval}])
195 if (test "${enable_ppp}" = "yes" || test "${enable_novatel}" = "yes" ||
196                                         test "${enable_huawei}" = "yes"); then
197         if (test -z "${path_pppd}"); then
198                 AC_PATH_PROG(PPPD, [pppd], [], $PATH:/sbin:/usr/sbin)
199         else
200                 PPPD="${path_pppd}"
201                 AC_SUBST(PPPD)
202         fi
203         AC_CHECK_HEADERS(pppd/pppd.h, enable_ppp=yes,
204                         AC_MSG_ERROR(PPP development files are required))
205 fi
206 AM_CONDITIONAL(PPPD, test "${enable_ppp}" = "yes")
207
208 AC_CHECK_LIB(dl, dlopen, dummy=yes,
209                         AC_MSG_ERROR(dynamic linking loader is required))
210
211 AC_ARG_WITH(iwmxsdk, AC_HELP_STRING([--with-iwmxsdk=PATH],
212                                                 [path to Intel WiMAX SDK]),
213                                 [pkgconfig_iwmxsdk=${withval}/lib/pkgconfig])
214
215 AC_ARG_ENABLE(iwmx, AC_HELP_STRING([--enable-iwmx],
216                 [enable Intel WiMAX support]), [enable_iwmx=${enableval}])
217 if (test "${enable_iwmx}" = "yes"); then
218         enable_threads="yes"
219         export PKG_CONFIG_PATH="${pkgconfig_iwmxsdk}"
220         PKG_CHECK_MODULES(IWMXSDK, libiWmxSdk-0, dummy=yes,
221                                 AC_MSG_ERROR(Intel WiMAX SDK is required))
222         PKG_CONFIG_PATH=""
223         AC_SUBST(IWMXSDK_CFLAGS)
224         AC_SUBST(IWMXSDK_LIBS)
225 fi
226 AM_CONDITIONAL(IWMX, test "${enable_iwmx}" = "yes")
227
228 AC_ARG_ENABLE(iospm, AC_HELP_STRING([--enable-iospm],
229                 [enable Intel OSPM support]), [enable_iospm=${enableval}])
230 AM_CONDITIONAL(IOSPM, test "${enable_iospm}" = "yes")
231
232 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes,
233                                 AC_MSG_ERROR(GLib >= 2.16 is required))
234 AC_SUBST(GLIB_CFLAGS)
235 AC_SUBST(GLIB_LIBS)
236
237 if (test "${enable_threads}" = "yes"); then
238         AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
239         PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
240                                 AC_MSG_ERROR(GThread >= 2.16 is required))
241         GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
242         GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
243 fi
244
245 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
246                                 AC_MSG_ERROR(D-Bus >= 1.0 is required))
247 AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
248         AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
249                 [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
250 AC_SUBST(DBUS_CFLAGS)
251 AC_SUBST(DBUS_LIBS)
252
253 AC_ARG_WITH(dbusconf, AC_HELP_STRING([--with-dbusconf=PATH],
254         [path to D-Bus config directory]), [path_dbusconf=${withval}],
255                 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
256 if (test -z "${path_dbusconf}"); then
257         DBUS_DATADIR="${sysconfdir}/dbus-1/system.d"
258 else
259         DBUS_DATADIR="${path_dbusconf}/dbus-1/system.d"
260 fi
261 AC_SUBST(DBUS_DATADIR)
262
263 AC_SUBST([GDBUS_CFLAGS], ['$(DBUS_CFLAGS) -I$(top_srcdir)/gdbus'])
264 AC_SUBST([GDBUS_LIBS], ['$(top_builddir)/gdbus/libgdbus.la $(DBUS_LIBS)'])
265
266 AC_SUBST([GATCHAT_CFLAGS], ['-I$(top_srcdir)/gatchat'])
267 AC_SUBST([GATCHAT_LIBS], ['$(top_builddir)/gatchat/libgatchat.la'])
268
269 AC_ARG_ENABLE(polkit,
270         AC_HELP_STRING([--enable-polkit], [enable PolicyKit support]),
271                         [enable_polkit=${enableval}], [enable_polkit="no"])
272 if (test "${enable_polkit}" != "no"); then
273         PKG_CHECK_MODULES(POLKIT, polkit-dbus >= 0.7, dummy=yes,
274                                 AC_MSG_ERROR(PolicyKit >= 0.7 is required))
275         AC_SUBST(POLKIT_CFLAGS)
276         AC_SUBST(POLKIT_LIBS)
277         POLKIT_DATADIR="`$PKG_CONFIG --variable=policydir polkit`"
278         if (test -z "${POLKIT_DATADIR}"); then
279                 POLKIT_DATADIR="${datadir}/PolicyKit/policy"
280         fi
281         AC_SUBST(POLKIT_DATADIR)
282 fi
283 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" != "no")
284 AM_CONDITIONAL(POLKIT_BUILTIN, test "${enable_polkit}" = "builtin")
285
286 AC_ARG_ENABLE(client, AC_HELP_STRING([--enable-client],
287                 [enable command line client]), [enable_client=${enableval}])
288 AM_CONDITIONAL(CLIENT, test "${enable_client}" = "yes")
289
290 AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools],
291                 [enable testing tools]), [enable_tools=${enableval}])
292 if (test "${enable_tools}" = "yes"); then
293         PKG_CHECK_MODULES(NETLINK, libnl-1, dummy=yes,
294                                 AC_MSG_ERROR(Netlink library is required))
295         AC_SUBST(NETLINK_CFLAGS)
296         AC_SUBST(NETLINK_LIBS)
297 fi
298 AM_CONDITIONAL(TOOLS, test "${enable_tools}" = "yes")
299
300 AC_ARG_ENABLE(fake, AC_HELP_STRING([--enable-fake],
301                 [enable fake device support]), [enable_fake=${enableval}])
302 AM_CONDITIONAL(FAKE, test "${enable_fake}" = "yes")
303
304 AC_ARG_ENABLE(udev, AC_HELP_STRING([--disable-udev],
305                         [don't use udev support even if available]),
306                                                 [enable_udev=${enableval}])
307 if (test "${enable_udev}" != "no"); then
308         PKG_CHECK_MODULES(UDEV, libudev >= 141,
309                                 [enable_udev="yes"], [enable_udev="no"])
310 fi
311 if (test "${enable_udev}" = "yes"); then
312         AC_CHECK_LIB(udev, udev_monitor_filter_update, dummy=yes,
313                 AC_DEFINE(NEED_UDEV_MONITOR_FILTER, 1,
314                         [Define to 1 if you need the
315                                         udev_monitor_filter...() functions.]))
316         UDEV_DATADIR="`$PKG_CONFIG --variable=udevdir udev`"
317         if (test -z "${UDEV_DATADIR}"); then
318                 UDEV_DATADIR="${sysconfdir}/udev/rules.d"
319         else
320                 UDEV_DATADIR="${UDEV_DATADIR}/rules.d"
321         fi
322         AC_SUBST(UDEV_DATADIR)
323 fi
324 AC_SUBST(UDEV_CFLAGS)
325 AC_SUBST(UDEV_LIBS)
326 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
327
328 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
329                         [don't install configuration and data files]),
330                                         [enable_datafiles=${enableval}])
331 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
332
333 AC_OUTPUT(Makefile include/version.h src/connman.service
334                                 scripts/connman doc/version.xml connman.pc)