Add configure options to select plugins
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 2 Jan 2009 17:13:38 +0000 (18:13 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 2 Jan 2009 17:13:38 +0000 (18:13 +0100)
Makefile.am
README
bootstrap-configure
configure.ac
plugins/Makefile.am
src/connman.h

index 78c98b8..7f61d2b 100644 (file)
@@ -5,7 +5,10 @@ pkgconfigdir = $(libdir)/pkgconfig
 
 pkgconfig_DATA = connman.pc
 
-DISTCHECK_CONFIGURE_FLAGS = --disable-gtk-doc
+DISTCHECK_CONFIGURE_FLAGS = --disable-gtk-doc \
+                               --enable-loopback \
+                               --enable-wifi \
+                               --enable-client
 
 DISTCLEANFILES = $(pkgconfig_DATA)
 
diff --git a/README b/README
index 70e8826..1cad5ab 100644 (file)
--- a/README
+++ b/README
@@ -13,6 +13,7 @@ In order to compile Connection Manager you need following software packages:
        - D-Bus library
        - udev library (optional)
        - PolicyKit (optional)
+       - PPP support (optional)
 
 To configure run:
        ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
index 5a7e4dc..54926b4 100755 (executable)
@@ -16,4 +16,10 @@ fi
                --mandir=/usr/share/man \
                --localstatedir=/var \
                --sysconfdir=/etc \
+               --enable-loopback \
+               --enable-wifi \
+               --enable-hso \
+               --enable-ppp \
+               --enable-udev \
+               --enable-polkit \
                --enable-client $*
index ad37741..64000e1 100644 (file)
@@ -43,14 +43,37 @@ AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
        fi
 ])
 
-AC_PATH_PROG(UDHCPC, [udhcpc], ,$PATH:/sbin:/usr/sbin)
-AC_PATH_PROG(DHCLIENT, [dhclient], ,$PATH:/sbin:/usr/sbin)
-AC_PATH_PROG(RESOLVCONF, [resolvconf], ,$PATH:/sbin:/usr/sbin)
-AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], ,$PATH:/sbin:/usr/sbin)
-AC_PATH_PROG(PPPD, [pppd], ,$PATH:/sbin:/usr/sbin)
-
-AC_CHECK_HEADERS(pppd/pppd.h, pppd_found=yes, pppd_found=no)
-AM_CONDITIONAL(PPPD, test "${pppd_found}" = "yes")
+AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
+               [enable threading support]), [enable_threads=${enableval}])
+
+AC_PATH_PROG(UDHCPC, [udhcpc], [], $PATH:/sbin:/usr/sbin)
+AC_PATH_PROG(DHCLIENT, [dhclient], [], $PATH:/sbin:/usr/sbin)
+AC_PATH_PROG(RESOLVCONF, [resolvconf], [], $PATH:/sbin:/usr/sbin)
+
+AC_ARG_ENABLE(loopback, AC_HELP_STRING([--enable-loopback],
+               [enable loopback support]), [enable_loopback=${enableval}])
+AM_CONDITIONAL(LOOPBACK, test "${enable_loopback}" = "yes")
+
+AC_ARG_ENABLE(wifi, AC_HELP_STRING([--enable-wifi],
+               [enable WiFi support]), [enable_wifi=${enableval}])
+if (test "${enable_wifi}" = "yes"); then
+       AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
+                                               $PATH:/sbin:/usr/sbin)
+fi
+AM_CONDITIONAL(WIFI, test "${enable_wifi}" = "yes")
+
+AC_ARG_ENABLE(hso, AC_HELP_STRING([--enable-hso],
+               [enable HSO support]), [enable_hso=${enableval}])
+AM_CONDITIONAL(HSO, test "${enable_hso}" = "yes")
+
+AC_ARG_ENABLE(ppp, AC_HELP_STRING([--enable-ppp],
+               [enable PPP support]), [enable_udev=${enableval}])
+if (test "${enable_ppp}" = "yes"); then
+       AC_PATH_PROG(PPPD, [pppd], [], $PATH:/sbin:/usr/sbin)
+       AC_CHECK_HEADERS(pppd/pppd.h, enable_ppp=yes,
+                       AC_MSG_ERROR(PPP development files are required))
+fi
+AM_CONDITIONAL(PPPD, test "${enable_ppp}" = "yes")
 
 AC_CHECK_LIB(dl, dlopen, dummy=yes,
                        AC_MSG_ERROR(dynamic linking loader is required))
@@ -60,15 +83,13 @@ PKG_CHECK_MODULES(GLIB, glib-2.0, dummy=yes,
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
-AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
-                                       [enable threading support]), [
+if (test "${enable_threads}" = "yes"); then
        AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
-
        PKG_CHECK_MODULES(GTHREAD, gthread-2.0, dummy=yes,
                                AC_MSG_ERROR(gthread is required))
        GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
        GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
-])
+fi
 
 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
                                AC_MSG_ERROR(libdbus is required))
@@ -78,22 +99,33 @@ AC_SUBST(DBUS_LIBS)
 AC_SUBST([GDBUS_CFLAGS], ['$(DBUS_CFLAGS) -I$(top_srcdir)/gdbus'])
 AC_SUBST([GDBUS_LIBS], ['$(top_builddir)/gdbus/libgdbus.la $(DBUS_LIBS)'])
 
-PKG_CHECK_MODULES(UDEV, libudev >= 127, udev_found=yes, udev_found=no)
+AC_ARG_ENABLE(udev, AC_HELP_STRING([--enable-udev],
+               [enable udev support]), [enable_udev=${enableval}])
+if (test "${enable_udev}" = "yes"); then
+       AC_DEFINE(HAVE_UDEV, 1, [Define if udev support is available])
+       PKG_CHECK_MODULES(UDEV, libudev >= 127, enable_udev=yes,
+                               AC_MSG_ERROR(udev >= 127 is required))
+fi
 AC_SUBST(UDEV_CFLAGS)
 AC_SUBST(UDEV_LIBS)
-AM_CONDITIONAL(UDEV, test "${udev_found}" = "yes")
-
-PKG_CHECK_MODULES(POLKIT, polkit-dbus >= 0.7, polkit_found=yes, polkit_found=no)
-AC_SUBST(POLKIT_CFLAGS)
-AC_SUBST(POLKIT_LIBS)
-AM_CONDITIONAL(POLKIT, test "${polkit_found}" = "yes")
+AM_CONDITIONAL(UDEV, test "${enable_udev}" = "yes")
+
+AC_ARG_ENABLE(polkit, AC_HELP_STRING([--enable-polkit],
+               [enable PolicyKit support]), [enable_polkit=${enableval}])
+if (test "${enable_polkit}" = "yes"); then
+       PKG_CHECK_MODULES(POLKIT, polkit-dbus >= 0.7, enable_polkit=yes,
+                               AC_MSG_ERROR(PolicyKit >= 0.7 is required))
+       AC_SUBST(POLKIT_CFLAGS)
+       AC_SUBST(POLKIT_LIBS)
+fi
+AM_CONDITIONAL(POLKIT, test "${enable_polkit}" = "yes")
 
 AC_ARG_ENABLE(client, AC_HELP_STRING([--enable-client],
                [enable command line client]), [enable_client=${enableval}])
 AM_CONDITIONAL(CLIENT, test "${enable_client}" = "yes")
 
 AC_ARG_ENABLE(fake, AC_HELP_STRING([--enable-fake],
-                       [enable fake plugin]), [enable_fake=${enableval}])
+               [enable fake device support]), [enable_fake=${enableval}])
 AM_CONDITIONAL(FAKE, test "${enable_fake}" = "yes")
 
 AC_OUTPUT(Makefile gdbus/Makefile include/Makefile src/Makefile doc/Makefile
index 78e6b44..4d8815b 100644 (file)
@@ -1,21 +1,35 @@
 
 plugindir = $(libdir)/connman/plugins
 
-plugin_LTLIBRARIES = loopback.la ethernet.la wifi.la bluetooth.la hso.la \
-                               udhcp.la dhclient.la ipv4.la dnsproxy.la \
-                                               resolvconf.la resolvfile.la
+plugin_LTLIBRARIES = ethernet.la bluetooth.la \
+                               ipv4.la udhcp.la dhclient.la \
+                               dnsproxy.la resolvconf.la resolvfile.la
+
+if LOOPBACK
+plugin_LTLIBRARIES += loopback.la
 
 loopback_la_SOURCES = loopback.c
+endif
 
 ethernet_la_SOURCES = ethernet.c inet.h inet.c
 
+if WIFI
+plugin_LTLIBRARIES += wifi.la
+
 wifi_la_SOURCES = wifi.c inet.h inet.c supplicant.h supplicant.c
 wifi_la_LIBADD = @GDBUS_LIBS@
+endif
 
 bluetooth_la_SOURCES = bluetooth.c inet.h inet.c
 bluetooth_la_LIBADD = @GDBUS_LIBS@
 
+if HSO
+plugin_LTLIBRARIES += hso.la
+
 hso_la_SOURCES = hso.c modem.h modem.c
+endif
+
+ipv4_la_SOURCES = ipv4.c inet.h inet.c
 
 udhcp_la_SOURCES = udhcp.c inet.h inet.c task.h task.c
 udhcp_la_CFLAGS = @GLIB_CFLAGS@ @GDBUS_CFLAGS@ -DUDHCPC=\"@UDHCPC@\" \
@@ -31,8 +45,6 @@ plugin_LTLIBRARIES += pppd.la
 pppd_la_SOURCES = pppd.c
 endif
 
-ipv4_la_SOURCES = ipv4.c inet.h inet.c
-
 dnsproxy_la_SOURCES = dnsproxy.c
 
 resolvconf_la_SOURCES = resolvconf.c
index 5dafe76..25f5085 100644 (file)
@@ -116,8 +116,19 @@ static inline void __connman_element_unlock(struct connman_element *element)
 int __connman_detect_init(void);
 void __connman_detect_cleanup(void);
 
+#ifdef HAVE_UDEV
 int __connman_udev_init(void);
 void __connman_udev_cleanup(void);
+#else
+static inline int __connman_udev_init(void)
+{
+       return 0;
+}
+
+static inline void __connman_udev_cleanup(void)
+{
+}
+#endif
 
 #include <connman/device.h>