1dnl
2dnl Copyright (c) 2011 QUALCOMM Incorporated.  All rights reserved.
3dnl The file License.txt specifies the terms for use, modification,
4dnl and redistribution.
5dnl
6dnl
7dnl File:       configure.in
8dnl Project:    Qpopper Server
9dnl Revisions:
10dnl
11dnl   04/26/10   [rg]
12dnl          - Added "check-hash-dir" as alias for "hash-dir-check".
13dnl          - Added "server-mode" as alias for "servermode".
14dnl   07/12/09   [rg]
15dnl          - Don't add "-m64" to CFLAGS when not using gcc.
16dnl   02/20/09   [rg]
17dnl          - Fix 64-bit compilation.
18dnl   06/16/08   [rg]
19dnl          - Added checks for mktemp, md5, and base64
20dnl   04/18/08   [rg]
21dnl          - Added check for strlcpy and strlcat
22dnl   12/07/07   [rg]
23dnl          - Added more checks to try and find getprpwnam().
24dnl          - Fixed bug that enabled pam by default (it should
25dnl            only be default enabled on certain platforms).
26dnl   12/04/07   [rg]
27dnl          - Added check for socklen_t (thanks to Hajimu UMEMOTO)
28dnl   12/02/07   [rg]
29dnl          - Tweaked pam so that default isn't enabled accidently.
30dnl          - Added check for getprpwnam() and if found, enable
31dnl            specialauth, just like we do for getspnam().  This
32dnl            should fix default configuration on platforms like
33dnl            Tru64 (thanks to J Bacher for his help on this).
34dnl   04/28/05   [rg]
35dnl          - Added check for crypt.h
36dnl          - Added check for setresuid(), used on HPUX
37dnl   04/22/05   [rg]
38dnl          - Added '--enable-tempnam' to continue using tempnam()
39dnl            instead of mkstemp() (just in case)
40dnl   04/14/05   [rg]
41dnl          - Check for libcrypt now unconditional
42dnl          - Export pam service name to Makefile
43dnl   07/23/04   [rg]
44dnl          - Added checks for declarations.
45dnl          - Don't set "traditional-cpp" for Apple gcc versions other than 2
46dnl          - Enable '--with-pam' by default on Darwin
47dnl   02/03/03   [rg]
48dnl          - Added '--enable-32-bit' and 'enable-64-bit'.
49dnl   01/18/03   [kenh]
50dnl          - Added SASL stuff.
51dnl   01/17/03   [rg]
52dnl          - Fixed library checks for SCO (hopefully).
53dnl   01/13/03   [rg]
54dnl          - Added checks for additional libraries for gethostbyname
55dnl   11/16/01   [secabeen]
56dnl          - Added 'enable-home-dir-misc' to put .pop and .cache files
57dnl            in home directories
58dnl   04/03/01   [rg]
59dnl          - Added some checks to compile cleanly on Darwin/Mac OS X.
60dnl   03/14/01   [rg]
61dnl          - Added 'enable-poppassd' to generate poppassd.
62dnl   02/20/01   [rg]
63dnl          - Don't insist on libkrb4 if '--with-kerberos5' specified.
64dnl   02/09/01   [rg]
65dnl          - Checking for lk5crypto/lcrrypto when using Kerberos 5.
66dnl   01/25/01   [rg]
67dnl          - Added '--enable-chunky-writes=0|1|2' to set default for
68dnl            pooling of network writes.
69dnl   01/10/01   [rg]
70dnl          - USE_REG_STRUCT_RET now has three possible values: yes, no,
71dnl            and default.  Fixed default case.
72dnl   01/02/00   [rg]
73dnl          - Fix setting of SPEC_POP_AUTH.
74dnl          - Fix check for -lsec on HPUX.
75dnl   12/28/00   [rg]
76dnl          - Set --enable-specialauth default based on getspnam().
77dnl   12/21/00   [rg]
78dnl          - Added '--disable-hash-dir-check' to not check for or
79dnl            create hash spool directories if they don't exist.
80dnl          - --enable-specialauth is now the default.
81dnl   12/15/00   [rg]
82dnl          - Added '--without-gdbm' to avoid it.
83dnl   11/26/00   [rg]
84dnl          - Adjustments for 'make install' support.
85dnl   11/13/00   [rg]
86dnl          - Added check if gcc supports __attribute__ (format).
87dnl   11/03/00   [rg]
88dnl          - Only add 'idirafter' if '/usr/local/include/gdbm.h' present.
89dnl   10/29/00   [rg]
90dnl          - Added '--with-openssl' for use with OpenSSL.
91dnl          - Added check for /dev/urandom.
92dnl          - Changed '--enable-drac' to '--with-drac'.
93dnl          - Changed '--with-new-bulls' to '--enable-new-bulls'.
94dnl          - Changed '--with-popuid=pop' to '--enable-popuid=pop'.
95dnl          - Changed '--with-log-facility' to '--enable-log-facility'
96dnl   10/18/00   [rg]
97dnl          - Added '--with-sslplus' for use with Certicom's SSL Plus.
98dnl          - Added '--with-sslplus-crypto' also for use with SSL Plus.
99dnl   10/04/00   [rg]
100dnl          - Only add 'idirafter' when using gcc.
101dnl   10/02/00   [rg]
102dnl          - Added '--enable-fast-update' to reduce I/O during update
103dnl            at end of session in server mode.  Note that use of this
104dnl            option may cause utilities which access the spool (such
105dnl            as biff or the shell's mail check) to not function
106dnl            properly.  This option should only be used when all spool
107dnl            access is through POP (other than the local delivery agent).
108dnl   09/27/00   [rg]
109dnl          - Added '--disable-update-abort' to set NOUPDATEONABORT.
110dnl          - Moved UnixWare case before default.
111dnl          - Added check for select.h and sys/select.h.
112dnl   09/20/00   [rg]
113dbl          - Add --enable-cache-dir=path' to set path for cache files.
114dnl   09/14/00   [rg]
115dnl          - Add '-idirafter /usr/local/include' since some systems
116dnl            (often BSD) don't search there by default, yet gdbm
117dnl            puts files there.
118dnl   09/06/00   [rg]
119dnl          - Added check for UnixWare.
120dnl          - Added a few misc. checks.
121dnl   09/01/00   [rg]
122dnl          - Added check for libdl and libpam.
123dnl          - Added --enable-auth-file and --enable-nonauth-file.
124dnl   08/23/00   [rg]
125dnl          - Added --enable-low-debug for low-level debugging.
126dnl   08/16/00   [rg]
127dnl          - Added 'enable-standalone' option to create standalone
128dnl            POP3 daemon instead of using inetd.
129dnl          - Added check for usleep().
130dnl          - Added check for gettimeofday()
131dnl          - Added check for sys/time.h
132dnl          - Added check for setproctitle(3).
133dnl   07/12/00   [rg]
134dnl          - Added patch from Ken Hornstein for Kerberos v5 et al.
135dnl          - Added '--enable-kuserok' to use kuserok() to vet users.
136dnl          - Added '--enable-ksockinst' to use getsockinst() for Kerberos
137dnl            instance.
138dnl   07/05/00   [rg]
139dnl          - Added check for srandom for old OSes (*sigh*).
140dnl   06/30/00   [rg]
141dnl          - Added --disable-optimizations to turn off optimizations.
142dnl          - Changed gperf stuff to avoid problems on systems without
143dnl            gperf.
144dnl   06/20/00   [rg]
145dnl          - Added --enable-secure-nis-plus for use with secure NIS+.
146dnl   06/16/00   [rg]
147dnl          - Added --disable-old-spool-loc to not check for old
148dnl            .user.pop files in old locations.
149dnl          - Added --enable-server-mode-group-include and
150dnl            --enable-server-mode-group-exclude to set or reset
151dnl            server mode by default for users in the specified
152dnl            group.
153dnl   06/10/00   [rg]
154dnl          - Added --disable-check-pw-max to stop check for expired
155dnl            passwords.
156dnl          - Now checking for spool in /var before /usr.
157dnl          - Added '-ls' to LIBS for AIX.
158dnl   06/08/00   [rg]
159dnl          - Added --enable-old-uidl to encode UIDLs in old (pre-3.x)
160dnl            style.  Only useful if NO_STATUS is defined and you have
161dnl            users with existing pre-3.x spools.
162dnl          - Added --status to to permit writing 'Status' and 'X-UIDL'
163dnl            headers to the spool.  This defaults to on, so to set
164dnl            NO_STATUS you disable this.
165dnl          - Added --keep-temp-drop to prevent deleting the temp drop.
166dnl   06/05/00   [rg]
167dnl          - Added --enable-drac.  Based on patches by Mike McHenry,
168dnl            Forrest Aldrich, Steven Champeon, and others
169dnl   05/16/00   [rg]
170dnl          - Added --enable-spool-dir to specify location of spool
171dnl            files instead of searching.
172dnl          - Added --enable-timing to write log records with elapsed
173dnl            time for authentication, initialization, and cleanup.
174dnl   04/28/00   [rg]
175dnl          - Added checks for SCO.
176dnl   03/20/00   [rg]
177dnl          - Fixed use of 'DEFS' instead of 'OS_DEFS'.
178dnl   03/11/00   [rg]
179dnl          - Changed 'test -r' to 'test -f'.
180dnl   03/09/00   [rg]
181dnl          - Changed AUTH to SPEC_POP_AUTH.
182dnl          - Changed 'test -x' to 'test -r' because not all systems
183dnl            support '-x' (*sigh*)
184dnl   03/03/00   [rg]
185dnl          - Add --enable-group-bulls to show bulletins by groups
186dnl            (group name is second element in bulletin name).
187dnl   02/16/00   [rg]
188dnl          - Add --enable-uw-kludge to check for and hide UW
189dnl            'Folder Internal Data' messages.
190dnl   02/04/00   [rg]
191dnl          - Restore check for gperf, but warn (not error) if not found.
192dnl   02/03/00   [rg]
193dnl          - Added '-Ae' flag when using HP's C compiler.
194dnl   02/02/00   [rg]
195dnl          - Made changes suggested by Jacques Distler for NEXT systems.
196dnl   01/28/00   [rg]
197dnl          - Fixed --enable-home-dir-mail=Mailbox.
198dnl   01/20/00   [rg]
199dnl          - Added check for snprintf() and vsnprintf().
200dnl   01/18/00   [rg]
201dnl          - Added check for hstrerror().
202dnl          - Don't look for or link with *dbm unless BULLDB, APOP, or SCAM
203dnl            used.
204dnl          - Added --enable-popbulldir to specify alternate location for
205dnl            users' popbull files.
206dnl   01/15/00   [rg]
207dnl          - Added --with-log-facility to specify the log facility.
208dnl   01/07/00   [rg]
209dnl          - Added --enable-hash-spool to use hashed spool directories.
210dnl          - Made POP_DROP and related directories depend on spool dir.
211dnl          - Added --enable-home-dir-mail to use spool files in user's
212dnl            home directory.
213dnl          - Added --enable-temp-drop-dir to specify directory for temporary
214dnl            drop files.
215dnl   12/29/99   [rg]
216dnl          - Fitted German Poo's patch adding --with-pam to
217dnl            support PAM.
218dnl          - Removed -fstrength-reduce (included in -o2)
219dnl          - Added check for BSDI-style DBM (BSD44_DBM)
220dnl          - Removed -DBSD, since BSD param.h defines it as year and month
221dnl          - Only check for gperf if mmangle/etags.c doesn't exist.
222dnl          - Remove useless doc/Makefile and man/Makefile.
223dnl   12/21/99   [rg]
224dnl          - Added --enable-bulldb as alternative to
225dnl            --enable-bulletins to use bulletin database for
226dnl            tracking bulletins.
227dnl          - Added --with-new-bulls to specify max bulletins
228dnl            for new users.
229dnl   12/17/99   [rg]
230dnl          - Added check if ar chokes on -r.
231dnl          - Added --with-warnings for extra compiler warnings.
232dnl          - If gcc version 2.7.2.3 is detected, remove -O2 flag.
233dnl          - Added -lsec to $LIBS when --enable-specialauth is
234dnl            used on HP.
235dnl   12/10/99   [rg]
236dnl          - Added --enable-warnings for extra compiler warnings.
237dbl          - Deleted unused --enable-mangle.
238dnl   12/08/99   [rg]
239dnl          - Added NeXTStep to OS section.
240dnl          - Added USE_REG_STRUCT_RETURN for FreeBSD and NeXTStep.
241dnl            This causes -freg-struct-return to be passed to gcc
242dnl            instead of -fpcc-struct-return.
243dnl   12/07/99   [rg]
244dnl          - Modify to use 'ar r' instead of 'ar -r', and to call
245dnl            ranlib, on SunOS4.
246dnl   12/02/99   [rg]
247dnl          - Add --enable-shy to hide qpopper version number.
248dnl   11/24/99   [rg]
249dnl          - Change MAILOCK to SYS_MAILLOCK.
250dnl   05/21/99   [rg]
251dnl          - Add --enable-auto-delete to automatically delete
252dnl            RETRd msgs.
253dnl   05/03/99   [rg]
254dnl          - Add FREEBSD and AC_DECL_SYS_SIGLIST
255dnl          - Add --enable-log-login to log successful logins
256dnl   09/30/98   [rg]
257dnl          - Edits for QPopper 3.0 version.
258dnl   05/06/98   [py]
259dnl          - Added AC_CHECK_SIZE for UINT4 in md5.h for 64bit OS.
260dnl   04/04/98   [py]
261dnl          - Added options for bulletins, servermode, specialauth
262dnl            (for systems with shadow passwords and Trusted
263dnl            systems), APOP,MANGLE.
264dnl   05/05/97   [py]
265dnl          - Added.
266dnl
267dnl Process this file with autoconf to produce a configure script.
268dnl
269
270AC_INIT(common/flock.c)
271AC_CONFIG_HEADER(config.h)
272
273dnl
274dnl Extract Qpopper version information
275dnl
276QPOPVERS=`grep "#define VERS_NUM" popper/version.h | awk '{print $3}'`
277AC_MSG_RESULT(Configuring Qpopper version $QPOPVERS)
278
279
280dnl
281dnl ---------- Checks for programs. ----------
282dnl
283
284AC_PROG_MAKE_SET
285AC_PROG_CC
286AC_ISC_POSIX
287AC_PROG_YACC
288AC_PROG_LEX
289AC_CHECK_PROGS(AR,    ar,          AC_MSG_ERROR("Unable to find ar"))
290AC_PROG_RANLIB
291AC_PROG_INSTALL
292AC_CHECK_PROGS(GPERF, gperf cperf, AC_MSG_WARN("Unable to find gperf/cperf"))
293
294if test -n "$GPERF"
295then
296    GPERFCMD="\${GPERF} -tpacCg -k"*" -N etags_lookup -H etags_hash -K enriched_tag etags.gperf > etags.c"
297else
298    GPERFCMD="touch etags.c"
299fi
300
301if test "$ISC" = "yes"
302then
303    AC_CHECK_LIB( cposix, main )
304    AC_CHECK_LIB( inet, bzero, NETWORK_LIBS="$NETWORK_LIBS -linet" )
305fi
306
307
308dnl
309dnl ---------- Make sure /usr/local/include gets searched ----------
310dnl
311
312if test -r /usr/local/include/gdbm.h -a "$GCC" = yes
313then
314    CFLAGS="$CFLAGS -idirafter /usr/local/include"
315    CPPFLAGS="$CPPFLAGS -idirafter /usr/local/include"
316fi
317
318
319dnl
320dnl ---------- gcc 2.7.2.3 optimizer emits bad code ----------
321dnl       reports Brian McCauley <B.A.McCauley@bham.ac.uk>
322dnl
323if test "$GCC" = yes
324then
325        AC_MSG_CHECKING([for gcc version 2.7.2.3])
326        if gcc --version | grep "2\.7\.2\.3" > /dev/null
327        then
328                AC_MSG_RESULT(yes)
329                AC_MSG_RESULT(CFLAGS was $CFLAGS)
330                CFLAGS=`echo "$CFLAGS" | sed 's/-O2//'`
331                AC_MSG_RESULT(CFLAGS now $CFLAGS)
332        else
333                AC_MSG_RESULT(no)
334        fi
335fi
336
337
338dnl
339dnl ---------- check if gcc supports '__attribute__ (format)' ----------
340dnl
341AC_MSG_CHECKING( [if gcc supports __attribute__ (format)] )
342AC_TRY_COMPILE( [ #include <stdarg.h> ],
343                [ char *fmt(char *c,...) __attribute__ ((format (printf, 1, 2)));
344                  char *p = fmt("test"); ],
345                AC_MSG_RESULT([yes]); AC_DEFINE(SUPPORT_ATTRIBUTE_FORMAT),
346                AC_MSG_RESULT(no) )
347
348
349dnl
350dnl ---------- See if ar chokes on '-r' ----------
351dnl
352AC_MSG_CHECKING([if ar chokes on -r])
353if ar -r junque.ar ${srcdir}/configure.in 2>/dev/null
354then
355        AR_FLAG=" -r "
356        RANLIB_CMD=""
357        rm -f junque.ar
358        AC_MSG_RESULT(no)
359elif ar r junque.ar ${srcdir}/configure.in 2>/dev/null
360then
361        AR_FLAG=" r "
362        RANLIB_CMD="	\${RANLIB} \$@"
363        rm -f junque.ar
364        AC_MSG_RESULT(yes)
365else
366        AC_MSG_RESULT(ar fails)
367        AC_MSG_ERROR(ar doesn't work)
368        AR_FLAG=" r "
369        RANLIB_CMD="	\${RANLIB} \$@"
370fi
371AC_SUBST(AR_FLAG)
372
373
374dnl
375dnl ---------- Need to check for getspnam() and getprpwnam() ----------
376dnl ---------- before we process options                     ----------
377dnl
378
379AC_CHECK_FUNC( getspnam,   found_spnam="yes",   found_spnam="no" )
380AC_CHECK_FUNC( getprpwnam, found_prpwnam="yes", found_prpwnam="no" )
381
382if test "$found_spnam" != "yes"; then
383    AC_CHECK_LIB( shadow, getspnam, found_spnam="yes", found_spnam="no" )
384    if test "$found_spnam" = "yes"; then
385        LIBS="$LIBS -lshadow"
386    fi
387fi
388
389if test "$found_prpwnam" != "yes"; then
390    AC_CHECK_LIB( prot, getprpwnam, found_prpwnam="yes", found_prpwnam="no" )
391    if test "$found_prpwnam" = "yes"; then
392        LIBS="$LIBS -lprot"
393    fi
394fi
395
396if test "$found_prpwnam" != "yes"; then
397    AC_CHECK_LIB( sec, getprpwnam, found_prpwnam="yes", found_prpwnam="no" )
398    if test "$found_prpwnam" = "yes"; then
399        LIBS="$LIBS -lsec"
400    fi
401fi
402
403if test "$found_prpwnam" != "yes"; then
404    AC_CHECK_LIB( security, getprpwnam, found_prpwnam="yes", found_prpwnam="no" )
405    if test "$found_prpwnam" = "yes"; then
406        LIBS="$LIBS -lsecurity"
407    fi
408fi
409
410if test "$found_spnam" = "yes"; then
411    AC_MSG_RESULT( Found getspnam(); using shadow passwords by default )
412    else
413    if test "$found_prpwnam" = "yes"; then
414        AC_MSG_RESULT( Found getprpwnam(); using secure protected passwords by default )
415    fi
416fi
417
418if test "$found_spnam" = "yes" -o "$found_prpwnam" = "yes"; then
419    found_spnam_prpwnam="yes"
420else
421    found_spnam_prpwnam="no"
422fi
423
424
425dnl
426dnl ---------- Check for configure options ----------
427dnl
428
429dnl
430dnl (old forms of some options are still supported for backwards compatibility)
431dnl
432AC_ARG_WITH(new-bulls, , newbullcnt="$withval", newbullcnt="no")
433AC_ARG_WITH(popuid, , popuid=$withval, popuid="no")
434AC_ARG_WITH(log-facility, , logid="$withval", logid="no")
435AC_ARG_ENABLE(drac, , dracauth="$enableval", dracauth="no")
436
437
438AC_ARG_ENABLE(debugging, [ --enable-debugging       Compile in debugging code ],
439              debugging="$enableval", debugging="no")
440if test "$debugging" != "no"; then
441    AC_MSG_RESULT(Turning on debugging code)
442    AC_DEFINE(DEBUG)
443else
444    AC_MSG_RESULT(Will NOT compile in debugging code)
445fi
446
447
448AC_ARG_ENABLE(low_debug, [ --enable-low-debug       Low-level heavy-duty debugging only.],
449              _debugging="$enableval", _debugging="no")
450if test "$_debugging" != "no"; then
451    AC_MSG_RESULT(Low-level heavy-duty debugging enabled!)
452    AC_DEFINE(_DEBUG)
453    CFLAGS=`echo "$CFLAGS" | sed 's/-O2//'`
454fi
455
456AC_ARG_ENABLE(server-mode, ,
457              servermode_old="$enableval", servermode_old="no")
458AC_ARG_ENABLE(servermode, [ --enable-servermode      Enable SERVER_MODE ],
459              servermode="$enableval", servermode="$servermode_old")
460if test "$servermode" != "no"; then
461    AC_MSG_RESULT(Enabled SERVER_MODE)
462    AC_DEFINE(SERVER_MODE)
463fi
464
465
466AC_ARG_ENABLE(bulletins, [ --enable-bulletins=directory
467                          Set the path for bulletin directory [/var/spool/bulls] ],
468              bulletins="$enableval", bulletins="no")
469if test "$bulletins" != "no" ; then
470    AC_MSG_RESULT(Bulletin support is enabled)
471    if test "$bulletins" != "yes" ; then
472        AC_DEFINE_UNQUOTED(BULLDIR, "$bulletins")
473    else
474        AC_DEFINE_UNQUOTED(BULLDIR, "/var/spool/bulls")
475    fi
476fi
477
478
479AC_ARG_ENABLE(bulldb, [ --enable-bulldb=path     Set the path for bulletin directory and use database to
480                              track bulletins [/var/spool/bulls] ],
481              bulldb="$enableval", bulldb="no")
482if test "$bulldb" != "no" ; then
483    need_db=yes
484    AC_MSG_RESULT(Bulletin database support is enabled)
485    AC_DEFINE(BULLDB)
486    if test "$bulldb" != "yes" ; then
487        AC_DEFINE_UNQUOTED(BULLDIR,"$bulldb")
488    elif test "$bulletins" = "no" ; then
489        AC_DEFINE_UNQUOTED(BULLDIR, "/var/spool/bulls")
490    fi
491fi
492
493
494AC_ARG_ENABLE(new-bulls, [ --enable-new-bulls=count Specify the maximum number of bulletins for new users [10] ],
495              newbullcnt="$enableval")
496if test "$newbullcnt" != "no" ; then
497    if test "$newbullcnt" != "yes" ; then
498        AC_MSG_RESULT(Maximum bulletins for new users=$newbullcnt)
499        AC_DEFINE_UNQUOTED(NEWBULLCNT, $newbullcnt)
500    else
501        AC_MSG_RESULT(Maximum bulletins for new users=10)
502        AC_DEFINE_UNQUOTED(NEWBULLCNT, 10)
503    fi
504fi
505
506
507AC_ARG_ENABLE(popbulldir, [ --enable-popbulldir=path Specify alternate directory for popbull files],
508              popbulldir="$enableval", popbulldir="no")
509if test "$popbulldir" != "no" -a "$popbulldir" != "yes" ; then
510    AC_DEFINE_UNQUOTED(POPBULLDIR, "$popbulldir")
511    AC_MSG_RESULT(User's popbull files are in $popbulldir)
512fi
513
514
515AC_ARG_ENABLE(specialauth, [ --enable-specialauth     Enable secure crypt or shadow passwords ],
516              specialauth="$enableval", specialauth="$found_spnam_prpwnam")
517if test "$specialauth" = "yes"; then
518    AC_MSG_RESULT(Defining SPEC_POP_AUTH)
519    AC_DEFINE(SPEC_POP_AUTH)
520fi
521
522
523AC_ARG_WITH(pam, [ --with-pam=service-name  Use PAM authentication [pop3]],
524            use_pam=$withval, use_pam="_default_")
525if test "$use_pam" != "no" -a $use_pam != "_default_"; then
526    if test "$use_pam" != "yes"; then
527        AC_DEFINE_UNQUOTED(USE_PAM, "$use_pam")
528        AC_SUBST(USE_PAM, "$use_pam")
529        AC_MSG_RESULT(Enabling PAM with service name "$use_pam" and defining SPC_POP_AUTH)
530    else
531        AC_DEFINE_UNQUOTED(USE_PAM, "pop3")
532        AC_SUBST(USE_PAM, "pop3")
533        AC_MSG_RESULT(Enabling PAM with service name "pop3" and defining SPEC_POP_AUTH)
534    fi
535    AC_DEFINE(SPEC_POP_AUTH)
536    pam_specified="yes"
537fi
538
539
540AC_ARG_ENABLE(apop,  [ --enable-apop=path       Set the pop.auth file path [/etc/pop.auth]],
541              apop="$enableval", apop="no")
542if test "$apop" != "no" ; then
543    need_db=yes
544    POPAUTH="popauth"
545    if test "$apop" != "yes" ; then
546        APOP_DB="$apop"
547    else
548        APOP_DB="/etc/pop.auth"
549    fi
550    AC_MSG_RESULT(apop is enabled; database is "$APOP_DB")
551    APOP_DIR=$(dirname "$APOP_DB")
552    AC_DEFINE_UNQUOTED(APOP, "$APOP_DB")
553    AC_DEFINE_UNQUOTED(APOP_DIR, "$APOP_DIR")
554fi
555
556
557AC_ARG_ENABLE(scram, [ --enable-scram=path      Include scram capability with AUTHDB file [/etc/pop.auth]],
558              scram="$enableval", scram="no")
559if test "$scram" != "no" ; then
560    need_db=yes
561    pop_target="popauth"
562    if test "$scram" != "yes" ; then
563        AC_DEFINE_UNQUOTED(SCRAM, "$scram")
564    else
565        AC_DEFINE_UNQUOTED(SCRAM, "/etc/pop.auth")
566    fi
567fi
568
569
570AC_ARG_ENABLE(popuid, [ --enable-popuid=pop      Set the owner of the pop.auth file. [pop]],
571              popuid=$enableval, popuid="no" )
572if test "${popuid}" != "no" ; then
573    if test "${popuid}" != "yes" ; then
574        APOP_UID="$popuid"
575        AC_DEFINE_UNQUOTED(POPUID, "$popuid")
576    else
577        APOP_UID="pop"
578        AC_DEFINE_UNQUOTED(POPUID,"pop")
579    fi
580else
581    if test "$apop" != "no" -o "$scram" != "no" ; then
582        APOP_UID="pop"
583        AC_DEFINE_UNQUOTED(POPUID, "pop")
584    fi
585fi
586
587
588AC_ARG_ENABLE(log-login, [ --enable-log-login       Log successful user authentications ],
589              logloginmode="$enableval", logloginmode="no")
590if test "$logloginmode" != "no"; then
591    AC_MSG_RESULT(Enabled LOG-LOGIN)
592    AC_DEFINE(LOG_LOGIN)
593fi
594
595
596AC_ARG_ENABLE(auto-delete, [ --enable-auto-delete     Automatically delete downloaded msgs ],
597              autodelmode="$enableval", autodelmode="no")
598if test "$autodelmode" != "no"; then
599    AC_MSG_RESULT(Enabled AUTO-DELETE and NOUPDATEONABORT)
600    AC_DEFINE(AUTO_DELETE)
601    AC_DEFINE(NOUPDATEONABORT)
602fi
603
604
605AC_ARG_ENABLE(shy, [ --enable-shy             Hide qpopper version number ],
606              shymode="$enableval", shymode="no")
607if test "$shymode" != "no"; then
608        AC_MSG_RESULT(Enabled SHY)
609        AC_DEFINE(SHY)
610fi
611
612
613AC_ARG_ENABLE(warnings, [ --enable-warnings        Enable additional compiler warnings ],
614              extrawarnings="$enableval", extrawarnings="no")
615if test "$extrawarnings" != "no" -a "$GCC" = yes; then
616        AC_MSG_RESULT(Extra compiler warnings requested)
617        CFLAGS="$CFLAGS -W -Wall "
618        CFLAGS="$CFLAGS -Wpointer-arith -Wcast-align "
619fi
620
621
622AC_ARG_ENABLE(hash-spool, [ --enable-hash-spool=1|2  Enable hashed spool directories [2] ],
623              hashspool="$enableval", hashspool="no")
624if test "$hashspool" != "no"; then
625    if test "$hashspool" = "1" -o "$hashspool" = "2" ; then
626        AC_MSG_RESULT(Using hashed spool directory method $hashspool)
627        AC_DEFINE_UNQUOTED(HASH_SPOOL, $hashspool)
628    else
629        AC_MSG_RESULT(Using hashed spool directory method 2)
630        AC_DEFINE_UNQUOTED(HASH_SPOOL, 2)
631    fi
632fi
633
634
635AC_ARG_ENABLE(home-dir-mail, [ --enable-home-dir-mail=spool file
636                          Mail spool file is in home directory [.mail] ],
637              homedirmail="$enableval", homedirmail="no")
638if test "$homedirmail" != "no"; then
639    if test "$homedirmail" != "yes" ; then
640        AC_MSG_RESULT(Spool files are in user's home directory: $homedirmail)
641        AC_DEFINE_UNQUOTED(HOMEDIRMAIL, "$homedirmail")
642    else
643        AC_MSG_RESULT(Spool files are in user's home directory: .mail)
644        AC_DEFINE(HOMEDIRMAIL, ".mail")
645    fi
646fi
647
648AC_ARG_ENABLE(home-dir-misc, [ --enable-home-dir-misc   .pop and .cache files are in home directory ],
649              homedirmisc="$enableval", homedirmisc="no")
650if test "$homedirmisc" != "no"; then
651    AC_MSG_RESULT(.pop and .cache files are in home directory)
652    AC_DEFINE(HOMEDIRMISC)
653fi
654
655
656AC_ARG_ENABLE(spool-dir, [ --enable-spool-dir=path  Spool directory [(search for it)] ],
657              spooldir="$enableval", spooldir="no")
658if test "$spooldir" != "no" -a "$spooldir" != "yes" ; then
659    AC_MSG_RESULT(The mail spools are in: $spooldir)
660    AC_DEFINE_UNQUOTED(POP_MAILDIR, "$spooldir")
661fi
662
663
664AC_ARG_ENABLE(temp-drop-dir, [ --enable-temp-drop-dir=path
665                          Directory for temporary mail drop [(spool directory)] ],
666              tempdropdir="$enableval", tempdropdir="no")
667if test "$tempdropdir" != "no"; then
668    if test "$tempdropdir" != "yes" ; then
669        AC_MSG_RESULT(Temporary drop files are in: $tempdropdir)
670        AC_DEFINE_UNQUOTED(POP_DROP_DIR, "$tempdropdir")
671    else
672        AC_MSG_RESULT(Temporary drop files are in spool directory)
673        AC_DEFINE_UNQUOTED(POP_DROP_DIR, POP_MAILDIR)
674    fi
675fi
676
677
678AC_ARG_ENABLE(cache-dir, [ --enable-cache-dir=path  Directory for cache files [(temp drop directory)] ],
679              cachedir="$enableval", cachedir="no")
680if test "$cachedir" != "no"; then
681    if test "$cachedir" != "yes" ; then
682        AC_MSG_RESULT(Cache files are in: $cachedir)
683        AC_DEFINE_UNQUOTED(POP_CACHE_DIR, "$cachedir")
684    else
685        AC_MSG_RESULT(Cache files are in spool directory)
686        AC_DEFINE_UNQUOTED(POP_CACHE_DIR, POP_DROP_DIR)
687    fi
688fi
689
690
691AC_ARG_ENABLE(log-facility, [ --enable-log-facility=name
692                          Log to specified facility [LOG_MAIL or LOG_LOCAL1] ],
693            logid="$enableval" )
694if test "$logid" != "no"; then
695    AC_MSG_RESULT(Will log using ${withval})
696fi
697
698
699AC_ARG_ENABLE(uw-kludge, [ --enable-uw-kludge       Check for and hide UW 'Folder Internal Data' messages ],
700              uwkludge="$enableval", uwkludge="no")
701if test "$uwkludge" != "no"; then
702    AC_MSG_RESULT(Will hide UW 'Folder Internal Data' messages)
703    AC_DEFINE(CHECK_UW_KLUDGE)
704fi
705
706
707AC_ARG_ENABLE(group-bulls, [ --enable-group-bulls     Group name is second part of bulletin file names ],
708              groupbulls="$enableval", groupbulls="no")
709if test "$groupbulls" != "no"; then
710    AC_MSG_RESULT(Bulletins go to groups; group name is second part of bulletin name)
711    AC_DEFINE(USE_BULL_GROUPS)
712fi
713
714
715AC_ARG_WITH(kerberos5, [ --with-kerberos5=dir     Enable Kerberos 5 support],
716           krb5_prefix=${withval},krb5_prefix="no")
717if test $krb5_prefix != "no"; then
718    AC_MSG_RESULT(Enabling Kerberos V5 support)
719    dnl --
720    dnl -- If the withval was something other than "yes" then
721    dnl -- assume it's a prefix to the kerberos stuff.
722    dnl --
723    if test $krb5_prefix != "yes"
724    then
725       OS_DEFS="$OS_DEFS -I${krb5_prefix}/include"
726       KERBEROS_LIBS="$KERBEROS_LIBS -L${krb5_prefix}/lib"
727    fi
728    AC_DEFINE(KERBEROS)
729    AC_DEFINE(KRB5)
730    AC_DEFINE(KRB5_KRB4_COMPAT)
731    KERBEROS_LIBS="$KERBEROS_LIBS -lkrb5util -lkrb5 -ldes425 -lcom_err"
732    AC_CHECK_LIB( k5crypto, krb5_c_string_to_key, KERBEROS_LIBS="$KERBEROS_LIBS -lk5crypto" )
733    AC_CHECK_LIB( crypto,   krb5_c_string_to_key, KERBEROS_LIBS="$KERBEROS_LIBS -lcrypto"   )
734    AC_CHECK_LIB( krb4,     krb_create_ticket,    KERBEROS_LIBS="$KERBEROS_LIBS -lkrb4"     )
735    dnl Do we need -lgen for compile/step?
736    AC_CHECK_LIB(gen, compile)
737fi
738
739
740AC_ARG_ENABLE(any-kerberos-principal, [ --enable-any-kerberos-principal
741                          Accept any Kerberos principal in POP request],
742              anyKprinc="$enableval", anyKprinc="no")
743if test "$anyKprinc" != "no"; then
744    AC_MSG_RESULT(Setting ACCEPT_ANY_PRINCIPAL)
745    AC_DEFINE(ACCEPT_ANY_PRINCIPAL)
746fi
747
748
749AC_ARG_ENABLE(kuserok, [ --enable-kuserok         Use kuserok() to vet users],
750              kuserok="$enableval", kuserok="no")
751if test "$kuserok" != "no"; then
752    AC_MSG_RESULT(Will use kuserok)
753    AC_DEFINE(KUSEROK)
754fi
755
756
757AC_ARG_ENABLE(ksockinst, [ --enable-ksockinst       Use getsockinst() for Kerberos instance],
758              ksockinst="$enableval", ksockinst="no")
759if test "$ksockinst" != "no"; then
760    AC_MSG_RESULT(Will use getsockinst)
761    AC_DEFINE(K_GETSOCKINST)
762fi
763
764
765AC_ARG_ENABLE(timing, [ --enable-timing          Report elapsed time for login, init, and cleanup ],
766              timing="$enableval", timing="no")
767if test "$timing" != "no"; then
768    AC_MSG_RESULT(Will report timing info)
769    AC_DEFINE(DO_TIMING)
770fi
771
772
773AC_ARG_WITH(drac, [ --with-drac=lib-path     Compile in DRAC support],
774              dracauth="$withval" )
775if test "$dracauth" != "no"; then
776    AC_MSG_RESULT(Compiling in DRAC support)
777    AC_DEFINE(DRAC_AUTH)
778    if test "$dracauth" != "yes"; then
779        LIBS="$LIBS -L$dracauth -ldrac"
780    else
781        LIBS="$LIBS -ldrac"
782    fi
783fi
784
785
786AC_ARG_ENABLE(old-uidl, [ --enable-old-uidl        Use old UID encoding ],
787              olduid="$enableval", olduid="no")
788if test "$olduid" != "no"; then
789    AC_MSG_RESULT(Will encode UIDs using old (pre-3.x) style)
790    AC_DEFINE(OLD_STYLE_UIDL)
791fi
792
793
794AC_ARG_ENABLE(status, [ --disable-status         Don't write 'Status' or 'X-UIDL' headers ],
795              statusok="$enableval", statusok="yes")
796if test "$statusok" != "yes"; then
797    AC_MSG_RESULT(Will NOT write 'Status' or 'X-UIDL' headers; UIDs must be recalculated each time)
798    AC_DEFINE(NO_STATUS)
799fi
800
801
802AC_ARG_ENABLE(keep-temp-drop, [ --enable-keep-temp-drop  Don't delete temp drop files ],
803              keeptemp="$enableval", keeptemp="no")
804if test "$keeptemp" != "no"; then
805    AC_MSG_RESULT(Will NOT delete temp drop files)
806    AC_DEFINE(KEEP_TEMP_DROP)
807fi
808
809
810AC_ARG_ENABLE(check-pw-max, [ --disable-check-pw-max   Don't check for expired passwords ],
811              checkpwmax="$enableval", checkpwmax="yes")
812if test "$checkpwmax" != "yes"; then
813    AC_MSG_RESULT(Will NOT check for expired passwords)
814    AC_DEFINE(DONT_CHECK_SP_MAX)
815fi
816
817
818AC_ARG_ENABLE(old-spool-loc, [ --disable-old-spool-loc  Don't check for old spools in old location ],
819              checkoldloc="$enableval", checkoldloc="yes")
820if test "$checkoldloc" != "yes"; then
821    AC_MSG_RESULT(Will NOT check for old spools in old locations)
822    AC_DEFINE(DONT_CHECK_OLD_SPOOL)
823fi
824
825
826AC_ARG_ENABLE(server-mode-group-include, [ --enable-server-mode-group-include=group
827                          Server mode set for users in this group ],
828              servergrp="$enableval", servergrp="no")
829if test "$servergrp" != "no" -a "$servergrp" != "yes" ; then
830        AC_MSG_RESULT(SERVER_MODE set for users in group: $servergrp)
831        AC_DEFINE_UNQUOTED(SERVER_MODE_GROUP_INCL, "$servergrp")
832fi
833
834
835AC_ARG_ENABLE(server-mode-group-exclude, [ --enable-server-mode-group-exclude=group
836                          Server mode off for users in this group ],
837              servergrpex="$enableval", servergrpex="no")
838if test "$servergrpex" != "no" -a "$servergrpex" != "yes" ; then
839        AC_MSG_RESULT(SERVER_MODE set OFF for users in group: $servergrpex)
840        AC_DEFINE_UNQUOTED(SERVER_MODE_GROUP_EXCL, "$servergrpex")
841fi
842
843
844AC_ARG_ENABLE(secure-nis-plus, [ --enable-secure-nis-plus For use with secure NIS+ ],
845              secnisplus="$enableval", secnisplus="no")
846if test "$secnisplus" != "no"; then
847    AC_MSG_RESULT(Enabling secure NIS+)
848    AC_DEFINE(SECURENISPLUS)
849fi
850
851
852AC_ARG_ENABLE(optimizations, [ --disable-optimizations  Turns off compiler optimizations ],
853              optimize="$enableval", optimize="yes")
854if test "$optimize" != "yes" -o "$_debugging" = "yes"; then
855    CFLAGS=`echo "$CFLAGS" | sed 's/-O2//'`
856    AC_MSG_RESULT(Compiling WITHOUT optimizations)
857fi
858
859
860AC_ARG_ENABLE(standalone, [ --enable-standalone      Makes a standalone POP3 daemon instead of using inetd ],
861              standalone="$enableval", standalone="no")
862if test "$standalone" != "no"; then
863    AC_MSG_RESULT(Compiling as standalone POP3 daemon -- NOT using inetd)
864    AC_DEFINE(STANDALONE)
865fi
866
867
868AC_ARG_ENABLE(auth-file, [ --enable-auth-file=path  Only users listed in the specified file have access ],
869              authfile="$enableval", authfile="no")
870if test "$authfile" != "no"; then
871    if test "$authfile" = "yes"; then
872        authfile="/etc/authfile"
873    fi
874    AC_MSG_RESULT(Restricting access to only users listed in $authfile)
875    AC_DEFINE_UNQUOTED(AUTHFILE, "$authfile")
876fi
877
878
879AC_ARG_ENABLE(nonauth-file, [ --enable-nonauth-file=path
880                          Deny access to users listed in the specified file ],
881              nonauthfile="$enableval", nonauthfile="no")
882if test "$nonauthfile" != "no"; then
883    if test "$nonauthfile" = "yes"; then
884        nonauthfile="/etc/nonauthfile"
885    fi
886    AC_MSG_RESULT(Denying access to users listed in $nonauthfile)
887    AC_DEFINE_UNQUOTED(NONAUTHFILE, "$nonauthfile")
888fi
889
890
891AC_ARG_ENABLE(update-abort, [ --disable-update-abort   Don't enter UPDATE state on abort ],
892              updateabort="$enableval", updateabort="yes")
893if test "$updateabort" = "no" -a "$autodelmode" = "no"; then
894    AC_MSG_RESULT(Enabled NOUPDATEONABORT)
895    AC_DEFINE(NOUPDATEONABORT)
896fi
897
898
899AC_ARG_ENABLE(fast-update, [ --enable-fast-update     Reduce I/O during server-mode updates ],
900              fastupdate="$enableval", fastupdate="no")
901if test "$fastupdate" != "no" ; then
902    AC_MSG_RESULT(Using reduced I/O technique during server mode updates)
903    AC_DEFINE(FAST_UPDATE)
904fi
905
906
907AC_ARG_WITH(sslplus, [ --with-sslplus=path      Use SSL Plus from Certicom [/usr/local/sslplus] ],
908            sslplus="$withval", sslplus="no")
909if test "$sslplus" != "no" ; then
910    if test "$sslplus" = "yes"; then
911        sslplus="/usr/local/sslplus"
912    fi
913    AC_MSG_RESULT(Attempting to use Certicom's SSL Plus in "$sslplus")
914    AC_DEFINE_UNQUOTED(QPOP_SSLPLUS, "$sslplus")
915    AC_DEFINE(QPOP_SSL)
916    SSL_DIR_INC="-I${sslplus}/include"
917    SSL_LIB_PROT="${sslplus}/lib"
918fi
919
920
921AC_ARG_WITH(sslplus-crypto, [ --with-sslplus-crypto=path
922                          Crypto library to use with SSL Plus [securitybuilder] ],
923            sslplus_crypto="$withval", sslplus_crypto="no")
924if test "$sslplus_crypto" = "no" -a "$sslplus" != "no"; then
925    sslplus_crypto="yes"
926fi
927if test "$sslplus_crypto" != "no" ; then
928    if test "$sslplus_crypto" = "yes"; then
929        sslplus_crypto="securitybuilder"
930    fi
931    AC_MSG_RESULT(Attempting to use "$sslplus_crypto" with Certicom's SSL Plus)
932fi
933
934
935AC_ARG_WITH(openssl, [ --with-openssl=path      Use OpenSSL [/usr/local/ssl] ],
936            openssl="$withval", openssl="no")
937if test "$openssl" != "no" ; then
938    if test "$openssl" = "yes"; then
939        openssl="/usr/local/ssl"
940    fi
941    AC_MSG_RESULT(Attempting to use OpenSSL in "$openssl")
942    AC_DEFINE_UNQUOTED(QPOP_OPENSSL, "$openssl")
943    AC_DEFINE(QPOP_SSL)
944    SSL_DIR_INC="-I${openssl}/include"
945    SSL_LIBS="-L${openssl}/lib -lssl -lcrypto"
946fi
947
948
949AC_ARG_WITH(gdbm, [ --with-gdbm=path         Use GDBM ],
950            use_gdbm="$withval", use_gdbm="yes")
951
952
953AC_ARG_ENABLE(check-hash-dir, ,
954              checkhashdir_old="$enableval", checkhashdir_old="yes")
955
956AC_ARG_ENABLE(hash-dir-check, [ --disable-hash-dir-check Don't check if hashed spool dirs exist ],
957              checkhashdir="$enableval", checkhashdir="$checkhashdir_old")
958if test "$checkhashdir" != "yes"; then
959    AC_MSG_RESULT(Will NOT check for or create hashed spool directories)
960    AC_DEFINE(DONT_CHECK_HASH_SPOOL_DIR)
961fi
962
963
964AC_ARG_ENABLE(chunky-writes, [ --enable-chunky-writes=0|1|2
965                          Set default network write pooling [0] ],
966              chunky_writes="$enableval", chunky_writes="yes")
967if test "$chunky_writes" != "yes"; then
968    if test "$chunky_writes" = "0" -o \
969            "$chunky_writes" = "1" -o \
970            "$chunky_writes" = "2"; then
971        AC_MSG_RESULT(Set CHUNKY_WRITES to $chunky_writes)
972        AC_DEFINE_UNQUOTED( CHUNKY_WRITES, $chunky_writes )
973    elif test "$chunky_writes" = "no"; then
974        AC_MSG_RESULT([Set CHUNKY_WRITES to never (2)])
975        AC_DEFINE_UNQUOTED( CHUNKY_WRITES, 2 )
976    else
977        AC_MSG_RESULT(Unknown CHUNKY_WRITES value: $chunky_writes)
978    fi
979else
980    AC_DEFINE_UNQUOTED( CHUNKY_WRITES, 0 )
981fi
982
983
984AC_ARG_ENABLE(poppassd, [ --enable-poppassd        Generate poppassd password-change daemon ],
985              poppassd="$enableval", poppassd="no")
986if test "$poppassd" != "no"; then
987    AC_MSG_RESULT(Generating password/poppassd password-change daemon)
988    POPPASSD="poppassd"
989fi
990
991
992AC_ARG_ENABLE(32-bit, [ --enable-32-bit          Generate code for a 32-bit environment],
993              b32="$enableval", b32="no")
994if test "$b32" != "no"; then
995    AC_MSG_RESULT(Building 32-bit binary)
996    LDFLAGS="-m32 $LDFLAGS"
997fi
998
999
1000AC_ARG_ENABLE(64-bit, [ --enable-64-bit          Generate code for a 64-bit environment],
1001              b64="$enableval", b64="no")
1002if test "$b64" != "no" -a "$GCC" = "yes"; then
1003    AC_MSG_RESULT(Building 64-bit binary)
1004    LDFLAGS="-m64 $LDFLAGS"
1005    CFLAGS=" -m64 $CFLAGS"
1006fi
1007
1008AC_ARG_ENABLE(ipv6, [ --disable-ipv6           Don't compile in IPv6 support],
1009              ipv6="$enableval", ipv6="yes")
1010if test "$ipv6" != "yes"; then
1011    AC_MSG_RESULT(IPv6 support is disabled)
1012else
1013    AC_DEFUN(IPv6_CHECK_FUNC, [
1014    changequote(, )dnl
1015    ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
1016      -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
1017    changequote([, ])dnl
1018    AC_CHECK_FUNC($1, [dnl
1019      AC_DEFINE_UNQUOTED($ac_tr_lib)
1020      ac_cv_lib_socket_$1=no
1021      ac_cv_lib_inet6_$1=no
1022    ], [dnl
1023      AC_CHECK_LIB(socket, $1, [dnl
1024        AC_DEFINE_UNQUOTED($ac_tr_lib)
1025        LIBS="$LIBS -lsocket"
1026        ac_cv_lib_inet6_$1=no
1027      ], [dnl
1028        AC_MSG_CHECKING([whether your system has IPv6 directory])
1029        AC_CACHE_VAL(ipv6_cv_dir, [dnl
1030          for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
1031            if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
1032              break
1033            fi
1034          done])dnl
1035        AC_MSG_RESULT($ipv6_cv_dir)
1036        if test $ipv6_cv_dir = no; then
1037          ac_cv_lib_inet6_$1=no
1038        else
1039          if test x$ipv6_libinet6 = x; then
1040            ipv6_libinet6=no
1041            SAVELDFLAGS="$LDFLAGS"
1042            LDFLAGS="-L$ipv6_cv_dir/lib"
1043          fi
1044          AC_CHECK_LIB(inet6, $1, [dnl
1045            AC_DEFINE_UNQUOTED($ac_tr_lib)
1046            if test $ipv6_libinet6 = no; then
1047              ipv6_libinet6=yes
1048              LIBS="$LIBS -L$ipv6_cv_dir/lib -linet6"
1049            fi],)dnl
1050          if test $ipv6_libinet6 = no; then
1051            LDFLAGS="$SAVELDFLAGS"
1052          fi
1053        fi])dnl
1054    ])dnl
1055    if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \
1056         -o $ac_cv_lib_inet6_$1 = yes
1057    then
1058      ipv6_cv_$1=yes
1059      ifelse([$2], , :, [$2])
1060    else
1061      ipv6_cv_$1=no
1062      ifelse([$3], , :, [$3])
1063    fi])
1064
1065    dnl
1066    dnl Now that IPv6_CHECK_FUNCT is defined, see if an IPv6 version
1067    dnl of getaddrino() is available, and if so, enable IPv6.  Note
1068    dnl that on Tru64, getaddrinfo() might really be called ngetaddrinfo
1069    dnl or ogetaddrinfo.  The right one is selected in netdb.h.
1070    dnl
1071
1072    AC_CHECK_HEADERS( [netdb.h sys/socket.h] )
1073    AC_MSG_CHECKING( [for getaddrinfo] )
1074    AC_TRY_LINK( [
1075        #include <sys/types.h>
1076        #ifdef HAVE_SYS_SOCKET_H
1077        #include <sys/socket.h>
1078        #endif
1079        #ifdef HAVE_NETDB_H
1080        #include <netdb.h>
1081        #endif
1082        #include <stddef.h>
1083        ], [getaddrinfo("", "", NULL, NULL);],
1084           [AC_MSG_RESULT([yes])
1085            AC_DEFINE(HAVE_GETADDRINFO)
1086            found_getaddrinfo="yes"],
1087           [AC_MSG_RESULT([no])]
1088       )
1089
1090    if test [ "$found_getaddrinfo" = "yes" ]; then
1091        AC_DEFINE(INET6)
1092    fi
1093
1094    IPv6_CHECK_FUNC(iruserok_sa)
1095fi
1096
1097
1098AC_ARG_ENABLE(tempnam, [ --enable-tempnam         Use tempnam() instead of mkstemp()],
1099              tempnam="$enableval", tempnam="no")
1100if test "$tempnam" != "no"; then
1101    AC_MSG_RESULT(Using tempnam instead of mkstemp)
1102    AC_DEFINE(USE_TEMPNAM)
1103fi
1104
1105
1106AC_ARG_WITH(cyrus-sasl, [ --with-cyrus-sasl=path    Compile in support for using Cyrus-SASL for auth ],
1107                       sasl="$withval", sasl="no")
1108if test "$sasl" != "no"; then
1109    AC_MSG_RESULT(Enabling support for the Cyrus-SASL library)
1110    dnl
1111    dnl If we get something other than "yes", then it's likely a path to the
1112    dnl SASL libraries
1113    dnl
1114    if test "$sasl" != "yes"; then
1115        OS_DEFS="$OS_DEFS -I${sasl}/include/sasl"
1116        SASL_LIBS="$SASL_LIBS -L${sasl}/lib -lsasl2"
1117    else
1118        SASL_LIBS="$SASL_LIBS -lsasl2"
1119    fi
1120    AC_DEFINE(CYRUS_SASL)
1121fi
1122
1123
1124AC_ARG_ENABLE(gss-kuserok, [ --enable-gss-kuserok     Use krb5_kuserok() for auth on GSSAPI connections],
1125                         gss_kuserok="$enableval", gss_kuserok="no")
1126if test "$gss_kuserok" != "no"; then
1127    if test "$sasl" = "no"; then
1128        AC_MSG_ERROR("Cannot enable gss-kuserok without cyrus-sasl")
1129        exit 1
1130    fi
1131    AC_MSG_RESULT([Enabling the use of krb5_kuserok() for the SASL GSSAPI mechanism])
1132    AC_DEFINE(GSSAPI_KUSEROK)
1133fi
1134
1135
1136dnl
1137dnl ---------- Query for OS options ----------
1138dnl
1139
1140USE_REG_STRUCT_RET="default"
1141
1142SYS_NAME="`uname -sr 2>/dev/null | sed 1q`"
1143if test -z "\$SYS_NAME"; then SYS_NAME=unknown;fi
1144
1145OS_NAME="`echo $SYS_NAME 2>/dev/null | sed -e 's/[ ].*//'`"
1146OS_VERSION="`echo $SYS_NAME 2>/dev/null | sed -e 's/.*[ ]//'`"
1147
1148AC_MSG_RESULT(System name: $OS_NAME; System version: $OS_VERSION)
1149
1150SSL_OS_NAME="unknown"
1151
1152case $OS_NAME in
1153
1154    SunOS)
1155           case $OS_VERSION in
1156               [5]*) OS_DEFS="$OS_DEFS -DSOLARIS2 -DGNU_PASS"
1157                     OS_DEFS="$OS_DEFS -DNO_GETLINE -DCONTENT_LENGTH=1"
1158                     if test $sasl != "no" -a $sasl != "yes"; then
1159                         SASL_LIBS="$SASL_LIBS -R${sasl}/lib"
1160                     fi
1161                     if test $krb5_prefix != "no" -a $krb5_prefix != "yes"; then
1162                         KERBEROS_LIBS="$KERBEROS_LIBS -R${krb5_prefix}/lib"
1163                     fi;;
1164               [4]*) OS_DEFS="$OS_DEFS -DSUNOS4"
1165                         IS_SUNOS4=yes;;
1166                  *) ;;
1167           esac
1168
1169           USE_REG_STRUCT_RET="no"
1170dnl
1171dnl        /Bug: place-holder for testing until I get a real Solaris
1172dnl        SSL Plus package from Certicom.
1173dnl
1174           SSL_OS_NAME="linux"
1175           ;;
1176
1177    OSF1)  OS_DEFS="$OS_DEFS -DOSF1"
1178           if test "$logid" = "no" -o "$logid" = "yes" ; then
1179               logid="LOG_MAIL"
1180           fi
1181           ;;
1182
1183    HP*)   OS_DEFS="$OS_DEFS -DHPUX -DSPEC_POP_AUTH"
1184           OS_VERSION="`echo $OS_VERSION 2>/dev/null | sed -e 's/..//'`"
1185           case $OS_VERSION in
1186                [1][0]*) OS_DEFS="$OS_DEFS -DHPUX10" ;;
1187                      *) ;;
1188           esac
1189dnl        -- add '-lsec' to LIBS if available.
1190           AC_CHECK_LIB( sec, bigcrypt, LIBS="$LIBS -lsec" )
1191
1192dnl
1193dnl        Add flag for HP's C compiler to get it to work better
1194dnl
1195           if test "$GCC" != yes; then
1196               CFLAGS="$CFLAGS -Ae"
1197           fi
1198dnl
1199dnl        If requested, add flag for warnings
1200dnl
1201           if test "$extrawarnings" != "no" -a "$GCC" != yes; then
1202               CFLAGS="$CFLAGS +w1"
1203           fi
1204           ;;
1205
1206    AIX*)  OS_DEFS="$OS_DEFS -DAIX"
1207           IS_AIX=yes
1208           if test "$specialauth" != "no"; then
1209               LIBS="$LIBS -ls"
1210           fi
1211           ;;
1212
1213    IRIX*) OS_DEFS="$OS_DEFS -DIRIX"
1214           ;;
1215
1216    FreeBSD*)
1217           OS_DEFS="$OS_DEFS -DFREEBSD"
1218           USE_REG_STRUCT_RET="yes"
1219           ;;
1220
1221    OpenBSD*)
1222           OS_DEFS="$OS_DEFS -DOPENBSD"
1223           USE_REG_STRUCT_RET="default"
1224           ;;
1225
1226    NetBSD*)
1227           OS_DEFS="$OS_DEFS -DNETBSD"
1228           USE_REG_STRUCT_RET="default"
1229           ;;
1230
1231    Linux*)
1232           OS_DEFS="$OS_DEFS -DLINUX"
1233           if test "$logid" = "no" -o "$logid" = "yes" ; then
1234               logid="LOG_MAIL"
1235           fi
1236           if test "$SSL_DIR_INC" != "" -a -d "/usr/kerberos/include"; then
1237             SSL_DIR_INC="$SSL_DIR_INC -I/usr/kerberos/include";
1238           fi
1239           SSL_OS_NAME="linux"
1240           ;;
1241
1242    NeXTStep*)
1243dnl
1244dnl        Jacques Distler says we need -D_POSIX_SOURCE and -traditional-cpp
1245dnl
1246           OS_DEFS="$OS_DEFS -DNEXTSTEP -DNEXT -D_POSIX_SOURCE"
1247           if test "$GCC" = yes
1248           then
1249               CFLAGS="$CFLAGS -traditional-cpp"
1250           fi
1251           USE_REG_STRUCT_RET="yes"
1252           ;;
1253
1254    SCO_SV*)
1255          OS_DEFS="$OS_DEFS -DPOPSCO"
1256
1257dnl
1258dnl       On SCO, we may need to link with lprot to get getprpwnam; lprot may
1259dnl       require lx, lcurses, and perhaps even lm and lsocket.  Note we don't
1260dnl       try all permutations to find the smallest set.
1261dnl
1262          AC_CHECK_LIB( prot, getprpwnam, , , )
1263          if test "$ac_cv_lib_prot_getprpwnam" != "yes"; then
1264              unset ac_cv_lib_prot_getprpwnam
1265              AC_CHECK_LIB( prot, getprpwnam, , , -lx )
1266          fi
1267          if test "$ac_cv_lib_prot_getprpwnam" != "yes"; then
1268              unset ac_cv_lib_prot_getprpwnam
1269              AC_CHECK_LIB( prot, getprpwnam, LIBS="-lcurses -lx $LIBS", ,
1270                            -lcurses -lx )
1271          fi
1272          if test "$ac_cv_lib_prot_getprpwnam" != "yes"; then
1273              unset ac_cv_lib_prot_getprpwnam
1274              AC_CHECK_LIB( prot, getprpwnam,
1275                            LIBS="-lcurses -lsocket -lx $LIBS" , ,
1276                            -lcurses -lsocket -lx )
1277          fi
1278          if test "$ac_cv_lib_prot_getprpwnam" != "yes"; then
1279              unset ac_cv_lib_prot_getprpwnam
1280              AC_CHECK_LIB( prot, getprpwnam,
1281                            LIBS="-lsocket -lprot -lcurses -lm -lx $LIBS", ,
1282                            -lsocket -lprot -lcurses -lm -lx )
1283          fi
1284          ;;
1285
1286    UnixWare*)
1287          OS_DEFS="$OS_DEFS -DUNIXWARE"
1288          LIBS="$LIBS -lgen"
1289          ;;
1290
1291    Darwin)
1292          OS_DEFS="$OS_DEFS -DDARWIN"
1293          cc -v 2> TMP_CC_V
1294          if grep -i "Apple" TMP_CC_V >/dev/null
1295          then
1296               if grep "gcc version 2" TMP_CC_V >/dev/null
1297               then
1298                    CFLAGS="$CFLAGS -traditional-cpp"
1299               fi
1300          fi
1301          rm -f TMP_CC_V
1302          AR_FLAG=" -r "
1303          RANLIB_CMD="	\${RANLIB} \$@"
1304          AC_SUBST(AR_FLAG)
1305          if test "$pam_specified" != "yes"
1306          then
1307              if test "$use_pam" = "_default_"
1308              then
1309                   AC_MSG_WARN(PAM required for proper use under MacOS X 10.3 and later)
1310                   AC_DEFINE_UNQUOTED(USE_PAM, "pop3")
1311                   AC_DEFINE(SPEC_POP_AUTH)
1312                   AC_MSG_RESULT(PAM required under MacOS X 10.3 and later; enabling PAM with service name "pop3" and defining SPEC_POP_AUTH)
1313                   AC_MSG_RESULT(Use --without-pam to disable)
1314                   use_pam="yes"
1315              fi
1316          fi
1317          ;;
1318
1319    *)
1320           MACHINE="`uname -m 2>/dev/null`"
1321           case $MACHINE in
1322               DS/90*) OS_DEFS="$OS_DEFS -DUXPDS -DSPEC_POP_AUTH";;
1323           esac
1324           ;;
1325
1326
1327esac
1328
1329OS_DEFS="$OS_DEFS -DUNIX"
1330AC_MSG_RESULT(Set OS_DEFS = $OS_DEFS)
1331
1332if test "$sslplus" != "no"; then
1333    SSL_LIB_PROT="${SSL_LIB_PROT}/${SSL_OS_NAME}/libsslplus.complete.a"
1334    SSL_LIB_CRYP="${sslplus}/tools/${sslplus_crypto}/${SSL_OS_NAME}/lib/*.a"
1335    SSL_LIBS="$SSL_LIB_PROT $SSL_LIB_CRYP"
1336fi
1337
1338
1339dnl
1340dnl ---------  Set the logging facility based on request or ----------
1341dnl ---------  OS specificics or default                    ----------
1342dnl
1343if test "$logid" = "no" -o "$logid" = "yes" ; then
1344       logid="LOG_LOCAL0"
1345fi
1346AC_MSG_RESULT(Logging to facility: $logid)
1347AC_DEFINE_UNQUOTED(POP_FACILITY, $logid)
1348
1349
1350dnl
1351dnl ---------- Set compiler flags specially for some OSes ----------
1352dnl
1353
1354if test "$GCC" = yes
1355then
1356        if test "$USE_REG_STRUCT_RET" = "yes"
1357        then
1358                CFLAGS="$CFLAGS -freg-struct-return "
1359        elif test "$USE_REG_STRUCT_RET" = "no"
1360        then
1361                CFLAGS="$CFLAGS -fpcc-struct-return "
1362        fi
1363fi
1364
1365
1366dnl
1367dnl ------ add mktemp, md5, and base64 to makefile if needed ------
1368dnl
1369AC_MSG_NOTICE( checking for mktemp md5 and base64 )
1370AC_CHECK_FUNC( mkstemp,                                 \
1371               [ AC_MSG_RESULT( found mkstemp ) ],      \
1372               [ MISSING_OBJS="$MISSING_OBJS mktemp.o"; \
1373                 MISSING_SRCS="$MISSING_SRCS mktemp.c"; \
1374                 AC_MSG_RESULT( mkstemp not found ) ] )
1375AC_CHECK_FUNC( MD5Init,                                 \
1376               [ AC_MSG_RESULT( found MD5Init ) ],      \
1377               [ MISSING_OBJS="$MISSING_OBJS md5.o";    \
1378                 MISSING_SRCS="$MISSING_SRCS md5.c";    \
1379                 AC_MSG_RESULT( MD5Init not found ) ] )
1380AC_CHECK_FUNC( encode64,                                \
1381               [ AC_MSG_RESULT( found encode64 ) ],     \
1382               [ MISSING_OBJS="$MISSING_OBJS base64.o"; \
1383                 MISSING_SRCS="$MISSING_SRCS base64.c"; \
1384                 AC_MSG_RESULT( encode64 not found ) ] )
1385AC_MSG_RESULT( set MISSING_OBJS to $MISSING_OBJS )
1386AC_MSG_RESULT( set MISSING_SRCS to $MISSING_SRCS )
1387
1388
1389dnl
1390dnl ---------- Substitute flags  ----------
1391dnl
1392
1393AC_SUBST(CC)
1394AC_SUBST(CFLAGS)
1395
1396AC_SUBST(RANLIB)
1397AC_SUBST(RANLIB_CMD)
1398AC_MSG_RESULT(Set AR_FLAG = $AR_FLAG; RANLIB_CMD = $RANLIB_CMD)
1399
1400AC_SUBST(POPAUTH)
1401AC_SUBST(APOP_UID)
1402AC_SUBST(APOP)
1403AC_SUBST(APOP_DIR)
1404AC_SUBST(POPPASSD)
1405
1406
1407dnl
1408dnl ---------- Checks for mail stuff ----------
1409dnl
1410
1411AC_MSG_CHECKING([for sendmail program])
1412if test -f ${sbindir}/sendmail
1413then
1414    AC_DEFINE(MAIL_COMMAND, "${sbindir}/sendmail")
1415    AC_MSG_RESULT([found at ${sbindir}/sendmail])
1416elif test -f /usr/sbin/sendmail
1417then
1418    AC_DEFINE(MAIL_COMMAND, "/usr/sbin/sendmail")
1419    AC_MSG_RESULT([found at /usr/sbin/sendmail])
1420elif test -f /usr/lib/sendmail
1421then
1422    AC_DEFINE(MAIL_COMMAND, "/usr/lib/sendmail")
1423    AC_MSG_RESULT([found at /usr/lib/sendmail])
1424elif test -f /usr/ucblib/sendmail
1425then
1426    AC_DEFINE(MAIL_COMMAND, "/usr/ucblib/sendmail")
1427    AC_MSG_RESULT([found at /usr/ucblib/sendmail])
1428else
1429    AC_MSG_RESULT([ERROR: The sendmail program cannot be located])
1430    exit 1
1431fi
1432if test "$spooldir" = "no" -o "$spooldir" = "yes" ; then
1433    AC_MSG_CHECKING([for mail spool directory])
1434    if test -d /var/mail
1435    then
1436        pop_maildir="/var/mail"
1437    elif test -d /var/spool/mail
1438    then
1439        pop_maildir="/var/spool/mail"
1440    elif test -d /usr/mail
1441    then
1442        pop_maildir="/usr/mail"
1443    elif test -d /usr/spool/mail
1444    then
1445        pop_maildir="/usr/spool/mail"
1446    else
1447        AC_MSG_RESULT([ERROR: Couln't locate the mail spool])
1448        exit 1
1449    fi
1450    AC_MSG_RESULT("found at $pop_maildir")
1451    AC_DEFINE_UNQUOTED(POP_MAILDIR, "$pop_maildir")
1452fi
1453
1454AC_DEFINE(POP_DROP,    ".%s.pop")
1455AC_DEFINE(POP_CACHE,   ".%s.cache")
1456AC_DEFINE(POP_TMPDROP, "tmpXXXXXX")
1457AC_DEFINE(POP_TMPXMIT, "xmitXXXXXX")
1458
1459if test "$tempdropdir" = "no"
1460then
1461    AC_DEFINE_UNQUOTED(POP_DROP_DIR, POP_MAILDIR)
1462fi
1463
1464if test "$cachedir" = "no"
1465then
1466    AC_DEFINE_UNQUOTED(POP_CACHE_DIR, POP_DROP_DIR)
1467fi
1468
1469
1470dnl
1471dnl ---------- Checks for header files ----------
1472dnl
1473
1474AC_HEADER_DIRENT
1475AC_HEADER_STDC
1476AC_HEADER_SYS_WAIT
1477AC_DECL_SYS_SIGLIST
1478AC_CHECK_HEADERS( \
1479prot.h \
1480fcntl.h \
1481limits.h \
1482strings.h \
1483sys/param.h \
1484sys/file.h \
1485sys/security.h \
1486sys/syslog.h \
1487sys/types.h \
1488sys/fcntl.h \
1489sys/select.h \
1490sys/socket.h \
1491sys/stat.h \
1492sys/unistd.h \
1493sys/netinet/in.h \
1494sys/time.h \
1495sys/syslimits.h \
1496syslog.h \
1497net/errno.h \
1498unistd.h \
1499netinet/in.h \
1500maillock.h \
1501select.h \
1502shadow.h \
1503security/pam_appl.h \
1504pam/pam_appl.h \
1505time.h \
1506crypt.h \
1507netdb.h \
1508)
1509
1510AC_CHECK_HEADER( ndbm.h, NDBM_H="yes"; AC_DEFINE(HAVE_NDBM_H), NDBM_H="no" )
1511AC_CHECK_HEADER( gdbm.h, GDBM_H="yes"; AC_DEFINE(HAVE_GDBM_H), GDBM_H="no" )
1512AC_CHECK_HEADER(  dbm.h,  DBM_H="yes"; AC_DEFINE(HAVE_DBM_H),   DBM_H="no" )
1513
1514AC_CHECK_TYPES( socklen_t, , , [#include <sys/socket.h>] )
1515
1516
1517
1518dnl ---------- Checks for libraries ----------
1519dnl
1520AC_CHECK_LIB(nsl, t_accept, NETWORK_LIBS="$NETWORK_LIBS -lnsl")
1521AC_CHECK_LIB(socket, socket, NETWORK_LIBS="$NETWORK_LIBS -lsocket")
1522AC_CHECK_LIB(resolv, res_init, NETWORK_LIBS="$NETWORK_LIBS -lresolv")
1523AC_CHECK_LIB(mail, maillock, NETWORK_LIBS="$NETWORK_LIBS -lmail"; AC_DEFINE(SYS_MAILLOCK))
1524AC_CHECK_LIB(krb, krb_recvauth, KERBEROS_LIBS="$KERBEROS_LIBS -lkrb")
1525AC_CHECK_LIB(posix4, clock_gettime, LIBS="$LIBS -lposix4"; AC_DEFINE(HAVE_CLOCK_GETTIME))
1526AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1527AC_CHECK_LIB(security, set_auth_parameters, LIBS="$LIBS -lsecurity")
1528
1529AC_MSG_RESULT("(use_pam is $use_pam)")
1530if test "$use_pam" != "no" -a "$use_pam" != "_default_"; then
1531    AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")
1532    AC_CHECK_LIB(pam, pam_authenticate, LIBS="$LIBS -lpam",
1533                 AC_MSG_RESULT([Can't use PAM: can't find libpam]);exit 1)
1534fi
1535
1536if test "$dracauth" != "no"; then
1537    AC_CHECK_LIB(drac, dracauth, ,AC_MSG_RESULT([Can't use DRAC: dracauth not found in -ldrac]);exit 1)
1538fi
1539
1540dnl
1541dnl ---------- Special checks for *DBM files ----------
1542dnl
1543
1544if test "$need_db" = "yes"; then
1545    AC_MSG_CHECKING( which database manager to use )
1546
1547    if test "$use_gdbm" != "no"; then
1548        AC_MSG_CHECKING( gdbm )
1549        AC_CHECK_LIB( gdbm, gdbm_open, GDBM_LIB="yes", GDBM_LIB="no" )
1550        if test "$GDBM_H" = "yes" -a "$GDBM_LIB" = "yes"; then
1551            DBM_LIBS="-lgdbm"
1552            AC_MSG_RESULT( found gdbm )
1553            AC_DEFINE(GDBM)
1554        elif test "$GDBM_H" = "yes" -a "$GDBM_LIB" = "no"; then
1555            AC_MSG_RESULT( found gdbm header file but not library )
1556        elif test "$GDBM_H" = "no" -a "$GDBM_LIB" = "yes"; then
1557            AC_MSG_RESULT( found gdbm library but not header file )
1558        else
1559            AC_MSG_RESULT( didn't find gdbm )
1560        fi
1561    fi
1562
1563    if test -z "$DBM_LIBS"; then
1564        AC_MSG_CHECKING( ndbm )
1565        AC_CHECK_LIB( ndbm, dbm_open, NDBM_LIB="yes", NDBM_LIB="no" )
1566        if test "$NDBM_H" = "yes" -a "$NDBM_LIB" = "yes"; then
1567            DBM_LIBS="-lndbm"
1568            AC_MSG_RESULT( found ndbm )
1569            AC_DEFINE(NDBM)
1570        elif test "$NDBM_H" = "yes" -a "$NDBM_LIB" = "no"; then
1571            AC_MSG_RESULT( found ndbm header file but not library )
1572        elif test "$NDBM_H" = "no" -a "$NDBM_LIB" = "yes"; then
1573            AC_MSG_RESULT( found ndbm library but not header file )
1574        else
1575            AC_MSG_RESULT( didn't find ndbm )
1576        fi
1577
1578        AC_MSG_CHECKING([if BSD DBM])
1579        AC_EGREP_CPP(yes,
1580                     [#include <ndbm.h>
1581#ifdef DBM_SUFFIX
1582                        yes_it_is
1583#endif
1584                     ],
1585                     AC_MSG_RESULT([yes]);AC_DEFINE(BSD44_DBM),
1586                     AC_MSG_RESULT([no]) )
1587    fi
1588    if test -z "$DBM_LIBS"; then
1589        AC_MSG_CHECKING( dbm )
1590        AC_CHECK_LIB( dbm, dbm_open, DBM_LIB="yes", DBM_LIB="no" )
1591        if test "$DBM_H" = "yes" -a "$DBM_LIB" = "yes"; then
1592            DBM_LIBS="-ldbm"
1593            AC_MSG_RESULT( found dbm )
1594        elif test "$DBM_H" = "yes" -a "$DBM_LIB" = "no"; then
1595            AC_MSG_RESULT( found dbm header file but not library )
1596        elif test "$DBM_H" = "no" -a "$DBM_LIB" = "yes"; then
1597            AC_MSG_RESULT( found dbm library but not header file )
1598        else
1599            AC_MSG_RESULT( didn't find dbm )
1600        fi
1601    fi
1602fi
1603
1604
1605dnl
1606dnl ---------- Substitute library values ----------
1607dnl
1608
1609AC_SUBST(NETWORK_LIBS)
1610AC_SUBST(KERBEROS_LIBS)
1611AC_SUBST(DBM_LIBS)
1612AC_SUBST(SASL_LIBS)
1613AC_SUBST(LIBS)
1614
1615
1616dnl
1617dnl ---------- Checks for typedefs, structures, and compiler ----------
1618dnl ---------- characteristics                               ----------
1619dnl
1620
1621AC_C_CONST
1622AC_TYPE_UID_T
1623AC_TYPE_MODE_T
1624AC_TYPE_OFF_T
1625AC_TYPE_SIZE_T
1626AC_DECL_SYS_SIGLIST
1627AC_HEADER_TIME
1628AC_STRUCT_TM
1629
1630
1631dnl
1632dnl ---------- Checks for library functions ----------
1633dnl
1634
1635AC_FUNC_MEMCMP
1636AC_TYPE_SIGNAL
1637AC_FUNC_UTIME_NULL
1638AC_FUNC_VPRINTF
1639AC_FUNC_WAIT3
1640
1641AC_CHECK_FUNCS( \
1642gethostname \
1643gethostbyname \
1644gettimeofday \
1645getusershell \
1646mkdir \
1647socket \
1648strdup \
1649strerror \
1650strstr \
1651strlcat \
1652strlcpy \
1653bcopy \
1654index \
1655flock  \
1656set_auth_parameters \
1657pw_encrypt \
1658hstrerror \
1659snprintf \
1660vsnprintf \
1661srandom \
1662srand \
1663usleep \
1664crypt \
1665crypt16 \
1666bigcrypt \
1667setproctitle \
1668mkstemp \
1669setresuid
1670)
1671
1672dnl
1673dnl ---------- Checks for function declarations ----------
1674dnl
1675    AC_CHECK_DECLS( [srandom,write], AC_MSG_RESULT([found decl]), AC_MSG_RESULT([didn't find decl]) )
1676
1677
1678dnl
1679dnl ---------- Check other libraries for networking functions ----------
1680dnl
1681
1682    AC_SEARCH_LIBS( gethostbyname, nsl bsd net socket )
1683
1684
1685dnl
1686dnl ---------- Check for sizes ----------
1687dnl
1688
1689AC_CHECK_SIZEOF( unsigned long int, 4 )
1690
1691
1692dnl
1693dnl ---------- Check for /dev/urandom ----------
1694dnl
1695AC_MSG_CHECKING( [for /dev/urandom] )
1696if test -r /dev/urandom
1697then
1698    AC_DEFINE([HAVE_DEV_URANDOM])
1699    AC_MSG_RESULT( [yes] )
1700else
1701    AC_MSG_RESULT( [no] )
1702fi
1703
1704
1705dnl
1706dnl ---------- Substitute other values ----------
1707dnl
1708
1709AC_SUBST(OS_DEFS)
1710AC_SUBST(CDEFS)
1711AC_SUBST(GPERFCMD)
1712AC_SUBST(USE_PAM)
1713AC_SUBST(MISSING_OBJS)
1714AC_SUBST(MISSING_SRCS)
1715
1716
1717AC_SUBST(SSL_DIR_INC)
1718AC_SUBST(SSL_LIBS)
1719
1720
1721AC_CONFIG_FILES([Makefile common/Makefile popper/Makefile mmangle/Makefile password/Makefile])
1722AC_OUTPUT
1723