2 # Originally by John Hawkinson <jhawk@mit.edu>
4 # applications need to link with "-lsocket -lnsl". Under IRIX, they
5 # need to link with "-lnsl" but should *not* link with "-lsocket"
6 # because libsocket.a breaks a number of things (for instance,
7 # gethostbyname() under IRIX 5.2, and snoop sockets under most versions
10 # The check for libresolv is in case you are attempting to link
11 # statically and happen to have a libresolv.a lying around (and no
12 # libnsl.a). An example of such a case would be Solaris with
13 # BIND 4.9.5 installed.
15 AC_DEFUN(AC_CHECK_NETLIBS,
16 [AC_CHECK_FUNC(getaddrinfo, ,
17 AC_CHECK_LIB(nsl, getaddrinfo, ,
18 AC_CHECK_LIB(resolv, getaddrinfo)))
19 AC_CHECK_FUNC(socket, ,
20 AC_CHECK_LIB(socket, socket))
27 dnl NMH_CHECK_DBM(include,library,action-if-found,action-if-not)
29 dnl Check for presence of dbm_open() in the specified library
30 dnl and with the specified include file (if libname is the empty
31 dnl string then don't try to link against any particular library).
33 dnl We set nmh_ndbm_found to 'yes' or 'no'; if found we set
34 dnl nmh_ndbmheader to the first arg and nmh_ndbm to the second.
36 dnl If this macro accepted a list of include,library tuples
37 dnl to test in order that would be cleaner than the current
38 dnl nest of calls in configure.in.
40 dnl We try to link our own code fragment (which includes the
41 dnl headers in the same way slocal.c does) rather than
42 dnl using AC_CHECK_LIB because on later versions of libdb
43 dnl the dbm_open() function is provided via a #define and
44 dnl we don't want to hardcode searching for the internal
45 dnl function that lies behind it. (AC_CHECK_LIB works by
46 dnl defining its own bogus prototype rather than pulling in
47 dnl the right header files.)
49 dnl An oddity (bug) of this macro is that if you haven't
50 dnl done AC_PROG_CC or something that implies it before
51 dnl using this macro autoconf complains about a recursive
54 AC_DEFUN(NMH_CHECK_NDBM,
56 if test "x$2" = "x"; then
58 AC_MSG_CHECKING([for dbm in $1])
61 AC_MSG_CHECKING([for dbm in $1 and $2])
64 dnl We don't try to cache the result, because that exceeds
65 dnl my autoconf skills -- feel free to put it in :-> -- PMM
67 nmh_saved_libs="$LIBS"
68 LIBS="$nmh_libs $5 $LIBS"
69 AC_LINK_IFELSE(AC_LANG_PROGRAM([[
70 #define DB_DBM_HSEARCH 1
73 [[dbm_open("",0,0);]]),[nmh_ndbm_found=yes],[nmh_ndbm_found=no])
74 LIBS="$nmh_saved_libs"
76 if test "$nmh_ndbm_found" = "yes"; then
92 dnl From Jim Meyering.
94 dnl Check whether struct dirent has a member named d_type.
97 # Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
100 # This file is free software; the Free Software Foundation
101 # gives unlimited permission to copy and/or distribute it,
102 # with or without modifications, as long as this notice is preserved.
104 AC_DEFUN([CHECK_TYPE_STRUCT_DIRENT_D_TYPE],
105 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
106 AC_CACHE_CHECK([for d_type member in directory struct],
107 jm_cv_struct_dirent_d_type,
110 #include <sys/types.h>
113 #else /* not HAVE_DIRENT_H */
114 # define dirent direct
115 # ifdef HAVE_SYS_NDIR_H
116 # include <sys/ndir.h>
117 # endif /* HAVE_SYS_NDIR_H */
118 # ifdef HAVE_SYS_DIR_H
119 # include <sys/dir.h>
120 # endif /* HAVE_SYS_DIR_H */
123 # endif /* HAVE_NDIR_H */
124 #endif /* HAVE_DIRENT_H */
126 [struct dirent dp; dp.d_type = 0;],
128 jm_cv_struct_dirent_d_type=yes,
129 jm_cv_struct_dirent_d_type=no)
132 if test $jm_cv_struct_dirent_d_type = yes; then
133 AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1,
134 [Define if there is a member named d_type in the struct describing