diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | acinclude.m4 | 34 | ||||
-rw-r--r-- | ares/Makefile.am | 2 | ||||
-rw-r--r-- | ares/acinclude.m4 | 25 | ||||
-rwxr-xr-x | ares/buildconf | 1 | ||||
-rw-r--r-- | ares/configure.ac | 2 | ||||
-rw-r--r-- | ares/reentrant.m4 | 846 | ||||
-rwxr-xr-x | buildconf | 1 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | reentrant.m4 | 868 |
10 files changed, 1722 insertions, 61 deletions
diff --git a/Makefile.am b/Makefile.am index 560f8259a..5f2257dc6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,6 +21,8 @@ # $Id$ ########################################################################### +ACLOCAL_AMFLAGS = -I . + AUTOMAKE_OPTIONS = foreign EXTRA_DIST = CHANGES COPYING maketgz reconf Makefile.dist curl-config.in \ diff --git a/acinclude.m4 b/acinclude.m4 index 7b9ab1e0d..94dc6f6b8 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -110,31 +110,6 @@ CURL_DEF_TOKEN $1 ]) -dnl CONFIGURE_WITH_REENTRANT -dnl ------------------------------------------------- -dnl This macro ensures that configuration tests done -dnl after this will execute with preprocessor symbol -dnl _REENTRANT defined. This macro also ensures that -dnl the generated config file will equally define it. - -AC_DEFUN([CONFIGURE_WITH_REENTRANT], [ -AC_BEFORE([$0], [AC_PREPROC_IFELSE])dnl -AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl -AC_BEFORE([$0], [AC_LINK_IFELSE])dnl -AC_BEFORE([$0], [AC_RUN_IFELSE])dnl -AH_VERBATIM([_REENTRANT], -[/* Define _REENTRANT if not already defined */ -@%:@ifndef _REENTRANT -@%:@ define _REENTRANT -@%:@endif]) -cat >>confdefs.h <<_ACEOF -[@%:@ifndef _REENTRANT -@%:@ define _REENTRANT -@%:@endif] -_ACEOF -]) - - dnl CURL_CHECK_HEADER_WINDOWS dnl ------------------------------------------------- dnl Check for compilable and valid windows.h header @@ -2628,7 +2603,6 @@ AC_DEFUN([CURL_CHECK_LOCALTIME_R], #undef _REENTRANT #define _REENTRANT #include <time.h>],[ - AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT defined]) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))])]) ]) @@ -2670,7 +2644,6 @@ AC_DEFUN([CURL_CHECK_STRERROR_R], #undef _REENTRANT #define _REENTRANT #include <string.h>],[ - AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT defined]) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no) AC_DEFINE(HAVE_NO_STRERROR_R_DECL, 1, [we have no strerror_r() proto]) @@ -2761,7 +2734,6 @@ AC_DEFUN([CURL_CHECK_INET_NTOA_R], #define _REENTRANT #include <arpa/inet.h>],[ AC_DEFINE(HAVE_INET_NTOA_R_DECL, 1, [inet_ntoa_r() is declared]) - AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT defined]) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))])]) ]) @@ -2848,7 +2820,6 @@ AC_DEFUN([CURL_CHECK_GETHOSTBYADDR_R], [ ],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args]) - AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT]) ac_cv_gethostbyaddr_r_args="5" ],[ AC_MSG_RESULT([no]) @@ -2904,7 +2875,6 @@ AC_DEFUN([CURL_CHECK_GETHOSTBYADDR_R], [ ],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args]) - AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT]) ac_cv_gethostbyaddr_r_args="7" ],[ AC_MSG_RESULT([no]) @@ -2962,7 +2932,6 @@ AC_DEFUN([CURL_CHECK_GETHOSTBYADDR_R], [ ],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args]) - AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT]) ac_cv_gethostbyaddr_r_args="8" ],[ AC_MSG_RESULT([no]) @@ -3068,7 +3037,6 @@ AC_DEFUN([CURL_CHECK_GETHOSTBYNAME_R], [ ],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args]) - AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT]) ac_cv_gethostbyname_r_args="3" ],[ AC_MSG_RESULT([no]) @@ -3118,7 +3086,6 @@ AC_DEFUN([CURL_CHECK_GETHOSTBYNAME_R], [ ],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args]) - AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT]) ac_cv_gethostbyname_r_args="5" ],[ AC_MSG_RESULT([no]) @@ -3168,7 +3135,6 @@ AC_DEFUN([CURL_CHECK_GETHOSTBYNAME_R], [ ],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args]) - AC_DEFINE(NEED_REENTRANT, 1, [need REENTRANT]) ac_cv_gethostbyname_r_args="6" ],[ AC_MSG_RESULT([no]) diff --git a/ares/Makefile.am b/ares/Makefile.am index a9433abdb..b265703d0 100644 --- a/ares/Makefile.am +++ b/ares/Makefile.am @@ -1,3 +1,5 @@ +ACLOCAL_AMFLAGS = -I . + AUTOMAKE_OPTIONS = foreign lib_LTLIBRARIES = libcares.la diff --git a/ares/acinclude.m4 b/ares/acinclude.m4 index da8366977..fb3005020 100644 --- a/ares/acinclude.m4 +++ b/ares/acinclude.m4 @@ -88,31 +88,6 @@ CURL_DEF_TOKEN $1 ]) -dnl CONFIGURE_WITH_REENTRANT -dnl ------------------------------------------------- -dnl This macro ensures that configuration tests done -dnl after this will execute with preprocessor symbol -dnl _REENTRANT defined. This macro also ensures that -dnl the generated config file will equally define it. - -AC_DEFUN([CONFIGURE_WITH_REENTRANT], [ -AC_BEFORE([$0], [AC_PREPROC_IFELSE])dnl -AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl -AC_BEFORE([$0], [AC_LINK_IFELSE])dnl -AC_BEFORE([$0], [AC_RUN_IFELSE])dnl -AH_VERBATIM([_REENTRANT], -[/* Define _REENTRANT if not already defined */ -@%:@ifndef _REENTRANT -@%:@ define _REENTRANT -@%:@endif]) -cat >>confdefs.h <<_ACEOF -[@%:@ifndef _REENTRANT -@%:@ define _REENTRANT -@%:@endif] -_ACEOF -]) - - dnl CURL_CHECK_HEADER_WINDOWS dnl ------------------------------------------------- dnl Check for compilable and valid windows.h header diff --git a/ares/buildconf b/ares/buildconf index 364d5a06e..ed3f81d1e 100755 --- a/ares/buildconf +++ b/ares/buildconf @@ -1,6 +1,7 @@ #!/bin/sh ${LIBTOOLIZE:-libtoolize} --copy --automake --force +ACLOCAL_FLAGS="-I . $ACLOCAL_FLAGS" ${ACLOCAL:-aclocal} $ACLOCAL_FLAGS ${AUTOHEADER:-autoheader} ${AUTOCONF:-autoconf} diff --git a/ares/configure.ac b/ares/configure.ac index 2266b1480..705fa2775 100644 --- a/ares/configure.ac +++ b/ares/configure.ac @@ -76,7 +76,7 @@ AM_PROG_CC_C_O AC_PROG_INSTALL dnl Our configure and build reentrant settings -CONFIGURE_WITH_REENTRANT +CONFIGURE_REENTRANT dnl check for how to do large files AC_SYS_LARGEFILE diff --git a/ares/reentrant.m4 b/ares/reentrant.m4 new file mode 100644 index 000000000..8cc3968f5 --- /dev/null +++ b/ares/reentrant.m4 @@ -0,0 +1,846 @@ + + +dnl CHECK_NEED_REENTRANT_STRERROR_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function strerror_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_STRERROR_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strerror_r]) + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r links... yes]) + tmp_strerror_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r links... no]) + tmp_strerror_r="no" + ]) + # + if test "$tmp_strerror_r" = "yes"; then + AC_EGREP_CPP([strerror_r],[ +#include <sys/types.h> +#include <string.h> + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r proto... without our definition]) + tmp_strerror_r="proto_wout_def" + ],[ + AC_EGREP_CPP([strerror_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <string.h> + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r proto... with our _reentrant]) + tmp_strerror_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_strerror_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <string.h> + ]],[[ + strerror_r(0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r proto wout finds... 3 args]) + tmp_strerror_r="done" + ]) + fi + # + if test "$tmp_strerror_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <string.h> + ]],[[ + strerror_r(0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r proto with finds... 3 args]) + tmp_strerror_r="needs_reentrant" + ]) + fi + # + if test "$tmp_strerror_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_LOCALTIME_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function localtime_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_LOCALTIME_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([localtime_r]) + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r links... yes]) + tmp_localtime_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r links... no]) + tmp_localtime_r="no" + ]) + # + if test "$tmp_localtime_r" = "yes"; then + AC_EGREP_CPP([localtime_r],[ +#include <sys/types.h> +#include <time.h> + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r proto... without our definition]) + tmp_localtime_r="proto_wout_def" + ],[ + AC_EGREP_CPP([localtime_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <time.h> + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r proto... with our _reentrant]) + tmp_localtime_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_localtime_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <time.h> + ]],[[ + localtime_r(0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r proto wout finds... 2 args]) + tmp_localtime_r="done" + ]) + fi + # + if test "$tmp_localtime_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <time.h> + ]],[[ + localtime_r(0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r proto with finds... 2 args]) + tmp_localtime_r="needs_reentrant" + ]) + fi + # + if test "$tmp_localtime_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_GMTIME_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function gmtime_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_GMTIME_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gmtime_r]) + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r links... yes]) + tmp_gmtime_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r links... no]) + tmp_gmtime_r="no" + ]) + # + if test "$tmp_gmtime_r" = "yes"; then + AC_EGREP_CPP([gmtime_r],[ +#include <sys/types.h> +#include <time.h> + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r proto... without our definition]) + tmp_gmtime_r="proto_wout_def" + ],[ + AC_EGREP_CPP([gmtime_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <time.h> + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r proto... with our _reentrant]) + tmp_gmtime_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_gmtime_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <time.h> + ]],[[ + gmtime_r(0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r proto wout finds... 2 args]) + tmp_gmtime_r="done" + ]) + fi + # + if test "$tmp_gmtime_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <time.h> + ]],[[ + gmtime_r(0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r proto with finds... 2 args]) + tmp_gmtime_r="needs_reentrant" + ]) + fi + # + if test "$tmp_gmtime_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_INET_NTOA_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function inet_ntoa_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_INET_NTOA_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([inet_ntoa_r]) + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r links... yes]) + tmp_inet_ntoa_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r links... no]) + tmp_inet_ntoa_r="no" + ]) + # + if test "$tmp_inet_ntoa_r" = "yes"; then + AC_EGREP_CPP([inet_ntoa_r],[ +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto... without our definition]) + tmp_inet_ntoa_r="proto_wout_def" + ],[ + AC_EGREP_CPP([inet_ntoa_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto... with our _reentrant]) + tmp_inet_ntoa_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_inet_ntoa_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ]],[[ + struct in_addr addr; + inet_ntoa_r(addr, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto wout finds... 2 args]) + tmp_inet_ntoa_r="done" + ]) + fi + if test "$tmp_inet_ntoa_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ]],[[ + struct in_addr addr; + inet_ntoa_r(addr, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto wout finds... 3 args]) + tmp_inet_ntoa_r="done" + ]) + fi + # + if test "$tmp_inet_ntoa_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ]],[[ + struct in_addr addr; + inet_ntoa_r(addr, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto with finds... 2 args]) + tmp_inet_ntoa_r="needs_reentrant" + ]) + fi + if test "$tmp_inet_ntoa_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ]],[[ + struct in_addr addr; + inet_ntoa_r(addr, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto with finds... 3 args]) + tmp_inet_ntoa_r="needs_reentrant" + ]) + fi + # + if test "$tmp_inet_ntoa_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_GETHOSTBYADDR_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function gethostbyaddr_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_GETHOSTBYADDR_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r links... yes]) + tmp_gethostbyaddr_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r links... no]) + tmp_gethostbyaddr_r="no" + ]) + # + if test "$tmp_gethostbyaddr_r" = "yes"; then + AC_EGREP_CPP([gethostbyaddr_r],[ +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto... without our definition]) + tmp_gethostbyaddr_r="proto_wout_def" + ],[ + AC_EGREP_CPP([gethostbyaddr_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto... with our _reentrant]) + tmp_gethostbyaddr_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_gethostbyaddr_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto wout finds... 5 args]) + tmp_gethostbyaddr_r="done" + ]) + fi + if test "$tmp_gethostbyaddr_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto wout finds... 7 args]) + tmp_gethostbyaddr_r="done" + ]) + fi + if test "$tmp_gethostbyaddr_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto wout finds... 8 args]) + tmp_gethostbyaddr_r="done" + ]) + fi + # + if test "$tmp_gethostbyaddr_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto with finds... 5 args]) + tmp_gethostbyaddr_r="needs_reentrant" + ]) + fi + if test "$tmp_gethostbyaddr_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto with finds... 7 args]) + tmp_gethostbyaddr_r="needs_reentrant" + ]) + fi + if test "$tmp_gethostbyaddr_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto with finds... 8 args]) + tmp_gethostbyaddr_r="needs_reentrant" + ]) + fi + # + if test "$tmp_gethostbyaddr_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_GETHOSTBYNAME_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function gethostbyname_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_GETHOSTBYNAME_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gethostbyname_r]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r links... yes]) + tmp_gethostbyname_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r links... no]) + tmp_gethostbyname_r="no" + ]) + # + if test "$tmp_gethostbyname_r" = "yes"; then + AC_EGREP_CPP([gethostbyname_r],[ +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto... without our definition]) + tmp_gethostbyname_r="proto_wout_def" + ],[ + AC_EGREP_CPP([gethostbyname_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto... with our _reentrant]) + tmp_gethostbyname_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_gethostbyname_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto wout finds... 3 args]) + tmp_gethostbyname_r="done" + ]) + fi + if test "$tmp_gethostbyname_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto wout finds... 5 args]) + tmp_gethostbyname_r="done" + ]) + fi + if test "$tmp_gethostbyname_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto wout finds... 6 args]) + tmp_gethostbyname_r="done" + ]) + fi + # + if test "$tmp_gethostbyname_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto with finds... 3 args]) + tmp_gethostbyname_r="needs_reentrant" + ]) + fi + if test "$tmp_gethostbyname_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto with finds... 5 args]) + tmp_gethostbyname_r="needs_reentrant" + ]) + fi + if test "$tmp_gethostbyname_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto with finds... 6 args]) + tmp_gethostbyname_r="needs_reentrant" + ]) + fi + # + if test "$tmp_gethostbyname_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_GETSERVBYPORT_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function getservbyport_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_GETSERVBYPORT_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([getservbyport_r]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r links... yes]) + tmp_getservbyport_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r links... no]) + tmp_getservbyport_r="no" + ]) + # + if test "$tmp_getservbyport_r" = "yes"; then + AC_EGREP_CPP([getservbyport_r],[ +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto... without our definition]) + tmp_getservbyport_r="proto_wout_def" + ],[ + AC_EGREP_CPP([getservbyport_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto... with our _reentrant]) + tmp_getservbyport_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_getservbyport_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto wout finds... 4 args]) + tmp_getservbyport_r="done" + ]) + fi + if test "$tmp_getservbyport_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto wout finds... 5 args]) + tmp_getservbyport_r="done" + ]) + fi + if test "$tmp_getservbyport_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto wout finds... 6 args]) + tmp_getservbyport_r="done" + ]) + fi + # + if test "$tmp_getservbyport_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto with finds... 4 args]) + tmp_getservbyport_r="needs_reentrant" + ]) + fi + if test "$tmp_getservbyport_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto with finds... 5 args]) + tmp_getservbyport_r="needs_reentrant" + ]) + fi + if test "$tmp_getservbyport_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto with finds... 6 args]) + tmp_getservbyport_r="needs_reentrant" + ]) + fi + # + if test "$tmp_getservbyport_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_FUNCTIONS_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes several _r functions compiler visible. +dnl Internal macro for CONFIGURE_REENTRANT. + +AC_DEFUN([CHECK_NEED_REENTRANT_FUNCTIONS_R], [ + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_STRERROR_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_LOCALTIME_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_GMTIME_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_INET_NTOA_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_GETHOSTBYADDR_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_GETHOSTBYNAME_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_GETSERVBYPORT_R + fi +]) + +AC_DEFUN([CHECK_NEED_REENTRANT_FUNCTIONS_R_DEBUG], [ + CHECK_NEED_REENTRANT_STRERROR_R + CHECK_NEED_REENTRANT_LOCALTIME_R + CHECK_NEED_REENTRANT_GMTIME_R + CHECK_NEED_REENTRANT_INET_NTOA_R + CHECK_NEED_REENTRANT_GETHOSTBYADDR_R + CHECK_NEED_REENTRANT_GETHOSTBYNAME_R + CHECK_NEED_REENTRANT_GETSERVBYPORT_R +]) + + +dnl CONFIGURE_FROM_NOW_ON_WITH_REENTRANT +dnl ------------------------------------------------- +dnl This macro ensures that configuration tests done +dnl after this will execute with preprocessor symbol +dnl _REENTRANT defined. This macro also ensures that +dnl the generated config file will equally define it. +dnl Internal macro for CONFIGURE_REENTRANT. + +AC_DEFUN([CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [ +AH_VERBATIM([NEED_REENTRANT], +[/* Configure process defines NEED_REENTRANT to 1 when it finds out that */ +/* _REENTRANT is required or already defined for proper configuration. */ +@%:@undef NEED_REENTRANT +@%:@if defined(NEED_REENTRANT) && !defined(_REENTRANT) +@%:@ define _REENTRANT +@%:@endif]) +cat >>confdefs.h <<_ACEOF +[@%:@ifndef _REENTRANT +@%:@ define _REENTRANT +@%:@endif] +_ACEOF +AC_DEFINE(NEED_REENTRANT, 1, []) +]) + + +dnl CONFIGURE_REENTRANT +dnl ------------------------------------------------- +dnl This first checks if the preprocessor _REENTRANT +dnl symbol is already defined. If it isn't currently +dnl defined a set of checks are performed to verify +dnl if its definition is required to make visible to +dnl the compiler a set of *_r functions. Finally, if +dnl _REENTRANT is already defined or needed it takes +dnl care of making adjustments necessary to ensure +dnl that it is defined equally for further configure +dnl tests and generated config file. + +AC_DEFUN([CONFIGURE_REENTRANT], [ + # + AC_MSG_CHECKING([if _REENTRANT is already defined]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ +#ifdef _REENTRANT + int dummy=1; +#else + force compilation error +#endif + ]]) + ],[ + AC_MSG_RESULT([yes]) + tmp_reentrant_initially_defined="yes" + ],[ + AC_MSG_RESULT([no]) + tmp_reentrant_initially_defined="no" + ]) + # + if test "$tmp_reentrant_initially_defined" = "no"; then + AC_MSG_CHECKING([if _REENTRANT is actually needed]) + ac_cv_need_reentrant="no" + CHECK_NEED_REENTRANT_FUNCTIONS_R_DEBUG + if test "$ac_cv_need_reentrant" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + AC_MSG_CHECKING([if _REENTRANT is onwards defined]) + if test "$tmp_reentrant_initially_defined" = "yes" || + test "$ac_cv_need_reentrant" = "yes"; then + CONFIGURE_FROM_NOW_ON_WITH_REENTRANT + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + # +]) + @@ -209,6 +209,7 @@ PERL=`findtool ${PERL:-perl}` echo "buildconf: running libtoolize" $libtoolize --copy --automake --force || die "The libtoolize command failed" echo "buildconf: running aclocal" +ACLOCAL_FLAGS="-I . $ACLOCAL_FLAGS" ${ACLOCAL:-aclocal} $ACLOCAL_FLAGS || die "The aclocal command line failed" if test -n "$PERL"; then echo "buildconf: running aclocal hack to convert all mv to mv -f" diff --git a/configure.ac b/configure.ac index a2a1fe290..ff2f386ee 100644 --- a/configure.ac +++ b/configure.ac @@ -142,7 +142,7 @@ dnl Checks for programs. AC_PROG_CC dnl Our configure and build reentrant settings -CONFIGURE_WITH_REENTRANT +CONFIGURE_REENTRANT dnl check for how to do large files AC_SYS_LARGEFILE diff --git a/reentrant.m4 b/reentrant.m4 new file mode 100644 index 000000000..f72bb7a21 --- /dev/null +++ b/reentrant.m4 @@ -0,0 +1,868 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +# $Id$ +########################################################################### + + +dnl CHECK_NEED_REENTRANT_STRERROR_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function strerror_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_STRERROR_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strerror_r]) + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r links... yes]) + tmp_strerror_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r links... no]) + tmp_strerror_r="no" + ]) + # + if test "$tmp_strerror_r" = "yes"; then + AC_EGREP_CPP([strerror_r],[ +#include <sys/types.h> +#include <string.h> + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r proto... without our definition]) + tmp_strerror_r="proto_wout_def" + ],[ + AC_EGREP_CPP([strerror_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <string.h> + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r proto... with our _reentrant]) + tmp_strerror_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_strerror_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <string.h> + ]],[[ + strerror_r(0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r proto wout finds... 3 args]) + tmp_strerror_r="done" + ]) + fi + # + if test "$tmp_strerror_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <string.h> + ]],[[ + strerror_r(0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: strerror_r proto with finds... 3 args]) + tmp_strerror_r="needs_reentrant" + ]) + fi + # + if test "$tmp_strerror_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_LOCALTIME_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function localtime_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_LOCALTIME_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([localtime_r]) + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r links... yes]) + tmp_localtime_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r links... no]) + tmp_localtime_r="no" + ]) + # + if test "$tmp_localtime_r" = "yes"; then + AC_EGREP_CPP([localtime_r],[ +#include <sys/types.h> +#include <time.h> + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r proto... without our definition]) + tmp_localtime_r="proto_wout_def" + ],[ + AC_EGREP_CPP([localtime_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <time.h> + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r proto... with our _reentrant]) + tmp_localtime_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_localtime_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <time.h> + ]],[[ + localtime_r(0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r proto wout finds... 2 args]) + tmp_localtime_r="done" + ]) + fi + # + if test "$tmp_localtime_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <time.h> + ]],[[ + localtime_r(0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: localtime_r proto with finds... 2 args]) + tmp_localtime_r="needs_reentrant" + ]) + fi + # + if test "$tmp_localtime_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_GMTIME_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function gmtime_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_GMTIME_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gmtime_r]) + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r links... yes]) + tmp_gmtime_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r links... no]) + tmp_gmtime_r="no" + ]) + # + if test "$tmp_gmtime_r" = "yes"; then + AC_EGREP_CPP([gmtime_r],[ +#include <sys/types.h> +#include <time.h> + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r proto... without our definition]) + tmp_gmtime_r="proto_wout_def" + ],[ + AC_EGREP_CPP([gmtime_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <time.h> + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r proto... with our _reentrant]) + tmp_gmtime_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_gmtime_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <time.h> + ]],[[ + gmtime_r(0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r proto wout finds... 2 args]) + tmp_gmtime_r="done" + ]) + fi + # + if test "$tmp_gmtime_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <time.h> + ]],[[ + gmtime_r(0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gmtime_r proto with finds... 2 args]) + tmp_gmtime_r="needs_reentrant" + ]) + fi + # + if test "$tmp_gmtime_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_INET_NTOA_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function inet_ntoa_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_INET_NTOA_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([inet_ntoa_r]) + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r links... yes]) + tmp_inet_ntoa_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r links... no]) + tmp_inet_ntoa_r="no" + ]) + # + if test "$tmp_inet_ntoa_r" = "yes"; then + AC_EGREP_CPP([inet_ntoa_r],[ +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto... without our definition]) + tmp_inet_ntoa_r="proto_wout_def" + ],[ + AC_EGREP_CPP([inet_ntoa_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto... with our _reentrant]) + tmp_inet_ntoa_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_inet_ntoa_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ]],[[ + struct in_addr addr; + inet_ntoa_r(addr, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto wout finds... 2 args]) + tmp_inet_ntoa_r="done" + ]) + fi + if test "$tmp_inet_ntoa_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ]],[[ + struct in_addr addr; + inet_ntoa_r(addr, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto wout finds... 3 args]) + tmp_inet_ntoa_r="done" + ]) + fi + # + if test "$tmp_inet_ntoa_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ]],[[ + struct in_addr addr; + inet_ntoa_r(addr, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto with finds... 2 args]) + tmp_inet_ntoa_r="needs_reentrant" + ]) + fi + if test "$tmp_inet_ntoa_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + ]],[[ + struct in_addr addr; + inet_ntoa_r(addr, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: inet_ntoa_r proto with finds... 3 args]) + tmp_inet_ntoa_r="needs_reentrant" + ]) + fi + # + if test "$tmp_inet_ntoa_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_GETHOSTBYADDR_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function gethostbyaddr_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_GETHOSTBYADDR_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r links... yes]) + tmp_gethostbyaddr_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r links... no]) + tmp_gethostbyaddr_r="no" + ]) + # + if test "$tmp_gethostbyaddr_r" = "yes"; then + AC_EGREP_CPP([gethostbyaddr_r],[ +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto... without our definition]) + tmp_gethostbyaddr_r="proto_wout_def" + ],[ + AC_EGREP_CPP([gethostbyaddr_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto... with our _reentrant]) + tmp_gethostbyaddr_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_gethostbyaddr_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto wout finds... 5 args]) + tmp_gethostbyaddr_r="done" + ]) + fi + if test "$tmp_gethostbyaddr_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto wout finds... 7 args]) + tmp_gethostbyaddr_r="done" + ]) + fi + if test "$tmp_gethostbyaddr_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto wout finds... 8 args]) + tmp_gethostbyaddr_r="done" + ]) + fi + # + if test "$tmp_gethostbyaddr_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto with finds... 5 args]) + tmp_gethostbyaddr_r="needs_reentrant" + ]) + fi + if test "$tmp_gethostbyaddr_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto with finds... 7 args]) + tmp_gethostbyaddr_r="needs_reentrant" + ]) + fi + if test "$tmp_gethostbyaddr_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyaddr_r proto with finds... 8 args]) + tmp_gethostbyaddr_r="needs_reentrant" + ]) + fi + # + if test "$tmp_gethostbyaddr_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_GETHOSTBYNAME_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function gethostbyname_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_GETHOSTBYNAME_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gethostbyname_r]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r links... yes]) + tmp_gethostbyname_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r links... no]) + tmp_gethostbyname_r="no" + ]) + # + if test "$tmp_gethostbyname_r" = "yes"; then + AC_EGREP_CPP([gethostbyname_r],[ +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto... without our definition]) + tmp_gethostbyname_r="proto_wout_def" + ],[ + AC_EGREP_CPP([gethostbyname_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto... with our _reentrant]) + tmp_gethostbyname_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_gethostbyname_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto wout finds... 3 args]) + tmp_gethostbyname_r="done" + ]) + fi + if test "$tmp_gethostbyname_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto wout finds... 5 args]) + tmp_gethostbyname_r="done" + ]) + fi + if test "$tmp_gethostbyname_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto wout finds... 6 args]) + tmp_gethostbyname_r="done" + ]) + fi + # + if test "$tmp_gethostbyname_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto with finds... 3 args]) + tmp_gethostbyname_r="needs_reentrant" + ]) + fi + if test "$tmp_gethostbyname_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto with finds... 5 args]) + tmp_gethostbyname_r="needs_reentrant" + ]) + fi + if test "$tmp_gethostbyname_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + gethostbyname_r(0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: gethostbyname_r proto with finds... 6 args]) + tmp_gethostbyname_r="needs_reentrant" + ]) + fi + # + if test "$tmp_gethostbyname_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_GETSERVBYPORT_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function getservbyport_r compiler visible. + +AC_DEFUN([CHECK_NEED_REENTRANT_GETSERVBYPORT_R], [ + # + AC_MSG_NOTICE([DEBUG:]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([getservbyport_r]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r links... yes]) + tmp_getservbyport_r="yes" + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r links... no]) + tmp_getservbyport_r="no" + ]) + # + if test "$tmp_getservbyport_r" = "yes"; then + AC_EGREP_CPP([getservbyport_r],[ +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto... without our definition]) + tmp_getservbyport_r="proto_wout_def" + ],[ + AC_EGREP_CPP([getservbyport_r],[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto... with our _reentrant]) + tmp_getservbyport_r="proto_with_def" + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto... not found]) + ]) + ]) + fi + # + if test "$tmp_getservbyport_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto wout finds... 4 args]) + tmp_getservbyport_r="done" + ]) + fi + if test "$tmp_getservbyport_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto wout finds... 5 args]) + tmp_getservbyport_r="done" + ]) + fi + if test "$tmp_getservbyport_r" = "proto_wout_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto wout finds... 6 args]) + tmp_getservbyport_r="done" + ]) + fi + # + if test "$tmp_getservbyport_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto with finds... 4 args]) + tmp_getservbyport_r="needs_reentrant" + ]) + fi + if test "$tmp_getservbyport_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto with finds... 5 args]) + tmp_getservbyport_r="needs_reentrant" + ]) + fi + if test "$tmp_getservbyport_r" = "proto_with_def"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include <sys/types.h> +#include <netdb.h> + ]],[[ + getservbyport_r(0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_NOTICE([DEBUG: getservbyport_r proto with finds... 6 args]) + tmp_getservbyport_r="needs_reentrant" + ]) + fi + # + if test "$tmp_getservbyport_r" = "needs_reentrant"; then + ac_cv_need_reentrant="yes" + fi +]) + + +dnl CHECK_NEED_REENTRANT_FUNCTIONS_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes several _r functions compiler visible. +dnl Internal macro for CONFIGURE_REENTRANT. + +AC_DEFUN([CHECK_NEED_REENTRANT_FUNCTIONS_R], [ + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_STRERROR_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_LOCALTIME_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_GMTIME_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_INET_NTOA_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_GETHOSTBYADDR_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_GETHOSTBYNAME_R + fi + if test "$ac_cv_need_reentrant" = "no"; then + CHECK_NEED_REENTRANT_GETSERVBYPORT_R + fi +]) + +AC_DEFUN([CHECK_NEED_REENTRANT_FUNCTIONS_R_DEBUG], [ + CHECK_NEED_REENTRANT_STRERROR_R + CHECK_NEED_REENTRANT_LOCALTIME_R + CHECK_NEED_REENTRANT_GMTIME_R + CHECK_NEED_REENTRANT_INET_NTOA_R + CHECK_NEED_REENTRANT_GETHOSTBYADDR_R + CHECK_NEED_REENTRANT_GETHOSTBYNAME_R + CHECK_NEED_REENTRANT_GETSERVBYPORT_R +]) + + +dnl CONFIGURE_FROM_NOW_ON_WITH_REENTRANT +dnl ------------------------------------------------- +dnl This macro ensures that configuration tests done +dnl after this will execute with preprocessor symbol +dnl _REENTRANT defined. This macro also ensures that +dnl the generated config file will equally define it. +dnl Internal macro for CONFIGURE_REENTRANT. + +AC_DEFUN([CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [ +AH_VERBATIM([NEED_REENTRANT], +[/* Configure process defines NEED_REENTRANT to 1 when it finds out that */ +/* _REENTRANT is required or already defined for proper configuration. */ +@%:@undef NEED_REENTRANT +@%:@if defined(NEED_REENTRANT) && !defined(_REENTRANT) +@%:@ define _REENTRANT +@%:@endif]) +cat >>confdefs.h <<_ACEOF +[@%:@ifndef _REENTRANT +@%:@ define _REENTRANT +@%:@endif] +_ACEOF +AC_DEFINE(NEED_REENTRANT, 1, []) +]) + + +dnl CONFIGURE_REENTRANT +dnl ------------------------------------------------- +dnl This first checks if the preprocessor _REENTRANT +dnl symbol is already defined. If it isn't currently +dnl defined a set of checks are performed to verify +dnl if its definition is required to make visible to +dnl the compiler a set of *_r functions. Finally, if +dnl _REENTRANT is already defined or needed it takes +dnl care of making adjustments necessary to ensure +dnl that it is defined equally for further configure +dnl tests and generated config file. + +AC_DEFUN([CONFIGURE_REENTRANT], [ + # + AC_MSG_CHECKING([if _REENTRANT is already defined]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ +#ifdef _REENTRANT + int dummy=1; +#else + force compilation error +#endif + ]]) + ],[ + AC_MSG_RESULT([yes]) + tmp_reentrant_initially_defined="yes" + ],[ + AC_MSG_RESULT([no]) + tmp_reentrant_initially_defined="no" + ]) + # + if test "$tmp_reentrant_initially_defined" = "no"; then + AC_MSG_CHECKING([if _REENTRANT is actually needed]) + ac_cv_need_reentrant="no" + CHECK_NEED_REENTRANT_FUNCTIONS_R_DEBUG + if test "$ac_cv_need_reentrant" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + AC_MSG_CHECKING([if _REENTRANT is onwards defined]) + if test "$tmp_reentrant_initially_defined" = "yes" || + test "$ac_cv_need_reentrant" = "yes"; then + CONFIGURE_FROM_NOW_ON_WITH_REENTRANT + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + # +]) + |