2 dnl configure.in -- autoconf template for nmh
7 dnl 2.13 definitely chokes; 2.53 is the earliest version I've tested.
8 dnl 2.58 needed for help string macro but that only affects help output
9 dnl 2.50 is the major breakpoint between the old autoconf and the new,
10 dnl so require that. If there are bug reports about 2.50-2.52 not working
11 dnl we can always move this up a little.
14 AC_INIT(nmh, m4_normalize(m4_include([VERSION])))
15 AC_CONFIG_SRCDIR(h/nmh.h)
16 AC_CONFIG_HEADER(config.h)
20 dnl ---------------------
21 dnl define a macro or two
22 dnl ---------------------
24 AC_DEFUN(NMH_PROG_GNU_LIBTOOL, [
25 if test -n "$LIBTOOL" ; then
26 tmptest=`$LIBTOOL --version 2>&1 | grep GNU`
27 if test x"$tmptest" != x ; then
29 AC_SUBST(GNU_LIBTOOL)dnl
34 echo "configuring for AC_PACKAGE_NAME-AC_PACKAGE_VERSION"
35 AC_SUBST(VERSION,AC_PACKAGE_VERSION)dnl
37 dnl What date of nmh are we building?
38 DATE=`cat ${srcdir}/DATE`
39 echo "configuring for nmh dated $DATE"
42 dnl --------------------------
43 dnl CHECK COMMAND LINE OPTIONS
44 dnl --------------------------
46 dnl Do you want client-side support for apop?
47 AC_ARG_ENABLE(apop, AS_HELP_STRING([--enable-apop],
48 [enable client-side support for POP3 and APOP]))
49 if test x"$enable_apop" = x"yes"; then
56 dnl Do you want to debug nmh?
58 AS_HELP_STRING([--enable-debug],[enable nmh code debugging]))
59 dnl The old redundant --enable-nmh-debug is deprecated and undocumented.
60 if test x"$enable_nmh_debug" = x"yes"; then
64 dnl Allow users to send email from addresses other than their default?
65 AC_ARG_ENABLE(masquerade,
66 AS_HELP_STRING([--enable-masquerade='draft_from mmailid username_extension'],
67 [enable up to 3 types of address masquerading]),
68 [if test x"$enable_masquerade" = x"yes"; then
69 masquerade="draft_from mmailid username_extension"
71 masquerade="$enable_masquerade"
73 AC_SUBST(masquerade)dnl
75 dnl Do you want mhe support?
77 AS_HELP_STRING([--disable-mhe],[disable mhe support]))
79 dnl mhe support is on by default, so define it unless --disable-mhe or the
80 dnl deprecated, undocumented --disable-nmh-mhe are specified.
81 if test x"$enable_mhe" != x"no" -a x"$enable_nmh_mhe" != x"no"; then
85 dnl Do you want client-side support for pop?
87 AS_HELP_STRING([--enable-pop], [enable client-side support for plain POP3]))
88 dnl The old redundant --enable-nmh-pop is deprecated and undocumented.
89 if test x"$enable_nmh_pop" = x"yes"; then
93 dnl Do you want client-side support for using SASL for authentication?
94 dnl Note that this code will be enabled for both POP and SMTP
95 AC_ARG_WITH(cyrus-sasl, AS_HELP_STRING([--with-cyrus-sasl=DIR],
96 [specify location of Cyrus SASL library]))
97 if test x"$with_cyrus_sasl" != x -a x"$with_cyrus_sasl" != x"no"; then
98 AC_DEFINE(CYRUS_SASL)dnl
104 dnl What should be the default editor?
106 AS_HELP_STRING([--with-editor=EDITOR],[specify the default editor]))
108 if test -n "$with_editor"; then
109 editorpath="$with_editor"
112 dnl Set the backup prefix
113 AC_ARG_WITH([hash-backup],
114 AS_HELP_STRING([--with-hash-backup],[use # as the backup prefix (default: ,)]))
115 if test x"$with_hash_backup" != x -a x"$with_hash_backup" != x"no"; then
120 AC_DEFINE_UNQUOTED(BACKUP_PREFIX, "$backup_prefix")dnl
122 dnl Do you want support for hesiod
124 AS_HELP_STRING([--with-hesiod=DIR],[specify location of Hesiod]))
125 if test x"$with_hesiod" != x -a x"$with_hesiod" != x"no"; then
129 dnl Do you want client-side support for kpop
130 AC_ARG_WITH(krb4, AS_HELP_STRING([--with-krb4=DIR],
131 [specify location of Kerberos V4 for KPOP support]))
132 if test x"$with_krb4" != x -a x"$with_krb4" != x"no"; then
135 AC_DEFINE(KPOP_PRINCIPAL, "pop")dnl
138 dnl After we know if we're including apop and kpop support, do pop stuff
139 if test x"$enable_pop" = x"yes"; then
142 POPSED='/^%nmhbeginpop%/d;/^%nmhendpop%/d'
144 POPSED='/^%nmhbeginpop%/,/^%nmhendpop%/d'
149 dnl What method of locking to use?
151 AS_HELP_STRING([--with-locking=@<:@dot|fcntl|flock|lockf@:>@],
152 [specify the file locking method]))
154 if test x"$with_locking" = x"dot"; then
156 AC_DEFINE(DOT_LOCKING)dnl
157 elif test x"$with_locking" = x"flock"; then
159 AC_DEFINE(FLOCK_LOCKING)dnl
160 elif test x"$with_locking" = x"lockf"; then
162 AC_DEFINE(LOCKF_LOCKING)dnl
163 elif test x"$with_locking" = x"fcntl"; then
165 AC_DEFINE(FCNTL_LOCKING)dnl
168 AC_DEFINE(DOT_LOCKING)dnl
171 dnl What method of posting should post use?
173 AS_HELP_STRING([--with-mts=@<:@smtp|sendmail@:>@],
174 [specify the default mail transport agent/service]))
176 if test x"$with_mts" = x"smtp"; then
178 elif test x"$with_mts" = x"sendmail"; then
185 dnl Both the smtp and sendmail mail transport services use the smtp code
186 AC_DEFINE(SMTPMTS)dnl
188 dnl What should be the default pager?
190 AS_HELP_STRING([--with-pager=PAGER],[specify the default pager]))
192 if test -n "$with_pager"; then
193 pagerpath="$with_pager"
196 dnl What should be the default mail server(s)?
197 AC_ARG_WITH(smtpservers,
198 AS_HELP_STRING([--with-smtpservers='SMTPSERVER1@<:@ SMTPSERVER2...@:>@'],
199 [specify the default SMTP server(s) @<:@localhost@:>@]))
200 if test -n "$with_smtpservers"; then
201 smtpservers="$with_smtpservers"
203 smtpservers="localhost"
205 AC_SUBST(smtpservers)dnl
207 dnl ----------------------------------------------------
208 dnl Default location is /usr/local/nmh/{bin,etc,lib,man}
209 dnl ----------------------------------------------------
210 AC_PREFIX_DEFAULT(/usr/local/nmh)
212 dnl ------------------
213 dnl CHECK THE COMPILER
214 dnl ------------------
215 dnl We want these before the checks,
216 dnl so the checks can modify their values.
217 test -z "$CFLAGS" && CFLAGS= auto_cflags=1
218 if test x"$enable_debug" = x"yes"; then
219 test -z "$LDFLAGS" && LDFLAGS=-g
224 dnl if the user hasn't specified CFLAGS, then
225 dnl if compiler is gcc, then
226 dnl use -O2 and some warning flags
228 if test -n "$auto_cflags"; then
229 if test x"$enable_debug" = x"yes"; then
230 if test -n "$GCC"; then
231 test -z "$CFLAGS" && CFLAGS="-Wall -g" || CFLAGS="$CFLAGS -Wall -g"
233 test -z "$CFLAGS" && CFLAGS=-g || CFLAGS="$CFLAGS -g"
236 if test -z "$LDFLAGS"; then
246 if test -n "$GCC"; then
247 test -z "$CFLAGS" && CFLAGS="-Wall -O2" || CFLAGS="$CFLAGS -Wall -O2"
249 test -z "$CFLAGS" && CFLAGS=-O || CFLAGS="$CFLAGS -O"
254 AC_C_CONST dnl Does compiler support `const'.
256 dnl ------------------
257 dnl CHECK FOR PROGRAMS
258 dnl ------------------
259 AC_PROG_MAKE_SET dnl Does make define $MAKE
260 AC_PROG_INSTALL dnl Check for BSD compatible `install'
261 AC_PROG_RANLIB dnl Check for `ranlib'
262 AC_PROG_AWK dnl Check for mawk,gawk,nawk, then awk
263 AC_PROG_LEX dnl Check for lex/flex
266 pathtmp=/usr/bin:/bin:/usr/local/bin:/usr/xpg4/bin:/usr/ucb
267 AC_PATH_PROG(cutpath, cut, no, [$pathtmp])
269 dnl ----------------------------------------------
270 dnl check for lclint, and lint if it doesn't exist
271 dnl ----------------------------------------------
272 AC_CHECK_PROG(linttmp1, lclint, lclint, no)dnl
273 if test x$ac_cv_prog_linttmp1 != xno ; then
274 LINT=$ac_cv_prog_linttmp1
275 LINTFLAGS="-weak +posixlib -macrovarprefixexclude"
277 AC_CHECK_PROG(linttmp2, lint, lint, no)dnl
278 if test x$ac_cv_prog_linttmp2 != xno ; then
279 LINT=$ac_cv_prog_linttmp2
282 LINT="echo 'No lint program found'"
287 AC_SUBST(LINTFLAGS)dnl
289 dnl try to figure out which one we've got
290 AC_CHECK_PROG(LIBTOOL, libtool, libtool, , [$pathtmp])
293 dnl Check for lorder and tsort commands
294 AC_CHECK_PROG(LORDER, lorder, lorder, no)dnl
295 AC_CHECK_PROG(TSORT, tsort, tsort, no)dnl
297 dnl If either doesn't exist, replace them with echo and cat
298 if test x$ac_cv_prog_LORDER != xlorder -o x$ac_cv_prog_TSORT != xtsort; then
303 dnl Mac OS X has lorder, but sh is too broken for it to work
304 dnl elif test -z "`lorder config/config.c 2>&1 | grep config/config.c`" ; then
307 dnl AC_SUBST(LORDER)dnl
308 dnl AC_SUBST(TSORT)dnl
311 dnl Check whether tsort can deal with loops
312 AC_CACHE_CHECK(whether tsort can deal with loops, nmh_cv_tsort_loop,
313 [if test -z "`echo a b b a | tsort 2>/dev/null | grep a`" ; then
316 nmh_cv_tsort_loop=yes
318 if test x$nmh_cv_tsort_loop = xno ; then
326 pathtmp=/usr/bin:/bin:/usr/local/bin:/usr/xpg4/bin:/usr/ucb
327 AC_PATH_PROG(lspath, ls, no, [$pathtmp])
329 dnl See how we get ls to display the owner and the group
330 if test "$lspath" != "no"; then
331 AC_CACHE_CHECK(how to get ls to show us the group ownership of a file,
333 [if test x"`$lspath -dl / | $AWK '{print $9}'`" = x"/"; then
334 dnl There were 9 parameters, so unless this is a really bizarre, nonstandard
335 dnl ls, it would seem -l gave us both the user and group. On this type of
336 dnl ls, -g makes _only_ the group be displayed (and not the user).
337 nmh_cv_ls_grpopt="-l"
339 dnl Looks like -l only gave us the user, so we need -g to get the group too.
340 nmh_cv_ls_grpopt="-lg"
345 pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
346 AC_PATH_PROG(morepath, more, no, [$pathtmp])
348 dnl If pager is not specified yet,
349 dnl then use `more' as the default.
350 if test -z "$pagerpath"; then
351 pagerpath="$morepath"
353 AC_SUBST(pagerpath)dnl
355 dnl Look for `sendmail'
356 pathtmp=/usr/lib:/usr/sbin:/usr/etc:/usr/ucblib:/usr/bin:/bin
357 AC_PATH_PROG(sendmailpath, sendmail, /usr/sbin/sendmail, [$pathtmp])
360 pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
361 AC_PATH_PROG(vipath, vi, /bin/vi, [$pathtmp])
363 dnl If editor is not specified yet,
364 dnl then use `vi' as the default.
365 if test -z "$editorpath"; then
368 AC_SUBST(editorpath)dnl
370 dnl Check for broken vi
371 AC_CACHE_CHECK(for broken vi, nmh_cv_attvibug,
372 [if echo 'r /nonexist-file
380 if test "$nmh_cv_attvibug" = yes; then
381 AC_DEFINE(ATTVIBUG)dnl
384 dnl ----------------------------------------------------------
385 dnl FIND MAIL SPOOL AND SEE IF WE NEED TO MAKE inc SETGID MAIL
386 dnl ----------------------------------------------------------
387 AC_CACHE_CHECK(where mail spool is located, nmh_cv_mailspool,
388 [for mailspool in /var/mail dnl
391 /dev/null; dnl Just in case we fall through
393 test -d $mailspool && break
395 nmh_cv_mailspool=$mailspool
397 mailspool=$nmh_cv_mailspool
398 AC_SUBST(mailspool)dnl
400 dnl See whether the mail spool directory is world-writable.
401 if test "$lspath" != "no" -a "$cutpath" != "no"; then
402 AC_CACHE_CHECK(whether the mail spool is world-writable,
403 nmh_cv_mailspool_world_writable,
404 [if test "`$lspath -dlL $mailspool | $cutpath -c9`" = "-"; then
405 nmh_cv_mailspool_world_writable=no
407 nmh_cv_mailspool_world_writable=yes
411 dnl Also, check for liblockfile (as found on Debian systems)
412 AC_CHECK_HEADER(lockfile.h, AC_CHECK_LIB(lockfile, lockfile_create) )
414 dnl and whether its companion program dotlockfile is setgid
415 AC_PATH_PROG(dotlockfilepath, dotlockfile, no)
416 if test "$ac_cv_lib_lockfile_lockfile_create" != "no" ; then
417 if test "$ac_cv_path_dotlockfilepath" != "no" ; then
418 AC_CACHE_CHECK(whether dotlockfile is setgid, nmh_cv_dotlockfile_setgid,
419 [ if test -g "$ac_cv_path_dotlockfilepath" ; then
420 nmh_cv_dotlockfile_setgid=yes
422 nmh_cv_dotlockfile_setgid=no
427 dnl If mailspool is not world-writable and dotlockfile is not setgid,
428 dnl we need to #define MAILGROUP to 1 and make inc setgid.
429 if test x"$nmh_cv_mailspool_world_writable" = x"no" -a x"$nmh_cv_dotlockfile_setgid" != x"yes" ; then
430 dnl do we really need both of these?
431 AC_DEFINE(MAILGROUP)dnl
434 AC_SUBST(SETGID_MAIL)dnl
436 dnl Use ls to see which group owns the mail spool directory.
437 AC_CACHE_CHECK(what group owns the mail spool, nmh_cv_ls_mail_grp,
438 [nmh_cv_ls_mail_grp=`$lspath -dL $nmh_cv_ls_grpopt $mailspool|$AWK '{print $4}'`
440 MAIL_SPOOL_GRP=$nmh_cv_ls_mail_grp
441 AC_SUBST(MAIL_SPOOL_GRP)dnl
443 dnl ------------------
444 dnl CHECK HEADER FILES
445 dnl ------------------
451 AC_CHECK_HEADERS(string.h memory.h stdlib.h unistd.h errno.h fcntl.h \
452 limits.h crypt.h termcap.h termio.h termios.h locale.h \
453 langinfo.h wchar.h wctype.h iconv.h netdb.h \
454 sys/param.h sys/time.h sys/utsname.h sys/stream.h \
455 arpa/inet.h arpa/ftp.h)
457 AC_CACHE_CHECK(POSIX termios, nmh_cv_sys_posix_termios,
458 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
460 #include <termios.h>]],
461 [[/* SunOS 4.0.3 has termios.h but not the library calls. */
462 tcgetattr(0, 0);]])],
463 nmh_cv_sys_posix_termios=yes, nmh_cv_sys_posix_termios=no)])
465 if test $nmh_cv_sys_posix_termios = yes; then
466 AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
467 nmh_cv_header_termios_h_tiocgwinsz,
468 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
469 #include <termios.h>]],
470 [[int x = TIOCGWINSZ;]])],
471 nmh_cv_header_termios_h_tiocgwinsz=yes,nmh_cv_header_termios_h_tiocgwinsz=no)])
473 nmh_cv_header_termios_h_tiocgwinsz=no
476 if test $nmh_cv_header_termios_h_tiocgwinsz = no; then
477 AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
478 nmh_cv_header_sys_ioctl_h_tiocgwinsz,
479 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
480 #include <sys/ioctl.h>]],
481 [[int x = TIOCGWINSZ;]])],
482 nmh_cv_header_sys_ioctl_h_tiocgwinsz=yes,nmh_cv_header_sys_ioctl_h_tiocgwinsz=no)])
483 if test $nmh_cv_header_sys_ioctl_h_tiocgwinsz = yes; then
484 AC_DEFINE(GWINSZ_IN_SYS_IOCTL)dnl
489 dnl Checks for _IO_write_ptr. A Linuxism used by nmh on linux. We
490 dnl really use a whole set of them, but this check should be
493 AC_CHECK_HEADER(libio.h, [
494 AC_EGREP_HEADER(_IO_write_ptr, libio.h, [
495 AC_DEFINE(LINUX_STDIO) ]) ])
497 AC_CHECK_HEADER([sys/ptem.h], AC_DEFINE(WINSIZE_IN_PTEM),,
498 [[#if HAVE_SYS_STREAM_H
499 # include <sys/stream.h>
507 AC_CHECK_LIB(mkstemp,mkstemp)
508 AC_CHECK_FUNCS(waitpid wait3 sigaction sigprocmask sigblock sigsetmask \
509 sighold sigrelse writev lstat uname tzset killpg mkstemp \
510 sethostent getutent nl_langinfo mbtowc wcwidth)
512 dnl solaris screws this up
513 AC_CHECK_FUNC(gethostbyname, [AC_DEFINE(HAVE_GETHOSTBYNAME)],
514 AC_CHECK_LIB(nsl, gethostbyname, [AC_DEFINE(HAVE_GETHOSTBYNAME)] ) )
516 dnl sigsetjmp may be a macro
517 AC_MSG_CHECKING(for sigsetjmp)
518 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <setjmp.h>]],
519 [[sigsetjmp((void *)0, 0);]])],[AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)],
522 AC_REPLACE_FUNCS(snprintf strdup)
524 dnl Look for the initgroups() declaration. On AIX 4.[13], Solaris 4.1.3, and
525 dnl ULTRIX 4.2A the function is defined in libc but there's no declaration in
526 dnl any system header.
528 dnl On Solaris 2.[456], the declaration is in <grp.h>. On HP-UX 9-11 and
529 dnl (reportedly) FreeBSD 3.[23], it's in <unistd.h>. Any other locations we
531 AC_EGREP_HEADER(initgroups, grp.h, AC_DEFINE(INITGROUPS_HEADER, <grp.h>),
532 AC_EGREP_HEADER(initgroups, unistd.h,
533 AC_DEFINE(INITGROUPS_HEADER, <unistd.h>)))
535 dnl On AIX 4.1, snprintf() is defined in libc.a but there's no prototype in
536 dnl <stdio.h> or elsewhere. Apparently it's not officially supported (though it
537 dnl seems to work perfectly and IBM apparently uses it in internal code).
538 dnl Anyhow, if we omit our own snprintf() and vsnprintf() prototypes when we
539 dnl HAVE_SNPRINTF, we get a billion warnings at compile time. Use the C
540 dnl preprocessor to preprocess stdio.h and make sure that there's actually a
542 AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_PROTOTYPE))
544 dnl Check for multibyte character set support
545 if test "x$ac_cv_header_wchar_h" = "xyes" -a "x$ac_cv_header_wctype_h" = "xyes" \
546 -a "x$ac_cv_func_wcwidth" = "xyes" -a "x$ac_cv_func_mbtowc" = "xyes"; then
547 AC_DEFINE(MULTIBYTE_SUPPORT, 1,
548 [Define to enable support for multibyte character sets])
551 dnl -------------------
552 dnl CHECK FOR LIBRARIES
553 dnl -------------------
554 dnl Check location of modf
555 AC_CHECK_FUNC(modf, , AC_CHECK_LIB(m, modf))
557 dnl Checks for network libraries (nsl, socket)
560 termcap_curses_order="termcap curses ncurses"
561 for lib in $termcap_curses_order; do
562 AC_CHECK_LIB(${lib}, tgetent, [TERMLIB="-l$lib"; break])
570 dnl Find iconv. It may be in libiconv and may be iconv() or libiconv()
571 if test "x$ac_cv_header_iconv_h" = "xyes"; then
572 AC_CHECK_FUNC(iconv, ac_found_iconv=yes, ac_found_iconv=no)
573 if test "x$ac_found_iconv" = "xno"; then
574 AC_CHECK_LIB(iconv, iconv, ac_found_iconv=yes)
575 if test "x$ac_found_iconv" = "xno"; then
576 AC_CHECK_LIB(iconv, libiconv, ac_found_iconv=yes)
578 if test "x$ac_found_iconv" != "xno"; then
582 dnl Handle case where there is a native iconv but iconv.h is from libiconv
583 AC_CHECK_DECL(_libiconv_version,
584 [ AC_CHECK_LIB(iconv, libiconv, LIBS="-liconv $LIBS") ],,
585 [ #include <iconv.h> ])
588 if test "x$ac_found_iconv" = xyes; then
589 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
592 dnl Check if iconv uses const in prototype declaration
593 if test "x$ac_found_iconv" = "xyes"; then
594 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
595 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
596 #include <iconv.h>]],
600 #if defined(__STDC__) || defined(__cplusplus)
601 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
605 [ac_cv_iconv_const=],
606 [ac_cv_iconv_const=const])])
607 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
608 [Define as const if the declaration of iconv() needs const.])
615 AC_ARG_WITH([ndbm],AS_HELP_STRING([--with-ndbm=ARG],[use -lARG to link with ndbm]),
616 [nmh_ndbm=$withval],[nmh_ndbm=autodetect])
617 AC_ARG_WITH([ndbmheader],AS_HELP_STRING([--with-ndbmheader=ARG],[#include <ARG> to use ndbm]),
618 [nmh_ndbmheader=$withval],[nmh_ndbmheader=autodetect])
620 if test "$nmh_ndbm" = "autodetect"; then
621 if test "$nmh_ndbmheader" != "autodetect"; then
622 AC_MSG_ERROR([must specify both --with-ndbm and --with-ndbmheader or neither])
625 dnl There are at least four implementations of ndbm, and
626 dnl several of those can be in different places at the whim
627 dnl of the system integrator. A good summary of this mess
628 dnl can be found at http://www.unixpapa.com/incnote/dbm.html
630 dnl Classic ndbm with no library required (eg NetBSD): try this
631 dnl first so we don't accidentally link in a pointless but harmless
632 dnl library in one of the later ndbm.h+libfoo tests:
633 NMH_CHECK_NDBM(ndbm.h,,,
634 dnl Berkeley DBv2 emulating ndbm: header in db.h:
635 NMH_CHECK_NDBM(db.h,db,,
636 dnl Berkeley DBv1 emulating ndbm:
637 NMH_CHECK_NDBM(ndbm.h,db,,
638 NMH_CHECK_NDBM(ndbm.h,db1,,
640 NMH_CHECK_NDBM(ndbm.h,ndbm,,
641 dnl glibc2.1 systems put db1 in a subdir:
642 NMH_CHECK_NDBM(db1/ndbm.h,db1,,
643 dnl GNU gdbm emulating ndbm, with header possibly in gdbm/
644 dnl and possibly needing gbdm_compat library:
645 NMH_CHECK_NDBM(gdbm/ndbm.h,gdbm,,
646 NMH_CHECK_NDBM(gdbm/ndbm.h,gdbm_compat -lgdbm,,
647 NMH_CHECK_NDBM(ndbm.h,gdbm,,
648 NMH_CHECK_NDBM(ndbm.h,gdbm_compat -lgdbm))))))))))
652 dnl We don't really need to check that the user-specified values work,
653 dnl but it is a convenience to the user to bomb out early rather than
654 dnl after configure and half the compile process.
655 NMH_CHECK_NDBM([$nmh_ndbmheader],[$nmh_ndbm])
658 if test "$nmh_ndbm_found" = "no"; then
659 AC_MSG_ERROR([could not find a working ndbm library/header combination])
661 dnl Now export the lib/header to our makefile/config.h:
662 if test x"$nmh_ndbmheader" != x; then
663 AC_DEFINE_UNQUOTED(NDBM_HEADER, <$nmh_ndbmheader>)
665 if test x"$nmh_ndbm" != x; then
666 NDBM_LIBS="-l$nmh_ndbm"
677 if test x"$with_hesiod" != x -a x"$with_hesiod" != x"no"; then
678 if test x"$with_hesiod" != x"yes"; then
679 HESIOD_INCLUDES="-I$with_hesiod/include"
680 HESIOD_LIBS="-L$with_hesiod/lib"
682 AC_CHECK_FUNC(res_send,
683 [AC_CHECK_LIB(hesiod, hes_resolve,
684 [HESIOD_LIBS="$HESIOD_LIBS -lhesiod"],
685 [AC_MSG_ERROR(Hesiod library not found)],
687 [AC_CHECK_LIB(hesiod, hes_resolve,
688 [HESIOD_LIBS="$HESIOD_LIBS -lhesiod -lresolv"],
689 [AC_MSG_ERROR(Hesiod library not found)],
690 $HESIOD_LIBS -lresolv)])
693 AC_SUBST(HESIOD_INCLUDES)dnl
694 AC_SUBST(HESIOD_LIBS)dnl
696 dnl ----------------------------------
697 dnl CHECK FOR KRB4 (Kerberos4 support)
698 dnl ----------------------------------
699 if test x"$with_krb4" != x -a x"$with_krb4" != x"no"; then
700 if test x"$with_krb4" != x"yes"; then
701 KRB4_INCLUDES="-I$with_krb4/include"
702 if test -d "$with_krb4/include/kerberosIV"; then
703 KRB4_INCLUDES="$KRB4_INCLUDES -I$with_krb4/include/kerberosIV"
705 KRB4_LIBS="-L$with_krb4/lib"
706 elif test -d /usr/include/kerberosIV; then
707 KRB4_INCLUDES="-I/usr/include/kerberosIV"
709 dnl First, check if we have -lk5crypto, since that means we have a recent krb5
711 AC_CHECK_LIB(k5crypto, krb5_encrypt,
712 [AC_CHECK_LIB(krb4, krb_rd_req,
713 [KRB4_LIBS="$KRB4_LIBS -lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
714 [AC_MSG_ERROR(Kerberos 4 compatibility libraries not found)],
715 $KRB4_LIBS -ldes425 -lkrb5 -lk5crypto -lcom_err)],
717 [AC_CHECK_LIB(krb4, krb_rd_req,
718 [KRB4_LIBS="$KRB4_LIBS -lkrb4 -ldes425 -lkrb5 -lcrypto -lcom_err"],
719 [AC_CHECK_LIB(krb, krb_rd_req,
720 [KRB4_LIBS="$KRB4_LIBS -lkrb -ldes"],
721 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
723 $KRB4_LIBS -ldes425 -lkrb5 -lcrypto -lcom_err)],
727 AC_SUBST(KRB4_INCLUDES)dnl
728 AC_SUBST(KRB4_LIBS)dnl
730 dnl --------------------
731 dnl CHECK FOR CYRUS SASL
732 dnl --------------------
733 if test x"$with_cyrus_sasl" != x -a x"$with_cyrus_sasl" != x"no"; then
734 if test x"$with_cyrus_sasl" != x"yes"; then
735 SASL_INCLUDES="-I$with_cyrus_sasl/include"
736 SASL_LIBS="-L$with_cyrus_sasl/lib"
738 dnl Do OS-specific hardcoding of SASL shared library path into executables,
739 dnl so user isn't forced to set environment variables like Solaris'
743 SASL_LIBS="$SASL_LIBS -R$with_cyrus_sasl/lib"
747 save_LDFLAGS="$LDFLAGS"
748 LDFLAGS="$LDFLAGS $SASL_LIBS"
749 AC_CHECK_LIB(sasl2, sasl_client_new,
750 [SASL_LIBS="$SASL_LIBS -lsasl2"],
751 [AC_MSG_ERROR(Cyrus SASL library not found)])
752 LDFLAGS="$save_LDFLAGS"
754 AC_SUBST(SASL_INCLUDES)dnl
755 AC_SUBST(SASL_LIBS)dnl
757 dnl ---------------------
758 dnl CHECK TERMCAP LIBRARY
759 dnl ---------------------
761 dnl Add the termcap library, so that the following configure
762 dnl tests will find it when it tries to link test programs.
763 nmh_save_LIBS="$LIBS"
764 LIBS="$TERMLIB $LIBS"
766 dnl Checks for external variable ospeed in the termcap library.
767 AC_CACHE_CHECK(if an include file defines ospeed,
768 nmh_cv_decl_ospeed_include_defines,
769 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
775 #endif]], [[ospeed = 0;]])],
776 nmh_cv_decl_ospeed_include_defines=yes,nmh_cv_decl_ospeed_include_defines=no)])
778 if test $nmh_cv_decl_ospeed_include_defines = no; then
779 AC_CACHE_CHECK(if you must define ospeed,
780 nmh_cv_decl_ospeed_must_define,
781 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
782 [[extern short ospeed; ospeed = 0;]])],
783 nmh_cv_decl_ospeed_must_define=yes,nmh_cv_decl_ospeed_must_define=no)])
786 if test $nmh_cv_decl_ospeed_include_defines = yes; then
787 AC_DEFINE(HAVE_OSPEED)dnl
788 elif test $nmh_cv_decl_ospeed_must_define = yes; then
789 AC_DEFINE(HAVE_OSPEED)
790 AC_DEFINE(MUST_DEFINE_OSPEED)
793 dnl dnl Checks if tgetent accepts NULL and will
794 dnl dnl allocate its own termcap buffer.
795 dnl AC_CACHE_CHECK(if tgetent accepts NULL,
796 dnl nmh_cv_func_tgetent_accepts_null,
797 dnl [AC_TRY_RUN([main(){int i = tgetent((char*)0,"vt100");exit(!i || i == -1);}],
798 dnl nmh_cv_func_tgetent_accepts_null=yes,
799 dnl nmh_cv_func_tgetent_accepts_null=no,
800 dnl nmh_cv_func_tgetent_accepts_null=no)])
801 dnl if test $nmh_cv_func_tgetent_accepts_null = yes; then
802 dnl AC_DEFINE(TGETENT_ACCEPTS_NULL)
805 dnl Now put the libraries back to what it was before we
806 dnl starting checking the termcap library.
807 LIBS="$nmh_save_LIBS"
819 dnl Check for sigset_t. Currently I'm looking in
820 dnl <sys/types.h> and <signal.h>. Others might need
822 AC_CACHE_CHECK(for sigset_t, nmh_cv_type_sigset_t,
823 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
824 #include <signal.h>]], [[sigset_t tempsigset;]])],
825 nmh_cv_type_sigset_t=yes,nmh_cv_type_sigset_t=no)])
826 if test $nmh_cv_type_sigset_t = no; then
827 AC_DEFINE(sigset_t, unsigned int)
833 AC_CHECK_MEMBERS(struct stat.st_blksize)
835 AC_CACHE_CHECK(for tm_gmtoff in struct tm, nmh_cv_struct_tm_gmtoff,
836 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef TIME_WITH_SYS_TIME
837 # include <sys/time.h>
840 # ifdef TM_IN_SYS_TIME
841 # include <sys/time.h>
845 #endif]], [[struct tm temptm; temptm.tm_gmtoff = 0;]])],
846 nmh_cv_struct_tm_gmtoff=yes,nmh_cv_struct_tm_gmtoff=no)])
847 if test $nmh_cv_struct_tm_gmtoff = yes; then
848 AC_DEFINE(HAVE_TM_GMTOFF)
851 AC_CACHE_CHECK(for ut_type in struct utmp, nmh_cv_struct_utmp_ut_type,
854 [struct utmp temputmp; temputmp.ut_type = 0;],
855 nmh_cv_struct_utmp_ut_type=yes, nmh_cv_struct_utmp_ut_type=no)])
856 if test $nmh_cv_struct_utmp_ut_type = yes; then
857 AC_DEFINE(HAVE_UTMP_UT_TYPE)
863 dnl What style of signal do you have (POSIX, BSD, or SYSV)?
864 AC_MSG_CHECKING(what style of signals to use)
865 if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then
866 signals_style=POSIX_SIGNALS
867 AC_DEFINE(POSIX_SIGNALS)
868 AC_DEFINE(RELIABLE_SIGNALS)
869 elif test $ac_cv_func_sigblock = yes -a $ac_cv_func_sigsetmask = yes; then
870 signals_style=BSD_SIGNALS
871 AC_DEFINE(BSD_SIGNALS)
872 AC_DEFINE(RELIABLE_SIGNALS)
873 elif test $ac_cv_func_sighold = yes -a $ac_cv_func_sigrelse = yes; then
874 signals_style=SYSV_SIGNALS
875 AC_DEFINE(SYSV_SIGNALS)
877 signals_style=NO_SIGNAL_BLOCKING
878 AC_DEFINE(NO_SIGNAL_BLOCKING)
881 AC_MSG_RESULT($signals_style)
883 dnl Where is <signal.h> located? Needed as input for signames.awk
884 AC_CACHE_CHECK(where signal.h is located, nmh_cv_path_signal_h,
885 [for SIGNAL_H in /usr/include/bsd/sys/signal.h dnl Next
886 /usr/include/asm/signal.h dnl Linux 1.3.0 and above
887 /usr/include/asm/signum.h dnl some versions of Linux/Alpha
888 /usr/include/linux/signal.h dnl Linux up to 1.2.11
889 /usr/include/sys/signal.h dnl Almost everybody else
890 /dev/null; dnl Just in case we fall through
892 test -f $SIGNAL_H && \
893 grep '#[ ]*define[ ][ ]*SIG[0-9A-Z]*[ ]*[0-9][0-9]*' $SIGNAL_H > /dev/null && \
896 nmh_cv_path_signal_h=$SIGNAL_H
898 SIGNAL_H=$nmh_cv_path_signal_h
899 AC_SUBST(SIGNAL_H)dnl
902 dnl OS SPECIFIC DEFINES
943 AC_DEFINE(SCO_5_STDIO)
951 AC_CONFIG_FILES(Makefile config/Makefile h/Makefile sbr/Makefile uip/Makefile \
952 mts/Makefile mts/smtp/Makefile \
953 etc/Makefile docs/Makefile man/Makefile)
954 AC_CONFIG_COMMANDS([stamp],[test -z "$CONFIG_HEADERS" || echo > stamp-h])
957 dnl Umm, what's the point of these assignments?? -- <dan-nmh@dilvish.speed.net>
958 eval "nmhbin=${bindir}"; eval "nmhbin2=${nmhbin}"
959 eval "nmhsysconf=${sysconfdir}"; eval "nmhsysconf2=${nmhsysconf}"
960 eval "nmhlib=${libdir}"; eval "nmhlib2=${nmhlib}"
961 eval "nmhman=${mandir}"
964 if test x"$enable_pop" = x"yes"; then
967 if test x"$enable_apop" = x"yes"; then
968 pop_kinds="${pop_kinds}APOP "
971 if test x"$with_krb4" != x -a x"$with_krb4" != x"no"; then
972 pop_kinds="${pop_kinds}KPOP "
975 pop_kinds="${pop_kinds}POP3)"
981 nmh version : AC_PACKAGE_VERSION
982 target os : ${target}
984 compiler flags : ${CFLAGS}
985 linker flags : ${LDFLAGS}
986 source code location : ${srcdir}
987 binary install path : ${nmhbin2}
988 libary install path : ${nmhlib2}
989 config files install path : ${nmhsysconf2}
990 man page install path : ${nmhman}
991 backup prefix : ${backup_prefix}
992 transport system : ${MTS}
993 file locking type : ${LOCKTYPE}
994 default smtp servers : ${smtpservers}
995 default editor : ${editorpath}
996 default pager : ${pagerpath}
997 email address masquerading : ${masquerade}
998 pop is enabled : ${pop_kinds}
999 SASL support : ${sasl_support}"