9b70b04157f813a91503bdec1063c5c3a3ce8f20
[platform/upstream/connman.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT()
3
4 AM_INIT_AUTOMAKE(connman, 0.5)
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(wifi, AC_HELP_STRING([--enable-wifi],
52                 [enable WiFi support]), [enable_wifi=${enableval}])
53 if (test "${enable_wifi}" = "yes"); then
54         AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
55                                                 $PATH:/sbin:/usr/sbin)
56 fi
57 AM_CONDITIONAL(WIFI, test "${enable_wifi}" = "yes")
58
59 AC_ARG_WITH(udhcpc, AC_HELP_STRING([--with-udhcpc=PROGRAM],
60         [specific location of udhcpc binary]), [path_udhcpc=${withval}])
61
62 AC_ARG_ENABLE(UDHCP, AC_HELP_STRING([--enable-udhcp],
63                 [enable uDHCP support]), [enable_udhcp=${enableval}])
64 if (test "${enable_udhcp}" = "yes"); then
65         if (test -z "${path_udhcpc}"); then
66                 AC_PATH_PROG(UDHCPC, [udhcpc], [], $PATH:/sbin:/usr/sbin)
67         else
68                 UDHCPC="${path_udhcpc}"
69                 AC_SUBST(UDHCPC)
70         fi
71 fi
72 AM_CONDITIONAL(UDHCP, test "${enable_udhcp}" = "yes")
73
74 AC_ARG_WITH(dhclient, AC_HELP_STRING([--with-dhclient=PROGRAM],
75         [specific location of dhclient binary]), [path_dhclient=${withval}])
76
77 AC_ARG_ENABLE(DHCLIENT, AC_HELP_STRING([--enable-dhclient],
78                 [enable dhclient support]), [enable_dhclient=${enableval}])
79 if (test "${enable_dhclient}" = "yes"); then
80         if (test -z "${path_dhclient}"); then
81                 AC_PATH_PROG(DHCLIENT, [dhclient], [], $PATH:/sbin:/usr/sbin)
82         else
83                 UDHCPC="${path_dhclient}"
84                 AC_SUBST(DHCLIENT)
85         fi
86 fi
87 AM_CONDITIONAL(DHCLIENT, test "${enable_dhclient}" = "yes")
88
89 AC_ARG_WITH(resolvconf, AC_HELP_STRING([--with-resolvconf=PROGRAM],
90         [specific location of resolvconf binary]), [path_resolvconf=${withval}])
91
92 AC_ARG_ENABLE(RESOLVCONF, AC_HELP_STRING([--enable-resolvconf],
93                 [enable resolvconf support]), [enable_resolvconf=${enableval}])
94 if (test "${enable_resolvconf}" = "yes"); then
95         if (test -z "${path_resolvconf}"); then
96                 AC_PATH_PROG(RESOLVCONF, [resolvconf], [], $PATH:/sbin:/usr/sbin)
97         else
98                 UDHCPC="${path_resolvconf}"
99                 AC_SUBST(RESOLVCONF)
100         fi
101 fi
102 AM_CONDITIONAL(RESOLVCONF, test "${enable_resolvconf}" = "yes")
103
104 AC_ARG_ENABLE(novatel, AC_HELP_STRING([--enable-novatel],
105                 [enable Novatel support]), [enable_novatel=${enableval}])
106 AM_CONDITIONAL(NOVATEL, test "${enable_novatel}" = "yes")
107
108 AC_ARG_ENABLE(huawei, AC_HELP_STRING([--enable-huawei],
109                 [enable HUAWEI support]), [enable_huawei=${enableval}])
110 AM_CONDITIONAL(HUAWEI, test "${enable_huawei}" = "yes")
111
112 AC_ARG_ENABLE(hso, AC_HELP_STRING([--enable-hso],
113                 [enable HSO support]), [enable_hso=${enableval}])
114 AM_CONDITIONAL(HSO, test "${enable_hso}" = "yes")
115
116 AC_ARG_WITH(pppd, AC_HELP_STRING([--with-pppd=PROGRAM],
117         [specific location of pppd binary]), [path_pppd=${withval}])
118
119 AC_ARG_ENABLE(ppp, AC_HELP_STRING([--enable-ppp],
120                 [enable PPP support]), [enable_ppp=${enableval}])
121 if (test "${enable_ppp}" = "yes" || test "${enable_novatel}" = "yes" ||
122                                         test "${enable_huawei}" = "yes"); then
123         if (test -z "${path_pppd}"); then
124                 AC_PATH_PROG(PPPD, [pppd], [], $PATH:/sbin:/usr/sbin)
125         else
126                 PPPD="${path_pppd}"
127                 AC_SUBST(PPPD)
128         fi
129         AC_CHECK_HEADERS(pppd/pppd.h, enable_ppp=yes,
130                         AC_MSG_ERROR(PPP development files are required))
131 fi
132 AM_CONDITIONAL(PPPD, test "${enable_ppp}" = "yes")
133
134 AC_CHECK_LIB(dl, dlopen, dummy=yes,
135                         AC_MSG_ERROR(dynamic linking loader is required))
136
137 PKG_CHECK_MODULES(GLIB, glib-2.0, dummy=yes,
138                                 AC_MSG_ERROR(glib is required))
139 AC_SUBST(GLIB_CFLAGS)
140 AC_SUBST(GLIB_LIBS)
141
142 if (test "${enable_threads}" = "yes"); then
143         AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
144         PKG_CHECK_MODULES(GTHREAD, gthread-2.0, dummy=yes,
145                                 AC_MSG_ERROR(gthread is required))
146         GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
147         GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
148 fi
149
150 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
151                                 AC_MSG_ERROR(libdbus is required))
152 AC_SUBST(DBUS_CFLAGS)
153 AC_SUBST(DBUS_LIBS)
154
155 AC_SUBST([GDBUS_CFLAGS], ['$(DBUS_CFLAGS) -I$(top_srcdir)/gdbus'])
156 AC_SUBST([GDBUS_LIBS], ['$(top_builddir)/gdbus/libgdbus.la $(DBUS_LIBS)'])
157
158 AC_ARG_ENABLE(udev, AC_HELP_STRING([--enable-udev],
159                 [enable udev support]), [enable_udev=${enableval}])
160 if (test "${enable_udev}" = "yes"); then
161         AC_DEFINE(HAVE_UDEV, 1, [Define if udev support is available])
162         PKG_CHECK_MODULES(UDEV, libudev >= 129, enable_udev=yes,
163                                 AC_MSG_ERROR(udev >= 129 is required))
164         AC_CHECK_LIB(udev, udev_enumerate_add_match_property, dummy=yes,
165                 AC_DEFINE(NEED_UDEV_ENUMERATE_ADD_MATCH_PROPERTY, 1,
166                         [Define to 1 if you need the
167                                 udev_enumerate_add_match_property() function.]))
168         AC_CHECK_LIB(udev, udev_device_get_parent_with_subsystem_devtype, dummy=yes,
169                 AC_DEFINE(NEED_UDEV_DEVICE_GET_PARENT_WITH_SUBSYSTEM_DEVTYPE, 1,
170                         [Define to 1 if you need the
171                                 udev_device_get_parent_with_subsystem_devtype()
172                                                                         function.]))
173 fi
174 AC_SUBST(UDEV_CFLAGS)
175 AC_SUBST(UDEV_LIBS)
176 AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
177
178 AC_ARG_ENABLE(polkit, AC_HELP_STRING([--enable-polkit],
179                 [enable PolicyKit support]), [enable_polkit=${enableval}])
180 if (test "${enable_polkit}" = "yes"); then
181         PKG_CHECK_MODULES(POLKIT, polkit-dbus >= 0.7, enable_polkit=yes,
182                                 AC_MSG_ERROR(PolicyKit >= 0.7 is required))
183         AC_SUBST(POLKIT_CFLAGS)
184         AC_SUBST(POLKIT_LIBS)
185 fi
186 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" = "yes")
187
188 AC_ARG_ENABLE(client, AC_HELP_STRING([--enable-client],
189                 [enable command line client]), [enable_client=${enableval}])
190 AM_CONDITIONAL(CLIENT, test "${enable_client}" = "yes")
191
192 AC_ARG_ENABLE(fake, AC_HELP_STRING([--enable-fake],
193                 [enable fake device support]), [enable_fake=${enableval}])
194 AM_CONDITIONAL(FAKE, test "${enable_fake}" = "yes")
195
196 AC_OUTPUT(Makefile gdbus/Makefile include/Makefile src/Makefile doc/Makefile
197                 test/Makefile plugins/Makefile client/Makefile scripts/Makefile
198                 scripts/connman src/connman.service doc/version.xml connman.pc)