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 # 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)
28 AC_C_CONST dnl getopt needs this.
34 AC_CHECK_LIB(nsl,inet_addr)
35 AC_CHECK_LIB(socket,socket)
36 AC_CHECK_LIB(inet,socket)
37 AC_CHECK_LIB(opie,opiegenerator)
39 AC_CHECK_FUNC(strstr, AC_DEFINE(HAVE_STRSTR),
40 [EXTRASRC="$EXTRASRC \$(srcdir)/strstr.c"
41 EXTRAOBJ="$EXTRAOBJ strstr.o"])
43 AC_CHECK_FUNC(strcasecmp, AC_DEFINE(HAVE_STRCASECMP),
44 [EXTRASRC="$EXTRASRC \$(srcdir)/strcasecmp.c"
45 EXTRAOBJ="$EXTRAOBJ strcasecmp.o"])
47 AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPTLONG),
48 [EXTRASRC="$EXTRASRC \$(srcdir)/getopt.c \$(srcdir)/getopt1.c"
49 EXTRAOBJ="$EXTRAOBJ getopt.o getopt1.o"])
55 EXTRASRC="$EXTRASRC \$(srcdir)/alloca.c"
56 EXTRAOBJ="$EXTRAOBJ alloca.o"
59 dnl All AC_CHECK_FUNCs must precede the following AC_SUBSTs
64 AC_CHECK_FUNCS(tcsetattr stty setsid seteuid gethostbyname res_search herror \
65 strrchr strerror setlinebuf syslog snprintf vsnprintf vsyslog atexit)
67 # Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
68 # and breaks gethostbyname(2). It's better to use the bind stuff in the C
69 # library. So don't add -lresolv to the link list unless it's necessary
70 # (It will be necessary when using GNU libc6).
71 AC_CHECK_FUNC(res_search,
72 AC_MSG_RESULT(using libc's resolver functions),
73 AC_CHECK_LIB(resolv,res_search,
74 [AC_DEFINE(HAVE_RES_SEARCH) AC_MSG_RESULT(found resolver functions in libresolv); LIBS="$LIBS -lresolv"], AC_MSG_RESULT(no resolver calls found)))
76 dnl AC_FUNC_SETVBUF_REVERSED
78 dnl Check for usable void pointer type
79 AC_MSG_CHECKING(use of void pointer type)
83 p = (char *) xmalloc(1);
85 [AC_DEFINE(HAVE_VOIDPOINTER) AC_MSG_RESULT(yes)],
88 dnl Check out the wait reality. We have to assume sys/wait.h is present.
89 AC_CHECK_FUNCS(waitpid wait3)
90 AC_MSG_CHECKING(for union wait);
91 AC_TRY_LINK([#include <sys/types.h>
92 #include <sys/wait.h>],
93 [union wait status; int pid; pid = wait (&status);
95 /* Some POSIXoid systems have both the new-style macros and the old
96 union wait type, and they do not work together. If union wait
97 conflicts with WEXITSTATUS et al, we don't want to use it at all. */
98 if (WEXITSTATUS (status) != 0) pid = -1;
101 /* Make sure union wait works with waitpid. */
102 pid = waitpid (-1, &status, 0);
105 [AC_DEFINE(HAVE_UNION_WAIT) AC_MSG_RESULT(yes)],
108 AC_MSG_CHECKING(sys_siglist declaration in signal.h or unistd.h)
109 AC_TRY_LINK([#include <signal.h>
110 /* NetBSD declares sys_siglist in <unistd.h>. */
113 #endif], [char *msg = *(sys_siglist + 1);],
114 [AC_DEFINE(SYS_SIGLIST_DECLARED) AC_MSG_RESULT(yes)],
117 AC_CHECK_SIZEOF(short)
119 AC_CHECK_SIZEOF(long)
121 ### use option --enable-POP2 to compile in the POP2 fallback support
123 [ --enable-POP2 compile in POP2 protocol support (obsolete)],
124 [with_POP2=$enableval],
126 test "$with_POP2" = "yes" && AC_DEFINE(POP2_ENABLE)
128 ### use option --with-kerberos=DIR to point at a Kerberos directory
129 AC_ARG_WITH(kerberos,
130 [ --with-kerberos=DIR point fetchmail compilation at a Kerberos directory])
132 # The "then" arm (nonempty $with_kerberos) is kind of a crock. It works for
133 # configuring the BSD/OS Kerberos IV support, though.
134 if test -n "$with_kerberos"
136 CFLAGS="$CFLAGS -DKERBEROS_V4 -I$with_kerberos"
137 LDFLAGS="$LDFLAGS -L$dir/lib"
138 LIBS="$LIBS -lkrb -ldes"
140 for dir in /usr/kerberos /usr/kerberosIV /usr/athena
142 if test -f "$dir/include/krb.h"
144 CFLAGS="$CFLAGS -DKERBEROS_V4 -I$dir/include"
145 LDFLAGS="$LDFLAGS -L$dir/lib"
146 LIBS="$LIBS -lkrb -ldes"
152 AC_OUTPUT(Makefile, [
153 echo "You can ignore any makedepend error messages";
154 makedepend -I$srcdir -I. -fMakefile ${srcdir}/*.c])
157 dnl comment-start: "dnl "
159 dnl comment-start-skip: "\\bdnl\\b\\s *"
160 dnl compile-command: "make configure config.h.in"