build: Move systemd checks to lib/util
authorChristof Schmitt <cs@samba.org>
Fri, 20 Mar 2015 19:13:14 +0000 (12:13 -0700)
committerChristof Schmitt <cs@samba.org>
Mon, 23 Mar 2015 20:22:11 +0000 (21:22 +0100)
Only lib/util uses the systemd library, so it makes sense to have the
checks there. This also removes the need for the ctdb build script to
specify an empty tag for the systemd library.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/wscript
lib/util/wscript
lib/util/wscript_configure
wscript

index 5957f16d511be556a4b5612f4088f306d103309d..f0b68cdcc18908b3e70647293a44e4423b388108 100755 (executable)
@@ -212,8 +212,6 @@ def configure(conf):
             conf.ADD_EXTRA_INCLUDES('#ctdb')
         conf.ADD_EXTRA_INCLUDES('#lib #lib/replace')
 
-        conf.SET_TARGET_TYPE('systemd-daemon', 'EMPTY')
-
         del(conf.env.defines['PYTHONDIR'])
         del(conf.env.defines['PYTHONARCHDIR'])
 
index d296e7565bae7dbd2952af36fb102995bb72f61a..23716890317ed574461102db458f543e02608061 100644 (file)
@@ -1,3 +1,11 @@
 def set_options(opt):
     ''' This is a bit strange, but disable is the flag, not enable. '''
     opt.add_option('--disable-fault-handling', action='store_true', dest='disable_fault_handling', help=('disable the fault handlers'), default=False)
+
+    opt.add_option('--with-systemd',
+                   help=("Enable systemd integration"),
+                   action='store_true', dest='enable_systemd')
+
+    opt.add_option('--without-systemd',
+                   help=("Disable systemd integration"),
+                   action='store_false', dest='enable_systemd')
index bf017a5429f6845cdeea98419ef3e29ec8754427..8cf77b432ae38dc2ecd94c4a0e0b9cf04d05d10b 100644 (file)
@@ -99,3 +99,17 @@ conf.CHECK_CODE('struct statvfs buf; buf.f_flags = 0',
                 headers='sys/statvfs.h',
                 local_include=False,
                 execute=False)
+
+if Options.options.enable_systemd != False:
+    conf.CHECK_CFG(package='libsystemd-daemon', args='--cflags --libs',
+                   msg='Checking for libsystemd-daemon', uselib_store="SYSTEMD-DAEMON")
+    conf.CHECK_HEADERS('systemd/sd-daemon.h', lib='systemd-daemon')
+    conf.CHECK_LIB('systemd-daemon', shlib=True)
+
+if (conf.CONFIG_SET('HAVE_SYSTEMD_SD_DAEMON_H') and
+    conf.CONFIG_SET('HAVE_LIBSYSTEMD_DAEMON')):
+    conf.DEFINE('HAVE_SYSTEMD', '1')
+    conf.env['ENABLE_SYSTEMD'] = True
+else:
+    conf.SET_TARGET_TYPE('systemd-daemon', 'EMPTY')
+    conf.undefine('HAVE_SYSTEMD')
diff --git a/wscript b/wscript
index 4e06576080606b19cba52cbac7bd2d6f69666729..146556bec4f8664cc6ae1fcbdb029678b435c440 100644 (file)
--- a/wscript
+++ b/wscript
@@ -69,14 +69,6 @@ def set_options(opt):
                   help=("Disable RELRO builds"),
                   action="store_false", dest='enable_relro')
 
-    opt.add_option('--with-systemd',
-                   help=("Enable systemd integration"),
-                   action='store_true', dest='enable_systemd')
-
-    opt.add_option('--without-systemd',
-                   help=("Disable systemd integration"),
-                   action='store_false', dest='enable_systemd')
-
     gr = opt.option_group('developer options')
 
     opt.tool_options('python') # options for disabling pyc or pyo compilation
@@ -212,20 +204,6 @@ def configure(conf):
                          msg="Checking compiler for full RELRO support"):
             conf.env['ENABLE_RELRO'] = True
 
-    if Options.options.enable_systemd != False:
-        conf.CHECK_CFG(package='libsystemd-daemon', args='--cflags --libs',
-                       msg='Checking for libsystemd-daemon', uselib_store="SYSTEMD-DAEMON")
-        conf.CHECK_HEADERS('systemd/sd-daemon.h', lib='systemd-daemon')
-        conf.CHECK_LIB('systemd-daemon', shlib=True)
-
-    if (conf.CONFIG_SET('HAVE_SYSTEMD_SD_DAEMON_H') and
-        conf.CONFIG_SET('HAVE_LIBSYSTEMD_DAEMON')):
-        conf.DEFINE('HAVE_SYSTEMD', '1')
-        conf.env['ENABLE_SYSTEMD'] = True
-    else:
-        conf.SET_TARGET_TYPE('systemd-daemon', 'EMPTY')
-        conf.undefine('HAVE_SYSTEMD')
-
     conf.SAMBA_CONFIG_H('include/config.h')
 
 def etags(ctx):