From: Alan T. DeKok Date: Mon, 2 May 2011 12:47:16 +0000 (+0200) Subject: Use built-in "offsetof" X-Git-Tag: release_2_1_11~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4f0c7ed4dc9811d8dfa982540ed8cb721cc854a;p=thirdparty%2Ffreeradius-server.git Use built-in "offsetof" Look for "stddef.h", and if found, include it in the various configure checks. Also use it at run time. --- diff --git a/acinclude.m4 b/acinclude.m4 index 1dd8ad14c8e..2730606faa7 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -349,6 +349,9 @@ dnl AC_TRY_COMPILE([ $1 +#ifdef HAVE_STDDEF_H +#include +#endif #ifndef offsetof #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER) #endif diff --git a/configure b/configure index cd0356c27a2..73e8732fdd2 100755 --- 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" + @@ -22723,6 +22725,8 @@ fi + + @@ -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 +#ifdef HAVE_STDDEF_H +#include +#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 +#ifdef HAVE_STDDEF_H +#include +#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 +#ifdef HAVE_STDDEF_H +#include +#endif #ifndef offsetof #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER) #endif diff --git a/configure.in b/configure.in index 24476fb812e..a12eb9fb518 100644 --- a/configure.in +++ b/configure.in @@ -619,6 +619,7 @@ AC_CHECK_HEADERS( \ prot.h \ pwd.h \ grp.h \ + stddef.h \ fnmatch.h \ sia.h \ siad.h diff --git a/src/include/autoconf.h.in b/src/include/autoconf.h.in index 9b5d1b84351..3493254c585 100644 --- a/src/include/autoconf.h.in +++ b/src/include/autoconf.h.in @@ -257,6 +257,9 @@ /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H diff --git a/src/include/missing.h b/src/include/missing.h index 7c7b37fb2c1..679d7f2b8be 100644 --- a/src/include/missing.h +++ b/src/include/missing.h @@ -18,6 +18,10 @@ RCSIDH(missing_h, "$Id$") #include #endif +#ifdef HAVE_STDDEF_H +#include +#endif + #ifdef HAVE_SYS_TYPES_H #include #endif