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