1 dnl Autoconfigure input file for fetchmail
2 dnl Eric S. Raymond <esr@thyrsus.com>
4 dnl Process this file with autoconf to produce a configure script.
7 AC_INIT(fetchmail.h) dnl A distinctive file to look for in srcdir.
8 AC_CONFIG_HEADER(config.h)
10 dnl We want these before the checks, so the checks can modify their values.
11 test -z "$CFLAGS" && CFLAGS=-O AC_SUBST(CFLAGS)
12 test -z "$LDFLAGS" && LDFLAGS=-s AC_SUBST(LDFLAGS)
17 AC_PROG_CPP dnl Later checks need this.
26 AC_CHECK_HEADERS(unistd.h termios.h termio.h sgtty.h stdarg.h alloca.h sys/itimer.h fcntl.h sys/fcntl.h memory.h)
28 AC_C_CONST dnl getopt needs this.
36 # Under sysV68, socket and friends are provided by the C library.
37 # -linet does not provide socket, but causes multiple definition
38 # errors at link-time. It is thus better to only use the C library.
39 # So don't add -linet to the link list unless it's necessary
41 AC_MSG_RESULT(using libc's socket),
42 AC_CHECK_LIB(socket,socket)
43 AC_CHECK_LIB(inet,socket))
45 # The condition in this test copes with the presence of inet_addr in libc6.
46 AC_CHECK_FUNC(inet_addr,
47 AC_MSG_RESULT(using libc's inet_addr),
48 AC_CHECK_LIB(nsl,inet_addr))
50 dnl Port hack for Interactive UNIX System V/386 Release 3.2
51 AC_CHECK_LIB(cposix, strchr,
52 [EXTRADEFS="$EXTRADEFS -D_SYSV3"
53 LIBS="$LIBS -lcposix"])
55 AC_CHECK_FUNC(strstr, AC_DEFINE(HAVE_STRSTR),
56 [EXTRASRC="$EXTRASRC \$(srcdir)/strstr.c"
57 EXTRAOBJ="$EXTRAOBJ strstr.o"])
59 AC_CHECK_FUNC(strcasecmp, AC_DEFINE(HAVE_STRCASECMP),
60 [EXTRASRC="$EXTRASRC \$(srcdir)/strcasecmp.c"
61 EXTRAOBJ="$EXTRAOBJ strcasecmp.o"])
63 AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPTLONG),
64 [EXTRASRC="$EXTRASRC \$(srcdir)/getopt.c \$(srcdir)/getopt1.c"
65 EXTRAOBJ="$EXTRAOBJ getopt.o getopt1.o"])
71 EXTRASRC="$EXTRASRC \$(srcdir)/alloca.c"
72 EXTRAOBJ="$EXTRAOBJ alloca.o"
75 dnl All AC_CHECK_FUNCs must precede the following AC_SUBSTs
81 AC_CHECK_FUNCS(tcsetattr stty setsid seteuid gethostbyname res_search herror \
82 strrchr strerror setlinebuf syslog snprintf vsnprintf vsyslog atexit \
85 # Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
86 # and breaks gethostbyname(2). It's better to use the bind stuff in the C
87 # library. So don't add -lresolv to the link list unless it's necessary
88 # (It will be necessary when using GNU libc6).
89 AC_CHECK_FUNC(res_search,
90 AC_MSG_RESULT(using libc's resolver functions),
91 AC_CHECK_LIB(resolv,res_search,
92 [AC_DEFINE(HAVE_RES_SEARCH) AC_MSG_RESULT(found resolver functions in libresolv); LIBS="$LIBS -lresolv"], AC_MSG_RESULT(no resolver calls found)))
94 dnl AC_FUNC_SETVBUF_REVERSED
96 dnl Check for usable void pointer type
97 AC_MSG_CHECKING(use of void pointer type)
101 p = (char *) xmalloc(1);
103 [AC_DEFINE(HAVE_VOIDPOINTER) AC_MSG_RESULT(yes)],
106 dnl Check out the wait reality. We have to assume sys/wait.h is present.
107 AC_CHECK_FUNCS(waitpid wait3)
108 AC_MSG_CHECKING(for union wait);
109 AC_TRY_LINK([#include <sys/types.h>
110 #include <sys/wait.h>],
111 [union wait status; int pid; pid = wait (&status);
113 /* Some POSIXoid systems have both the new-style macros and the old
114 union wait type, and they do not work together. If union wait
115 conflicts with WEXITSTATUS et al, we don't want to use it at all. */
116 if (WEXITSTATUS (status) != 0) pid = -1;
119 /* Make sure union wait works with waitpid. */
120 pid = waitpid (-1, &status, 0);
123 [AC_DEFINE(HAVE_UNION_WAIT) AC_MSG_RESULT(yes)],
126 AC_MSG_CHECKING(sys_siglist declaration in signal.h or unistd.h)
127 AC_TRY_LINK([#include <signal.h>
128 /* NetBSD declares sys_siglist in <unistd.h>. */
131 #endif], [char *msg = *(sys_siglist + 1);],
132 [AC_DEFINE(SYS_SIGLIST_DECLARED) AC_MSG_RESULT(yes)],
135 # Find the right directory to put the root-mode PID file in
136 for dir in "/var/run" "/etc"
143 AC_MSG_RESULT(root-mode pid file will go in $dir)
144 AC_DEFINE_UNQUOTED(PID_DIR, "$dir")
146 AC_CHECK_SIZEOF(short)
148 AC_CHECK_SIZEOF(long)
150 ### use option --enable-POP2 to compile in the POP2 support
152 [ --enable-POP2 compile in POP2 protocol support (obsolete)],
153 [with_POP2=$enableval],
155 test "$with_POP2" = "yes" && AC_DEFINE(POP2_ENABLE)
157 ### use option --enable-RPA to compile in the RPA support
159 [ --enable-RPA compile in RPA protocol support],
160 [with_RPA=$enableval],
162 test "$with_RPA" = "yes" && AC_DEFINE(RPA_ENABLE)
164 ### use option --enable-OPIE to compile in the OPIE support
166 [ --enable-OPIE support OTP through the OPIE library],
167 [with_opie=$enableval],
169 if test "$with_opie" = "yes";
171 AC_CHECK_HEADER(opie.h,,
172 [echo 'configure: cannot find <opie.h>, which is required for OPIE support.'; exit 1])
173 AC_CHECK_LIB(opie,opiegenerator,,
174 [echo 'configure: cannot find libopie, which is required for OPIE support.'; exit 1])
178 ### use option --with-kerberos=DIR to point at a Kerberos directory
179 AC_ARG_WITH(kerberos,
180 [ --with-kerberos=DIR point fetchmail compilation at a Kerberos directory])
182 # The "then" arm (nonempty $with_kerberos) is kind of a crock. It works for
183 # configuring the BSD/OS Kerberos IV support, though.
184 if test -n "$with_kerberos"
186 CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$with_kerberos"
187 LDEFLAGS="$LDEFLAGS -L$dir/lib"
188 LIBS="$LIBS -lkrb -ldes"
190 for dir in /usr/kerberos /usr/kerberosIV /usr/athena
192 if test -f "$dir/include/krb.h"
194 CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$dir/include"
195 LDEFLAGS="$LDEFLAGS -L$dir/lib"
196 LIBS="$LIBS -lkrb -ldes"
202 AC_OUTPUT(Makefile, [
203 # The reason for this odd makedepend line is that we want
204 # to have all dependencies evaluated relative to the source directory
205 # and let VPATH do all the dirty work when we build remotely
206 echo "You can ignore any makedepend error messages";
207 (cd $srcdir; makedepend -f - *.c) >>Makefile])
210 dnl comment-start: "dnl "
212 dnl comment-start-skip: "\\bdnl\\b\\s *"
213 dnl compile-command: "make configure config.h.in"