summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-09-24 02:29:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:01:06 -0500
commit64d4ff5dcc24d8dfd104b340816d2c89b7735a85 (patch)
treee291b5a202c0012e903fb5fc03442c0a5e2194c3 /source3
parentaf4f43db8d8d2b79d04f33e513555bdb72e265f6 (diff)
downloadsamba-64d4ff5dcc24d8dfd104b340816d2c89b7735a85.tar.gz
samba-64d4ff5dcc24d8dfd104b340816d2c89b7735a85.tar.bz2
samba-64d4ff5dcc24d8dfd104b340816d2c89b7735a85.zip
r18864: merge lib/replace changes from samba4
(This used to be commit 6d5f507136be327558e98214b64eca225ca23d66)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/replace/README7
-rw-r--r--source3/lib/replace/libreplace.m48
-rw-r--r--source3/lib/replace/libreplace_cc.m427
-rw-r--r--source3/lib/replace/replace.h4
4 files changed, 40 insertions, 6 deletions
diff --git a/source3/lib/replace/README b/source3/lib/replace/README
index fd630ddc45..182a276116 100644
--- a/source3/lib/replace/README
+++ b/source3/lib/replace/README
@@ -65,6 +65,12 @@ Constants:
PATH_NAME_MAX
UINT{16,32,64}_MAX
INT32_MAX
+RTLD_LAZY
+HOST_NAME_MAX
+UINT16_MAX
+UINT32_MAX
+UINT64_MAX
+CHAR_BIT
Macros:
va_copy
@@ -72,6 +78,7 @@ __FUNCTION__
__STRING
MIN
MAX
+QSORT_CAST
Prerequisites:
memset (for bzero)
diff --git a/source3/lib/replace/libreplace.m4 b/source3/lib/replace/libreplace.m4
index 6c26f7b904..804f998b9e 100644
--- a/source3/lib/replace/libreplace.m4
+++ b/source3/lib/replace/libreplace.m4
@@ -267,10 +267,10 @@ AC_CHECK_FUNCS(strnlen setenv)
AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
# this test disabled as we don't actually need __VA_ARGS__ yet
-# AC_TRY_CPP([
-# #define eprintf(...) fprintf(stderr, __VA_ARGS__)
-# eprintf("bla", "bar");
-# ], [], [AC_MSG_ERROR([__VA_ARGS__ is required])])
+AC_TRY_CPP([
+#define eprintf(...) fprintf(stderr, __VA_ARGS__)
+eprintf("bla", "bar");
+], AC_DEFINE(HAVE__VA_ARGS__MACRO, 1, [Whether the __VA_ARGS__ macro is available]))
# Check prerequisites
AC_CHECK_FUNCS([memset printf syslog], [],
diff --git a/source3/lib/replace/libreplace_cc.m4 b/source3/lib/replace/libreplace_cc.m4
index aa0465983a..352d115547 100644
--- a/source3/lib/replace/libreplace_cc.m4
+++ b/source3/lib/replace/libreplace_cc.m4
@@ -28,7 +28,13 @@ ac_cv_prog_cc_Ae=no
savedCFLAGS=$CFLAGS
AC_PROG_CC
CFLAGS=$savedCFLAGS
+
+dnl don't try for C99 if we are using gcc, as otherwise we
+dnl lose immediate structure constants
+if test x"$GCC" = x"no" ; then
AC_PROG_CC_C99
+fi
+
if test x"$GCC" = x"yes" ; then
AC_MSG_CHECKING([for version of gcc])
GCC_VERSION=`$CC -dumpversion`
@@ -122,5 +128,26 @@ if test $ac_cv_sizeof_long_long -lt 8;then
AC_MSG_ERROR([LIBREPLACE needs sizeof(long long) >= 8])
fi
+############################################
+# check if the compiler can do immediate structures
+AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
+ AC_TRY_COMPILE([
+#include <stdio.h>],
+[
+ typedef struct {unsigned x;} FOOBAR;
+ #define X_FOOBAR(x) ((FOOBAR) { x })
+ #define FOO_ONE X_FOOBAR(1)
+ FOOBAR f = FOO_ONE;
+ static const struct {
+ FOOBAR y;
+ } f2[] = {
+ {FOO_ONE}
+ };
+],
+ samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
+if test x"$samba_cv_immediate_structures" = x"yes"; then
+ AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES,1,[Whether the compiler supports immediate structures])
+fi
+
AC__LIBREPLACE_ONLY_CC_CHECKS_END
]) dnl end AC_LIBREPLACE_CC_CHECKS
diff --git a/source3/lib/replace/replace.h b/source3/lib/replace/replace.h
index edcdebe6bd..01f626390c 100644
--- a/source3/lib/replace/replace.h
+++ b/source3/lib/replace/replace.h
@@ -357,10 +357,10 @@ typedef int bool;
#endif
#ifndef _TRUE
-#define _TRUE
+#define _TRUE true
#endif
#ifndef _FALSE
-#define _FALSE
+#define _FALSE false
#endif
#ifndef HAVE_FUNCTION_MACRO