$OpenBSD: patch-source3_wscript,v 1.12 2021/05/12 23:33:24 jca Exp $

- avoid using glib (only useful for spotlight?)
- use more generic check for OpenBSD.
- avoid nested function error with clang

Index: source3/wscript
--- source3/wscript.orig
+++ source3/wscript
@@ -102,6 +102,7 @@ def options(opt):
 
     # default = None means autodetection
     opt.samba_add_onoff_option('spotlight', with_name="enable", without_name="disable", default=None)
+    opt.samba_add_onoff_option('glib', default=False)
 
 def configure(conf):
     default_static_modules = []
@@ -114,7 +115,7 @@ def configure(conf):
         conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
         conf.env.developer = True
 
-    if sys.platform != 'openbsd5':
+    if not sys.platform.startswith('openbsd'):
         conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True)
 
     # We crash without vfs_default
@@ -1694,6 +1695,7 @@ main() {
 
     conf.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
                     'SEEKDIR_RETURNS_VOID',
+                    addmain=False,
                     headers='sys/types.h dirent.h',
                     msg='Checking whether seekdir returns void')
 
@@ -1807,7 +1809,7 @@ main() {
         else:
             conf.fatal('AFS headers not available, but --with-fake-kaserver was specified')
 
-    if conf.CHECK_CFG(package='glib-2.0',
+    if Options.options.with_glib and conf.CHECK_CFG(package='glib-2.0',
                       args='--cflags --libs',
                       msg='Checking for glib-2.0',
                       uselib_store="GLIB-2.0"):
