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