summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-10-02 11:22:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-10-02 11:22:40 (GMT)
commitdc81b2efafb3f33e0da6dc17a3e1a4746da91fd6 (patch)
treedf018372c15ff97c102d01257bfd8d8aca45fb81 /unix
parentf512f6d8d5b94d39b6b66c6f361ba026ba439e96 (diff)
downloadtcl-dc81b2efafb3f33e0da6dc17a3e1a4746da91fd6.zip
tcl-dc81b2efafb3f33e0da6dc17a3e1a4746da91fd6.tar.gz
tcl-dc81b2efafb3f33e0da6dc17a3e1a4746da91fd6.tar.bz2
Fix [16768d65f0]: Fix gethostbyname_r and gethostbyaddr_r detection on NetBSD. Patch by Kamil Rytarowski.
Diffstat (limited to 'unix')
-rwxr-xr-xunix/configure162
-rw-r--r--unix/tcl.m430
2 files changed, 190 insertions, 2 deletions
diff --git a/unix/configure b/unix/configure
index aedf8ff..3ac5145 100755
--- a/unix/configure
+++ b/unix/configure
@@ -12110,6 +12110,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
@@ -12428,6 +12507,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
@@ -12682,6 +12842,8 @@ _ACEOF
fi
fi
+
+ fi
fi
#---------------------------------------------------------------------------
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 6660255..7936470 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -2910,7 +2910,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>
@@ -2978,7 +2991,20 @@ AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
#
#--------------------------------------------------------------------
-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>