]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/replace: Look for special flags needed for c99
authorAndrew Bartlett <abartlet@samba.org>
Sun, 23 Sep 2012 20:45:05 +0000 (06:45 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 24 Sep 2012 01:51:07 +0000 (03:51 +0200)
This is normally handled by the waf core, but for HP-UX we currently fail.

The autoconf code hard-codes a case for HP-UX, but I want to try testing
it using a generic system first.

Andrew Bartlett

lib/replace/wscript

index 58053057d790667e36cc3582baa2e0a4cf33b050..d5b2631cfd75b052e1a40639779e4ef6ed5e71c0 100644 (file)
@@ -43,6 +43,16 @@ def configure(conf):
         conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True)
         conf.DEFINE('_BSD_TYPES', 1, add_to_cflags=True)
 
+    # Try to find the right extra flags for C99 initialisers
+    for f in ["", "-AC99", "-qlanglvl=extc99", "-qlanglvl=stdc99", "-c99"]:
+        if conf.CHECK_CFLAGS([f], '''
+struct foo {int x;char y;};
+struct foo bar = { .y = 'X', .x = 1 };
+'''):
+            if f != "":
+                conf.ADD_CFLAGS(f)
+            break
+
     conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h')
     conf.CHECK_HEADERS('acl/libacl.h attr/xattr.h compat.h ctype.h dustat.h')
     conf.CHECK_HEADERS('fcntl.h fnmatch.h glob.h history.h krb5.h langinfo.h')