summaryrefslogtreecommitdiff
path: root/source4/lib/replace
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-09-06 08:27:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:17:40 -0500
commit68d172c5063c3e84977e4238c1147cdc40d4b0be (patch)
tree25fce7fc9b564ab02912441e8919490750610da7 /source4/lib/replace
parented356c798974a302036b7e68c7e6b703c50bf09d (diff)
downloadsamba-68d172c5063c3e84977e4238c1147cdc40d4b0be.tar.gz
samba-68d172c5063c3e84977e4238c1147cdc40d4b0be.tar.bz2
samba-68d172c5063c3e84977e4238c1147cdc40d4b0be.zip
r18144: make the logic a bit more cut&paste friendly
metze (This used to be commit da9be10dc602d21871d970a10015e970650942fe)
Diffstat (limited to 'source4/lib/replace')
-rw-r--r--source4/lib/replace/cc_features.m431
1 files changed, 21 insertions, 10 deletions
diff --git a/source4/lib/replace/cc_features.m4 b/source4/lib/replace/cc_features.m4
index a109dfb414..255009dd55 100644
--- a/source4/lib/replace/cc_features.m4
+++ b/source4/lib/replace/cc_features.m4
@@ -8,18 +8,22 @@ dnl adapted for libreplace by Andrew Tridgell
############################################
# Check if the compiler handles c99 struct initialization, and if not try -AC99 and -c99 flags
-# Usage: LIBREPLACE_CC_SUPPORTS_C99_STRUCT_INIT(success-action,failure-action)
+# Usage: LIBREPLACE_C99_STRUCT_INIT(success-action,failure-action)
# changes CFLAGS to add -AC99 or -c99 if needed
AC_DEFUN([LIBREPLACE_C99_STRUCT_INIT],
[
-AC_MSG_CHECKING(for C99 designated initializers)
saved_CFLAGS="$CFLAGS";
-AC_TRY_COMPILE([#include <stdio.h>],
- [ struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
- ],
- [AC_MSG_RESULT(yes); c99_init=yes; $1], [c99_init=no; AC_MSG_RESULT(no)])
+c99_init=no
+if test x"$c99_init" = x"no"; then
+ AC_MSG_CHECKING(for C99 designated initializers)
+ CFLAGS="$saved_CFLAGS";
+ AC_TRY_COMPILE([#include <stdio.h>],
+ [ struct foo {int x;char y;};
+ struct foo bar = { .y = 'X', .x = 1 };
+ ],
+ [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
+fi
if test x"$c99_init" = x"no"; then
AC_MSG_CHECKING(for C99 designated initializers with -AC99)
CFLAGS="$saved_CFLAGS -AC99";
@@ -27,7 +31,7 @@ if test x"$c99_init" = x"no"; then
[ struct foo {int x;char y;};
struct foo bar = { .y = 'X', .x = 1 };
],
- [AC_MSG_RESULT(yes); c99_init=yes; $1],[AC_MSG_RESULT(no)])
+ [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
fi
if test x"$c99_init" = x"no"; then
AC_MSG_CHECKING(for C99 designated initializers with -c99)
@@ -36,7 +40,14 @@ if test x"$c99_init" = x"no"; then
[ struct foo {int x;char y;};
struct foo bar = { .y = 'X', .x = 1 };
],
- [AC_MSG_RESULT(yes); $1],[AC_MSG_RESULT(no);CFLAGS="$saved_CFLAGS"; $2])
+ [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
+fi
+if test x"$c99_init" = x"yes"; then
+ saved_CFLAGS=""
+ $1
+else
+ CFLAGS="$saved_CFLAGS"
+ saved_CFLAGS=""
+ $2
fi
])
-