diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-02 11:29:45 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-02 11:29:45 (GMT) |
commit | aaa0152aeb05ac7c58b33911587a0654f4ddad1c (patch) | |
tree | 716d63ab77846709376d23a0e37e7487b8edac85 /unix | |
parent | f96662305e702a2c78089497268cff80903028e2 (diff) | |
parent | dc81b2efafb3f33e0da6dc17a3e1a4746da91fd6 (diff) | |
download | tcl-aaa0152aeb05ac7c58b33911587a0654f4ddad1c.zip tcl-aaa0152aeb05ac7c58b33911587a0654f4ddad1c.tar.gz tcl-aaa0152aeb05ac7c58b33911587a0654f4ddad1c.tar.bz2 |
Fix [16768d65f0]: Fix gethostbyname_r and gethostbyaddr_r detection on NetBSD. Patch by Kamil Rytarowski.
Diffstat (limited to 'unix')
-rwxr-xr-x | unix/configure | 162 | ||||
-rw-r--r-- | unix/tcl.m4 | 38 |
2 files changed, 194 insertions, 6 deletions
diff --git a/unix/configure b/unix/configure index ae5f7d8..1d0f261 100755 --- a/unix/configure +++ b/unix/configure @@ -12319,6 +12319,85 @@ _ACEOF else + + # Avoids picking hidden internal symbol from libc + echo "$as_me:$LINENO: checking whether gethostbyname_r is declared" >&5 +echo $ECHO_N "checking whether gethostbyname_r is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_gethostbyname_r+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <netdb.h> + +int +main () +{ +#ifndef gethostbyname_r + char *p = (char *) gethostbyname_r; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_gethostbyname_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_gethostbyname_r=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_gethostbyname_r" >&5 +echo "${ECHO_T}$ac_cv_have_decl_gethostbyname_r" >&6 +if test $ac_cv_have_decl_gethostbyname_r = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETHOSTBYNAME_R 1 +_ACEOF + + + tcl_cv_api_gethostbyname_r=yes +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETHOSTBYNAME_R 0 +_ACEOF + +tcl_cv_api_gethostbyname_r=no +fi + + + + + if test "$tcl_cv_api_gethostbyname_r" = yes; then echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyname_r+set}" = set; then @@ -12637,6 +12716,87 @@ _ACEOF fi + fi + + + # Avoids picking hidden internal symbol from libc + echo "$as_me:$LINENO: checking whether gethostbyaddr_r is declared" >&5 +echo $ECHO_N "checking whether gethostbyaddr_r is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_gethostbyaddr_r+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <netdb.h> + +int +main () +{ +#ifndef gethostbyaddr_r + char *p = (char *) gethostbyaddr_r; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_gethostbyaddr_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_gethostbyaddr_r=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_gethostbyaddr_r" >&5 +echo "${ECHO_T}$ac_cv_have_decl_gethostbyaddr_r" >&6 +if test $ac_cv_have_decl_gethostbyaddr_r = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETHOSTBYADDR_R 1 +_ACEOF + + + tcl_cv_api_gethostbyaddr_r=yes +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETHOSTBYADDR_R 0 +_ACEOF + +tcl_cv_api_gethostbyaddr_r=no +fi + + + + + if test "$tcl_cv_api_gethostbyaddr_r" = yes; then echo "$as_me:$LINENO: checking for gethostbyaddr_r" >&5 echo $ECHO_N "checking for gethostbyaddr_r... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyaddr_r+set}" = set; then @@ -12891,6 +13051,8 @@ _ACEOF fi fi + + fi fi #--------------------------------------------------------------------------- diff --git a/unix/tcl.m4 b/unix/tcl.m4 index f091a6b..f451d0e 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2679,7 +2679,20 @@ AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[ # #-------------------------------------------------------------------- -AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [ +AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [ + # Avoids picking hidden internal symbol from libc + SC_TCL_GETHOSTBYADDR_R_DECL + + if test "$tcl_cv_api_gethostbyaddr_r" = yes; then + SC_TCL_GETHOSTBYADDR_R_TYPE + fi +]) + +AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_DECL], [AC_CHECK_DECLS(gethostbyaddr_r, [ + tcl_cv_api_gethostbyaddr_r=yes],[tcl_cv_api_gethostbyaddr_r=no],[#include <netdb.h>]) +]) + +AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_TYPE], [AC_CHECK_FUNC(gethostbyaddr_r, [ AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [ AC_TRY_COMPILE([ #include <netdb.h> @@ -2740,14 +2753,27 @@ AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [ # Results: # # Might define the following vars: -# HAVE_GETHOSTBYADDR_R -# HAVE_GETHOSTBYADDR_R_3 -# HAVE_GETHOSTBYADDR_R_5 -# HAVE_GETHOSTBYADDR_R_6 +# HAVE_GETHOSTBYNAME_R +# HAVE_GETHOSTBYNAME_R_3 +# HAVE_GETHOSTBYNAME_R_5 +# HAVE_GETHOSTBYNAME_R_6 # #-------------------------------------------------------------------- -AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [ +AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [ + # Avoids picking hidden internal symbol from libc + SC_TCL_GETHOSTBYNAME_R_DECL + + if test "$tcl_cv_api_gethostbyname_r" = yes; then + SC_TCL_GETHOSTBYNAME_R_TYPE + fi +]) + +AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_DECL], [AC_CHECK_DECLS(gethostbyname_r, [ + tcl_cv_api_gethostbyname_r=yes],[tcl_cv_api_gethostbyname_r=no],[#include <netdb.h>]) +]) + +AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_TYPE], [AC_CHECK_FUNC(gethostbyname_r, [ AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [ AC_TRY_COMPILE([ #include <netdb.h> |