replace: Improve sys/sysctl.h check to catch warning on glibc >= 2.30
authorAndreas Schneider <asn@samba.org>
Wed, 2 Oct 2019 12:27:41 +0000 (14:27 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 7 Oct 2019 11:48:24 +0000 (11:48 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Oct  7 11:48:24 UTC 2019 on sn-devel-184

lib/replace/wscript

index c9d27e13df8121e92516d414bae2b8a9c9f87a5f..e4da1a71a4c4e13ffdd56df9a9406419a94781e7 100644 (file)
@@ -106,7 +106,18 @@ def configure(conf):
             conf.SET_TARGET_TYPE('nsl', 'SYSLIB')
     conf.CHECK_HEADERS('rpcsvc/nis.h rpcsvc/ypclnt.h', lib='tirpc nsl')
 
-    conf.CHECK_HEADERS('sys/sysctl.h')
+    # This file is decprecated with glibc >= 2.30 so we need to check if it
+    # includes a deprecation warning:
+    # #warning "The <sys/sysctl.h> header is deprecated and will be removed."
+    conf.CHECK_CODE('''
+                    #include <sys/sysctl.h>
+                    int main(void) { return 0; }
+                    ''',
+                    define='HAVE_SYS_SYSCTL_H',
+                    cflags=['-Werror=cpp'],
+                    addmain=False,
+                    msg='Checking for header sys/sysctl.h')
+
     conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h')
     conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h')