summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2007-11-13 16:10:24 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2007-11-13 16:10:24 (GMT)
commit106bfb35165b65c6a2dc1920ad7d52b8bec71659 (patch)
tree48e04f4c3fa430bdd7674742dfd6a29579930817 /unix
parenta11af924b2bb8efa1f392323ec9a5b6047687e7e (diff)
downloadtcl-106bfb35165b65c6a2dc1920ad7d52b8bec71659.zip
tcl-106bfb35165b65c6a2dc1920ad7d52b8bec71659.tar.gz
tcl-106bfb35165b65c6a2dc1920ad7d52b8bec71659.tar.bz2
Added autoconf goo to detect availability of getaddrinfo
Diffstat (limited to 'unix')
-rwxr-xr-xunix/configure165
-rw-r--r--unix/configure.in4
-rw-r--r--unix/tcl.m431
3 files changed, 199 insertions, 1 deletions
diff --git a/unix/configure b/unix/configure
index faa8fdd..74e877b 100755
--- a/unix/configure
+++ b/unix/configure
@@ -10272,6 +10272,171 @@ _ACEOF
fi
+echo "$as_me:$LINENO: checking for getaddrinfo" >&5
+echo $ECHO_N "checking for getaddrinfo... $ECHO_C" >&6
+if test "${ac_cv_func_getaddrinfo+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. */
+/* Define getaddrinfo to an innocuous variant, in case <limits.h> declares getaddrinfo.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define getaddrinfo innocuous_getaddrinfo
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getaddrinfo (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef getaddrinfo
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char getaddrinfo ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_getaddrinfo) || defined (__stub___getaddrinfo)
+choke me
+#else
+char (*f) () = getaddrinfo;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != getaddrinfo;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 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_exeext'
+ { (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_func_getaddrinfo=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_getaddrinfo=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_getaddrinfo" >&5
+echo "${ECHO_T}$ac_cv_func_getaddrinfo" >&6
+if test $ac_cv_func_getaddrinfo = yes; then
+
+ echo "$as_me:$LINENO: checking for getaddrinfo" >&5
+echo $ECHO_N "checking for getaddrinfo... $ECHO_C" >&6
+if test "${tcl_cv_api_getaddrinfo+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 ()
+{
+
+ const char *name, *port;
+ struct addrinfo *aiPtr, hints;
+ (void)getaddrinfo(name,port, &hints, &aiPtr);
+ (void)freeaddrinfo(aiPtr);
+
+ ;
+ 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
+ tcl_cv_api_getaddrinfo=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_getaddrinfo=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_api_getaddrinfo" >&5
+echo "${ECHO_T}$tcl_cv_api_getaddrinfo" >&6
+ tcl_ok=$tcl_cv_api_getaddrinfo
+ if test "$tcl_ok" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETADDRINFO 1
+_ACEOF
+
+ fi
+
+fi
+
+
#--------------------------------------------------------------------
# Look for thread-safe variants of some library functions.
#--------------------------------------------------------------------
diff --git a/unix/configure.in b/unix/configure.in
index ed1cb51..fdc0f8f 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tcl installation
dnl to configure the system for the local environment.
#
-# RCS: @(#) $Id: configure.in,v 1.168 2007/11/10 22:24:14 msofer Exp $
+# RCS: @(#) $Id: configure.in,v 1.169 2007/11/13 16:10:29 patthoyts Exp $
AC_INIT([tcl],[8.5])
AC_PREREQ(2.59)
@@ -165,6 +165,8 @@ if test "`uname -s`" = "Darwin" && test "${TCL_THREADS}" = 1 && \
fi
AC_CHECK_FUNC(realpath, , [AC_DEFINE(NO_REALPATH, 1, [Do we have realpath()])])
+SC_TCL_GETADDRINFO
+
#--------------------------------------------------------------------
# Look for thread-safe variants of some library functions.
#--------------------------------------------------------------------
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 73c1606..eb2c6b9 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -3006,6 +3006,37 @@ AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
])])
#--------------------------------------------------------------------
+# SC_TCL_GETADDRINFO
+#
+# Check if we have 'getaddrinfo'
+#
+# Arguments:
+# None
+#
+# Results:
+# Might define the following vars:
+# HAVE_GETADDRINFO
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_TCL_GETADDRINFO], [AC_CHECK_FUNC(getaddrinfo, [
+ AC_CACHE_CHECK([for getaddrinfo], tcl_cv_api_getaddrinfo, [
+ AC_TRY_COMPILE([
+ #include <netdb.h>
+ ], [
+ const char *name, *port;
+ struct addrinfo *aiPtr, hints;
+ (void)getaddrinfo(name,port, &hints, &aiPtr);
+ (void)freeaddrinfo(aiPtr);
+ ], tcl_cv_api_getaddrinfo=yes, tcl_cv_getaddrinfo=no)])
+ tcl_ok=$tcl_cv_api_getaddrinfo
+ if test "$tcl_ok" = yes; then
+ AC_DEFINE(HAVE_GETADDRINFO, 1,
+ [Define to 1 if getaddrinfo is available.])
+ fi
+])])
+
+#--------------------------------------------------------------------
# SC_TCL_GETPWUID_R
#
# Check if we have MT-safe variant of getpwuid() and if yes,