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)
38 AC_CHECK_FUNC(strstr, AC_DEFINE(HAVE_STRSTR),
39 [EXTRASRC="$EXTRASRC \$(srcdir)/strstr.c"
40 EXTRAOBJ="$EXTRAOBJ strstr.o"])
42 AC_CHECK_FUNC(strcasecmp, AC_DEFINE(HAVE_STRCASECMP),
43 [EXTRASRC="$EXTRASRC \$(srcdir)/strcasecmp.c"
44 EXTRAOBJ="$EXTRAOBJ strcasecmp.o"])
46 AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPTLONG),
47 [EXTRASRC="$EXTRASRC \$(srcdir)/getopt.c \$(srcdir)/getopt1.c"
48 EXTRAOBJ="$EXTRAOBJ getopt.o getopt1.o"])
54 EXTRASRC="$EXTRASRC \$(srcdir)/alloca.c"
55 EXTRAOBJ="$EXTRAOBJ alloca.o"
58 dnl All AC_CHECK_FUNCs must precede the following AC_SUBSTs
63 AC_CHECK_FUNCS(tcsetattr stty setsid seteuid gethostbyname res_search herror \
64 strrchr strerror setlinebuf syslog snprintf vsnprintf vsyslog atexit)
66 # Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
67 # and breaks gethostbyname(2). It's better to use the bind stuff in the C
68 # library. So don't add -lresolv to the link list unless it's necessary
69 # (It will be necessary when using GNU libc6).
70 AC_CHECK_FUNC(res_search,
71 AC_MSG_RESULT(using libc's resolver functions),
72 AC_CHECK_LIB(resolv,res_search,
73 [AC_DEFINE(HAVE_RES_SEARCH) AC_MSG_RESULT(found resolver functions in libresolv); LIBS="$LIBS -lresolv"], AC_MSG_RESULT(no resolver calls found)))
75 dnl AC_FUNC_SETVBUF_REVERSED
77 dnl Check for usable void pointer type
78 AC_MSG_CHECKING(use of void pointer type)
82 p = (char *) xmalloc(1);
84 [AC_DEFINE(HAVE_VOIDPOINTER) AC_MSG_RESULT(yes)],
87 dnl Check out the wait reality. We have to assume sys/wait.h is present.
88 AC_CHECK_FUNCS(waitpid wait3)
89 AC_MSG_CHECKING(for union wait);
90 AC_TRY_LINK([#include <sys/types.h>
91 #include <sys/wait.h>],
92 [union wait status; int pid; pid = wait (&status);
94 /* Some POSIXoid systems have both the new-style macros and the old
95 union wait type, and they do not work together. If union wait
96 conflicts with WEXITSTATUS et al, we don't want to use it at all. */
97 if (WEXITSTATUS (status) != 0) pid = -1;
100 /* Make sure union wait works with waitpid. */
101 pid = waitpid (-1, &status, 0);
104 [AC_DEFINE(HAVE_UNION_WAIT) AC_MSG_RESULT(yes)],
107 AC_MSG_CHECKING(sys_siglist declaration in signal.h or unistd.h)
108 AC_TRY_LINK([#include <signal.h>
109 /* NetBSD declares sys_siglist in <unistd.h>. */
112 #endif], [char *msg = *(sys_siglist + 1);],
113 [AC_DEFINE(SYS_SIGLIST_DECLARED) AC_MSG_RESULT(yes)],
116 AC_CHECK_SIZEOF(short)
118 AC_CHECK_SIZEOF(long)
120 ### use option --enable-POP2 to compile in the POP2 fallback support
122 [ --enable-POP2 compile in POP2 protocol support (obsolete)],
123 [with_POP2=$enableval],
125 test "$with_POP2" = "yes" && AC_DEFINE(POP2_ENABLE)
127 ### use option --with-kerberos=DIR to point at a Kerberos directory
128 AC_ARG_WITH(kerberos,
129 [ --with-kerberos=DIR point fetchmail compilation at a Kerberos directory])
131 for dir in $with_kerberos /usr/kerberos /usr/athena
133 if test -f "$dir/include/krb.h"
135 CFLAGS="$CFLAGS -DKERBEROS_V4 -I$dir/include"
136 LDFLAGS="$LDFLAGS -L$dir/lib"
137 LIBS="$LIBS -lkrb -ldes"
142 AC_OUTPUT(Makefile, [
143 # Makefile uses this timestamp file to know when to remake Makefile,
144 # build.sh, and glob/Makefile.
148 dnl comment-start: "dnl "
150 dnl comment-start-skip: "\\bdnl\\b\\s *"
151 dnl compile-command: "make configure config.h.in"