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