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