]> diplodocus.org Git - nmh/blob - configure.in
Update the instructions for subscribing to the nmh-workers list
[nmh] / configure.in
1 dnl
2 dnl configure.in -- autoconf template for nmh
3 dnl
4 dnl $Id$
5 dnl
6
7 AC_INIT(h/nmh.h)
8 AC_CONFIG_HEADER(config.h)
9
10 AC_CANONICAL_SYSTEM
11
12 dnl ---------------------
13 dnl define a macro or two
14 dnl ---------------------
15
16 AC_DEFUN(NMH_PROG_GNU_LIBTOOL, [
17 if test -n "$LIBTOOL" ; then
18 tmptest=`$LIBTOOL --version 2>&1 | grep GNU`
19 if test x"$tmptest" != x ; then
20 GNU_LIBTOOL=1
21 AC_SUBST(GNU_LIBTOOL)dnl
22 fi
23 fi
24 ] )
25
26
27 dnl What version of nmh are we building?
28 VERSION=`sed -e 's/nmh-//' ${srcdir}/VERSION`
29 echo "configuring for nmh-$VERSION"
30 AC_SUBST(VERSION)dnl
31
32 dnl What date of nmh are we building?
33 DATE=`cat ${srcdir}/DATE`
34 echo "configuring for nmh dated $DATE"
35 AC_SUBST(DATE)dnl
36
37 dnl --------------------------
38 dnl CHECK COMMAND LINE OPTIONS
39 dnl --------------------------
40
41 dnl Do you want client-side support for apop?
42 AC_ARG_ENABLE(apop,
43 [ --enable-apop enable client-side support for POP3 and APOP])
44 if test x"$enable_apop" = x"yes"; then
45 AC_DEFINE(APOP)dnl
46 APOPLIB=md5.o
47 enable_pop=yes
48 fi
49 AC_SUBST(APOPLIB)dnl
50
51 dnl Do you want to debug nmh?
52 AC_ARG_ENABLE(debug,
53 [ --enable-debug enable nmh code debugging])
54 dnl The old redundant --enable-nmh-debug is deprecated and undocumented.
55 if test x"$enable_nmh_debug" = x"yes"; then
56 enable_debug=yes
57 fi
58
59 dnl Allow users to send email from addresses other than their default?
60 AC_ARG_ENABLE(masquerade,
61 [ --enable-masquerade[='draft_from mmailid username_extension']
62 enable up to 3 types of address masquerading [none]],
63 [if test x"$enable_masquerade" = x"yes"; then
64 masquerade="draft_from mmailid username_extension"
65 else
66 masquerade="$enable_masquerade"
67 fi])
68 AC_SUBST(masquerade)dnl
69
70 dnl Do you want mhe support?
71 AC_ARG_ENABLE(mhe,
72 [ --enable-mhe enable mhe support (DEFAULT)])
73
74 dnl mhe support is on by default, so define it unless --disable-mhe or the
75 dnl deprecated, undocumented --disable-nmh-mhe are specified.
76 if test x"$enable_mhe" != x"no" -a x"$enable_nmh_mhe" != x"no"; then
77 AC_DEFINE(MHE)dnl
78 fi
79
80 dnl Do you want client-side support for pop?
81 AC_ARG_ENABLE(pop,
82 [ --enable-pop enable client-side support for plain POP3])
83 dnl The old redundant --enable-nmh-pop is deprecated and undocumented.
84 if test x"$enable_nmh_pop" = x"yes"; then
85 enable_pop=yes
86 fi
87
88 dnl Do you want client-side support for using SASL for authentication?
89 dnl Note that this code will be enabled for both POP and SMTP
90 AC_ARG_WITH(cyrus-sasl,
91 [ --with-cyrus-sasl=<dir> Specify location of Cyrus SASL library for auth])
92 if test x"$with_cyrus_sasl" != x -a x"$with_cyrus_sasl" != x"no"; then
93 AC_DEFINE(CYRUS_SASL)dnl
94 sasl_support=yes
95 else
96 sasl_support=no
97 fi
98
99 dnl What should be the default editor?
100 AC_ARG_WITH(editor,
101 [ --with-editor=EDITOR specify the default editor])
102
103 if test -n "$with_editor"; then
104 editorpath="$with_editor"
105 fi
106
107 dnl Set the backup prefix
108 AC_ARG_WITH([hash-backup],
109 [ --with-hash-backup use # as the backup prefix (default: ,)])
110 if test x"$with_hash_backup" != x -a x"$with_hash_backup" != x"no"; then
111 backup_prefix="#"
112 else
113 backup_prefix=","
114 fi
115 AC_DEFINE_UNQUOTED(BACKUP_PREFIX, "$backup_prefix")dnl
116
117 dnl Do you want support for hesiod
118 AC_ARG_WITH(hesiod,
119 [ --with-hesiod=PREFIX specify location of Hesiod])
120 if test x"$with_hesiod" != x -a x"$with_hesiod" != x"no"; then
121 AC_DEFINE(HESIOD)dnl
122 fi
123
124 dnl Do you want client-side support for kpop
125 AC_ARG_WITH(krb4,
126 [ --with-krb4=PREFIX specify location of Kerberos V4 for KPOP support])
127 if test x"$with_krb4" != x -a x"$with_krb4" != x"no"; then
128 enable_pop=yes
129 AC_DEFINE(KPOP)dnl
130 AC_DEFINE(KPOP_PRINCIPAL, "pop")dnl
131 fi
132
133 dnl After we know if we're including apop and kpop support, do pop stuff
134 if test x"$enable_pop" = x"yes"; then
135 AC_DEFINE(POP)dnl
136 POPLIB=popsbr.o
137 POPSED='/^%nmhbeginpop%/d;/^%nmhendpop%/d'
138 else
139 POPSED='/^%nmhbeginpop%/,/^%nmhendpop%/d'
140 fi
141 AC_SUBST(POPLIB)dnl
142 AC_SUBST(POPSED)dnl
143
144 dnl What method of locking to use?
145 AC_ARG_WITH(locking,
146 [ --with-locking=LOCKTYPE specify the file locking method
147 (one of dot, fcntl, flock, lockf)])
148
149 if test x"$with_locking" = x"dot"; then
150 LOCKTYPE="dot"
151 AC_DEFINE(DOT_LOCKING)dnl
152 elif test x"$with_locking" = x"flock"; then
153 LOCKTYPE="flock"
154 AC_DEFINE(FLOCK_LOCKING)dnl
155 elif test x"$with_locking" = x"lockf"; then
156 LOCKTYPE="lockf"
157 AC_DEFINE(LOCKF_LOCKING)dnl
158 elif test x"$with_locking" = x"fcntl"; then
159 LOCKTYPE="fcntl"
160 AC_DEFINE(FCNTL_LOCKING)dnl
161 else
162 LOCKTYPE="dot"
163 AC_DEFINE(DOT_LOCKING)dnl
164 fi
165
166 dnl What method of posting should post use?
167 AC_ARG_WITH(mts,
168 [ --with-mts=MTS specify the default mail transport agent/service])
169
170 if test x"$with_mts" = x"smtp"; then
171 MTS="smtp"
172 elif test x"$with_mts" = x"sendmail"; then
173 MTS="sendmail"
174 else
175 MTS="smtp"
176 fi
177 AC_SUBST(MTS)dnl
178
179 dnl Both the smtp and sendmail mail transport services use the smtp code
180 AC_DEFINE(SMTPMTS)dnl
181
182 dnl What should be the default pager?
183 AC_ARG_WITH(pager,
184 [ --with-pager=PAGER specify the default pager])
185
186 if test -n "$with_pager"; then
187 pagerpath="$with_pager"
188 fi
189
190 dnl What should be the default mail server(s)?
191 AC_ARG_WITH(smtpservers,
192 [ --with-smtpservers='SMTPSERVER1[ SMTPSERVER2...]'
193 specify the default SMTP server(s) [localhost]])
194 if test -n "$with_smtpservers"; then
195 smtpservers="$with_smtpservers"
196 else
197 smtpservers="localhost"
198 fi
199 AC_SUBST(smtpservers)dnl
200
201 dnl ----------------------------------------------------
202 dnl Default location is /usr/local/nmh/{bin,etc,lib,man}
203 dnl ----------------------------------------------------
204 AC_PREFIX_DEFAULT(/usr/local/nmh)
205
206 dnl ------------------
207 dnl CHECK THE COMPILER
208 dnl ------------------
209 dnl We want these before the checks,
210 dnl so the checks can modify their values.
211 test -z "$CFLAGS" && CFLAGS= auto_cflags=1
212 if test x"$enable_debug" = x"yes"; then
213 test -z "$LDFLAGS" && LDFLAGS=-g
214 fi
215
216 AC_PROG_CC
217
218 dnl if the user hasn't specified CFLAGS, then
219 dnl if compiler is gcc, then
220 dnl use -O2 and some warning flags
221 dnl else use -O
222 if test -n "$auto_cflags"; then
223 if test x"$enable_debug" = x"yes"; then
224 if test -n "$GCC"; then
225 test -z "$CFLAGS" && CFLAGS="-Wall -g" || CFLAGS="$CFLAGS -Wall -g"
226 else
227 test -z "$CFLAGS" && CFLAGS=-g || CFLAGS="$CFLAGS -g"
228 fi
229 else
230 if test -z "$LDFLAGS"; then
231 case "$build_os" in
232 darwin*)
233 LDFLAGS=
234 ;;
235 *)
236 LDFLAGS=-s
237 ;;
238 esac
239 fi
240 if test -n "$GCC"; then
241 test -z "$CFLAGS" && CFLAGS="-Wall -O2" || CFLAGS="$CFLAGS -Wall -O2"
242 else
243 test -z "$CFLAGS" && CFLAGS=-O || CFLAGS="$CFLAGS -O"
244 fi
245 fi
246 fi
247
248 AC_C_CONST dnl Does compiler support `const'.
249
250 dnl ------------------
251 dnl CHECK FOR PROGRAMS
252 dnl ------------------
253 AC_PROG_MAKE_SET dnl Does make define $MAKE
254 AC_PROG_INSTALL dnl Check for BSD compatible `install'
255 AC_PROG_RANLIB dnl Check for `ranlib'
256 AC_PROG_AWK dnl Check for mawk,gawk,nawk, then awk
257 AC_PROG_LEX dnl Check for lex/flex
258
259 dnl Look for `cut'
260 pathtmp=/usr/bin:/bin:/usr/local/bin:/usr/xpg4/bin:/usr/ucb
261 AC_PATH_PROG(cutpath, cut, no, [$pathtmp])
262
263 dnl ----------------------------------------------
264 dnl check for lclint, and lint if it doesn't exist
265 dnl ----------------------------------------------
266 AC_CHECK_PROG(linttmp1, lclint, lclint, no)dnl
267 if test x$ac_cv_prog_linttmp1 != xno ; then
268 LINT=$ac_cv_prog_linttmp1
269 LINTFLAGS="-weak +posixlib -macrovarprefixexclude"
270 else
271 AC_CHECK_PROG(linttmp2, lint, lint, no)dnl
272 if test x$ac_cv_prog_linttmp2 != xno ; then
273 LINT=$ac_cv_prog_linttmp2
274 LINTFLAGS=""
275 else
276 LINT="echo 'No lint program found'"
277 LINTFLAGS=""
278 fi
279 fi
280 AC_SUBST(LINT)dnl
281 AC_SUBST(LINTFLAGS)dnl
282
283 dnl try to figure out which one we've got
284 AC_CHECK_PROG(LIBTOOL, libtool, libtool, , [$pathtmp])
285 NMH_PROG_GNU_LIBTOOL
286
287 dnl Check for lorder and tsort commands
288 AC_CHECK_PROG(LORDER, lorder, lorder, no)dnl
289 AC_CHECK_PROG(TSORT, tsort, tsort, no)dnl
290
291 dnl If either doesn't exist, replace them with echo and cat
292 if test x$ac_cv_prog_LORDER != xlorder -o x$ac_cv_prog_TSORT != xtsort; then
293 LORDER=echo
294 TSORT=cat
295 AC_SUBST(LORDER)dnl
296 AC_SUBST(TSORT)dnl
297 dnl Mac OS X has lorder, but sh is too broken for it to work
298 dnl elif test -z "`lorder config/config.c 2>&1 | grep config/config.c`" ; then
299 dnl LORDER=echo
300 dnl TSORT=cat
301 dnl AC_SUBST(LORDER)dnl
302 dnl AC_SUBST(TSORT)dnl
303 fi
304
305 dnl Check whether tsort can deal with loops
306 AC_CACHE_CHECK(whether tsort can deal with loops, nmh_cv_tsort_loop,
307 [if test -z "`echo a b b a | tsort 2>/dev/null | grep a`" ; then
308 nmh_cv_tsort_loop=no
309 else
310 nmh_cv_tsort_loop=yes
311 fi])
312 if test x$nmh_cv_tsort_loop = xno ; then
313 LORDER=echo
314 TSORT=cat
315 AC_SUBST(LORDER)dnl
316 AC_SUBST(TSORT)dnl
317 fi
318
319 dnl Look for `ls'
320 pathtmp=/usr/bin:/bin:/usr/local/bin:/usr/xpg4/bin:/usr/ucb
321 AC_PATH_PROG(lspath, ls, no, [$pathtmp])
322
323 dnl See how we get ls to display the owner and the group
324 if test "$lspath" != "no"; then
325 AC_CACHE_CHECK(how to get ls to show us the group ownership of a file,
326 nmh_cv_ls_grpopt,
327 [if test x"`$lspath -dl / | $AWK '{print $9}'`" = x"/"; then
328 dnl There were 9 parameters, so unless this is a really bizarre, nonstandard
329 dnl ls, it would seem -l gave us both the user and group. On this type of
330 dnl ls, -g makes _only_ the group be displayed (and not the user).
331 nmh_cv_ls_grpopt="-l"
332 else
333 dnl Looks like -l only gave us the user, so we need -g to get the group too.
334 nmh_cv_ls_grpopt="-lg"
335 fi])
336 fi
337
338 dnl Look for `more'
339 pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
340 AC_PATH_PROG(morepath, more, no, [$pathtmp])
341
342 dnl If pager is not specified yet,
343 dnl then use `more' as the default.
344 if test -z "$pagerpath"; then
345 pagerpath="$morepath"
346 fi
347 AC_SUBST(pagerpath)dnl
348
349 dnl Look for `sendmail'
350 pathtmp=/usr/lib:/usr/sbin:/usr/etc:/usr/ucblib:/usr/bin:/bin
351 AC_PATH_PROG(sendmailpath, sendmail, no, [$pathtmp])
352
353 dnl Look for `vi'
354 pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
355 AC_PATH_PROG(vipath, vi, no, [$pathtmp])
356
357 dnl If editor is not specified yet,
358 dnl then use `vi' as the default.
359 if test -z "$editorpath"; then
360 editorpath="$vipath"
361 fi
362 AC_SUBST(editorpath)dnl
363
364 dnl Check for broken vi
365 AC_CACHE_CHECK(for broken vi, nmh_cv_attvibug,
366 [if echo 'r /nonexist-file
367 q' | ex > /dev/null
368 then
369 nmh_cv_attvibug=no
370 else
371 nmh_cv_attvibug=yes
372 fi])
373
374 if test "$nmh_cv_attvibug" = yes; then
375 AC_DEFINE(ATTVIBUG)dnl
376 fi
377
378 dnl ----------------------------------------------------------
379 dnl FIND MAIL SPOOL AND SEE IF WE NEED TO MAKE inc SETGID MAIL
380 dnl ----------------------------------------------------------
381 AC_CACHE_CHECK(where mail spool is located, nmh_cv_mailspool,
382 [for mailspool in /var/mail dnl
383 /var/spool/mail dnl
384 /usr/spool/mail dnl
385 /dev/null; dnl Just in case we fall through
386 do
387 test -d $mailspool && break
388 done
389 nmh_cv_mailspool=$mailspool
390 ])
391 mailspool=$nmh_cv_mailspool
392 AC_SUBST(mailspool)dnl
393
394 dnl See whether the mail spool directory is world-writable.
395 if test "$lspath" != "no" -a "$cutpath" != "no"; then
396 AC_CACHE_CHECK(whether the mail spool is world-writable,
397 nmh_cv_mailspool_world_writable,
398 [if test "`$lspath -dlL $mailspool | $cutpath -c9`" = "-"; then
399 nmh_cv_mailspool_world_writable=no
400 else
401 nmh_cv_mailspool_world_writable=yes
402 fi])
403 fi
404
405 dnl Also, check for liblockfile (as found on Debian systems)
406 AC_CHECK_HEADER(lockfile.h, AC_CHECK_LIB(lockfile, lockfile_create) )
407
408 dnl and whether its companion program dotlockfile is setgid
409 AC_PATH_PROG(dotlockfilepath, dotlockfile, no)
410 if test "$ac_cv_lib_lockfile_lockfile_create" != "no" ; then
411 if test "$ac_cv_path_dotlockfilepath" != "no" ; then
412 AC_CACHE_CHECK(whether dotlockfile is setgid, nmh_cv_dotlockfile_setgid,
413 [ if test -g "$ac_cv_path_dotlockfilepath" ; then
414 nmh_cv_dotlockfile_setgid=yes
415 else
416 nmh_cv_dotlockfile_setgid=no
417 fi])
418 fi
419 fi
420
421 dnl If mailspool is not world-writable and dotlockfile is not setgid,
422 dnl we need to #define MAILGROUP to 1 and make inc setgid.
423 if test x"$nmh_cv_mailspool_world_writable" = x"no" -a x"$nmh_cv_dotlockfile_setgid" != x"yes" ; then
424 dnl do we really need both of these?
425 AC_DEFINE(MAILGROUP)dnl
426 SETGID_MAIL=1
427 fi
428 AC_SUBST(SETGID_MAIL)dnl
429
430 dnl Use ls to see which group owns the mail spool directory.
431 AC_CACHE_CHECK(what group owns the mail spool, nmh_cv_ls_mail_grp,
432 [nmh_cv_ls_mail_grp=`$lspath -dL $nmh_cv_ls_grpopt $mailspool|$AWK '{print $4}'`
433 ])
434 MAIL_SPOOL_GRP=$nmh_cv_ls_mail_grp
435 AC_SUBST(MAIL_SPOOL_GRP)dnl
436
437 dnl ------------------
438 dnl CHECK HEADER FILES
439 dnl ------------------
440 AC_HEADER_DIRENT
441 AC_HEADER_STDC
442 AC_HEADER_TIME
443 AC_HEADER_SYS_WAIT
444 AC_HEADER_STAT
445 AC_CHECK_HEADERS(string.h memory.h stdlib.h unistd.h errno.h fcntl.h \
446 limits.h crypt.h termcap.h termio.h termios.h locale.h \
447 langinfo.h netdb.h sys/param.h sys/time.h sys/utsname.h \
448 iconv.h arpa/inet.h arpa/ftp.h)
449
450
451 AC_CACHE_CHECK(POSIX termios, nmh_cv_sys_posix_termios,
452 [AC_TRY_LINK([#include <sys/types.h>
453 #include <unistd.h>
454 #include <termios.h>],
455 [/* SunOS 4.0.3 has termios.h but not the library calls. */
456 tcgetattr(0, 0);],
457 nmh_cv_sys_posix_termios=yes, nmh_cv_sys_posix_termios=no)])
458
459 if test $nmh_cv_sys_posix_termios = yes; then
460 AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
461 nmh_cv_header_termios_h_tiocgwinsz,
462 [AC_TRY_LINK([#include <sys/types.h>
463 #include <termios.h>],
464 [int x = TIOCGWINSZ;],
465 nmh_cv_header_termios_h_tiocgwinsz=yes,
466 nmh_cv_header_termios_h_tiocgwinsz=no)])
467 else
468 nmh_cv_header_termios_h_tiocgwinsz=no
469 fi
470
471 if test $nmh_cv_header_termios_h_tiocgwinsz = no; then
472 AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
473 nmh_cv_header_sys_ioctl_h_tiocgwinsz,
474 [AC_TRY_LINK([#include <sys/types.h>
475 #include <sys/ioctl.h>],
476 [int x = TIOCGWINSZ;],
477 nmh_cv_header_sys_ioctl_h_tiocgwinsz=yes,
478 nmh_cv_header_sys_ioctl_h_tiocgwinsz=no)])
479 if test $nmh_cv_header_sys_ioctl_h_tiocgwinsz = yes; then
480 AC_DEFINE(GWINSZ_IN_SYS_IOCTL)dnl
481 fi
482 fi
483
484 dnl
485 dnl Checks for _IO_write_ptr. A Linuxism used by nmh on linux. We
486 dnl really use a whole set of them, but this check should be
487 dnl sufficient.
488 dnl
489 AC_CHECK_HEADER(libio.h, [
490 AC_EGREP_HEADER(_IO_write_ptr, libio.h, [
491 AC_DEFINE(LINUX_STDIO) ]) ])
492
493 AC_CHECK_HEADER([sys/ptem.h], AC_DEFINE(WINSIZE_IN_PTEM))
494
495 dnl ---------------
496 dnl CHECK FUNCTIONS
497 dnl ---------------
498 AC_FUNC_VFORK
499 AC_CHECK_LIB(mkstemp,mkstemp)
500 AC_CHECK_FUNCS(waitpid wait3 sigaction sigprocmask sigblock sigsetmask \
501 sighold sigrelse writev lstat uname tzset killpg mkstemp \
502 sethostent getutent nl_langinfo)
503
504 dnl solaris screws this up
505 AC_CHECK_FUNC(gethostbyname, [AC_DEFINE(HAVE_GETHOSTBYNAME)],
506 AC_CHECK_LIB(nsl, gethostbyname, [AC_DEFINE(HAVE_GETHOSTBYNAME)] ) )
507
508 dnl sigsetjmp may be a macro
509 AC_MSG_CHECKING(for sigsetjmp)
510 AC_TRY_LINK([#include <setjmp.h>], [sigsetjmp((void *)0, 0);],
511 [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
512
513 AC_REPLACE_FUNCS(snprintf strerror strdup)
514
515 dnl Look for the initgroups() declaration. On AIX 4.[13], Solaris 4.1.3, and
516 dnl ULTRIX 4.2A the function is defined in libc but there's no declaration in
517 dnl any system header.
518 dnl
519 dnl On Solaris 2.[456], the declaration is in <grp.h>. On HP-UX 9-11 and
520 dnl (reportedly) FreeBSD 3.[23], it's in <unistd.h>. Any other locations we
521 dnl need to check?
522 AC_EGREP_HEADER(initgroups, grp.h, AC_DEFINE(INITGROUPS_HEADER, <grp.h>),
523 AC_EGREP_HEADER(initgroups, unistd.h,
524 AC_DEFINE(INITGROUPS_HEADER, <unistd.h>)))
525
526 dnl On AIX 4.1, snprintf() is defined in libc.a but there's no prototype in
527 dnl <stdio.h> or elsewhere. Apparently it's not officially supported (though it
528 dnl seems to work perfectly and IBM apparently uses it in internal code).
529 dnl Anyhow, if we omit our own snprintf() and vsnprintf() prototypes when we
530 dnl HAVE_SNPRINTF, we get a billion warnings at compile time. Use the C
531 dnl preprocessor to preprocess stdio.h and make sure that there's actually a
532 dnl prototype.
533 AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_PROTOTYPE))
534
535 dnl -------------------
536 dnl CHECK FOR LIBRARIES
537 dnl -------------------
538 dnl Check location of modf
539 AC_CHECK_FUNC(modf, , AC_CHECK_LIB(m, modf))
540
541 dnl Checks for network libraries (nsl, socket)
542 AC_CHECK_NETLIBS
543
544 termcap_curses_order="termcap curses ncurses"
545 for lib in $termcap_curses_order; do
546 AC_CHECK_LIB(${lib}, tgetent, [TERMLIB="-l$lib"; break])
547 done
548 AC_SUBST(TERMLIB)dnl
549
550 dnl ---------------
551 dnl CHECK FOR ICONV
552 dnl ---------------
553
554 dnl Find iconv. It may be in libiconv and may be iconv() or libiconv()
555 if test "x$ac_cv_header_iconv_h" = "xyes"; then
556 AC_CHECK_FUNC(iconv, ac_found_iconv=yes, ac_found_iconv=no)
557 if test "x$ac_found_iconv" = "xno"; then
558 AC_CHECK_LIB(iconv, iconv, ac_found_iconv=yes)
559 if test "x$ac_found_iconv" = "xno"; then
560 AC_CHECK_LIB(iconv, libiconv, ac_found_iconv=yes)
561 fi
562 if test "x$ac_found_iconv" != "xno"; then
563 LIBS="-liconv $LIBS"
564 fi
565 fi
566 fi
567 if test "x$ac_found_iconv" = xyes; then
568 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
569 fi
570
571 dnl Check if iconv uses const in prototype declaration
572 if test "x$ac_found_iconv" = "xyes"; then
573 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
574 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
575 #include <iconv.h>]],
576 [[#ifdef __cplusplus
577 "C"
578 #endif
579 #if defined(__STDC__) || defined(__cplusplus)
580 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
581 #else
582 size_t iconv();
583 #endif]])],
584 [ac_cv_iconv_const=],
585 [ac_cv_iconv_const=const])])
586 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
587 [Define as const if the declaration of iconv() needs const.])
588 fi
589
590 dnl --------------
591 dnl CHECK FOR NDBM
592 dnl --------------
593 dnl Checks for ndbm
594 AC_CHECK_FUNC(dbm_open, ,
595 AC_CHECK_LIB(ndbm, dbm_open, ,
596 AC_CHECK_LIB(dbm, dbm_open, ,
597 AC_CHECK_LIB(db1, dbm_open, ,
598 AC_CHECK_LIB(gdbm, dbm_open, ,
599 AC_CHECK_LIB(db, __db_ndbm_open))))))
600
601 dnl ----------------
602 dnl CHECK FOR NDBM.H
603 dnl ----------------
604
605 AC_CHECK_HEADERS(db1/ndbm.h gdbm/ndbm.h db.h, break, )
606
607 dnl ----------------
608 dnl CHECK FOR HESIOD
609 dnl ----------------
610 if test x"$with_hesiod" != x -a x"$with_hesiod" != x"no"; then
611 if test x"$with_hesiod" != x"yes"; then
612 HESIOD_INCLUDES="-I$with_hesiod/include"
613 HESIOD_LIBS="-L$with_hesiod/lib"
614 fi
615 AC_CHECK_FUNC(res_send,
616 [AC_CHECK_LIB(hesiod, hes_resolve,
617 [HESIOD_LIBS="$HESIOD_LIBS -lhesiod"],
618 [AC_MSG_ERROR(Hesiod library not found)],
619 $HESIOD_LIBS)],
620 [AC_CHECK_LIB(hesiod, hes_resolve,
621 [HESIOD_LIBS="$HESIOD_LIBS -lhesiod -lresolv"],
622 [AC_MSG_ERROR(Hesiod library not found)],
623 $HESIOD_LIBS -lresolv)])
624
625 fi
626 AC_SUBST(HESIOD_INCLUDES)dnl
627 AC_SUBST(HESIOD_LIBS)dnl
628
629 dnl ----------------------------------
630 dnl CHECK FOR KRB4 (Kerberos4 support)
631 dnl ----------------------------------
632 if test x"$with_krb4" != x -a x"$with_krb4" != x"no"; then
633 if test x"$with_krb4" != x"yes"; then
634 KRB4_INCLUDES="-I$with_krb4/include"
635 if test -d "$with_krb4/include/kerberosIV"; then
636 KRB4_INCLUDES="$KRB4_INCLUDES -I$with_krb4/include/kerberosIV"
637 fi
638 KRB4_LIBS="-L$with_krb4/lib"
639 elif test -d /usr/include/kerberosIV; then
640 KRB4_INCLUDES="-I/usr/include/kerberosIV"
641 fi
642 dnl First, check if we have -lk5crypto, since that means we have a recent krb5
643
644 AC_CHECK_LIB(k5crypto, krb5_encrypt,
645 [AC_CHECK_LIB(krb4, krb_rd_req,
646 [KRB4_LIBS="$KRB4_LIBS -lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
647 [AC_MSG_ERROR(Kerberos 4 compatibility libraries not found)],
648 $KRB4_LIBS -ldes425 -lkrb5 -lk5crypto -lcom_err)],
649
650 [AC_CHECK_LIB(krb4, krb_rd_req,
651 [KRB4_LIBS="$KRB4_LIBS -lkrb4 -ldes425 -lkrb5 -lcrypto -lcom_err"],
652 [AC_CHECK_LIB(krb, krb_rd_req,
653 [KRB4_LIBS="$KRB4_LIBS -lkrb -ldes"],
654 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
655 $KRB4_LIBS -ldes)],
656 $KRB4_LIBS -ldes425 -lkrb5 -lcrypto -lcom_err)],
657 $KRB4_LIBS)
658
659 fi
660 AC_SUBST(KRB4_INCLUDES)dnl
661 AC_SUBST(KRB4_LIBS)dnl
662
663 dnl --------------------
664 dnl CHECK FOR CYRUS SASL
665 dnl --------------------
666 if test x"$with_cyrus_sasl" != x -a x"$with_cyrus_sasl" != x"no"; then
667 if test x"$with_cyrus_sasl" != x"yes"; then
668 SASL_INCLUDES="-I$with_cyrus_sasl/include"
669 SASL_LIBS="-L$with_cyrus_sasl/lib"
670
671 dnl Do OS-specific hardcoding of SASL shared library path into executables,
672 dnl so user isn't forced to set environment variables like Solaris'
673 dnl LD_LIBRARY_PATH.
674 case "$target_os" in
675 solaris*)
676 SASL_LIBS="$SASL_LIBS -R$with_cyrus_sasl/lib"
677 ;;
678 esac
679 fi
680 save_LDFLAGS="$LDFLAGS"
681 LDFLAGS="$LDFLAGS $SASL_LIBS"
682 AC_CHECK_LIB(sasl2, sasl_client_new,
683 [SASL_LIBS="$SASL_LIBS -lsasl2"],
684 [AC_MSG_ERROR(Cyrus SASL library not found)])
685 LDFLAGS="$save_LDFLAGS"
686 fi
687 AC_SUBST(SASL_INCLUDES)dnl
688 AC_SUBST(SASL_LIBS)dnl
689
690 dnl ---------------------
691 dnl CHECK TERMCAP LIBRARY
692 dnl ---------------------
693
694 dnl Add the termcap library, so that the following configure
695 dnl tests will find it when it tries to link test programs.
696 nmh_save_LIBS="$LIBS"
697 LIBS="$TERMLIB $LIBS"
698
699 dnl Checks for external variable ospeed in the termcap library.
700 AC_CACHE_CHECK(if an include file defines ospeed,
701 nmh_cv_decl_ospeed_include_defines,
702 [AC_TRY_LINK(
703 [#include <sys/types.h>
704 #if HAVE_TERMIOS_H
705 #include <termios.h>
706 #endif
707 #if HAVE_TERMCAP_H
708 #include <termcap.h>
709 #endif], [ospeed = 0;],
710 nmh_cv_decl_ospeed_include_defines=yes,
711 nmh_cv_decl_ospeed_include_defines=no)])
712
713 if test $nmh_cv_decl_ospeed_include_defines = no; then
714 AC_CACHE_CHECK(if you must define ospeed,
715 nmh_cv_decl_ospeed_must_define,
716 [AC_TRY_LINK( ,[extern short ospeed; ospeed = 0;],
717 nmh_cv_decl_ospeed_must_define=yes,
718 nmh_cv_decl_ospeed_must_define=no)])
719 fi
720
721 if test $nmh_cv_decl_ospeed_include_defines = yes; then
722 AC_DEFINE(HAVE_OSPEED)dnl
723 elif test $nmh_cv_decl_ospeed_must_define = yes; then
724 AC_DEFINE(HAVE_OSPEED)
725 AC_DEFINE(MUST_DEFINE_OSPEED)
726 fi
727
728 dnl dnl Checks if tgetent accepts NULL and will
729 dnl dnl allocate its own termcap buffer.
730 dnl AC_CACHE_CHECK(if tgetent accepts NULL,
731 dnl nmh_cv_func_tgetent_accepts_null,
732 dnl [AC_TRY_RUN([main(){int i = tgetent((char*)0,"vt100");exit(!i || i == -1);}],
733 dnl nmh_cv_func_tgetent_accepts_null=yes,
734 dnl nmh_cv_func_tgetent_accepts_null=no,
735 dnl nmh_cv_func_tgetent_accepts_null=no)])
736 dnl if test $nmh_cv_func_tgetent_accepts_null = yes; then
737 dnl AC_DEFINE(TGETENT_ACCEPTS_NULL)
738 dnl fi
739
740 dnl Now put the libraries back to what it was before we
741 dnl starting checking the termcap library.
742 LIBS="$nmh_save_LIBS"
743
744 dnl --------------
745 dnl CHECK TYPEDEFS
746 dnl --------------
747 AC_TYPE_SIGNAL
748 AC_TYPE_PID_T
749 AC_TYPE_OFF_T
750 AC_TYPE_UID_T
751 AC_TYPE_MODE_T
752 AC_TYPE_SIZE_T
753
754 dnl Check for sigset_t. Currently I'm looking in
755 dnl <sys/types.h> and <signal.h>. Others might need
756 dnl to be added.
757 AC_CACHE_CHECK(for sigset_t, nmh_cv_type_sigset_t,
758 [AC_TRY_COMPILE(
759 [#include <sys/types.h>
760 #include <signal.h>], [sigset_t tempsigset;],
761 nmh_cv_type_sigset_t=yes, nmh_cv_type_sigset_t=no)])
762 if test $nmh_cv_type_sigset_t = no; then
763 AC_DEFINE(sigset_t, unsigned int)
764 fi
765
766 dnl ----------------
767 dnl CHECK STRUCTURES
768 dnl ----------------
769 AC_STRUCT_ST_BLKSIZE
770
771 AC_CACHE_CHECK(for tm_gmtoff in struct tm, nmh_cv_struct_tm_gmtoff,
772 [AC_TRY_COMPILE(
773 [#ifdef TIME_WITH_SYS_TIME
774 # include <sys/time.h>
775 # include <time.h>
776 #else
777 # ifdef TM_IN_SYS_TIME
778 # include <sys/time.h>
779 # else
780 # include <time.h>
781 # endif
782 #endif],
783 [struct tm temptm; temptm.tm_gmtoff = 0;],
784 nmh_cv_struct_tm_gmtoff=yes, nmh_cv_struct_tm_gmtoff=no)])
785 if test $nmh_cv_struct_tm_gmtoff = yes; then
786 AC_DEFINE(HAVE_TM_GMTOFF)
787 fi
788
789 dnl -------------
790 dnl CHECK SIGNALS
791 dnl -------------
792 dnl What style of signal do you have (POSIX, BSD, or SYSV)?
793 AC_MSG_CHECKING(what style of signals to use)
794 if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then
795 signals_style=POSIX_SIGNALS
796 AC_DEFINE(POSIX_SIGNALS)
797 AC_DEFINE(RELIABLE_SIGNALS)
798 elif test $ac_cv_func_sigblock = yes -a $ac_cv_func_sigsetmask = yes; then
799 signals_style=BSD_SIGNALS
800 AC_DEFINE(BSD_SIGNALS)
801 AC_DEFINE(RELIABLE_SIGNALS)
802 elif test $ac_cv_func_sighold = yes -a $ac_cv_func_sigrelse = yes; then
803 signals_style=SYSV_SIGNALS
804 AC_DEFINE(SYSV_SIGNALS)
805 else
806 signals_style=NO_SIGNAL_BLOCKING
807 AC_DEFINE(NO_SIGNAL_BLOCKING)
808 fi
809
810 AC_MSG_RESULT($signals_style)
811
812 dnl Where is <signal.h> located? Needed as input for signames.awk
813 AC_CACHE_CHECK(where signal.h is located, nmh_cv_path_signal_h,
814 [for SIGNAL_H in /usr/include/bsd/sys/signal.h dnl Next
815 /usr/include/asm/signal.h dnl Linux 1.3.0 and above
816 /usr/include/asm/signum.h dnl some versions of Linux/Alpha
817 /usr/include/linux/signal.h dnl Linux up to 1.2.11
818 /usr/include/sys/signal.h dnl Almost everybody else
819 /dev/null; dnl Just in case we fall through
820 do
821 test -f $SIGNAL_H && \
822 grep '#[ ]*define[ ][ ]*SIG[0-9A-Z]*[ ]*[0-9][0-9]*' $SIGNAL_H > /dev/null && \
823 break
824 done
825 nmh_cv_path_signal_h=$SIGNAL_H
826 ])
827 SIGNAL_H=$nmh_cv_path_signal_h
828 AC_SUBST(SIGNAL_H)dnl
829
830 dnl ----------------
831 dnl OS SPECIFIC DEFINES
832 dnl ----------------
833 case "$target_os" in
834
835 solaris2*)
836 AC_DEFINE(SYS5)
837 AC_DEFINE(SVR4)
838 ;;
839 irix*)
840 AC_DEFINE(SYS5)
841 AC_DEFINE(SVR4)
842 ;;
843 osf*)
844 AC_DEFINE(SYS5)
845 AC_DEFINE(SVR4)
846 ;;
847 aix*)
848 AC_DEFINE(SYS5)
849 AC_DEFINE(SVR4)
850 ;;
851 sunos4*)
852 AC_DEFINE(BSD42)
853 ;;
854 freebsd*)
855 AC_DEFINE(BSD42)
856 AC_DEFINE(BSD44)
857 ;;
858 netbsd*)
859 AC_DEFINE(BSD42)
860 AC_DEFINE(BSD44)
861 ;;
862 openbsd*)
863 AC_DEFINE(BSD42)
864 AC_DEFINE(BSD44)
865 ;;
866 bsd/os*)
867 AC_DEFINE(BSD42)
868 AC_DEFINE(BSD44)
869 ;;
870 sco5*)
871 AC_DEFINE(SYS5)
872 AC_DEFINE(SCO_5_STDIO)
873 ;;
874 esac
875
876
877 dnl ----------------
878 dnl OUTPUT MAKEFILES
879 dnl ----------------
880 AC_OUTPUT(Makefile config/Makefile h/Makefile sbr/Makefile uip/Makefile \
881 mts/Makefile mts/smtp/Makefile \
882 etc/Makefile docs/Makefile man/Makefile, \
883 [test -z "$CONFIG_HEADERS" || echo > stamp-h])
884
885 dnl Umm, what's the point of these assignments?? -- <dan-nmh@dilvish.speed.net>
886 eval "nmhbin=${bindir}"; eval "nmhbin2=${nmhbin}"
887 eval "nmhsysconf=${sysconfdir}"; eval "nmhsysconf2=${nmhsysconf}"
888 eval "nmhlib=${libdir}"; eval "nmhlib2=${nmhlib}"
889 eval "nmhman=${mandir}"
890
891 pop_kinds=no
892 if test x"$enable_pop" = x"yes"; then
893 pop_kinds="yes ("
894
895 if test x"$enable_apop" = x"yes"; then
896 pop_kinds="${pop_kinds}APOP "
897 fi
898
899 if test x"$with_krb4" != x -a x"$with_krb4" != x"no"; then
900 pop_kinds="${pop_kinds}KPOP "
901 fi
902
903 pop_kinds="${pop_kinds}POP3)"
904 fi
905
906 echo "
907 nmh configuration
908 -----------------
909 nmh version : ${VERSION}
910 target os : ${target}
911 compiler : ${CC}
912 compiler flags : ${CFLAGS}
913 linker flags : ${LDFLAGS}
914 source code location : ${srcdir}
915 binary install path : ${nmhbin2}
916 libary install path : ${nmhlib2}
917 config files install path : ${nmhsysconf2}
918 man page install path : ${nmhman}
919 backup prefix : ${backup_prefix}
920 transport system : ${MTS}
921 file locking type : ${LOCKTYPE}
922 default smtp servers : ${smtpservers}
923 default editor : ${editorpath}
924 default pager : ${pagerpath}
925 email address masquerading : ${masquerade}
926 pop is enabled : ${pop_kinds}
927 SASL support : ${sasl_support}"
928 echo ""