Use built-in "offsetof"
authorAlan T. DeKok <aland@freeradius.org>
Mon, 2 May 2011 12:47:16 +0000 (14:47 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 2 May 2011 12:50:38 +0000 (14:50 +0200)
Look for "stddef.h", and if found, include it in the various
configure checks.  Also use it at run time.

acinclude.m4
configure
configure.in
src/include/autoconf.h.in
src/include/missing.h

index 1dd8ad1..2730606 100644 (file)
@@ -349,6 +349,9 @@ dnl
 
   AC_TRY_COMPILE([
 $1
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
 #ifndef offsetof
 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
 #endif
index cd0356c..73e8732 100755 (executable)
--- a/configure
+++ b/configure
@@ -20091,9 +20091,7 @@ echo "${ECHO_T}no" >&6; }
 fi
 
 
-else
 
-  LIBTOOL="`pwd`/libtool"
 
 
 
@@ -20103,6 +20101,10 @@ else
 
 
 
+else
+
+  LIBTOOL="`pwd`/libtool"
+
 
 
 
@@ -22726,6 +22728,8 @@ fi
 
 
 
+
+
 for ac_header in \
        unistd.h \
        crypt.h \
@@ -22760,6 +22764,7 @@ for ac_header in \
        prot.h \
        pwd.h \
        grp.h \
+       stddef.h \
         fnmatch.h \
        sia.h \
        siad.h
@@ -23163,6 +23168,7 @@ echo "$as_me: skipping test for openssl/ssl.h" >&6;}
 
 
 
+
 for ac_header in \
        openssl/ssl.h \
        openssl/crypto.h \
@@ -24775,6 +24781,9 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
 #include <utmpx.h>
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
 #ifndef offsetof
 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
 #endif
@@ -24848,6 +24857,9 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
 #include <netinet/in.h>
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
 #ifndef offsetof
 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
 #endif
@@ -24920,6 +24932,9 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
 #include <netinet/in.h>
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
 #ifndef offsetof
 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
 #endif
index 24476fb..a12eb9f 100644 (file)
@@ -619,6 +619,7 @@ AC_CHECK_HEADERS( \
        prot.h \
        pwd.h \
        grp.h \
+       stddef.h \
         fnmatch.h \
        sia.h \
        siad.h
index 9b5d1b8..3493254 100644 (file)
 /* Define to 1 if you have the `snprintf' function. */
 #undef HAVE_SNPRINTF
 
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
index 7c7b37f..679d7f2 100644 (file)
@@ -18,6 +18,10 @@ RCSIDH(missing_h, "$Id$")
 #include <stdint.h>
 #endif
 
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif