add systemd integration
[bbaumbach/samba-autobuild/.git] / wscript
diff --git a/wscript b/wscript
index ae4ff50b6d194f74adf50b83f1a3090a59fedd17..87541da62ceea8ab2177995aac6f8eaea992f2f2 100644 (file)
--- a/wscript
+++ b/wscript
@@ -69,8 +69,15 @@ def set_options(opt):
                   help=("Disable RELRO builds"),
                   action="store_false", dest='enable_relro')
 
-    gr = opt.option_group('developer options')
+    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
     # enable options related to building python extensions
@@ -169,8 +176,6 @@ def configure(conf):
                            addmain=False,
                            msg='Checking configure summary'):
         raise Utils.WafError('configure summary failed')
-    
-    conf.SAMBA_CONFIG_H('include/config.h')
 
     if Options.options.enable_pie != False:
         if Options.options.enable_pie == True:
@@ -192,6 +197,21 @@ 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'):
+        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):
     '''build TAGS file using etags'''
     import Utils