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