Release 0.4
[connman] / configure.ac
1 AC_PREREQ(2.50)
2 AC_INIT()
3
4 AM_INIT_AUTOMAKE(connman, 0.4)
5 AM_CONFIG_HEADER(config.h)
6
7 AM_MAINTAINER_MODE
8
9 AC_PREFIX_DEFAULT(/usr/local)
10
11 if (test "${CFLAGS}" = ""); then
12         CFLAGS="-Wall -O2 -D_FORTIFY_SOURCE=2"
13 fi
14
15 AC_LANG_C
16
17 AC_PROG_CC
18 AC_PROG_CC_PIE
19 AC_PROG_INSTALL
20
21 m4_define([_LT_AC_TAGCONFIG], [])
22 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
23
24 AC_DISABLE_STATIC
25 AC_PROG_LIBTOOL
26
27 GTK_DOC_CHECK
28
29 AC_PATH_PROG([XSLTPROC], [xsltproc])
30
31 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
32                         [enable compiling with debugging information]), [
33         if (test "${enableval}" = "yes" &&
34                                 test "${ac_cv_prog_cc_g}" = "yes"); then
35                 CFLAGS="$CFLAGS -g -O0"
36         fi
37 ])
38
39 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
40                         [enable position independent executables flag]), [
41         if (test "${enableval}" = "yes" &&
42                                 test "${ac_cv_prog_cc_pie}" = "yes"); then
43                 CFLAGS="$CFLAGS -fPIE"
44                 LDFLAGS="$LDFLAGS -pie"
45         fi
46 ])
47
48 AC_PATH_PROG(DHCLIENT, [dhclient], ,$PATH:/sbin:/usr/sbin)
49 AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], ,$PATH:/sbin:/usr/sbin)
50
51 AC_CHECK_LIB(dl, dlopen, dummy=yes,
52                         AC_MSG_ERROR(dynamic linking loader is required))
53
54 PKG_CHECK_MODULES(GLIB, glib-2.0, dummy=yes,
55                                 AC_MSG_ERROR(glib is required))
56 AC_SUBST(GLIB_CFLAGS)
57 AC_SUBST(GLIB_LIBS)
58
59 AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
60                                         [enable threading support]), [
61         AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
62
63         PKG_CHECK_MODULES(GTHREAD, gthread-2.0, dummy=yes,
64                                 AC_MSG_ERROR(gthread is required))
65         GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
66         GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
67 ])
68
69 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
70                                 AC_MSG_ERROR(libdbus is required))
71 AC_SUBST(DBUS_CFLAGS)
72 AC_SUBST(DBUS_LIBS)
73
74 AC_SUBST([GDBUS_CFLAGS], ['$(DBUS_CFLAGS) -I$(top_srcdir)/gdbus'])
75 AC_SUBST([GDBUS_LIBS], ['$(top_builddir)/gdbus/libgdbus.la $(DBUS_LIBS)'])
76
77 PKG_CHECK_MODULES(UDEV, libudev >= 127, udev_found=yes, udev_found=no)
78 AC_SUBST(UDEV_CFLAGS)
79 AC_SUBST(UDEV_LIBS)
80 AM_CONDITIONAL(UDEV, test "${udev_found}" = "yes")
81
82 PKG_CHECK_MODULES(POLKIT, polkit-dbus >= 0.7, polkit_found=yes, polkit_found=no)
83 AC_SUBST(POLKIT_CFLAGS)
84 AC_SUBST(POLKIT_LIBS)
85 AM_CONDITIONAL(POLKIT, test "${polkit_found}" = "yes")
86
87 AC_ARG_ENABLE(fake, AC_HELP_STRING([--enable-fake],
88                         [enable fake plugin]), [enable_fake=${enableval}])
89 AM_CONDITIONAL(FAKE, test "${enable_fake}" = "yes")
90
91 AC_OUTPUT(Makefile gdbus/Makefile include/Makefile src/Makefile doc/Makefile
92                 test/Makefile plugins/Makefile client/Makefile scripts/Makefile
93                 scripts/connman src/connman.service doc/version.xml connman.pc)