From ea31416b4fcdf23732355a8002f93f29e3b3d2db Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Wed, 12 May 1999 05:34:59 +0000 Subject: [PATCH] AC_PREREQ; support both mit-pthreads and ptl2 on NetBSD; sa_len fixes --- config.h.in | 3 + configure | 220 ++++++++++++++++++++++++++++++++++----------------- configure.in | 83 +++++++++++++++++-- 3 files changed, 226 insertions(+), 80 deletions(-) diff --git a/config.h.in b/config.h.in index 7576e6d84b..b6f5faf1b9 100644 --- a/config.h.in +++ b/config.h.in @@ -30,6 +30,9 @@ /* define if your struct sockaddr has a sa_len member */ #undef HAVE_SA_LEN +/* define on DEC OSF to enable 4.4BSD style sa_len support */ +#undef _SOCKADDR_LEN + /* Define if you have the header file. */ #undef HAVE_FCNTL_H diff --git a/configure b/configure index 068f69165f..5e8e70f31a 100755 --- a/configure +++ b/configure @@ -1,6 +1,8 @@ #! /bin/sh -# From configure.in Revision: 1.21 +# From configure.in Revision: 1.22 + + # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.12 @@ -13,6 +15,10 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: +ac_help="$ac_help + --with-mit-pthreads use the mit-pthreads thread library" +ac_help="$ac_help + --with-ptl2 use the ptl2 thread library" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -548,7 +554,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:552: checking host system type" >&5 +echo "configure:558: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -570,7 +576,7 @@ echo "$ac_t""$host" 1>&6 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:574: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:580: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -599,7 +605,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:603: checking for $ac_word" >&5 +echo "configure:609: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -636,7 +642,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:640: checking for a BSD compatible install" >&5 +echo "configure:646: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -710,10 +716,77 @@ if test "X$CC" = "X" ; then esac fi + +case "$host" in + *-netbsd*) + CC="gcc" + echo $ac_n "checking which thread library to use""... $ac_c" 1>&6 +echo "configure:725: checking which thread library to use" >&5 + + # Check whether --with-mit-pthreads or --without-mit-pthreads was given. +if test "${with_mit_pthreads+set}" = set; then + withval="$with_mit_pthreads" + use_mit_pthreads="$withval" +else + use_mit_pthreads="no" +fi + + + # Check whether --with-ptl2 or --without-ptl2 was given. +if test "${with_ptl2+set}" = set; then + withval="$with_ptl2" + use_ptl2="$withval" +else + use_ptl2="no" +fi + + + + case "$use_mit_pthreads+$use_ptl2" in + no+no) + if test -d /usr/pkg/pthreads + then + use_mit_pthreads="yes" + fi + if test -d /usr/pkg/PTL + then + use_ptl2="yes" + fi + ;; + esac + + case "$use_mit_pthreads+$use_ptl2" in + yes+no) + echo "$ac_t""mit-pthreads" 1>&6 + pkg="/usr/pkg/pthreads" + lib1="-L$pkg/lib -Wl,-R$pkg/lib" + lib2="-lpthread -lm -lgcc -lpthread" + LIBS="$lib1 $lib2 $LIBS" + STD_CINCLUDES="-I$pkg/include" + ;; + no+yes) + echo "$ac_t""PTL2" 1>&6 + pkg="/usr/pkg/PTL" + LIBS="-L/usr/pkg/lib -lPTL $LIBS" + STD_CINCLUDES="-nostdinc -idirafter $pkg/include" + ;; + *) + { echo "configure: error: no thread library. + +Please choose a thread library using one of + + configure --with-mit-pthreads + configure --with-ptl2 +" 1>&2; exit 1; } + ;; + esac + ;; +esac + # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:717: checking for $ac_word" >&5 +echo "configure:790: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -742,7 +815,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:746: checking for $ac_word" >&5 +echo "configure:819: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -790,7 +863,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:794: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:867: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -800,11 +873,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -824,12 +897,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:828: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:901: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:833: checking whether we are using GNU C" >&5 +echo "configure:906: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -838,7 +911,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:842: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:915: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -853,7 +926,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:857: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:930: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -882,7 +955,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:886: checking how to run the C preprocessor" >&5 +echo "configure:959: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -897,13 +970,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:907: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:980: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -914,13 +987,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:997: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -943,12 +1016,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:947: checking for ANSI C header files" >&5 +echo "configure:1020: 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 < #include @@ -956,7 +1029,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -973,7 +1046,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 @@ -991,7 +1064,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 @@ -1012,7 +1085,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1023,7 +1096,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1050,17 +1123,17 @@ for ac_hdr in fcntl.h sys/time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1054: checking for $ac_hdr" >&5 +echo "configure:1127: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1064: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1137: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1088,12 +1161,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1092: checking for working const" >&5 +echo "configure:1165: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1163,21 +1236,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1167: checking for inline" >&5 +echo "configure:1240: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1254: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1203,12 +1276,12 @@ EOF esac echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1207: checking for size_t" >&5 +echo "configure:1280: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1236,12 +1309,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1240: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1313: 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 < #include @@ -1250,7 +1323,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1254: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1327: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1272,7 +1345,7 @@ fi echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:1276: checking for pthread_create in -lpthread" >&5 +echo "configure:1349: checking for pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1280,7 +1353,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1317,7 +1390,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for __pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:1321: checking for __pthread_create in -lpthread" >&5 +echo "configure:1394: checking for __pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'__pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1325,7 +1398,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1364,7 +1437,7 @@ else fi echo $ac_n "checking for __pthread_create_system in -lpthread""... $ac_c" 1>&6 -echo "configure:1368: checking for __pthread_create_system in -lpthread" >&5 +echo "configure:1441: checking for __pthread_create_system in -lpthread" >&5 ac_lib_var=`echo pthread'_'__pthread_create_system | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1372,7 +1445,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1419,7 +1492,7 @@ case "$host" in ;; *) echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:1423: checking for socket in -lsocket" >&5 +echo "configure:1496: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1427,7 +1500,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1466,7 +1539,7 @@ else fi echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6 -echo "configure:1470: checking for inet_ntoa in -lnsl" >&5 +echo "configure:1543: checking for inet_ntoa in -lnsl" >&5 ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1474,7 +1547,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1516,12 +1589,12 @@ fi esac echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6 -echo "configure:1520: checking for inet_ntop" >&5 +echo "configure:1593: checking for inet_ntop" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_ntop'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_inet_ntop=yes" else @@ -1571,12 +1644,12 @@ EOF fi echo $ac_n "checking for inet_pton""... $ac_c" 1>&6 -echo "configure:1575: checking for inet_pton" >&5 +echo "configure:1648: checking for inet_pton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_pton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_inet_pton=yes" else @@ -1626,12 +1699,12 @@ EOF fi echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 -echo "configure:1630: checking for inet_aton" >&5 +echo "configure:1703: checking for inet_aton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_inet_aton=yes" else @@ -1687,11 +1760,6 @@ if test "X$GCC" = "Xyes"; then *-sun-solaris*) LIBS="$LIBS -lthread" ;; - *-netbsd*) - CC="gcc" - LIBS="-L/usr/pkg/lib -lPTL $LIBS" - STD_CINCLUDES="-nostdinc -idirafter /usr/pkg/PTL/include" - ;; esac else case "$host" in @@ -1717,20 +1785,27 @@ EOF *-hp-hpux*) cat >> confdefs.h <<\EOF #define NEED_AF_INET6 1 +EOF + + ;; + *-dec-osf*) + cat >> confdefs.h <<\EOF +#define _SOCKADDR_LEN 1 EOF ;; esac + echo $ac_n "checking for sa_len in struct sockaddr""... $ac_c" 1>&6 -echo "configure:1727: checking for sa_len in struct sockaddr" >&5 +echo "configure:1802: checking for sa_len in struct sockaddr" >&5 cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "sa_len" >/dev/null 2>&1; then + egrep "sa_len[^a-z0-9_]" >/dev/null 2>&1; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -1745,7 +1820,6 @@ rm -f conftest* - BIND9_TOP_BUILDDIR=`pwd` diff --git a/configure.in b/configure.in index caffe3fa61..01dbc6ab45 100644 --- a/configure.in +++ b/configure.in @@ -13,7 +13,9 @@ dnl PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS dnl ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS dnl SOFTWARE. -AC_REVISION($Revision: 1.22 $) +AC_REVISION($Revision: 1.23 $) + +AC_PREREQ(2.12) AC_INIT(lib/dns/name.c) AC_CONFIG_HEADER(config.h) @@ -56,6 +58,70 @@ if test "X$CC" = "X" ; then esac fi +dnl +dnl NetBSD has two alternative pthreads implementations. Make the +dnl user choose one by saying --with-mit-pthreads or --with-ptl2 +dnl if necessary. +dnl + +case "$host" in + *-netbsd*) + CC="gcc" + AC_MSG_CHECKING(which thread library to use) + + AC_ARG_WITH(mit-pthreads, + [ --with-mit-pthreads use the mit-pthreads thread library], + use_mit_pthreads="$withval", use_mit_pthreads="no") + + AC_ARG_WITH(ptl2, + [ --with-ptl2 use the ptl2 thread library], + use_ptl2="$withval", use_ptl2="no") + + dnl If user did not choose a thread library explicitly, + dnl try to choose one automatically. This will work when + dnl exactly one library is installed. + + case "$use_mit_pthreads+$use_ptl2" in + no+no) + if test -d /usr/pkg/pthreads + then + use_mit_pthreads="yes" + fi + if test -d /usr/pkg/PTL + then + use_ptl2="yes" + fi + ;; + esac + + case "$use_mit_pthreads+$use_ptl2" in + yes+no) + AC_MSG_RESULT(mit-pthreads) + pkg="/usr/pkg/pthreads" + lib1="-L$pkg/lib -Wl,-R$pkg/lib" + lib2="-lpthread -lm -lgcc -lpthread" + LIBS="$lib1 $lib2 $LIBS" + STD_CINCLUDES="-I$pkg/include" + ;; + no+yes) + AC_MSG_RESULT(PTL2) + pkg="/usr/pkg/PTL" + LIBS="-L/usr/pkg/lib -lPTL $LIBS" + STD_CINCLUDES="-nostdinc -idirafter $pkg/include" + ;; + *) + AC_MSG_ERROR([no thread library. + +Please choose a thread library using one of + + configure --with-mit-pthreads + configure --with-ptl2 +]) + ;; + esac + ;; +esac + AC_PROG_CC AC_HEADER_STDC @@ -112,11 +178,6 @@ if test "X$GCC" = "Xyes"; then *-sun-solaris*) LIBS="$LIBS -lthread" ;; - *-netbsd*) - CC="gcc" - LIBS="-L/usr/pkg/lib -lPTL $LIBS" - STD_CINCLUDES="-nostdinc -idirafter /usr/pkg/PTL/include" - ;; esac else case "$host" in @@ -142,10 +203,18 @@ case "$host" in *-hp-hpux*) AC_DEFINE(NEED_AF_INET6) ;; + *-dec-osf*) + dnl 4.4BSD sa_len support is not turned on + dnl by default, see netintro(7) + AC_DEFINE(_SOCKADDR_LEN) + ;; esac +dnl Look for a 4.4BSD-style sa_len member in struct sockaddr. +dnl Be careful not to be fooled by the IRIX "sa_len2" member. + AC_MSG_CHECKING(for sa_len in struct sockaddr) -AC_EGREP_HEADER(sa_len, sys/socket.h, +AC_EGREP_HEADER([sa_len[^a-z0-9_]], sys/socket.h, [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SA_LEN)], [AC_MSG_RESULT(no)])