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