]> Pileus Git - ~andy/fetchmail/blob - configure.in
710cd78f5348f23213b501d594f0a1e71ff9a595
[~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 AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h resolv.h net/socket.h)
28
29 AC_C_CONST                      dnl getopt needs this.
30
31 AC_PROG_LEX
32 AC_PROG_YACC
33 AC_SUBST(CPFLAGS)
34 AC_SUBST(CEFLAGS)
35 AC_SUBST(LDEFLAGS)
36 AC_SUBST(LIBOBJS)
37 AC_SUBST(POMAKE)
38
39 PACKAGE=`sed -n '/PACKAGE *= *\(.*\)/s//\1/p' <$srcdir/Makefile.in`
40 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
41 AC_SUBST(PACKAGE)
42
43 VERSION=`sed -n '/VERSION *= *\(.*\)/s//\1/p' <$srcdir/Makefile.in`
44 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
45 AC_SUBST(VERSION)
46
47 # Check for LynxOS special case: -lbsd needed (at least on 2.3.0) and -s
48 # not working.
49 if test `uname` = "LynxOS" 
50 then
51   echo "Adding -lbsd to standard libraries"
52   LIBS="$LIBS -lbsd"
53   LDFLAGS=""
54   echo "Prepending standard include path to gcc flags"
55   CPFLAGS="-I/usr/include"
56 fi
57
58 # Check for FreeBSD special case: -lkvm needed
59 if test `uname` = "FreeBSD" 
60 then
61    echo "Adding -lkvm to standard libraries"
62    LIBS="$LIBS -lkvm"
63 fi
64  
65 # Check for Rhapsody special case: it doesn't like -s
66 if test `uname` = "Rhapsody" 
67 then
68    echo "Removing -s load flag"
69    LDFLAGS=`echo $LDFLAGS | sed "s/-s //"`
70 fi
71  
72 # i18n
73 ALL_LINGUAS="cs es fr pl pt_BR gl da"
74
75 AM_GNU_GETTEXT
76
77 # end i18n
78
79 # Under sysV68, socket and friends are provided by the C library.
80 # -linet does not provide socket, but causes multiple definition
81 # errors at link-time.  It is thus better to only use the C library.
82 # So don't add -linet to the link list unless it's necessary
83 AC_CHECK_FUNC(socket,
84     AC_MSG_RESULT(using libc's socket),
85     AC_CHECK_LIB(socket,socket)
86     AC_CHECK_LIB(inet,socket))
87
88 # If gettext isn't in the C library, maybe there's a -lintl.
89 AC_CHECK_FUNC(gettext,
90     AC_MSG_RESULT(using libc's gettext),
91     AC_CHECK_LIB(intl,gettext))
92
93 # The condition in this test copes with the presence of inet_addr in libc6.
94 AC_CHECK_FUNC(inet_addr,
95     AC_MSG_RESULT(using libc's inet_addr),
96     AC_CHECK_LIB(nsl,inet_addr))
97
98 dnl Port hack for Interactive UNIX System V/386 Release 3.2
99 AC_CHECK_LIB(cposix, strchr,
100                 [EXTRADEFS="$EXTRADEFS -D_SYSV3"
101                 LIBS="$LIBS -lcposix"])
102
103 AC_CHECK_FUNC(strstr, AC_DEFINE(HAVE_STRSTR), 
104               [EXTRASRC="$EXTRASRC \$(srcdir)/strstr.c"
105                EXTRAOBJ="$EXTRAOBJ strstr.o"])
106
107 AC_CHECK_FUNC(strcasecmp, AC_DEFINE(HAVE_STRCASECMP), 
108               [EXTRASRC="$EXTRASRC \$(srcdir)/strcasecmp.c"
109                EXTRAOBJ="$EXTRAOBJ strcasecmp.o"])
110              
111 AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE), 
112               [EXTRASRC="$EXTRASRC \$(srcdir)/memmove.c"
113                EXTRAOBJ="$EXTRAOBJ memmove.o"])
114              
115 AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPTLONG),
116               [EXTRASRC="$EXTRASRC \$(srcdir)/getopt.c \$(srcdir)/getopt1.c"
117                EXTRAOBJ="$EXTRAOBJ getopt.o getopt1.o"])
118
119 AC_CHECK_FUNC(MD5Init, AC_DEFINE(HAVE_MD5),
120               [EXTRASRC="$EXTRASRC \$(srcdir)/md5c.c"
121                EXTRAOBJ="$EXTRAOBJ md5c.o"])
122
123 AC_FUNC_VPRINTF
124 AC_FUNC_ALLOCA
125 if test -n "$ALLOCA" 
126 then
127   EXTRASRC="$EXTRASRC \$(srcdir)/alloca.c"
128   EXTRAOBJ="$EXTRAOBJ alloca.o"
129 fi
130
131 dnl AC_CHECK_FUNC calls that might hack the Makefile must precede
132 dnl the following AC_SUBSTs
133
134 AC_SUBST(EXTRADEFS)
135 AC_SUBST(EXTRASRC)
136 AC_SUBST(EXTRAOBJ)
137
138 AC_CHECK_FUNCS(tcsetattr stty setsid geteuid seteuid gethostbyname \
139   res_search herror strrchr strerror setlinebuf syslog \
140   snprintf vprintf vsnprintf vsyslog \
141   atexit inet_aton strftime setrlimit socketpair sigprocmask sigaction)
142
143 # Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
144 # and breaks gethostbyname(2).  It's better to use the bind stuff in the C
145 # library.  So don't add -lresolv to the link list unless it's necessary
146 # (It will be necessary when using GNU libc6).
147 AC_CHECK_FUNC(res_search,
148     AC_MSG_RESULT(using libc's resolver functions),
149     AC_CHECK_LIB(resolv,res_search, 
150         [AC_DEFINE(HAVE_RES_SEARCH) AC_MSG_RESULT(found resolver functions in libresolv); LIBS="$LIBS -lresolv"], AC_MSG_RESULT(no resolver calls found)))
151
152 dnl Check for libcrypt -- it may live in libc or libcrypt, as on IRIX
153 AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt,crypt))
154
155 dnl Check for RSA refersence library in case we're using SSL
156 AC_CHECK_LIB(rsaref, RSAPublicDecrypt)
157
158 dnl AC_FUNC_SETVBUF_REVERSED
159
160 dnl Check for usable void pointer type
161 AC_MSG_CHECKING(use of void pointer type)
162 AC_TRY_COMPILE([],
163    [char *p;
164     void *xmalloc();
165     p = (char *) xmalloc(1);
166    ],
167  [AC_DEFINE(HAVE_VOIDPOINTER) AC_MSG_RESULT(yes)],
168  AC_MSG_RESULT(no))
169
170 dnl Check for ANSI volatile
171 AC_MSG_CHECKING(for ANSI volatile)
172 AC_TRY_COMPILE([],
173    [volatile int n;],
174  [AC_DEFINE(HAVE_VOLATILE) AC_MSG_RESULT(yes)],
175  AC_MSG_RESULT(no))
176
177 dnl Check out the wait reality.  We have to assume sys/wait.h is present.
178 AC_CHECK_FUNCS(waitpid wait3)
179 AC_MSG_CHECKING(for union wait);
180 AC_TRY_LINK([#include <sys/types.h>
181 #include <sys/wait.h>],
182                  [union wait status; int pid; pid = wait (&status);
183 #ifdef WEXITSTATUS
184 /* Some POSIXoid systems have both the new-style macros and the old
185    union wait type, and they do not work together.  If union wait
186    conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
187 if (WEXITSTATUS (status) != 0) pid = -1;
188 #endif
189 #ifdef HAVE_WAITPID
190 /* Make sure union wait works with waitpid.  */
191 pid = waitpid (-1, &status, 0);
192 #endif
193 ],
194   [AC_DEFINE(HAVE_UNION_WAIT) AC_MSG_RESULT(yes)],
195   AC_MSG_RESULT(no))
196
197 AC_MSG_CHECKING(sys_siglist declaration in signal.h or unistd.h)
198 AC_TRY_LINK([#include <signal.h>
199 /* NetBSD declares sys_siglist in <unistd.h>.  */
200 #ifdef HAVE_UNISTD_H
201 #include <unistd.h>
202 #endif], [char *msg = *(sys_siglist + 1);],
203   [AC_DEFINE(SYS_SIGLIST_DECLARED) AC_MSG_RESULT(yes)],
204   AC_MSG_RESULT(no))
205
206 # Find the right directory to put the root-mode PID file in
207 for dir in "/var/run" "/etc"
208 do
209         if test -d $dir 
210         then
211                 break;
212         fi
213 done
214 AC_MSG_RESULT(root-mode pid file will go in $dir)
215 AC_DEFINE_UNQUOTED(PID_DIR, "$dir")
216
217 AC_CHECK_SIZEOF(short)
218 AC_CHECK_SIZEOF(int)
219 AC_CHECK_SIZEOF(long)
220
221 if test "$USE_NLS" = "yes"
222 then
223         echo 'Enabling internationalization support...'
224         POMAKE='$(MAKE) -C po'
225         if test "x$prefix" != xNONE; then
226                 EXTRADEFS="$EXTRADEFS -DLOCALEDIR='\"$prefix/share/locale\"'"
227         else
228                 EXTRADEFS="$EXTRADEFS -DLOCALEDIR='\"$ac_default_prefix/share/locale\"'"
229         fi
230 else
231         echo 'Disabling internationalization support...'
232         POMAKE="@echo '(NLS support disabled)'; #"
233 fi
234
235 ###     use option --enable-POP2 to compile in the POP2 support
236 AC_ARG_ENABLE(POP2,
237         [  --enable-POP2           compile in POP2 protocol support (obsolete)],
238         [with_POP2=$enableval],
239         [with_POP2=no])
240 test "$with_POP2" = "yes" && AC_DEFINE(POP2_ENABLE)
241
242 ###     use option --disable-POP3 to omit the POP3 support
243 AC_ARG_ENABLE(POP3,
244         [  --disable-POP3          don't compile in POP3 protocol support],
245         [with_POP3=$enableval],
246         [with_POP3=yes])
247 test "$with_POP3" = "yes" && AC_DEFINE(POP3_ENABLE)
248
249 ###     use option --disable-IMAP to omit the IMAP support
250 AC_ARG_ENABLE(IMAP,
251         [  --disable-IMAP          don't compile in IMAP protocol support],
252         [with_IMAP=$enableval],
253         [with_IMAP=yes])
254 test "$with_IMAP" = "yes" && AC_DEFINE(IMAP_ENABLE)
255
256 ###     use option --disable-ETRN to omit the ETRN support
257 AC_ARG_ENABLE(ETRN,
258         [  --disable-ETRN          don't compile in ETRN protocol support],
259         [with_ETRN=$enableval],
260         [with_ETRN=yes])
261 test "$with_ETRN" = "yes" && AC_DEFINE(ETRN_ENABLE)
262
263 ###     use option --enable-RPA to compile in the RPA support
264 AC_ARG_ENABLE(RPA,
265         [  --enable-RPA            compile in RPA protocol support],
266         [with_RPA=$enableval],
267         [with_RPA=no])
268 test "$with_RPA" = "yes" && AC_DEFINE(RPA_ENABLE)
269
270 ###     use option --enable-NTLM to compile in the NTLM support
271 AC_ARG_ENABLE(NTLM,
272         [  --enable-NTLM           compile in NTLM authentication support],
273         [with_NTLM=$enableval],
274         [with_NTLM=no])
275 test "$with_NTLM" = "yes" && AC_DEFINE(NTLM_ENABLE)
276
277 ###     use option --enable-SDPS to compile in the SDPS support
278 AC_ARG_ENABLE(SDPS,
279         [  --enable-SDPS           compile in SDPS protocol support],
280         [with_SDPS=$enableval],
281         [with_SDPS=no])
282 test "$with_SDPS" = "yes" && AC_DEFINE(SDPS_ENABLE)
283
284 ###     use option --enable-opie to compile in the OPIE support
285 AC_ARG_ENABLE(opie,
286         [  --enable-opie           support OTP through the OPIE library],
287         [ AC_CHECK_HEADER(opie.h,, [echo 'configure: cannot find <opie.h>, which is required for OPIE support.'; exit 1])
288           AC_CHECK_LIB(opie,opiegenerator,, [echo 'configure: cannot find libopie, which is required for OPIE support.'; exit 1])
289           with_opie=$enableval],
290         [with_opie=no])
291 test "$with_opie" = "yes" && AC_DEFINE(OPIE_ENABLE)
292
293 AC_ARG_ENABLE(inet6,
294         [  --enable-inet6          support IPv6 (requires the inet6-apps library)],
295
296         [ AC_CHECK_FUNC(getaddrinfo, [with_inet6=yes],
297           [ LDFLAGS="$LDFLAGS -L/usr/inet6/lib";
298             AC_CHECK_LIB(inet6, getaddrinfo, [with_inet6=yes
299             LIBS="$LIBS -linet6"],
300             [ echo 'configure: cannot find proper glibc version or libinet6,';
301               echo '           which is required for IPv6 support.';
302               exit 1]) ] )],
303         [with_inet6=no])
304 test "$with_inet6" = "yes" && AC_DEFINE(INET6_ENABLE)
305
306 AC_CHECK_FUNCS(inner_connect)
307
308 AC_ARG_ENABLE(netsec,
309         [  --enable-netsec         support network security (requires inet6-apps library)],
310         [ unset ac_cv_lib_inet6_net_security_strtorequest; AC_CHECK_LIB(inet6, net_security_strtorequest,,
311           [ unset ac_cv_lib_inet6_net_security_strtorequest;
312             LDFLAGS="$LDFLAGS -L/usr/inet6/lib"; 
313             AC_CHECK_LIB(inet6, net_security_strtorequest,,
314             [ echo 'configure: cannot find net_security_strtorequest in libinet6, which is required';
315               echo '           for network security support. Either it does not exist, or it was';
316               echo '           not built with network security support enabled.';
317               exit 1]) ])
318         unset ac_cv_header_net_security_h; AC_CHECK_HEADER(net/security.h,,
319         [ unset ac_cv_header_net_security_h; 
320         CPPFLAGS="$CPPFLAGS -I/usr/inet6/include"; 
321         CFLAGS="$CFLAGS -I/usr/inet6/include"; AC_CHECK_HEADER(net/security.h,,
322           [ echo 'configure: cannot find <net/security.h>, which is required';
323           echo '             for network security support.';
324           exit 1]) ]) ]
325         [with_netsec=no])
326 test "$with_netsec" = "yes" && AC_DEFINE(NET_SECURITY)
327
328 ###     use option --with-kerberos5=DIR to point at a Kerberos 5 directory
329 AC_ARG_WITH(kerberos5,
330         [  --with-kerberos5=DIR    point fetchmail compilation at a Kerberos 5 directory])
331
332 # The "then" arm (nonempty $with_kerberos5) is kind of a crock.  It works for
333 # configuring the BSD/OS Kerberos IV support, though. 
334 if test -n "$with_kerberos5" -a "$with_kerberos5" != "no"
335 then
336     # Path given
337     CEFLAGS="$CEFLAGS -DKERBEROS_V5 -I$with_kerberos5/include"
338     LDEFLAGS="$LDEFLAGS -L$with_kerberos5/lib"
339     if test -f "$with_kerberos5/include/roken.h"
340     then
341        AC_DEFINE(HEIMDAL)
342        LIBS="$LIBS -lkrb5 -lasn1 -ldes -lroken -lcom_err"
343     else
344        LIBS="$LIBS -lkrb5 -lcrypto -lcom_err"
345     fi
346 elif test "$with_kerberos" != "no"; then
347     for dir in /usr/kerberos /usr/local/krb5 /usr/athena
348     do
349       if test -f "$dir/include/krb5.h"
350       then
351         CEFLAGS="$CEFLAGS -DKERBEROS_V5 -I$dir/include"
352         LDEFLAGS="$LDEFLAGS -L$dir/lib"
353         if test -f "$dir/include/roken.h"
354         then
355            AC_DEFINE(HEIMDAL)
356            LIBS="$LIBS -lkrb5 -lasn1 -ldes -lcom_err"
357         else
358            LIBS="$LIBS -lkrb5 -lcrypto -lcom_err"
359         fi
360         with_kerberos5=$dir
361         break
362       fi
363     done
364 fi
365
366 ###     use option --with-ssl to compile in the SSL support
367 AC_ARG_WITH(ssl,
368         [  --with-ssl=[DIR]        enable SSL support using libraries in DIR],
369         [with_ssl=$withval],
370         [with_ssl=no])
371 test "$with_ssl" = "yes" && AC_DEFINE(SSL_ENABLE)
372
373 if test "$with_ssl" = "yes"
374 then
375 #       He didn't specify an SSL location.  Let's look at some common
376 #       directories where SSL has been found in the past and try and auto
377 #       configure for SSL.  OpenSSL determination will be made later.
378 #       This will screw up if an OpenSSL install is located in a later
379 #       directory than an older SSLeay install, but the user should fix that
380 #       anyways and he can override on the configure line.
381
382     for ac_dir in \
383       /usr/local/ssl \
384       /usr/ssl \
385       /local/ssl \
386       /opt/ssl \
387       ; \
388     do
389         if test -d "$ac_dir" ; then
390             with_ssl=$ac_dir
391             break;
392         fi
393     done
394 fi
395
396 if test -n "$with_ssl" -a "$with_ssl" != "no"
397 then
398     # With the autoconfigure above, the only time this is going to be
399     # true is going to be when we could not find the headers.  If they
400     # are not in system standard locations, we are going to be broken.
401     if test "$with_ssl" = "yes"
402     then
403 # Let's just define the standard location for the SSLeay root
404         with_ssl="/usr/local/ssl"
405     fi
406     if test -r $with_ssl/include/openssl/ssl.h
407     then
408 ###     ssl.h found under openssl.  Use openssl configuration preferentially
409         echo "Enabling OpenSSL support in $with_ssl"
410         CEFLAGS="$CEFLAGS -I$with_ssl/include -I$with_ssl/include/openssl"
411 ###     OpenBSD comes with ssl headers
412     elif test -r /usr/include/ssl/ssl.h
413     then
414         echo "Enabling SSLeay support in $with_ssl"
415         CEFLAGS="$CEFLAGS -I/usr/include/ssl"
416     else
417         echo "Enabling SSLeay support in $with_ssl"
418         CEFLAGS="$CEFLAGS -I$with_ssl/include"
419     fi
420     LDEFLAGS="$LDEFLAGS -L$with_ssl/lib"
421     LIBS="$LIBS -lssl -lcrypto"
422     AC_DEFINE(SSL_ENABLE)
423 else
424     echo 'Disabling SSL support...'
425 fi
426
427 ###     use option --with-kerberos=DIR to point at a Kerberos directory
428 AC_ARG_WITH(kerberos,
429         [  --with-kerberos=DIR     point fetchmail compilation at a Kerberos directory])
430
431 # The "elif" arm (nonempty $with_kerberos) is kind of a crock.  It works for
432 # configuring the BSD/OS Kerberos IV support, though. 
433
434 # Check for a NetBSD/OpenBSD special case
435 if test "$with_kerberos" = "yes" && test `uname` = "NetBSD" -o `uname` = "OpenBSD"
436 then
437   echo "Configuring kerberosIV for `uname`"
438   CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I/usr/include/kerberosIV"
439   LIBS="$LIBS -lkrb -ldes"
440 elif test -n "$with_kerberos" -a -n "$with_kerberos5" -a "$with_kerberos" != "no"
441 then
442     CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$with_kerberos/include"
443     LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib"
444     if test -f "$with_kerberos5/roken.h"
445     then
446        AC_DEFINE(HEIMDAL)
447        LIBS="-lkrb4 -l45 $LIBS" 
448     else
449        LIBS="-lkrb4 -ldes425 $LIBS"
450     fi
451 elif test -n "$with_kerberos5" -a "$with_kerberos" != "no"
452 then
453     for dir in /usr/kerberos /usr/kerberosIV /usr/athena
454     do
455       if test -f "$dir/include/kerberosIV/krb.h"
456       then
457         CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$dir/include"
458         LDEFLAGS="$LDEFLAGS -L$dir/lib"
459         LIBS="-lkrb4 -ldes425 $LIBS"
460         break
461       fi
462     done
463 elif test -n "$with_kerberos" -a "$with_kerberos" != "no"
464 then
465     CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$with_kerberos/include"
466     LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib"
467     LIBS="$LIBS -lkrb -ldes"
468 else
469   if test "$with_kerberos" != "no"
470   then
471     for dir in /usr/kerberos /usr/kerberosIV /usr/athena
472     do
473       if test -f "$dir/include/krb.h"
474       then
475         CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$dir/include"
476         LDEFLAGS="$LDEFLAGS -L$dir/lib"
477         LIBS="$LIBS -lkrb -ldes"
478         break
479       fi
480     done
481 fi
482
483 ###     use option --with-socks=DIR to point at SOCKS library
484 AC_ARG_WITH(socks,
485         [  --with-socks[=DIR]      add built-in SOCKS firewall access],
486 [
487 if test "$with_socks" != no
488 then
489     if test "$with_socks" != yes
490     then
491         LDEFLAGS="$LDEFLAGS -L$with_socks"
492     else
493         AC_CHECK_LIB(socks, Rconnect,,
494                AC_MSG_ERROR([could not find libsocks which is needed for built-in SOCKS support]))
495     fi
496     AC_DEFINE(HAVE_SOCKS)
497     CEFLAGS="$CEFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
498     LIBS="-lsocks $LIBS"
499 fi])
500
501 ###     use option --with-socks5=DIR to point at SOCKS library
502 AC_ARG_WITH(socks5,
503         [  --with-socks5[=DIR]     add built-in SOCKS5 firewall access],
504 [
505 if test "$with_socks5" != no
506 then
507     if test "$with_socks5" != yes
508     then
509         LDEFLAGS="$LDEFLAGS -L$with_socks5"
510     else
511         AC_CHECK_LIB(socks5, SOCKSconnect,,
512                AC_MSG_ERROR([could not find libsocks5 which is needed for built-in SOCKS5 support]))
513     fi
514     AC_DEFINE(HAVE_SOCKS)
515     CEFLAGS="$CEFLAGS -Dconnect=SOCKSconnect -Dgetsockname=SOCKSgetsockname -Dbind=SOCKSbind -Daccept=SOCKSaccept -Dlisten=SOCKSlisten -Dselect=SOCKSselect -Drecvfrom=SOCKSrecvfrom -Dsendto=SOCKSsendto -Drecv=SOCKSrecv -Dsend=SOCKSsend -Dread=SOCKSread -Dwrite=SOCKSwrite -Drresvport=SOCKSrresvport -Dshutdown=SOCKSshutdown -Dlisten=SOCKSlisten -Dclose=SOCKSclose -Ddup=SOCKSdup -Ddup2=SOCKSdup2 -Dfclose=SOCKSfclose -Dgethostbyname=SOCKSgethostbyname"
516     LIBS="-lsocks5 $LIBS"
517 fi])
518
519 ###     use option --with-hesiod=DIR to point at a HESIOD directory
520 AC_ARG_WITH(hesiod,
521         [  --with-hesiod=DIR       point fetchmail compilation at a HESIOD directory])
522
523 case "x$with_hesiod" in
524 xno)
525     ;;
526 x)
527     for dir in /usr/athena /usr /usr/local
528     do
529       if test -f "$dir/include/hesiod.h"
530       then
531         CEFLAGS="$CEFLAGS -DHESIOD -I$dir/include"
532         LDEFLAGS="$LDEFLAGS -L$dir/lib"
533         LIBS="$LIBS -lhesiod"
534         with_hesiod=$dir
535         break
536       fi
537     done
538     ;;
539 *)
540     # Path given
541     CEFLAGS="$CEFLAGS -DHESIOD -I$with_hesiod/include"
542     LDEFLAGS="$LDEFLAGS -L$with_hesiod/lib"
543     LIBS="$LIBS -lhesiod"
544     ;;
545   esac
546 fi
547
548 ###     use option --with-gssapi=DIR to compile in GSSAPI support
549 AC_ARG_WITH(gssapi,
550         [  --with-gssapi[=DIR]     compile in GSSAPI support using libraries in DIR],
551 [
552 if test "$with_gssapi" != "no"
553 then
554   if test "$with_gssapi" = "yes" -a -n "$with_kerberos5"
555   then
556     with_gssapi=$with_kerberos5
557   fi
558   if test "$with_gssapi" != "yes" -a -n "$with_gssapi"
559   then
560     CFLAGS="$CFLAGS -I$with_gssapi/include"
561     LDFLAGS="$LDFLAGS -L$with_gssapi/lib"
562   fi
563
564   if test -f "$with_gssapi/include/roken.h"
565   then
566      LIBS="$LIBS -lkrb5 -lasn1 -ldes -lroken -ldb -ldl"
567      AC_CHECK_LIB(gssapi, gss_init_sec_context,LIBS="$LIBS -lgssapi",
568                   AC_MSG_ERROR([could not find libgssapi which is needed for GSSAPI support]), )
569      AC_DEFINE(HEIMDAL)
570   else
571      AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,LIBS="$LIBS -lgssapi_krb5",
572                   AC_MSG_ERROR([could not find libgssapi_krb5 which is needed for GSSAPI support]), -lkrb5)
573   fi
574   AC_DEFINE(GSSAPI)
575   save_CPPFLAGS=$CPPFLAGS
576   CPPFLAGS="-I$with_gssapi/include"
577   AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h)
578   if test "$ac_cv_header_gssapi_h" = "yes"; then
579     AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE))
580   else
581     AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE))
582   fi
583 fi])
584
585 AC_OUTPUT([Makefile intl/Makefile po/Makefile.in], [
586         # The reason for this odd makedepend line is that we want
587         # to have all dependencies evaluated relative to the source directory
588         # and let VPATH do all the dirty work when we build remotely
589         echo "You can ignore any makedepend error messages:";
590         echo timestamp > stamp-h;
591         (cd $srcdir; makedepend -f - *.c) >>Makefile])
592
593 dnl Local Variables:
594 dnl comment-start: "dnl "
595 dnl comment-end: ""
596 dnl comment-start-skip: "\\bdnl\\b\\s *"
597 dnl compile-command: "make configure config.h.in"
598 dnl End: