* uip/inc.c: gcc 4.4.1 noticed that maildir could have been
[mmh] / aclocal.m4
1
2 # Originally by John Hawkinson <jhawk@mit.edu>
3 # Under Solaris, those
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
8 # of IRIX).
9 #
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.
14
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))
21 ])
22
23 dnl --------------
24 dnl CHECK FOR NDBM
25 dnl --------------
26 dnl
27 dnl NMH_CHECK_DBM(include,library,action-if-found,action-if-not)
28
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).
32
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.
35
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.
39
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.)
48
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
52 dnl expansion.
53
54 AC_DEFUN(NMH_CHECK_NDBM,
55 [
56 if test "x$2" = "x"; then
57   nmh_libs=
58   AC_MSG_CHECKING([for dbm in $1])
59 else
60   nmh_libs="-l$2 "
61   AC_MSG_CHECKING([for dbm in $1 and $2])
62 fi
63
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
66
67 nmh_saved_libs="$LIBS"
68 LIBS="$nmh_libs $5 $LIBS"
69 AC_LINK_IFELSE(AC_LANG_PROGRAM([[
70 #define DB_DBM_HSEARCH 1
71 #include <$1>
72 ]],
73 [[dbm_open("",0,0);]]),[nmh_ndbm_found=yes],[nmh_ndbm_found=no])
74 LIBS="$nmh_saved_libs"
75
76 if test "$nmh_ndbm_found" = "yes"; then
77   AC_MSG_RESULT(yes)
78   nmh_ndbmheader="$1"
79   nmh_ndbm="$2"
80   $3
81 else
82   AC_MSG_RESULT(no)
83   $4
84   :
85 fi
86 ])dnl
87
88 dnl ----------------
89 dnl CHECK FOR d_type
90 dnl ----------------
91 dnl
92 dnl From Jim Meyering.
93 dnl
94 dnl Check whether struct dirent has a member named d_type.
95 dnl
96
97 # Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
98 # Foundation, Inc.
99 #
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.
103
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,
108      [AC_TRY_LINK(dnl
109        [
110 #include <sys/types.h>
111 #ifdef HAVE_DIRENT_H
112 # include <dirent.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 */
121 # ifdef HAVE_NDIR_H
122 #  include <ndir.h>
123 # endif /* HAVE_NDIR_H */
124 #endif /* HAVE_DIRENT_H */
125        ],
126        [struct dirent dp; dp.d_type = 0;],
127
128        jm_cv_struct_dirent_d_type=yes,
129        jm_cv_struct_dirent_d_type=no)
130      ]
131    )
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
135         directory headers.])
136    fi
137   ]
138 )