]> Pileus Git - ~andy/fetchmail/blob - configure.in
2bda847b3b936862d3d346c0f5e40457b91c13c9
[~andy/fetchmail] / configure.in
1 dnl Autoconfigure input file for fetchmail
2 dnl Eric S. Raymond <esr@thyrsus.com>
3 dnl
4 dnl Process this file with autoconf to produce a configure script.
5 dnl
6
7 AC_INIT(fetchmail.h)            dnl A distinctive file to look for in srcdir. 
8 AC_CONFIG_HEADER(config.h)
9
10 # We want these before the checks, so the checks can modify their values.
11 test -z "$CFLAGS" && CFLAGS=-g AC_SUBST(CFLAGS)
12 test -z "$LDFLAGS" && LDFLAGS=-g AC_SUBST(LDFLAGS)
13
14 AC_CANONICAL_HOST
15 AC_PROG_CC
16 AC_PROG_INSTALL
17 AC_PROG_CPP                     dnl Later checks need this.
18 AC_PROG_CC_C_O
19 AC_AIX
20 AC_ISC_POSIX
21 AC_MINIX
22 AC_HEADER_STDC
23 AC_TYPE_SIZE_T
24 AC_TYPE_PID_T
25 AC_TYPE_SIGNAL
26 AC_CHECK_HEADERS(unistd.h termios.h termio.h sgtty.h stdarg.h alloca.h) 
27
28 AC_C_CONST                      dnl getopt needs this.
29
30 AC_PROG_LEX
31 AC_PROG_YACC
32 AC_SUBST(LIBOBJS)
33
34 AC_CHECK_LIB(socket,socket)
35 AC_CHECK_LIB(nsl,inet_addr)
36
37
38 # Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
39 # and breaks gethostbyname(2).  It's better to use the bind stuff in the C
40 # library.  So don't add -lresolv to the link list unless it's necessary
41 AC_CHECK_FUNC(res_search,, AC_CHECK_LIB(resolv,res_search))
42
43 AC_CHECK_FUNC(strcasecmp, AC_DEFINE(HAVE_STRCASECMP), 
44               [EXTRASRC="$EXTRASRC \$(srcdir)/strcasecmp.c"
45                EXTRAOBJ="$EXTRAOBJ strcasecmp.o"])
46              
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"])
50
51 AC_FUNC_VPRINTF
52 AC_FUNC_ALLOCA
53 if test -n "$ALLOCA" 
54 then
55   EXTRASRC="$EXTRASRC \$(srcdir)/alloca.c"
56   EXTRAOBJ="$EXTRAOBJ alloca.o"
57 fi
58
59 if test -f "/usr/kerberos/include/krb.h"
60 then
61   CFLAGS="$CFLAGS -DKERBEROS_V4 -I/usr/kerberos/include"
62   LDFLAGS="$LDFLAGS -L/usr/kerberos/lib"
63   LIBS="$LIBS -lkrb -ldes"
64 fi
65
66 if test -f "/usr/athena/include/krb.h"
67 then
68   CFLAGS="$CFLAGS -DKERBEROS_V4 -I/usr/athena/include"
69   LDFLAGS="$LDFLAGS -L/usr/athena/lib"
70   LIBS="$LIBS -lkrb -ldes"
71 fi
72
73
74 dnl All AC_CHECK_FUNCs must precede the following AC_SUBSTs
75
76 AC_SUBST(EXTRASRC)
77 AC_SUBST(EXTRAOBJ)
78
79 AC_CHECK_FUNCS(tcsetattr stty setsid seteuid gethostbyname res_search herror \
80   strrchr strerror)
81
82 dnl AC_FUNC_SETVBUF_REVERSED
83
84 dnl Check for usuable void pointer type
85 AC_MSG_CHECKING(use of void pointer type)
86 AC_TRY_COMPILE([],
87    [char *p;
88     void *xmalloc();
89     p = (char *) xmalloc(1);
90    ],
91  [AC_DEFINE(HAVE_VOIDPOINTER) AC_MSG_RESULT(yes)],
92  AC_MSG_RESULT(no))
93
94 dnl Check out the wait reality.  We have to assume sys/wait.h is present.
95 AC_CHECK_FUNCS(waitpid wait3)
96 AC_MSG_CHECKING(for union wait);
97 AC_TRY_LINK([#include <sys/types.h>
98 #include <sys/wait.h>],
99                  [union wait status; int pid; pid = wait (&status);
100 #ifdef WEXITSTATUS
101 /* Some POSIXoid systems have both the new-style macros and the old
102    union wait type, and they do not work together.  If union wait
103    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
104 if (WEXITSTATUS (status) != 0) pid = -1;
105 #endif
106 #ifdef HAVE_WAITPID
107 /* Make sure union wait works with waitpid.  */
108 pid = waitpid (-1, &status, 0);
109 #endif
110 ],
111   [AC_DEFINE(HAVE_UNION_WAIT) AC_MSG_RESULT(yes)],
112   AC_MSG_RESULT(no))
113
114 AC_MSG_CHECKING(sys_siglist declaration in signal.h or unistd.h)
115 AC_TRY_LINK([#include <signal.h>
116 /* NetBSD declares sys_siglist in <unistd.h>.  */
117 #ifdef HAVE_UNISTD_H
118 #include <unistd.h>
119 #endif], [char *msg = *(sys_siglist + 1);],
120   [AC_DEFINE(SYS_SIGLIST_DECLARED) AC_MSG_RESULT(yes)],
121   AC_MSG_RESULT(no))
122
123 AC_OUTPUT(Makefile, [
124 # Makefile uses this timestamp file to know when to remake Makefile,
125 # build.sh, and glob/Makefile.
126 touch stamp-config])
127
128 dnl Local Variables:
129 dnl comment-start: "dnl "
130 dnl comment-end: ""
131 dnl comment-start-skip: "\\bdnl\\b\\s *"
132 dnl compile-command: "make configure config.h.in"
133 dnl End: