From 4f74ab0f44c6dd4712f3edd732ea04d6c1ff75c8 Mon Sep 17 00:00:00 2001 From: hniksic Date: Mon, 3 Nov 2003 17:05:06 -0800 Subject: [PATCH] [svn] Move some checks to aclocal.m4. --- ChangeLog | 2 ++ aclocal.m4 | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 52 +++++++++++----------------------------------- 3 files changed, 72 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3869a14b..74fe6756 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2003-11-04 Hrvoje Niksic + * configure.in: Move some checks into aclocal.m4. + * configure.in: Also check whether #include works before deciding to use Solaris libmd5. diff --git a/aclocal.m4 b/aclocal.m4 index 7b594463..a4535c24 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -44,6 +44,64 @@ int accept (int, struct sockaddr *, size_t *); ]) ]) +dnl Check whether fnmatch.h can be included. This doesn't use +dnl AC_FUNC_FNMATCH because Wget is already careful to only use +dnl fnmatch on certain OS'es. However, fnmatch.h is sometimes broken +dnl even on those because Apache installs its own fnmatch.h to +dnl /usr/local/include (!), which GCC uses before /usr/include. + +AC_DEFUN([WGET_FNMATCH], [ + AC_MSG_CHECKING([whether fnmatch.h can be included]) + AC_COMPILE_IFELSE([#include + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_FNMATCH_H) + ], [ + AC_MSG_RESULT(no) + ]) +]) + +dnl Check for nanosleep. For nanosleep to work on Solaris, we must +dnl link with -lt (recently) or with -lposix (older releases). + +AC_DEFUN([WGET_NANOSLEEP], [ + AC_CHECK_FUNCS(nanosleep, [], [ + AC_CHECK_LIB(rt, nanosleep, [ + AC_DEFINE(HAVE_NANOSLEEP) + LIBS="-lrt $LIBS" + ], [ + AC_CHECK_LIB(posix4, nanosleep, [ + AC_DEFINE(HAVE_NANOSLEEP) + LIBS="-lposix4 $LIBS" + ]) + ]) + ]) +]) + +dnl Check whether we need to link with -lnsl and -lsocket, as is the +dnl case on e.g. Solaris. + +AC_DEFUN([WGET_NSL_SOCKET], [ + dnl On Solaris, -lnsl is needed to use gethostbyname. But checking + dnl for gethostbyname is not enough because on "NCR MP-RAS 3.0" + dnl gethostbyname is in libc, but -lnsl is still needed to use + dnl -lsocket, as well as for functions such as inet_ntoa. We look + dnl for such known offenders and if one of them is not found, we + dnl check if -lnsl is needed. + wget_check_in_nsl=NONE + AC_CHECK_FUNCS(gethostbyname, [], [ + wget_check_in_nsl=gethostbyname + ]) + AC_CHECK_FUNCS(inet_ntoa, [], [ + wget_check_in_nsl=inet_ntoa + ]) + if test $wget_check_in_nsl != NONE; then + AC_CHECK_LIB(nsl, $wget_check_in_nsl) + fi + AC_CHECK_LIB(socket, socket) +]) + + dnl dnl ansi2knr support: check whether C prototypes are available. dnl diff --git a/configure.in b/configure.in index 63f7fe44..be2f9ffe 100644 --- a/configure.in +++ b/configure.in @@ -180,12 +180,6 @@ dnl Return type of signal-handlers dnl AC_TYPE_SIGNAL -dnl -dnl Call several of Wget's macros. -dnl -WGET_STRUCT_UTIMBUF -WGET_SOCKLEN_T - dnl dnl Checks for library functions. dnl @@ -196,6 +190,15 @@ AC_CHECK_FUNCS(gettimeofday mktime strptime strerror snprintf vsnprintf) AC_CHECK_FUNCS(select sigblock sigsetjmp signal symlink access isatty) AC_CHECK_FUNCS(uname gethostname usleep) +dnl +dnl Call Wget's local macros defined in aclocal. +dnl +WGET_STRUCT_UTIMBUF +WGET_SOCKLEN_T +WGET_FNMATCH +WGET_NANOSLEEP +WGET_NSL_SOCKET + dnl dnl Check if we need to compile in getopt.c. dnl @@ -208,39 +211,6 @@ dnl dnl Checks for libraries. dnl -dnl On Solaris, -lnsl is needed to use gethostbyname. On "NCR MP-RAS -dnl 3.0", however, gethostbyname is in libc, but -lnsl is still needed -dnl to use -lsocket, as well as for functions such as inet_ntoa. We -dnl look for such known offenders and if one of them is not found, we -dnl check if -lnsl is needed. - -wget_check_in_nsl=NONE -AC_CHECK_FUNCS(gethostbyname, [], [ - wget_check_in_nsl=gethostbyname -]) -AC_CHECK_FUNCS(inet_ntoa, [], [ - wget_check_in_nsl=inet_ntoa -]) -if test $wget_check_in_nsl != NONE; then - AC_CHECK_LIB(nsl, $wget_check_in_nsl) -fi - -AC_CHECK_LIB(socket, socket) - -dnl nanosleep on Solaris requires -lrt (more recently) or -lposix4 -dnl (older versions). - -AC_CHECK_FUNCS(nanosleep, [], [ - AC_CHECK_LIB(rt, nanosleep, [ - AC_DEFINE(HAVE_NANOSLEEP) - LIBS="-lrt $LIBS" - ], [ - AC_CHECK_LIB(posix4, nanosleep, [ - AC_DEFINE(HAVE_NANOSLEEP) - LIBS="-lposix4 $LIBS" - ]) - ])]) - dnl #### This appears to be deficient with later versions of SOCKS. if test "x${with_socks}" = xyes then @@ -426,8 +396,10 @@ dnl if test x"$wget_need_md5" = xyes then - MD5_OBJ='gen-md5$o' + dnl This should be moved to an AC_DEFUN, but I'm not sure how to + dnl manipulate MD5_OBJ from the defun. + MD5_OBJ='gen-md5$o' found_md5=no dnl Check for the system MD5 library on Solaris. We don't check for