2 dnl configure.in -- autoconf template for nmh
8 AC_CONFIG_HEADER(config.h)
12 dnl What version of nmh are we building?
13 VERSION=`sed -e 's/nmh-//' ${srcdir}/VERSION`
14 echo "configuring for nmh-$VERSION"
17 dnl -------------------------
18 dnl CHECK COMMAND LINE OPTION
19 dnl -------------------------
20 dnl What method of posting should post use?
23 [ --with-mts=MTS specify the mail transport agent])
25 if test x$with_mts = xsmtp; then
27 MTSLIB="mts/smtp/libsmtp.a"
29 elif test x$with_mts = xsendmail; then
31 MTSLIB="mts/sendmail/libsend.a"
35 MTSLIB="mts/smtp/libsmtp.a"
42 dnl What should be the default editor?
45 [ --with-editor=EDITOR specify the default editor])
47 if test -n "$with_editor"; then
48 editorpath="$with_editor"
51 dnl What should be the default pager?
54 [ --with-pager=PAGER specify the default pager])
56 if test -n "$with_pager"; then
57 pagerpath="$with_pager"
60 dnl Do you want mhe support?
61 undefine([nmh-mhe])dnl
62 AC_ARG_ENABLE(nmh-mhe,
63 [ --enable-nmh-mhe enable mhe support (DEFAULT)])
65 dnl mhe support is on by default, so define it unless
66 dnl explicitly disabled.
67 if test x$enable_nmh_mhe != xno; then
71 dnl Do you want client-side support for pop
72 undefine([nmh-pop])dnl
73 AC_ARG_ENABLE(nmh-pop,
74 [ --enable-nmh-pop enable client-side support for pop])
75 if test x$enable_nmh_pop = xyes; then
78 POPSED='/^%nmhbeginpop%/d;/^%nmhendpop%/d'
80 POPSED='/^%nmhbeginpop%/,/^%nmhendpop%/d'
85 dnl Do you want client-side support for kpop
87 [ --with-krb4=PREFIX specify location of Kerberos V4 for kpop support])
88 if test x$with_krb4 != x -a x$with_krb4 != xno; then
90 AC_DEFINE(KPOP_PRINCIPAL, "pop")dnl
93 dnl Do you want support for hesiod
95 [ --with-hesiod=PREFIX specify location of Hesiod])
96 if test x$with_hesiod != x -a x$with_hesiod != xno; then
100 dnl Do you want to debug nmh?
101 undefine([nmh-debug])dnl
102 AC_ARG_ENABLE(nmh-debug,
103 [ --enable-nmh-debug enable nmh code debugging])
105 dnl ----------------------------------------------------
106 dnl Default location is /usr/local/nmh/{bin,etc,lib,man}
107 dnl ----------------------------------------------------
108 AC_PREFIX_DEFAULT(/usr/local/nmh)
110 dnl ------------------
111 dnl CHECK THE COMPILER
112 dnl ------------------
113 dnl We want these before the checks,
114 dnl so the checks can modify their values.
115 test -z "$CFLAGS" && CFLAGS= auto_cflags=1
116 if test x$enable_nmh_debug = xyes; then
117 test -z "$LDFLAGS" && LDFLAGS=-g
122 dnl if the user hasn't specified CFLAGS, then
123 dnl if compiler is gcc, then
124 dnl use -O2 and some warning flags
126 if test -n "$auto_cflags"; then
127 if test x$enable_nmh_debug = xyes; then
128 if test -n "$GCC"; then
129 test -z "$CFLAGS" && CFLAGS="-Wall -g" || CFLAGS="$CFLAGS -Wall -g"
131 test -z "$CFLAGS" && CFLAGS=-g || CFLAGS="$CFLAGS -g"
134 test -z "$LDFLAGS" && LDFLAGS=-s
135 if test -n "$GCC"; then
136 test -z "$CFLAGS" && CFLAGS=-O2 || CFLAGS="$CFLAGS -O2"
138 test -z "$CFLAGS" && CFLAGS=-O || CFLAGS="$CFLAGS -O"
143 AC_C_CONST dnl Does compiler support `const'.
145 dnl ------------------
146 dnl CHECK FOR PROGRAMS
147 dnl ------------------
148 AC_PROG_MAKE_SET dnl Does make define $MAKE
149 AC_PROG_INSTALL dnl Check for BSD compatible `install'
150 AC_PROG_RANLIB dnl Check for `ranlib'
151 AC_PROG_AWK dnl Check for mawk,gawk,nawk, then awk
152 AC_PROG_LEX dnl Check for lex/flex
155 pathtmp=/usr/bin:/bin:/usr/local/bin:/usr/xpg4/bin:/usr/ucb
156 AC_PATH_PROG(cutpath, cut, no, [$pathtmp])
158 dnl Check for lorder and tsort commands
159 AC_CHECK_PROG(LORDER, lorder, lorder, no)dnl
160 AC_CHECK_PROG(TSORT, tsort, tsort, no)dnl
162 dnl If either doesn't exist, replace them with echo and cat
163 if test x$ac_cv_prog_LORDER != xlorder -o x$ac_cv_prog_TSORT != xtsort; then
171 pathtmp=/usr/bin:/bin:/usr/local/bin:/usr/xpg4/bin:/usr/ucb
172 AC_PATH_PROG(lspath, ls, no, [$pathtmp])
175 pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
176 AC_PATH_PROG(morepath, more, no, [$pathtmp])
178 dnl If pager is not specified yet,
179 dnl then use `more' as the default.
180 if test -z "$pagerpath"; then
181 pagerpath="$morepath"
183 AC_SUBST(pagerpath)dnl
185 dnl Look for `sendmail'
186 pathtmp=/usr/lib:/usr/sbin:/usr/etc:/usr/ucblib:/usr/bin:/bin
187 AC_PATH_PROG(sendmailpath, sendmail, no, [$pathtmp])
190 pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
191 AC_PATH_PROG(vipath, vi, no, [$pathtmp])
193 dnl If editor is not specified yet,
194 dnl then use `vi' as the default.
195 if test -z "$editorpath"; then
198 AC_SUBST(editorpath)dnl
200 dnl Check for broken vi
201 AC_CACHE_CHECK(for broken vi, nmh_cv_attvibug,
202 [if echo 'r /nonexist-file
203 q' | ex > /dev/null 2>&1
210 if test "$nmh_cv_attvibug" = yes; then
214 dnl ----------------------------------------------------------
215 dnl FIND MAIL SPOOL AND SEE IF WE NEED TO MAKE inc SETGID MAIL
216 dnl ----------------------------------------------------------
217 AC_CACHE_CHECK(where mail spool is located, nmh_cv_mailspool,
218 [for mailspool in /var/mail dnl
221 /dev/null; dnl Just in case we fall through
223 test -d $mailspool && break
225 nmh_cv_mailspool=$mailspool
227 mailspool=$nmh_cv_mailspool
228 AC_SUBST(mailspool)dnl
230 dnl See whether the mail spool directory is world-writable.
231 if test "$lspath" != "no" -a "$cutpath" != "no"; then
232 AC_CACHE_CHECK(whether the mail spool is world-writable,
233 nmh_cv_mailspool_world_writable,
234 [if test "`$lspath -dl $mailspool | $cutpath -c9`" = "-"; then
235 nmh_cv_mailspool_world_writable=no
237 nmh_cv_mailspool_world_writable=yes
241 dnl see if we can determine which group owns the mail spool dir
242 undefine([nmh_grp_mailspool])dnl
243 AC_CACHE_CHECK(what group owns the mail spool, nmh_group_mailspool,
244 [ nmh_group_mailspool=`ls -lgd $mailspool | awk '{print $4}'`
245 if test x$nmh_group_mailspool = xmail; then
247 elif test x$nmh_group_mailspool = xwheel; then
254 dnl ...If it's not, we need to #define MAILGROUP to 1 and make inc setgid mail.
255 if test "$nmh_cv_mailspool_world_writable" = "no"; then
256 dnl do we really need both of these?
260 AC_SUBST(SETGID_MAIL)dnl
262 dnl ------------------
263 dnl CHECK HEADER FILES
264 dnl ------------------
270 AC_CHECK_HEADERS(string.h memory.h stdlib.h unistd.h errno.h fcntl.h \
271 limits.h crypt.h termcap.h termio.h termios.h locale.h \
272 sys/param.h sys/time.h sys/utsname.h arpa/inet.h \
275 AC_CACHE_CHECK(POSIX termios, nmh_cv_sys_posix_termios,
276 [AC_TRY_LINK([#include <sys/types.h>
278 #include <termios.h>],
279 [/* SunOS 4.0.3 has termios.h but not the library calls. */
281 nmh_cv_sys_posix_termios=yes, nmh_cv_sys_posix_termios=no)])
283 if test $nmh_cv_sys_posix_termios = yes; then
284 AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
285 nmh_cv_header_termios_h_tiocgwinsz,
286 [AC_TRY_LINK([#include <sys/types.h>
287 #include <termios.h>],
288 [int x = TIOCGWINSZ;],
289 nmh_cv_header_termios_h_tiocgwinsz=yes,
290 nmh_cv_header_termios_h_tiocgwinsz=no)])
292 nmh_cv_header_termios_h_tiocgwinsz=no
295 if test $nmh_cv_header_termios_h_tiocgwinsz = no; then
296 AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
297 nmh_cv_header_sys_ioctl_h_tiocgwinsz,
298 [AC_TRY_LINK([#include <sys/types.h>
299 #include <sys/ioctl.h>],
300 [int x = TIOCGWINSZ;],
301 nmh_cv_header_sys_ioctl_h_tiocgwinsz=yes,
302 nmh_cv_header_sys_ioctl_h_tiocgwinsz=no)])
303 if test $nmh_cv_header_sys_ioctl_h_tiocgwinsz = yes; then
304 AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
308 AC_CHECK_HEADER([sys/ptem.h], AC_DEFINE(WINSIZE_IN_PTEM))
314 AC_CHECK_LIB(mkstemp,mkstemp)
315 AC_CHECK_FUNCS(waitpid wait3 sigaction sigprocmask sigblock sigsetmask \
316 sighold sigrelse writev lstat uname tzset killpg mkstemp)
318 dnl sigsetjmp may be a macro
319 AC_MSG_CHECKING(for sigsetjmp)
320 AC_TRY_LINK([#include <setjmp.h>], [sigsetjmp((void *)0, 0);],
321 [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
323 AC_REPLACE_FUNCS(snprintf strerror strdup)
325 dnl -------------------
326 dnl CHECK FOR LIBRARIES
327 dnl -------------------
328 dnl Check location of modf
329 AC_CHECK_FUNC(modf, , AC_CHECK_LIB(m, modf))
331 dnl Checks for network libraries (nsl, socket)
334 dnl Check for bug in libraries such that ruserpass
335 dnl needs to be linked as _ruserpass.
338 termcap_curses_order="termcap curses ncurses"
339 for lib in $termcap_curses_order; do
340 AC_CHECK_LIB(${lib}, tgetent, [TERMLIB="-l$lib"; break])
349 AC_CHECK_FUNC(dbm_open, ,
350 AC_CHECK_LIB(ndbm, dbm_open, ,
351 AC_CHECK_LIB(dbm, dbm_open)))
356 if test x$with_hesiod != x -a x$with_hesiod != xno; then
357 if test x$with_hesiod != xyes; then
358 HESIOD_INCLUDES="-I$with_hesiod/include"
359 HESIOD_LIBS="-L$with_hesiod/lib"
361 AC_CHECK_FUNC(res_send, ,
362 AC_CHECK_LIB(resolv, res_send))
363 AC_CHECK_LIB(hesiod, hes_resolve, [HESIOD_LIBS="$HESIOD_LIBS -lhesiod"],
364 [AC_MSG_ERROR(Hesiod library not found)], $HESIOD_LIBS)
366 AC_SUBST(HESIOD_INCLUDES)dnl
367 AC_SUBST(HESIOD_LIBS)dnl
369 dnl ----------------------------------
370 dnl CHECK FOR KRB4 (Kerberos4 support)
371 dnl ----------------------------------
372 if test x$with_krb4 != x -a x$with_krb4 != xno; then
373 if test x$with_krb4 != xyes; then
374 KRB4_INCLUDES="-I$with_krb4/include"
375 if test -d "$with_krb4/include/kerberosIV"; then
376 KRB4_INCLUDES="$KRB4_INCLUDES -I$with_krb4/include/kerberosIV"
378 KRB4_LIBS="-L$with_krb4/lib"
379 elif test -d /usr/include/kerberosIV; then
380 KRB4_INCLUDES="-I/usr/include/kerberosIV"
382 AC_CHECK_LIB(krb4, krb_rd_req,
383 [KRB4_LIBS="$KRB4_LIBS -lkrb4 -ldes425 -lkrb5 -lcrypto -lcom_err"],
384 [AC_CHECK_LIB(krb, krb_rd_req,
385 [KRB4_LIBS="$KRB4_LIBS -lkrb -ldes"],
386 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
388 $KRB4_LIBS -ldes425 -lkrb5 -lcrypto -lcom_err)
390 AC_SUBST(KRB4_INCLUDES)dnl
391 AC_SUBST(KRB4_LIBS)dnl
393 dnl ---------------------
394 dnl CHECK TERMCAP LIBRARY
395 dnl ---------------------
397 dnl Add the termcap library, so that the following configure
398 dnl tests will find it when it tries to link test programs.
399 nmh_save_LIBS="$LIBS"
400 LIBS="$TERMLIB $LIBS"
402 dnl Checks for external variable ospeed in the termcap library.
403 AC_CACHE_CHECK(if an include file defines ospeed,
404 nmh_cv_decl_ospeed_include_defines,
406 [#include <sys/types.h>
412 #endif], [ospeed = 0;],
413 nmh_cv_decl_ospeed_include_defines=yes,
414 nmh_cv_decl_ospeed_include_defines=no)])
416 if test $nmh_cv_decl_ospeed_include_defines = no; then
417 AC_CACHE_CHECK(if you must define ospeed,
418 nmh_cv_decl_ospeed_must_define,
419 [AC_TRY_LINK( ,[extern short ospeed; ospeed = 0;],
420 nmh_cv_decl_ospeed_must_define=yes,
421 nmh_cv_decl_ospeed_must_define=no)])
424 if test $nmh_cv_decl_ospeed_include_defines = yes; then
425 AC_DEFINE(HAVE_OSPEED)
426 elif test $nmh_cv_decl_ospeed_must_define = yes; then
427 AC_DEFINE(HAVE_OSPEED)
428 AC_DEFINE(MUST_DEFINE_OSPEED)
431 dnl dnl Checks if tgetent accepts NULL and will
432 dnl dnl allocate its own termcap buffer.
433 dnl AC_CACHE_CHECK(if tgetent accepts NULL,
434 dnl nmh_cv_func_tgetent_accepts_null,
435 dnl [AC_TRY_RUN([main(){int i = tgetent((char*)0,"vt100");exit(!i || i == -1);}],
436 dnl nmh_cv_func_tgetent_accepts_null=yes,
437 dnl nmh_cv_func_tgetent_accepts_null=no,
438 dnl nmh_cv_func_tgetent_accepts_null=no)])
439 dnl if test $nmh_cv_func_tgetent_accepts_null = yes; then
440 dnl AC_DEFINE(TGETENT_ACCEPTS_NULL)
443 dnl Now put the libraries back to what it was before we
444 dnl starting checking the termcap library.
445 LIBS="$nmh_save_LIBS"
457 dnl Check for sigset_t. Currently I'm looking in
458 dnl <sys/types.h> and <signal.h>. Others might need
460 AC_CACHE_CHECK(for sigset_t, nmh_cv_type_sigset_t,
462 [#include <sys/types.h>
463 #include <signal.h>], [sigset_t tempsigset;],
464 nmh_cv_type_sigset_t=yes, nmh_cv_type_sigset_t=no)])
465 if test $nmh_cv_type_sigset_t = no; then
466 AC_DEFINE(sigset_t, unsigned int)
474 AC_CACHE_CHECK(for tm_gmtoff in struct tm, nmh_cv_struct_tm_gmtoff,
476 [#ifdef TIME_WITH_SYS_TIME
477 # include <sys/time.h>
480 # ifdef TM_IN_SYS_TIME
481 # include <sys/time.h>
486 [struct tm temptm; temptm.tm_gmtoff = 0;],
487 nmh_cv_struct_tm_gmtoff=yes, nmh_cv_struct_tm_gmtoff=no)])
488 if test $nmh_cv_struct_tm_gmtoff = yes; then
489 AC_DEFINE(HAVE_TM_GMTOFF)
495 dnl What style of signal do you have (POSIX, BSD, or SYSV)?
496 AC_MSG_CHECKING(what style of signals to use)
497 if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then
498 signals_style=POSIX_SIGNALS
499 AC_DEFINE(POSIX_SIGNALS)
500 AC_DEFINE(RELIABLE_SIGNALS)
501 elif test $ac_cv_func_sigblock = yes -a $ac_cv_func_sigsetmask = yes; then
502 signals_style=BSD_SIGNALS
503 AC_DEFINE(BSD_SIGNALS)
504 AC_DEFINE(RELIABLE_SIGNALS)
505 elif test $ac_cv_func_sighold = yes -a $ac_cv_func_sigrelse = yes; then
506 signals_style=SYSV_SIGNALS
507 AC_DEFINE(SYSV_SIGNALS)
509 signals_style=NO_SIGNAL_BLOCKING
510 AC_DEFINE(NO_SIGNAL_BLOCKING)
513 AC_MSG_RESULT($signals_style)
515 dnl Where is <signal.h> located? Needed as input for signames.awk
516 AC_CACHE_CHECK(where signal.h is located, nmh_cv_path_signal_h,
517 [for SIGNAL_H in /usr/include/bsd/sys/signal.h dnl Next
518 /usr/include/asm/signal.h dnl Linux 1.3.0 and above
519 /usr/include/asm/signum.h dnl some versions of Linux/Alpha
520 /usr/include/linux/signal.h dnl Linux up to 1.2.11
521 /usr/include/sys/signal.h dnl Almost everybody else
522 /dev/null; dnl Just in case we fall through
524 test -f $SIGNAL_H && \
525 grep '#[ ]*define[ ][ ]*SIG[0-9A-Z]*[ ]*[0-9][0-9]*' $SIGNAL_H > /dev/null && \
528 nmh_cv_path_signal_h=$SIGNAL_H
530 SIGNAL_H=$nmh_cv_path_signal_h
531 AC_SUBST(SIGNAL_H)dnl
534 dnl OS SPECIFIC DEFINES
559 AC_DEFINE(LINUX_STDIO)
583 AC_DEFINE(SCO_5_STDIO)
591 AC_OUTPUT(Makefile config/Makefile h/Makefile sbr/Makefile uip/Makefile \
592 zotnet/Makefile zotnet/mts/Makefile zotnet/tws/Makefile \
593 zotnet/mf/Makefile zotnet/bboards/Makefile mts/Makefile \
594 mts/smtp/Makefile mts/sendmail/Makefile mts/mmdf/Makefile \
595 etc/Makefile man/Makefile, \
596 [test -z "$CONFIG_HEADERS" || echo > stamp-h])
598 eval "nmhbin=${bindir}"; eval "nmhbin2=${nmhbin}"
599 eval "nmhsysconf=${sysconfdir}"; eval "nmhsysconf2=${nmhsysconf}"
600 eval "nmhlib=${libdir}"; eval "nmhlib2=${nmhlib}"
601 eval "nmhman=${mandir}"
606 nmh version : ${VERSION}
607 target os : ${target}
609 compiler flags : ${CFLAGS}
610 linker flags : ${LDFLAGS}
611 source code location : ${srcdir}
612 binary install path : ${nmhbin2}
613 libary install path : ${nmhlib2}
614 config files install path : ${nmhsysconf2}
615 man page install path : ${nmhman}
616 transport system : ${MTS}
617 default editor : ${editorpath}
618 default pager : ${pagerpath}"