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