From ef763b13a467090cb1d08bc1c691527d8e63ebfc Mon Sep 17 00:00:00 2001 From: Stephane Bortzmeyer Date: Thu, 29 Jun 2000 13:39:16 +0000 Subject: [PATCH] autoconf support extended for Solaris (which needs -lnsl and -socket) --- SRC/TODO | 3 +- SRC/acinclude.m4 | 37 +++++++++++ SRC/aclocal.m4 | 37 +++++++++++ SRC/config.h.in | 3 + SRC/configure | 170 ++++++++++++++++++++++++++++++++++++++++++----- SRC/configure.in | 4 +- 6 files changed, 236 insertions(+), 18 deletions(-) diff --git a/SRC/TODO b/SRC/TODO index fabe266..014f9d5 100644 --- a/SRC/TODO +++ b/SRC/TODO @@ -1,7 +1,8 @@ Check the TCP timeout with T/TCP. Difficult to test, few T/TCP machines exist. -TCP timeout with long packets seem to confuse Cisco routers. +TCP timeout with long packets seem to confuse Cisco routers. Does +someone can reproduce it and perform tests? It seems to work now. diff --git a/SRC/acinclude.m4 b/SRC/acinclude.m4 index 6ba5dcb..64de750 100644 --- a/SRC/acinclude.m4 +++ b/SRC/acinclude.m4 @@ -88,3 +88,40 @@ do done ])dnl +dnl Useful macros to check libraries which are not implicit +dnl in Solaris. +AC_DEFUN([CF_LIB_NSL], +[ +AC_CHECK_LIB(nsl,gethostbyname, +[ +AC_MSG_CHECKING(if libnsl is mandatory) +AC_TRY_LINK([#include + #include + char *domain; ], + [gethostbyname(domain)], dnl + [AC_MSG_RESULT(no)], dnl + [AC_MSG_RESULT(yes); LIBS="${LIBS} -lnsl"]) +]) +]) +AC_DEFUN([CF_LIB_SOCKET], +[ +AC_CHECK_LIB(socket,socket, +[ +AC_MSG_CHECKING(if libsocket is mandatory) +AC_TRY_LINK([#include + #include + union + { + HEADER hdr; + u_char buf[512]; + } + response; + char *domain; + int requested_type; ], + [socket (AF_INET, SOCK_STREAM, 0) ], dnl + [AC_MSG_RESULT(no)], dnl + [AC_MSG_RESULT(yes); LIBS="${LIBS} -lsocket"]) +]) +]) + + diff --git a/SRC/aclocal.m4 b/SRC/aclocal.m4 index d811337..2057ea6 100644 --- a/SRC/aclocal.m4 +++ b/SRC/aclocal.m4 @@ -100,6 +100,43 @@ do done ])dnl +dnl Useful macros to check libraries which are not implicit +dnl in Solaris. +AC_DEFUN([CF_LIB_NSL], +[ +AC_CHECK_LIB(nsl,gethostbyname, +[ +AC_MSG_CHECKING(if libnsl is mandatory) +AC_TRY_LINK([#include + #include + char *domain; ], + [gethostbyname(domain)], dnl + [AC_MSG_RESULT(no)], dnl + [AC_MSG_RESULT(yes); LIBS="${LIBS} -lnsl"]) +]) +]) +AC_DEFUN([CF_LIB_SOCKET], +[ +AC_CHECK_LIB(socket,socket, +[ +AC_MSG_CHECKING(if libsocket is mandatory) +AC_TRY_LINK([#include + #include + union + { + HEADER hdr; + u_char buf[512]; + } + response; + char *domain; + int requested_type; ], + [socket (AF_INET, SOCK_STREAM, 0) ], dnl + [AC_MSG_RESULT(no)], dnl + [AC_MSG_RESULT(yes); LIBS="${LIBS} -lsocket"]) +]) +]) + + # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. diff --git a/SRC/config.h.in b/SRC/config.h.in index 3086ca5..49ab990 100644 --- a/SRC/config.h.in +++ b/SRC/config.h.in @@ -18,6 +18,9 @@ /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME +/* Define if you have the gethostbyname function. */ +#undef HAVE_GETHOSTBYNAME + /* Define if you have the gettimeofday function. */ #undef HAVE_GETTIMEOFDAY diff --git a/SRC/configure b/SRC/configure index 5480843..afa09b0 100755 --- a/SRC/configure +++ b/SRC/configure @@ -1460,13 +1460,150 @@ EOF fi + +echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 +echo "configure:1466: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + +echo $ac_n "checking if libsocket is mandatory""... $ac_c" 1>&6 +echo "configure:1502: checking if libsocket is mandatory" >&5 +cat > conftest.$ac_ext < + #include + union + { + HEADER hdr; + u_char buf[512]; + } + response; + char *domain; + int requested_type; +int main() { +socket (AF_INET, SOCK_STREAM, 0) +; return 0; } +EOF +if { (eval echo configure:1520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""no" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""yes" 1>&6; LIBS="${LIBS} -lsocket" +fi +rm -f conftest* + +else + echo "$ac_t""no" 1>&6 +fi + + + +echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 +echo "configure:1538: checking for gethostbyname in -lnsl" >&5 +ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lnsl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + +echo $ac_n "checking if libnsl is mandatory""... $ac_c" 1>&6 +echo "configure:1574: checking if libnsl is mandatory" >&5 +cat > conftest.$ac_ext < + #include + char *domain; +int main() { +gethostbyname(domain) +; return 0; } +EOF +if { (eval echo configure:1585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""no" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""yes" 1>&6; LIBS="${LIBS} -lnsl" +fi +rm -f conftest* + +else + echo "$ac_t""no" 1>&6 +fi + + echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1465: checking return type of signal handlers" >&5 +echo "configure:1602: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1483,7 +1620,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1487: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1624: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1502,12 +1639,12 @@ EOF echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:1506: checking for vprintf" >&5 +echo "configure:1643: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+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:1671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -1554,12 +1691,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:1558: checking for _doprnt" >&5 +echo "configure:1695: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+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:1723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -1606,15 +1743,15 @@ fi fi -for ac_func in gettimeofday socket sigaction +for ac_func in gettimeofday socket gethostbyname sigaction do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1613: checking for $ac_func" >&5 +echo "configure:1750: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1658,14 +1795,15 @@ EOF else echo "$ac_t""no" 1>&6 +{ echo "configure: error: Missing mandatory function" 1>&2; exit 1; } fi done echo $ac_n "checking T/TCP""... $ac_c" 1>&6 -echo "configure:1667: checking T/TCP" >&5 +echo "configure:1805: checking T/TCP" >&5 cat > conftest.$ac_ext < #include @@ -1674,7 +1812,7 @@ int main() { int foobar = MSG_EOF; ; return 0; } EOF -if { (eval echo configure:1678: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define TTCP 1 diff --git a/SRC/configure.in b/SRC/configure.in index 0aeca88..30c9d47 100644 --- a/SRC/configure.in +++ b/SRC/configure.in @@ -39,9 +39,11 @@ AC_C_CONST AC_HEADER_TIME dnl Checks for library functions. +CF_LIB_SOCKET +CF_LIB_NSL AC_TYPE_SIGNAL AC_FUNC_VPRINTF -AC_CHECK_FUNCS(gettimeofday socket sigaction) +AC_CHECK_FUNCS(gettimeofday socket gethostbyname sigaction, , AC_MSG_ERROR(Missing mandatory function)) dnl T/TCP AC_MSG_CHECKING([T/TCP])