session: Fix configuration plugin build
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 13 Sep 2012 13:30:26 +0000 (15:30 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 14 Sep 2012 13:32:00 +0000 (16:32 +0300)
Instead of allow the user configuring which plugin should build and used
via issuing 'configure --with-configplugin=foo' add explicit
enable flags 'configure --enable-session-policy'.

Also with this patch, the name is changed from session-default to
session-policy.

Makefile.plugins
configure.ac
plugins/session_default.c [deleted file]
plugins/session_policy.c [new file with mode: 0644]

index 263cb208890c5a4d96aa40f9dd5dc08cb42e6e30..a6cda480c667be1eb402737f7bc579f4ece9cc67 100644 (file)
@@ -223,8 +223,17 @@ plugins_tist_la_LDFLAGS = $(plugin_ldflags)
 endif
 endif
 
-builtin_modules += @SESSION_CONFIG_PLUGIN@
-builtin_sources += plugins/@SESSION_CONFIG_PLUGIN@.c
+if SESSION_POLICY
+if SESSION_POLICY_BUILTIN
+builtin_modules += session_policy
+builtin_sources += plugins/session_policy.c
+else
+plugin_LTLIBRARIES += plugins/session_policy.la
+plugin_objects += $(plugins_session_policy_la_OBJECTS)
+plugins_session_policy_la_CFLAGS = $(plugin_cflags)
+plugins_session_policy_la_LDFLAGS = $(plugin_ldflags)
+endif
+endif
 
 EXTRA_DIST += plugins/polkit.policy
 
index f43b2517eb64524934319c2b49ddedb3ada2b885..2a7b20b66f8972a374e3ce6d368854e9559adb26 100644 (file)
@@ -252,11 +252,11 @@ AC_ARG_ENABLE(tist,
 AM_CONDITIONAL(TIST, test "${enable_tist}" != "no")
 AM_CONDITIONAL(TIST_BUILTIN, test "${enable_tist}" = "builtin")
 
-AC_ARG_WITH(configplugin, AC_HELP_STRING([--with-configplugin=PLUGIN],
-       [session config plugin]), [configplugin=${withval}],
-               [configplugin="session_default"])
-SESSION_CONFIG_PLUGIN="$configplugin"
-AC_SUBST(SESSION_CONFIG_PLUGIN)
+AC_ARG_ENABLE(session-policy,
+       AC_HELP_STRING([--enable-session-policy], [enable default Session policy configuration support]),
+                       [enable_session_policy=${enableval}], [enable_session_policy="no"])
+AM_CONDITIONAL(SESSION_POLICY, test "${enable_session_policy}" != "no")
+AM_CONDITIONAL(SESSION_POLICY_BUILTIN, test "${enable_session_policy}" = "builtin")
 
 AC_ARG_WITH(stats-max-file-size, AC_HELP_STRING([--with-stats-max-file-size=SIZE],
                        [Maximal size of a statistics round robin file]),
diff --git a/plugins/session_default.c b/plugins/session_default.c
deleted file mode 100644 (file)
index d62a596..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *
- *  Connection Manager
- *
- *  Copyright (C) 2012  BMW Car IT GbmH. 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 <errno.h>
-#include <string.h>
-
-#include <glib.h>
-
-#define CONNMAN_API_SUBJECT_TO_CHANGE
-#include <connman/plugin.h>
-#include <connman/log.h>
-#include <connman/session.h>
-
-static int config_get_bool(const char *id, const char *key, connman_bool_t *val)
-{
-       DBG("id %s key %s", id, key);
-
-       if (g_str_equal(key, "Priority") == TRUE)
-               *val = FALSE;
-       else if (g_str_equal(key, "EmergencyCall") == TRUE)
-               *val = FALSE;
-       else
-               return -EINVAL;
-
-       return 0;
-}
-
-static int config_get_string(const char *id, const char *key, char **val)
-{
-       DBG("id %s key %s", id, key);
-
-       if (g_str_equal(key, "RoamingPolicy") == TRUE)
-               *val = "default";
-       else
-               return -EINVAL;
-
-       return 0;
-}
-
-static struct connman_session_config session_config = {
-       .name = "session default configuration",
-       .get_bool = config_get_bool,
-       .get_string = config_get_string,
-};
-
-static int session_config_init(void)
-{
-       int err;
-
-       err = connman_session_config_register(&session_config);
-       if (err < 0)
-               return err;
-
-       return 0;
-}
-
-static void session_config_exit(void)
-{
-       connman_session_config_unregister(&session_config);
-}
-
-CONNMAN_PLUGIN_DEFINE(session_default, "Session default configuration plugin",
-               VERSION, CONNMAN_PLUGIN_PRIORITY_DEFAULT,
-               session_config_init, session_config_exit)
diff --git a/plugins/session_policy.c b/plugins/session_policy.c
new file mode 100644 (file)
index 0000000..626d9bb
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ *
+ *  Connection Manager
+ *
+ *  Copyright (C) 2012  BMW Car IT GbmH. 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 <errno.h>
+#include <string.h>
+
+#include <glib.h>
+
+#define CONNMAN_API_SUBJECT_TO_CHANGE
+#include <connman/plugin.h>
+#include <connman/log.h>
+#include <connman/session.h>
+
+static int config_get_bool(const char *id, const char *key, connman_bool_t *val)
+{
+       DBG("id %s key %s", id, key);
+
+       if (g_str_equal(key, "Priority") == TRUE)
+               *val = FALSE;
+       else if (g_str_equal(key, "EmergencyCall") == TRUE)
+               *val = FALSE;
+       else
+               return -EINVAL;
+
+       return 0;
+}
+
+static int config_get_string(const char *id, const char *key, char **val)
+{
+       DBG("id %s key %s", id, key);
+
+       if (g_str_equal(key, "RoamingPolicy") == TRUE)
+               *val = "default";
+       else
+               return -EINVAL;
+
+       return 0;
+}
+
+static struct connman_session_config session_config = {
+       .name = "session policy configuration",
+       .get_bool = config_get_bool,
+       .get_string = config_get_string,
+};
+
+static int session_config_init(void)
+{
+       int err;
+
+       err = connman_session_config_register(&session_config);
+       if (err < 0)
+               return err;
+
+       return 0;
+}
+
+static void session_config_exit(void)
+{
+       connman_session_config_unregister(&session_config);
+}
+
+CONNMAN_PLUGIN_DEFINE(session_policy, "Session policy configuration plugin",
+               VERSION, CONNMAN_PLUGIN_PRIORITY_DEFAULT,
+               session_config_init, session_config_exit)