]> Pileus Git - ~andy/fetchmail/blob - configure.in
Fix Roidl's problem.
[~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=-O AC_SUBST(CFLAGS)
12 test -z "$LDFLAGS" && LDFLAGS=-s 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 sys/itimer.h fcntl.h sys/fcntl.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(nsl,inet_addr)
35 AC_CHECK_LIB(socket,socket)
36 AC_CHECK_LIB(inet,socket)
37
38 AC_CHECK_FUNC(strstr, AC_DEFINE(HAVE_STRSTR), 
39               [EXTRASRC="$EXTRASRC \$(srcdir)/strstr.c"
40                EXTRAOBJ="$EXTRAOBJ strstr.o"])
41
42 AC_CHECK_FUNC(strcasecmp, AC_DEFINE(HAVE_STRCASECMP), 
43               [EXTRASRC="$EXTRASRC \$(srcdir)/strcasecmp.c"
44                EXTRAOBJ="$EXTRAOBJ strcasecmp.o"])
45              
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"])
49
50 AC_FUNC_VPRINTF
51 AC_FUNC_ALLOCA
52 if test -n "$ALLOCA" 
53 then
54   EXTRASRC="$EXTRASRC \$(srcdir)/alloca.c"
55   EXTRAOBJ="$EXTRAOBJ alloca.o"
56 fi
57
58 dnl All AC_CHECK_FUNCs must precede the following AC_SUBSTs
59
60 AC_SUBST(EXTRASRC)
61 AC_SUBST(EXTRAOBJ)
62
63 AC_CHECK_FUNCS(tcsetattr stty setsid seteuid gethostbyname res_search herror \
64   strrchr strerror setlinebuf syslog snprintf vsnprintf vsyslog atexit)
65
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)))
74
75 dnl AC_FUNC_SETVBUF_REVERSED
76
77 dnl Check for usable void pointer type
78 AC_MSG_CHECKING(use of void pointer type)
79 AC_TRY_COMPILE([],
80    [char *p;
81     void *xmalloc();
82     p = (char *) xmalloc(1);
83    ],
84  [AC_DEFINE(HAVE_VOIDPOINTER) AC_MSG_RESULT(yes)],
85  AC_MSG_RESULT(no))
86
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);
93 #ifdef WEXITSTATUS
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;
98 #endif
99 #ifdef HAVE_WAITPID
100 /* Make sure union wait works with waitpid.  */
101 pid = waitpid (-1, &status, 0);
102 #endif
103 ],
104   [AC_DEFINE(HAVE_UNION_WAIT) AC_MSG_RESULT(yes)],
105   AC_MSG_RESULT(no))
106
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>.  */
110 #ifdef HAVE_UNISTD_H
111 #include <unistd.h>
112 #endif], [char *msg = *(sys_siglist + 1);],
113   [AC_DEFINE(SYS_SIGLIST_DECLARED) AC_MSG_RESULT(yes)],
114   AC_MSG_RESULT(no))
115
116 AC_CHECK_SIZEOF(short)
117 AC_CHECK_SIZEOF(int)
118 AC_CHECK_SIZEOF(long)
119
120 ###     use option --enable-POP2 to compile in the POP2 fallback support
121 AC_ARG_ENABLE(POP2,
122         [  --enable-POP2        compile in POP2 protocol support (obsolete)],
123         [with_POP2=$enableval],
124         [with_POP2=no])
125 test "$with_POP2" = "yes" && AC_DEFINE(POP2_ENABLE)
126
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])
130
131 for dir in $with_kerberos /usr/kerberos /usr/athena
132 do
133   if test -f "$dir/include/krb.h"
134   then
135     CFLAGS="$CFLAGS -DKERBEROS_V4 -I$dir/include"
136     LDFLAGS="$LDFLAGS -L$dir/lib"
137     LIBS="$LIBS -lkrb -ldes"
138     break
139   fi
140 done
141
142 AC_OUTPUT(Makefile, [
143 # Makefile uses this timestamp file to know when to remake Makefile,
144 # build.sh, and glob/Makefile.
145 touch stamp-config])
146
147 dnl Local Variables:
148 dnl comment-start: "dnl "
149 dnl comment-end: ""
150 dnl comment-start-skip: "\\bdnl\\b\\s *"
151 dnl compile-command: "make configure config.h.in"
152 dnl End: