Require udev and if not present use a compat layer
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 3 Jul 2009 22:05:20 +0000 (15:05 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 3 Jul 2009 22:05:20 +0000 (15:05 -0700)
README
bootstrap-configure
configure.ac
src/Makefile.am
src/connman.h
src/udev-compat.c [new file with mode: 0644]

diff --git a/README b/README
index 37130dd..3b003e3 100644 (file)
--- a/README
+++ b/README
@@ -128,14 +128,6 @@ For a working system, certain configuration options need to be enabled:
                are in place. It detects an already configured loopback
                device and leaves it as it is.
 
-       --enable-udev
-
-               Enable device detection support via udev
-
-               Network devices are by default detected via the builtin RTNL
-               functionality. This allows to detect TTY based modem devices
-               via udev.
-
        --enable-polkit
 
                Enable support for PolicyKit authorization
index 236579d..674f6e0 100755 (executable)
@@ -31,7 +31,6 @@ fi
                --enable-hso=builtin \
                --enable-mbm=builtin \
                --enable-ppp \
-               --enable-udev \
                --enable-iwmx \
                --enable-iospm \
                --enable-polkit=builtin \
index 7223efa..7e37a96 100644 (file)
@@ -195,16 +195,13 @@ AC_CHECK_LIB(c, inotify_init, dummy=yes,
 AC_CHECK_LIB(dl, dlopen, dummy=yes,
                        AC_MSG_ERROR(dynamic linking loader is required))
 
-AC_ARG_ENABLE(udev, AC_HELP_STRING([--enable-udev],
-               [enable udev support]), [enable_udev=${enableval}])
+PKG_CHECK_MODULES(UDEV, libudev >= 141,
+                               [enable_udev="yes"], [enable_udev="no"])
 if (test "${enable_udev}" = "yes"); then
-       AC_DEFINE(HAVE_UDEV, 1, [Define if udev support is available])
-       PKG_CHECK_MODULES(UDEV, libudev >= 141, dummy=yes,
-                               AC_MSG_ERROR(udev >= 141 is required))
        AC_CHECK_LIB(udev, udev_monitor_filter_update, dummy=yes,
                AC_DEFINE(NEED_UDEV_MONITOR_FILTER, 1,
                        [Define to 1 if you need the
-                               udev_monitor_filter...() functions.]))
+                                       udev_monitor_filter...() functions.]))
        UDEV_DATADIR="`$PKG_CONFIG --variable=rulesdir libudev`"
        if (test -z "${UDEV_DATADIR}"); then
                UDEV_DATADIR="${sysconfdir}/udev/rules.d"
index 8b73346..b146a4b 100644 (file)
@@ -15,6 +15,8 @@ connmand_SOURCES = main.c connman.h log.c selftest.c error.c plugin.c \
 
 if UDEV
 connmand_SOURCES += udev.c
+else
+connmand_SOURCES += udev-compat.c
 endif
 
 connmand_LDADD = $(top_builddir)/plugins/libbuiltin.la \
index 2273769..24b64ad 100644 (file)
@@ -186,25 +186,9 @@ void __connman_connection_cleanup(void);
 
 void __connman_connection_update_gateway(void);
 
-#ifdef HAVE_UDEV
 int __connman_udev_init(void);
 void __connman_udev_cleanup(void);
 char *__connman_udev_get_devtype(const char *ifname);
-#else
-static inline int __connman_udev_init(void)
-{
-       return 0;
-}
-
-static inline void __connman_udev_cleanup(void)
-{
-}
-
-static inline char *__connman_udev_get_devtype(const char *ifname)
-{
-       return NULL;
-}
-#endif
 
 #include <connman/device.h>
 
diff --git a/src/udev-compat.c b/src/udev-compat.c
new file mode 100644 (file)
index 0000000..516a48d
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ *
+ *  Connection Manager
+ *
+ *  Copyright (C) 2007-2009  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "connman.h"
+
+char *__connman_udev_get_devtype(const char *ifname)
+{
+       return NULL;
+}
+
+int __connman_udev_init(void)
+{
+       return 0;
+}
+
+void __connman_udev_cleanup(void)
+{
+}