tconfigure test added to detect presence of socklen_t data type - vaccinewars - be a doctor and try to vaccinate the world (HTM) git clone git://src.adamsgaard.dk/vaccinewars (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit f96ff1bb11366328567f7cc6df2690634d07e646 (DIR) parent bc6b11e2dfe46a2ff4058c81fb68b1cec283a7cc (HTM) Author: Ben Webb <ben@salilab.org> Date: Sun, 29 Apr 2001 01:48:30 +0000 configure test added to detect presence of socklen_t data type Diffstat: M acconfig.h | 3 +++ M config.h.in | 3 +++ M configure | 126 +++++++++++++++++++------------ M configure.in | 8 ++++++++ M src/message.c | 6 +++++- 5 files changed, 95 insertions(+), 51 deletions(-) --- (DIR) diff --git a/acconfig.h b/acconfig.h t@@ -17,6 +17,9 @@ /* Use a graphical server? */ #undef GUI_SERVER +/* Do we have the socklen_t data type? */ +#undef HAVE_SOCKLEN_T + #undef ENABLE_NLS #undef HAVE_CATGETS #undef HAVE_GETTEXT (DIR) diff --git a/config.h.in b/config.h.in t@@ -75,6 +75,9 @@ /* Use a graphical server? */ #undef GUI_SERVER +/* Do we have the socklen_t data type? */ +#undef HAVE_SOCKLEN_T + #undef ENABLE_NLS #undef HAVE_CATGETS #undef HAVE_GETTEXT (DIR) diff --git a/configure b/configure t@@ -3923,6 +3923,32 @@ EOF LDFLAGS="$LDFLAGS `glib-config --libs`" GUI_SERVER="no" + + echo $ac_n "checking for socklen_t data type""... $ac_c" 1>&6 +echo "configure:3929: checking for socklen_t data type" >&5 + cat > conftest.$ac_ext <<EOF +#line 3931 "configure" +#include "confdefs.h" +#include <sys/types.h> + #include <sys/socket.h> +int main() { +socklen_t val +; return 0; } +EOF +if { (eval echo configure:3939: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_SOCKLEN_T 1 +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* fi if test "$GUI_CLIENT" = "yes" ; then t@@ -3959,12 +3985,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3963: checking for ANSI C header files" >&5 +echo "configure:3989: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3968 "configure" +#line 3994 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> t@@ -3972,7 +3998,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3976: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4002: \"$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* t@@ -3989,7 +4015,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 3993 "configure" +#line 4019 "configure" #include "confdefs.h" #include <string.h> EOF t@@ -4007,7 +4033,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 4011 "configure" +#line 4037 "configure" #include "confdefs.h" #include <stdlib.h> EOF t@@ -4028,7 +4054,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 4032 "configure" +#line 4058 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') t@@ -4039,7 +4065,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:4043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else t@@ -4063,12 +4089,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:4067: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:4093: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4072 "configure" +#line 4098 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> t@@ -4084,7 +4110,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:4088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else t@@ -4108,17 +4134,17 @@ for ac_hdr in fcntl.h sys/time.h unistd.h stdlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4112: checking for $ac_hdr" >&5 +echo "configure:4138: 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 4117 "configure" +#line 4143 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4122: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4148: \"$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* t@@ -4146,12 +4172,12 @@ done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:4150: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:4176: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4155 "configure" +#line 4181 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> t@@ -4160,7 +4186,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:4164: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4190: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else t@@ -4181,12 +4207,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:4185: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:4211: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4190 "configure" +#line 4216 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> t@@ -4194,7 +4220,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:4198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else t@@ -4216,7 +4242,7 @@ fi echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:4220: checking size of long long" >&5 +echo "configure:4246: checking size of long long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -4224,7 +4250,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 4228 "configure" +#line 4254 "configure" #include "confdefs.h" #include <stdio.h> main() t@@ -4235,7 +4261,7 @@ main() exit(0); } EOF -if { (eval echo configure:4239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_long=`cat conftestval` else t@@ -4256,7 +4282,7 @@ EOF echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:4260: checking for 8-bit clean memcmp" >&5 +echo "configure:4286: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -4264,7 +4290,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <<EOF -#line 4268 "configure" +#line 4294 "configure" #include "confdefs.h" main() t@@ -4274,7 +4300,7 @@ main() } EOF -if { (eval echo configure:4278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else t@@ -4292,7 +4318,7 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6 -echo "configure:4296: checking whether setvbuf arguments are reversed" >&5 +echo "configure:4322: checking whether setvbuf arguments are reversed" >&5 if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else t@@ -4300,7 +4326,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 4304 "configure" +#line 4330 "configure" #include "confdefs.h" #include <stdio.h> /* If setvbuf has the reversed format, exit 0. */ t@@ -4314,7 +4340,7 @@ main () { exit(0); /* Non-reversed systems segv here. */ } EOF -if { (eval echo configure:4318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setvbuf_reversed=yes else t@@ -4338,12 +4364,12 @@ EOF fi echo $ac_n "checking for strftime""... $ac_c" 1>&6 -echo "configure:4342: checking for strftime" >&5 +echo "configure:4368: checking for strftime" >&5 if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4347 "configure" +#line 4373 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strftime(); below. */ t@@ -4366,7 +4392,7 @@ strftime(); ; return 0; } EOF -if { (eval echo configure:4370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strftime=yes" else t@@ -4388,7 +4414,7 @@ else echo "$ac_t""no" 1>&6 # strftime is in -lintl on SCO UNIX. echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 -echo "configure:4392: checking for strftime in -lintl" >&5 +echo "configure:4418: checking for strftime in -lintl" >&5 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 t@@ -4396,7 +4422,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 4400 "configure" +#line 4426 "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 t@@ -4407,7 +4433,7 @@ int main() { strftime() ; return 0; } EOF -if { (eval echo configure:4411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4437: \"$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 t@@ -4436,12 +4462,12 @@ fi for ac_func in strdup strstr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4440: checking for $ac_func" >&5 +echo "configure:4466: 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 4445 "configure" +#line 4471 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ t@@ -4464,7 +4490,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4494: \"$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 t@@ -4495,14 +4521,14 @@ if test "$CYGWIN" = "yes" ; then else echo $ac_n "checking for library containing socket""... $ac_c" 1>&6 -echo "configure:4499: checking for library containing socket" >&5 +echo "configure:4525: checking for library containing socket" >&5 if eval "test \"`echo '$''{'ac_cv_search_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_socket="no" cat > conftest.$ac_ext <<EOF -#line 4506 "configure" +#line 4532 "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 t@@ -4513,7 +4539,7 @@ int main() { socket() ; return 0; } EOF -if { (eval echo configure:4517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socket="none required" else t@@ -4524,7 +4550,7 @@ rm -f conftest* test "$ac_cv_search_socket" = "no" && for i in socket; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 4528 "configure" +#line 4554 "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 t@@ -4535,7 +4561,7 @@ int main() { socket() ; return 0; } EOF -if { (eval echo configure:4539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socket="-l$i" break t@@ -4557,14 +4583,14 @@ else : fi echo $ac_n "checking for library containing gethostbyname""... $ac_c" 1>&6 -echo "configure:4561: checking for library containing gethostbyname" >&5 +echo "configure:4587: checking for library containing gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_search_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_gethostbyname="no" cat > conftest.$ac_ext <<EOF -#line 4568 "configure" +#line 4594 "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 t@@ -4575,7 +4601,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:4579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_gethostbyname="none required" else t@@ -4586,7 +4612,7 @@ rm -f conftest* test "$ac_cv_search_gethostbyname" = "no" && for i in nsl socket; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <<EOF -#line 4590 "configure" +#line 4616 "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 t@@ -4597,7 +4623,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:4601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_gethostbyname="-l$i" break t@@ -4620,12 +4646,12 @@ fi for ac_func in socket gethostbyname select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4624: checking for $ac_func" >&5 +echo "configure:4650: 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 4629 "configure" +#line 4655 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ t@@ -4648,7 +4674,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4678: \"$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 (DIR) diff --git a/configure.in b/configure.in t@@ -95,6 +95,14 @@ else dnl Use console server by default GUI_SERVER="no" + + dnl Some systems use int rather than socklen_t as an argument to getsockopt + AC_MSG_CHECKING([for socklen_t data type]) + AC_TRY_COMPILE([#include <sys/types.h> + #include <sys/socket.h>],[socklen_t val], + [AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_SOCKLEN_T)], + [AC_MSG_RESULT([no])]) fi if test "$GUI_CLIENT" = "yes" ; then (DIR) diff --git a/src/message.c b/src/message.c t@@ -776,7 +776,11 @@ char *FinishSetupNetwork() { return NULL; #else int optval; +#ifdef HAVE_SOCKLEN_T socklen_t optlen; +#else + int optlen; +#endif optlen=sizeof(optval); if (getsockopt(ClientSock,SOL_SOCKET,SO_ERROR,&optval,&optlen)==-1) { t@@ -788,7 +792,7 @@ char *FinishSetupNetwork() { } else { return NoConnect; } -#endif +#endif /* CYGWIN */ } #endif /* NETWORKING */