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