]> Pileus Git - ~andy/fetchmail/blob - configure.in
Added LMTP support.
[~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 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)
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 memory.h sys/wait.h)
27
28 AC_C_CONST                      dnl getopt needs this.
29
30 AC_PROG_LEX
31 AC_PROG_YACC
32 AC_SUBST(CEFLAGS)
33 AC_SUBST(LDEFLAGS)
34 AC_SUBST(LIBOBJS)
35
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
40 AC_CHECK_FUNC(socket,
41     AC_MSG_RESULT(using libc's socket),
42     AC_CHECK_LIB(socket,socket)
43     AC_CHECK_LIB(inet,socket))
44
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))
49
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"])
54
55 AC_CHECK_FUNC(strstr, AC_DEFINE(HAVE_STRSTR), 
56               [EXTRASRC="$EXTRASRC \$(srcdir)/strstr.c"
57                EXTRAOBJ="$EXTRAOBJ strstr.o"])
58
59 AC_CHECK_FUNC(strcasecmp, AC_DEFINE(HAVE_STRCASECMP), 
60               [EXTRASRC="$EXTRASRC \$(srcdir)/strcasecmp.c"
61                EXTRAOBJ="$EXTRAOBJ strcasecmp.o"])
62              
63 AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE), 
64               [EXTRASRC="$EXTRASRC \$(srcdir)/memmove.c"
65                EXTRAOBJ="$EXTRAOBJ memmove.o"])
66              
67 AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPTLONG),
68               [EXTRASRC="$EXTRASRC \$(srcdir)/getopt.c \$(srcdir)/getopt1.c"
69                EXTRAOBJ="$EXTRAOBJ getopt.o getopt1.o"])
70
71 AC_FUNC_VPRINTF
72 AC_FUNC_ALLOCA
73 if test -n "$ALLOCA" 
74 then
75   EXTRASRC="$EXTRASRC \$(srcdir)/alloca.c"
76   EXTRAOBJ="$EXTRAOBJ alloca.o"
77 fi
78
79 dnl AC_CHECK_FUNC calls that might hack the Makefile must precede
80 dnl the following AC_SUBSTs
81
82 AC_SUBST(EXTRADEFS)
83 AC_SUBST(EXTRASRC)
84 AC_SUBST(EXTRAOBJ)
85
86 AC_CHECK_FUNCS(tcsetattr stty setsid seteuid gethostbyname res_search herror \
87   strrchr strerror setlinebuf syslog snprintf vprintf vsnprintf vsyslog \
88   atexit inet_aton strftime setrlimit)
89
90 # Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
91 # and breaks gethostbyname(2).  It's better to use the bind stuff in the C
92 # library.  So don't add -lresolv to the link list unless it's necessary
93 # (It will be necessary when using GNU libc6).
94 AC_CHECK_FUNC(res_search,
95     AC_MSG_RESULT(using libc's resolver functions),
96     AC_CHECK_LIB(resolv,res_search, 
97         [AC_DEFINE(HAVE_RES_SEARCH) AC_MSG_RESULT(found resolver functions in libresolv); LIBS="$LIBS -lresolv"], AC_MSG_RESULT(no resolver calls found)))
98
99 dnl AC_FUNC_SETVBUF_REVERSED
100
101 dnl Check for usable void pointer type
102 AC_MSG_CHECKING(use of void pointer type)
103 AC_TRY_COMPILE([],
104    [char *p;
105     void *xmalloc();
106     p = (char *) xmalloc(1);
107    ],
108  [AC_DEFINE(HAVE_VOIDPOINTER) AC_MSG_RESULT(yes)],
109  AC_MSG_RESULT(no))
110
111 dnl Check for ANSI volatile
112 AC_MSG_CHECKING(for ANSI volatile)
113 AC_TRY_COMPILE([],
114    [volatile int n;],
115  [AC_DEFINE(HAVE_VOLATILE) AC_MSG_RESULT(yes)],
116  AC_MSG_RESULT(no))
117
118 dnl Check out the wait reality.  We have to assume sys/wait.h is present.
119 AC_CHECK_FUNCS(waitpid wait3)
120 AC_MSG_CHECKING(for union wait);
121 AC_TRY_LINK([#include <sys/types.h>
122 #include <sys/wait.h>],
123                  [union wait status; int pid; pid = wait (&status);
124 #ifdef WEXITSTATUS
125 /* Some POSIXoid systems have both the new-style macros and the old
126    union wait type, and they do not work together.  If union wait
127    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
128 if (WEXITSTATUS (status) != 0) pid = -1;
129 #endif
130 #ifdef HAVE_WAITPID
131 /* Make sure union wait works with waitpid.  */
132 pid = waitpid (-1, &status, 0);
133 #endif
134 ],
135   [AC_DEFINE(HAVE_UNION_WAIT) AC_MSG_RESULT(yes)],
136   AC_MSG_RESULT(no))
137
138 AC_MSG_CHECKING(sys_siglist declaration in signal.h or unistd.h)
139 AC_TRY_LINK([#include <signal.h>
140 /* NetBSD declares sys_siglist in <unistd.h>.  */
141 #ifdef HAVE_UNISTD_H
142 #include <unistd.h>
143 #endif], [char *msg = *(sys_siglist + 1);],
144   [AC_DEFINE(SYS_SIGLIST_DECLARED) AC_MSG_RESULT(yes)],
145   AC_MSG_RESULT(no))
146
147 # Find the right directory to put the root-mode PID file in
148 for dir in "/var/run" "/etc"
149 do
150         if test -d $dir 
151         then
152                 break;
153         fi
154 done
155 AC_MSG_RESULT(root-mode pid file will go in $dir)
156 AC_DEFINE_UNQUOTED(PID_DIR, "$dir")
157
158 AC_CHECK_SIZEOF(short)
159 AC_CHECK_SIZEOF(int)
160 AC_CHECK_SIZEOF(long)
161
162 ###     use option --enable-POP2 to compile in the POP2 support
163 AC_ARG_ENABLE(POP2,
164         [  --enable-POP2        compile in POP2 protocol support (obsolete)],
165         [with_POP2=$enableval],
166         [with_POP2=no])
167 test "$with_POP2" = "yes" && AC_DEFINE(POP2_ENABLE)
168
169 ###     use option --disable-POP3 to omit the POP3 support
170 AC_ARG_ENABLE(POP3,
171         [  --disable-POP3       don't compile in POP3 protocol support],
172         [with_POP3=$enableval],
173         [with_POP3=yes])
174 test "$with_POP3" = "yes" && AC_DEFINE(POP3_ENABLE)
175
176 ###     use option --disable-IMAP to omit the IMAP support
177 AC_ARG_ENABLE(IMAP,
178         [  --disable-IMAP       don't compile in IMAP protocol support],
179         [with_IMAP=$enableval],
180         [with_IMAP=yes])
181 test "$with_IMAP" = "yes" && AC_DEFINE(IMAP_ENABLE)
182
183 ###     use option --disable-ETRN to omit the ETRN support
184 AC_ARG_ENABLE(ETRN,
185         [  --disable-ETRN       don't compile in ETRN protocol support],
186         [with_ETRN=$enableval],
187         [with_ETRN=yes])
188 test "$with_ETRN" = "yes" && AC_DEFINE(ETRN_ENABLE)
189
190 ###     use option --enable-RPA to compile in the RPA support
191 AC_ARG_ENABLE(RPA,
192         [  --enable-RPA         compile in RPA protocol support],
193         [with_RPA=$enableval],
194         [with_RPA=no])
195 test "$with_RPA" = "yes" && AC_DEFINE(RPA_ENABLE)
196
197 ###     use option --enable-SDPS to compile in the SDPS support
198 AC_ARG_ENABLE(SDPS,
199         [  --enable-SDPS        compile in SDPS protocol support],
200         [with_SDPS=$enableval],
201         [with_SDPS=no])
202 test "$with_SDPS" = "yes" && AC_DEFINE(SDPS_ENABLE)
203
204 ###     use option --enable-opie to compile in the OPIE support
205 AC_ARG_ENABLE(opie,
206         [  --enable-opie        support OTP through the OPIE library],
207         [ AC_CHECK_HEADER(opie.h,, [echo 'configure: cannot find <opie.h>, which is required for OPIE support.'; exit 1])
208           AC_CHECK_LIB(opie,opiegenerator,, [echo 'configure: cannot find libopie, which is required for OPIE support.'; exit 1])
209           AC_DEFINE(OPIE,1) ],
210         [with_opie=no])
211
212 AC_ARG_ENABLE(inet6,
213         [  --enable-inet6       support IPv6 (requires the inet6-apps library)],
214         [ unset ac_cv_lib_inet6_getaddrinfo; AC_CHECK_LIB(inet6, getaddrinfo,,
215         [ unset ac_cv_lib_inet6_getaddrinfo; LDFLAGS="$LDFLAGS -L/usr/inet6/lib"; AC_CHECK_LIB(inet6, getaddrinfo,,
216         [ echo 'configure: cannot find libinet6, which is required for IPv6 support.'; exit 1]) ])
217           AC_DEFINE(INET6, 1) ])
218
219 AC_ARG_ENABLE(netsec,
220         [  --enable-netsec      support network security (requires inet6-apps library)],
221         [ unset ac_cv_lib_inet6_net_security_strtorequest; AC_CHECK_LIB(inet6, net_security_strtorequest,,
222         [ unset ac_cv_lib_inet6_net_security_strtorequest; LDFLAGS="$LDFLAGS -L/usr/inet6/lib"; AC_CHECK_LIB(inet6, net_security_strtorequest,,
223         [ echo 'configure: cannot find net_security_strtorequest in libinet6, which is required';
224           echo '           for network security support. Either it does not exist, or it was';
225           echo '           not built with network security support enabled.';
226           exit 1]) ])
227           unset ac_cv_header_net_security_h; AC_CHECK_HEADER(net/security.h,,
228         [ unset ac_cv_header_net_security_h; CPPFLAGS="$CPPFLAGS -I/usr/inet6/include"; CFLAGS="$CFLAGS -I/usr/inet6/include"; AC_CHECK_HEADER(net/security.h,,
229         [ echo 'configure: cannot find <net/security.h>, which is required for network security';
230           echo '           support.';
231           exit 1]) ])
232           AC_DEFINE(NET_SECURITY, 1) ])
233   
234 ###     use option --with-gssapi=DIR to compile in GSSAPI support
235 AC_ARG_WITH(gssapi,
236         [  --with-gssapi[=DIR]  compile in GSSAPI support using libraries in DIR],
237 [
238 if test "$with_gssapi" != "no"
239 then
240   if test "$with_gssapi" != "yes" -a -n "$with_gssapi"
241   then
242     CFLAGS="$CFLAGS -I$with_gssapi/include"
243     LDFLAGS="$LDFLAGS -L$with_gssapi/lib"
244   fi
245   AC_CHECK_LIB(krb5, krb5_init_context,,
246                AC_MSG_ERROR([could not find libkrb5 which is needed for GSSAPI support]))
247   AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,,
248                AC_MSG_ERROR([could not find libgssapi_krb5 which is needed for GSSAPI support]), -lkrb5)
249   AC_DEFINE(GSSAPI)
250   LIBS="$LIBS -lgssapi_krb5 -lkrb5"
251 fi])
252
253 ###     use option --with-kerberos=DIR to point at a Kerberos directory
254 AC_ARG_WITH(kerberos,
255         [  --with-kerberos=DIR  point fetchmail compilation at a Kerberos directory])
256
257 # The "elif" arm (nonempty $with_kerberos) is kind of a crock.  It works for
258 # configuring the BSD/OS Kerberos IV support, though. 
259
260 # Check for a NetBSD special case
261 if test "$with_kerberos" = "yes" -a `uname` = "NetBSD" 
262 then
263   echo "Configuring kerberosIV for NetBSD"
264   CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I/usr/include/kerberosIV"
265   LIBS="$LIBS -lkrb -ldes"
266 elif test -n "$with_kerberos"
267 then
268     CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$with_kerberos/include"
269     LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib"
270     LIBS="$LIBS -lkrb -ldes"
271 else
272     for dir in /usr/kerberos /usr/kerberosIV /usr/athena
273     do
274       if test -f "$dir/include/krb.h"
275       then
276         CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$dir/include"
277         LDEFLAGS="$LDEFLAGS -L$dir/lib"
278         LIBS="$LIBS -lkrb -ldes"
279         break
280       fi
281     done
282 fi
283
284 ###     use option --with-kerberos5=DIR to point at a Kerberos 5 directory
285 AC_ARG_WITH(kerberos5,
286         [  --with-kerberos5=DIR  point fetchmail compilation at a Kerberos 5 directory])
287
288 # The "then" arm (nonempty $with_kerberos5) is kind of a crock.  It works for
289 # configuring the BSD/OS Kerberos IV support, though. 
290 if test -n "$with_kerberos5"
291 then
292     # Path given
293     CEFLAGS="$CEFLAGS -DKERBEROS_V5 -I$with_kerberos5/include"
294     LDEFLAGS="$LDEFLAGS -L$with_kerberos5/lib"
295     LIBS="$LIBS -lkrb5 -lcrypto -lcom_err"
296 else
297     for dir in /usr/kerberos /usr/local/krb5 /usr/athena
298     do
299       if test -f "$dir/include/krb5.h"
300       then
301         CEFLAGS="$CEFLAGS -DKERBEROS_V5 -I$dir/include"
302         LDEFLAGS="$LDEFLAGS -L$dir/lib"
303         LIBS="$LIBS -lkrb5 -lcrypto -lcom_err"
304         break
305       fi
306     done
307 fi
308
309 AC_OUTPUT(Makefile, [
310         # The reason for this odd makedepend line is that we want
311         # to have all dependencies evaluated relative to the source directory
312         # and let VPATH do all the dirty work when we build remotely
313         echo "You can ignore any makedepend error messages";
314         (cd $srcdir; makedepend -f - *.c) >>Makefile])
315
316 dnl Local Variables:
317 dnl comment-start: "dnl "
318 dnl comment-end: ""
319 dnl comment-start-skip: "\\bdnl\\b\\s *"
320 dnl compile-command: "make configure config.h.in"
321 dnl End: