]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
configure.in: Check for struct hostent_data and need for -D_REENTRANT for gethostbyna...
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Sun, 1 Aug 1999 00:14:00 +0000 (00:14 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Sun, 1 Aug 1999 00:14:00 +0000 (00:14 +0000)
1999-07-31  Alexandre Oliva  <oliva@dcc.unicamp.br>

* configure.in: Check for struct hostent_data and need for
-D_REENTRANT for gethostbyname_r declaration.
* java/net/natInetAddress.cc: Define _REENTRANT if needed.
(lookup): Use hostent_data for fixed_buffer.
* configure, include/config.h.in: Rebuilt.

From-SVN: r28368

libjava/ChangeLog
libjava/configure
libjava/configure.in
libjava/include/config.h.in
libjava/java/net/natInetAddress.cc

index cf051217c93fa4d0fc0241b9b027cc8778418ad2..4e15f7c18037c32ce7f850566fefc6f7c8e15253 100644 (file)
@@ -1,3 +1,11 @@
+1999-07-31  Alexandre Oliva  <oliva@dcc.unicamp.br>
+
+       * configure.in: Check for struct hostent_data and need for
+       -D_REENTRANT for gethostbyname_r declaration.
+       * java/net/natInetAddress.cc: Define _REENTRANT if needed.
+       (lookup): Use hostent_data for fixed_buffer.
+       * configure, include/config.h.in: Rebuilt.
+
 1999-07-31  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
        * include/javaprims.h (TRUE, FALSE): Redefine as themselves.
index fc95e227f4cf47f93fcd9657fd1ec37fd43b359d..5ac3fcc5cd05c8a26ddab23a8b2c54543a5b03cf 100755 (executable)
@@ -3474,6 +3474,119 @@ EOF
 fi
 rm -f conftest*
 
+
+     case " $GCINCS " in
+     *" -D_REENTRANT "*) ;;
+     *)
+               echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6
+echo "configure:3483: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
+if eval "test \"`echo '$''{'libjava_cv_gethostbyname_r_needs_reentrant'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   
+         ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+         cat > conftest.$ac_ext <<EOF
+#line 3496 "configure"
+#include "confdefs.h"
+#include <netdb.h>
+int main() {
+gethostbyname_r("", 0, 0);
+; return 0; }
+EOF
+if { (eval echo configure:3503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  libjava_cv_gethostbyname_r_needs_reentrant=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+               CPPFLAGS_SAVE="$CPPFLAGS"
+               CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+               cat > conftest.$ac_ext <<EOF
+#line 3513 "configure"
+#include "confdefs.h"
+#include <netdb.h>
+int main() {
+gethostbyname_r("", 0, 0);
+; return 0; }
+EOF
+if { (eval echo configure:3520: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  libjava_cv_gethostbyname_r_needs_reentrant=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  libjava_cv_gethostbyname_r_needs_reentrant=fail
+fi
+rm -f conftest*
+               CPPFLAGS="$CPPFLAGS_SAVE"
+         
+fi
+rm -f conftest*
+         ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+       
+fi
+
+echo "$ac_t""$libjava_cv_gethostbyname_r_needs_reentrant" 1>&6
+       if test "x$libjava_cv_gethostbyname_r_needs_reentrant" = xyes; then
+         cat >> confdefs.h <<\EOF
+#define GETHOSTBYNAME_R_NEEDS_REENTRANT 1
+EOF
+
+       fi
+     ;;
+     esac
+
+     echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6
+echo "configure:3555: checking for struct hostent_data" >&5
+if eval "test \"`echo '$''{'libjava_cv_struct_hostent_data'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+       cat > conftest.$ac_ext <<EOF
+#line 3560 "configure"
+#include "confdefs.h"
+
+#if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
+# define _REENTRANT 1
+#endif
+#include <netdb.h>
+int main() {
+struct hostent_data data;
+; return 0; }
+EOF
+if { (eval echo configure:3571: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  libjava_cv_struct_hostent_data=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  libjava_cv_struct_hostent_data=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$libjava_cv_struct_hostent_data" 1>&6
+     if test "x$libjava_cv_struct_hostent_data" = xyes; then
+       cat >> confdefs.h <<\EOF
+#define HAVE_STRUCT_HOSTENT_DATA 1
+EOF
+
+     fi
+   
 else
   echo "$ac_t""no" 1>&6
 fi
@@ -3483,12 +3596,12 @@ done
    for ac_func in gethostbyaddr_r
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3487: checking for $ac_func" >&5
+echo "configure:3600: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3492 "configure"
+#line 3605 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3511,7 +3624,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3538,7 +3651,7 @@ EOF
      # We look for the one that returns `int'.
      # Hopefully this check is robust enough.
      cat > conftest.$ac_ext <<EOF
-#line 3542 "configure"
+#line 3655 "configure"
 #include "confdefs.h"
 #include <netdb.h>
 EOF
@@ -3562,12 +3675,12 @@ done
    for ac_func in gethostname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3566: checking for $ac_func" >&5
+echo "configure:3679: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3571 "configure"
+#line 3684 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3590,7 +3703,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3614,7 +3727,7 @@ EOF
 EOF
 
      cat > conftest.$ac_ext <<EOF
-#line 3618 "configure"
+#line 3731 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -3641,12 +3754,12 @@ done
    for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np sched_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3645: checking for $ac_func" >&5
+echo "configure:3758: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3650 "configure"
+#line 3763 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3669,7 +3782,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3697,12 +3810,12 @@ done
    for ac_func in sched_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3701: checking for $ac_func" >&5
+echo "configure:3814: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3706 "configure"
+#line 3819 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3725,7 +3838,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3747,7 +3860,7 @@ EOF
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
-echo "configure:3751: checking for sched_yield in -lposix4" >&5
+echo "configure:3864: checking for sched_yield in -lposix4" >&5
 ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3755,7 +3868,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix4  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3759 "configure"
+#line 3872 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3766,7 +3879,7 @@ int main() {
 sched_yield()
 ; return 0; }
 EOF
-if { (eval echo configure:3770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3801,12 +3914,12 @@ done
    for ac_func in gettimeofday time ftime
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3805: checking for $ac_func" >&5
+echo "configure:3918: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3810 "configure"
+#line 3923 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3829,7 +3942,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3860,12 +3973,12 @@ done
    for ac_func in memmove
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3864: checking for $ac_func" >&5
+echo "configure:3977: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3869 "configure"
+#line 3982 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3888,7 +4001,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3918,12 +4031,12 @@ done
    for ac_func in memcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3922: checking for $ac_func" >&5
+echo "configure:4035: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3927 "configure"
+#line 4040 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3946,7 +4059,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3994,7 +4107,7 @@ done
    #--------------------------------------------------------------------
 
    echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
-echo "configure:3998: checking for socket libraries" >&5
+echo "configure:4111: checking for socket libraries" >&5
 if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4002,12 +4115,12 @@ else
      gcj_checkBoth=0
      unset ac_cv_func_connect
      echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:4006: checking for connect" >&5
+echo "configure:4119: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4011 "configure"
+#line 4124 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -4030,7 +4143,7 @@ connect();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -4053,7 +4166,7 @@ fi
      if test "$gcj_checkSocket" = 1; then
         unset ac_cv_func_connect
         echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:4057: checking for main in -lsocket" >&5
+echo "configure:4170: checking for main in -lsocket" >&5
 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4061,14 +4174,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4065 "configure"
+#line 4178 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4095,12 +4208,12 @@ fi
         LIBS="$LIBS -lsocket -lnsl"
         unset ac_cv_func_accept
         echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:4099: checking for accept" >&5
+echo "configure:4212: checking for accept" >&5
 if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4104 "configure"
+#line 4217 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char accept(); below.  */
@@ -4123,7 +4236,7 @@ accept();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_accept=yes"
 else
@@ -4150,12 +4263,12 @@ fi
      gcj_oldLibs=$LIBS
      LIBS="$LIBS $gcj_cv_lib_sockets"
      echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:4154: checking for gethostbyname" >&5
+echo "configure:4267: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4159 "configure"
+#line 4272 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -4178,7 +4291,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -4196,7 +4309,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:4200: checking for main in -lnsl" >&5
+echo "configure:4313: checking for main in -lnsl" >&5
 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4204,14 +4317,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4208 "configure"
+#line 4321 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4243,7 +4356,7 @@ echo "$ac_t""$gcj_cv_lib_sockets" 1>&6
 
    if test "$with_system_zlib" = yes; then
       echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
-echo "configure:4247: checking for deflate in -lz" >&5
+echo "configure:4360: checking for deflate in -lz" >&5
 ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4251,7 +4364,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lz  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4255 "configure"
+#line 4368 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4262,7 +4375,7 @@ int main() {
 deflate()
 ; return 0; }
 EOF
-if { (eval echo configure:4266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4291,7 +4404,7 @@ fi
    # requires -ldl.
    if test "$GC" = boehm; then
       echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
-echo "configure:4295: checking for main in -ldl" >&5
+echo "configure:4408: checking for main in -ldl" >&5
 ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4299,14 +4412,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4303 "configure"
+#line 4416 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4415,17 +4528,17 @@ for ac_hdr in unistd.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sy
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4419: checking for $ac_hdr" >&5
+echo "configure:4532: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4424 "configure"
+#line 4537 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4429: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4542: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4455,17 +4568,17 @@ for ac_hdr in dirent.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4459: checking for $ac_hdr" >&5
+echo "configure:4572: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4464 "configure"
+#line 4577 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4469: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4493,16 +4606,16 @@ done
 
 
 echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:4497: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
+echo "configure:4610: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 4499 "configure"
+#line 4612 "configure"
 #include "confdefs.h"
 #include <netinet/in.h>
 int main() {
 struct sockaddr_in6 addr6;
 ; return 0; }
 EOF
-if { (eval echo configure:4506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define HAVE_INET6 1
@@ -4518,16 +4631,16 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
-echo "configure:4522: checking for socklen_t in sys/socket.h" >&5
+echo "configure:4635: checking for socklen_t in sys/socket.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 4524 "configure"
+#line 4637 "configure"
 #include "confdefs.h"
 #include <sys/socket.h>
 int main() {
 socklen_t x = 5;
 ; return 0; }
 EOF
-if { (eval echo configure:4531: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define HAVE_SOCKLEN_T 1
@@ -4543,16 +4656,16 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
-echo "configure:4547: checking for tm_gmtoff in struct tm" >&5
+echo "configure:4660: checking for tm_gmtoff in struct tm" >&5
 cat > conftest.$ac_ext <<EOF
-#line 4549 "configure"
+#line 4662 "configure"
 #include "confdefs.h"
 #include <time.h>
 int main() {
 struct tm tim; tim.tm_gmtoff = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4556: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4669: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define STRUCT_TM_HAS_GMTOFF 1
@@ -4565,16 +4678,16 @@ else
   rm -rf conftest*
   echo "$ac_t""no" 1>&6
    echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6
-echo "configure:4569: checking for global timezone variable" >&5
+echo "configure:4682: checking for global timezone variable" >&5
             cat > conftest.$ac_ext <<EOF
-#line 4571 "configure"
+#line 4684 "configure"
 #include "confdefs.h"
 #include <time.h>
 int main() {
 long z2 = timezone;
 ; return 0; }
 EOF
-if { (eval echo configure:4578: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4691: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define HAVE_TIMEZONE 1
@@ -4594,19 +4707,19 @@ rm -f conftest*
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:4598: checking for working alloca.h" >&5
+echo "configure:4711: checking for working alloca.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4603 "configure"
+#line 4716 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:4610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -4627,12 +4740,12 @@ EOF
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:4631: checking for alloca" >&5
+echo "configure:4744: checking for alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4636 "configure"
+#line 4749 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -4660,7 +4773,7 @@ int main() {
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:4664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -4692,12 +4805,12 @@ EOF
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:4696: checking whether alloca needs Cray hooks" >&5
+echo "configure:4809: checking whether alloca needs Cray hooks" >&5
 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4701 "configure"
+#line 4814 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -4722,12 +4835,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4726: checking for $ac_func" >&5
+echo "configure:4839: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4731 "configure"
+#line 4844 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4750,7 +4863,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4777,7 +4890,7 @@ done
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:4781: checking stack direction for C alloca" >&5
+echo "configure:4894: checking stack direction for C alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4785,7 +4898,7 @@ else
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 4789 "configure"
+#line 4902 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -4804,7 +4917,7 @@ main ()
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:4808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_stack_direction=1
 else
@@ -4827,7 +4940,7 @@ fi
 
 
 echo $ac_n "checking for g++ -g jboolean bug""... $ac_c" 1>&6
-echo "configure:4831: checking for g++ -g jboolean bug" >&5
+echo "configure:4944: checking for g++ -g jboolean bug" >&5
 if eval "test \"`echo '$''{'libjava_cv_gxx_debug_jboolean_bug'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4840,14 +4953,14 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
 cross_compiling=$ac_cv_prog_cxx_cross
 
   cat > conftest.$ac_ext <<EOF
-#line 4844 "configure"
+#line 4957 "configure"
 #include "confdefs.h"
 typedef __java_boolean jboolean;
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:4851: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libjava_cv_gxx_debug_jboolean_bug=no
 else
@@ -4881,7 +4994,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4885: checking for $ac_word" >&5
+echo "configure:4998: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
index 9f926a072cc581c7c07df1faaea7c8b94d870140..611f16b434f239e7b42a46cc3779fae80c845aef 100644 (file)
@@ -309,7 +309,48 @@ else
      # We look for the one that returns `int'.
      # Hopefully this check is robust enough.
      AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [
-       AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT)])])
+       AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT)])
+
+     case " $GCINCS " in
+     *" -D_REENTRANT "*) ;;
+     *)
+       dnl On DU4.0, gethostbyname_r is only declared with -D_REENTRANT
+       AC_CACHE_CHECK([whether gethostbyname_r declaration requires -D_REENTRANT],
+       [libjava_cv_gethostbyname_r_needs_reentrant],
+       [ AC_LANG_SAVE
+         AC_LANG_CPLUSPLUS
+         AC_TRY_COMPILE([#include <netdb.h>],
+           [gethostbyname_r("", 0, 0);],
+           [libjava_cv_gethostbyname_r_needs_reentrant=no], [dnl
+               CPPFLAGS_SAVE="$CPPFLAGS"
+               CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+               AC_TRY_COMPILE([#include <netdb.h>], [gethostbyname_r("", 0, 0);],
+                   [libjava_cv_gethostbyname_r_needs_reentrant=yes],
+                   [libjava_cv_gethostbyname_r_needs_reentrant=fail])
+               CPPFLAGS="$CPPFLAGS_SAVE"
+         ])
+         AC_LANG_RESTORE
+       ])
+       if test "x$libjava_cv_gethostbyname_r_needs_reentrant" = xyes; then
+         AC_DEFINE(GETHOSTBYNAME_R_NEEDS_REENTRANT, 1, [Define if gethostbyname_r is only declared if _REENTRANT is defined])
+       fi
+     ;;
+     esac
+
+     AC_CACHE_CHECK([for struct hostent_data],
+       [libjava_cv_struct_hostent_data], [dnl
+       AC_TRY_COMPILE([
+#if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
+# define _REENTRANT 1
+#endif
+#include <netdb.h>], [struct hostent_data data;],
+         [libjava_cv_struct_hostent_data=yes],
+         [libjava_cv_struct_hostent_data=no])])
+     if test "x$libjava_cv_struct_hostent_data" = xyes; then
+       AC_DEFINE(HAVE_STRUCT_HOSTENT_DATA, 1,
+         [Define if struct hostent_data is defined in netdb.h])
+     fi
+   ])
 
    AC_CHECK_FUNCS(gethostbyaddr_r, [
      AC_DEFINE(HAVE_GETHOSTBYADDR_R)
index be94a759c0db26620ecdc230b111964c29bc6051..b87f54e8edece6d3fb529e2bc30f5dbbd2cd873c 100644 (file)
 /* Version number of package */
 #undef VERSION
 
+/* Define if gethostbyname_r is only declared if _REENTRANT is defined */
+#undef GETHOSTBYNAME_R_NEEDS_REENTRANT
+
+/* Define if struct hostent_data is defined in netdb.h */
+#undef HAVE_STRUCT_HOSTENT_DATA
+
index feac469f3796646d4356a8bb0dc702a7b13b52cf..b15590a0ebc70cb6d8908efd3f8f2b99a56ddbc5 100644 (file)
@@ -10,6 +10,10 @@ details.  */
 
 #include <config.h>
 
+#if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
+# define _REENTRANT 1
+#endif
+
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -97,6 +101,9 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
   struct hostent *hptr = NULL;
 #if defined (HAVE_GETHOSTBYNAME_R) || defined (HAVE_GETHOSTBYADDR_R)
   struct hostent hent_r;
+#if HAVE_STRUCT_HOSTENT_DATA
+  struct hostent_data fixed_buffer, *buffer_r = &fixed_buffer;
+#else
 #if defined (__GLIBC__) 
   // FIXME: in glibc, gethostbyname_r returns NETDB_INTERNAL to herr and
   // ERANGE to errno if the buffer size is too small, rather than what is 
@@ -108,6 +115,7 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
 #endif
   char *buffer_r = fixed_buffer;
   int size_r = sizeof (fixed_buffer);
+#endif
 #endif
 
   if (host != NULL)
@@ -122,10 +130,13 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
       JvGetStringUTFRegion (host, 0, host->length(), hostname);
       buf[len] = '\0';
 #ifdef HAVE_GETHOSTBYNAME_R
-      int herr = 0;
       while (true)
        {
          int ok;
+#if HAVE_STRUCT_HOSTENT_DATA
+         ok = ! gethostbyname_r (hostname, &hent_r, buffer_r);
+#else
+         int herr = 0;
 #ifdef GETHOSTBYNAME_R_RETURNS_INT
          ok = ! gethostbyname_r (hostname, &hent_r, buffer_r, size_r,
                                  &hptr, &herr);
@@ -139,6 +150,7 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
              buffer_r = (char *) _Jv_AllocBytesChecked (size_r);
            }
          else
+#endif /* HAVE_STRUCT_HOSTENT_DATA */
            break;
        }
 #else
@@ -171,10 +183,13 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
        JvFail ("unrecognized size");
 
 #ifdef HAVE_GETHOSTBYADDR_R
-      int herr = 0;
       while (true)
        {
          int ok;
+#if HAVE_STRUCT_HOSTENT_DATA
+         ok = ! gethostbyaddr_r (val, len, type, &hent_r, buffer_r);
+#else
+         int herr = 0;
 #ifdef GETHOSTBYADDR_R_RETURNS_INT
          ok = ! gethostbyaddr_r (val, len, type, &hent_r,
                                  buffer_r, size_r, &hptr, &herr);
@@ -189,6 +204,7 @@ java::net::InetAddress::lookup (jstring host, java::net::InetAddress* iaddr,
              buffer_r = (char *) _Jv_AllocBytesChecked (size_r);
            }
          else 
+#endif /* HAVE_STRUCT_HOSTENT_DATA */
            break;
        }
 #else /* HAVE_GETHOSTBYADDR_R */