2 dnl configure.in -- autoconf template for nmh
8 AC_CONFIG_HEADER(config.h)
10 dnl What version of nmh are we building?
11 VERSION=`sed -e 's/nmh-//' ${srcdir}/VERSION`
12 echo "configuring for nmh-$VERSION"
15 dnl -------------------------
16 dnl CHECK COMMAND LINE OPTION
17 dnl -------------------------
18 dnl What method of posting should post use?
21 [ --with-mts=MTS specify the mail transport agent])
23 if test x$with_mts = xsmtp; then
25 MTSLIB="mts/smtp/libsmtp.a"
27 elif test x$with_mts = xsendmail; then
29 MTSLIB="mts/sendmail/libsend.a"
33 MTSLIB="mts/smtp/libsmtp.a"
40 dnl What should be the default editor?
43 [ --with-editor=EDITOR specify the default editor])
45 if test -n "$with_editor"; then
46 editorpath="$with_editor"
49 dnl What should be the default pager?
52 [ --with-pager=PAGER specify the default pager])
54 if test -n "$with_pager"; then
55 pagerpath="$with_pager"
58 dnl Do you want mhe support?
59 undefine([nmh-mhe])dnl
60 AC_ARG_ENABLE(nmh-mhe,
61 [ --enable-nmh-mhe enable mhe support (DEFAULT)])
63 dnl mhe support is on by default, so define it unless
64 dnl explicitly disabled.
65 if test x$enable_nmh_mhe != xno; then
69 dnl Do you want client-side support for pop
70 undefine([nmh-pop])dnl
71 AC_ARG_ENABLE(nmh-pop,
72 [ --enable-nmh-pop enable client-side support for pop])
73 if test x$enable_nmh_pop = xyes; then
76 POPSED='/^%nmhbeginpop%/d;/^%nmhendpop%/d'
78 POPSED='/^%nmhbeginpop%/,/^%nmhendpop%/d'
83 dnl Do you want client-side support for kpop
85 [ --with-krb4=PREFIX specify location of Kerberos V4 for kpop support])
86 if test x$with_krb4 != x -a x$with_krb4 != xno; then
88 AC_DEFINE(KPOP_PRINCIPAL, "pop")dnl
91 dnl Do you want support for hesiod
93 [ --with-hesiod=PREFIX specify location of Hesiod])
94 if test x$with_hesiod != x -a x$with_hesiod != xno; then
98 dnl Do you want to debug nmh?
99 undefine([nmh-debug])dnl
100 AC_ARG_ENABLE(nmh-debug,
101 [ --enable-nmh-debug enable nmh code debugging])
103 dnl ----------------------------------------------------
104 dnl Default location is /usr/local/nmh/{bin,etc,lib,man}
105 dnl ----------------------------------------------------
106 AC_PREFIX_DEFAULT(/usr/local/nmh)
108 dnl ------------------
109 dnl CHECK THE COMPILER
110 dnl ------------------
111 dnl We want these before the checks,
112 dnl so the checks can modify their values.
113 test -z "$CFLAGS" && CFLAGS= auto_cflags=1
114 if test x$enable_nmh_debug = xyes; then
115 test -z "$LDFLAGS" && LDFLAGS=-g
120 dnl if the user hasn't specified CFLAGS, then
121 dnl if compiler is gcc, then
122 dnl use -O2 and some warning flags
124 if test -n "$auto_cflags"; then
125 if test x$enable_nmh_debug = xyes; then
126 if test -n "$GCC"; then
127 test -z "$CFLAGS" && CFLAGS="-Wall -g" || CFLAGS="$CFLAGS -Wall -g"
129 test -z "$CFLAGS" && CFLAGS=-g || CFLAGS="$CFLAGS -g"
132 test -z "$LDFLAGS" && LDFLAGS=-s
133 if test -n "$GCC"; then
134 test -z "$CFLAGS" && CFLAGS=-O2 || CFLAGS="$CFLAGS -O2"
136 test -z "$CFLAGS" && CFLAGS=-O || CFLAGS="$CFLAGS -O"
141 AC_C_CONST dnl Does compiler support `const'.
143 dnl ------------------
144 dnl CHECK FOR PROGRAMS
145 dnl ------------------
146 AC_PROG_MAKE_SET dnl Does make define $MAKE
147 AC_PROG_INSTALL dnl Check for BSD compatible `install'
148 AC_PROG_RANLIB dnl Check for `ranlib'
149 AC_PROG_AWK dnl Check for mawk,gawk,nawk, then awk
150 AC_PROG_LEX dnl Check for lex/flex
152 dnl Check for lorder and tsort commands
153 AC_CHECK_PROG(LORDER, lorder, lorder, no)dnl
154 AC_CHECK_PROG(TSORT, tsort, tsort, no)dnl
156 dnl If either doesn't exist, replace them with echo and cat
157 if test x$ac_cv_prog_LORDER != xlorder -o x$ac_cv_prog_TSORT != xtsort; then
164 dnl Look for `sendmail'
165 pathtmp=/usr/lib:/usr/sbin:/usr/etc:/usr/ucblib:/usr/bin:/bin
166 AC_PATH_PROG(sendmailpath, sendmail, no, [$pathtmp])
169 pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
170 AC_PATH_PROG(morepath, more, no, [$pathtmp])
172 dnl If pager is not specified yet,
173 dnl then use `more' as the default.
174 if test -z "$pagerpath"; then
175 pagerpath="$morepath"
177 AC_SUBST(pagerpath)dnl
180 pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
181 AC_PATH_PROG(vipath, vi, no, [$pathtmp])
183 dnl If editor is not specified yet,
184 dnl then use `vi' as the default.
185 if test -z "$editorpath"; then
188 AC_SUBST(editorpath)dnl
190 dnl Check for broken vi
191 AC_CACHE_CHECK(for broken vi, nmh_cv_attvibug,
192 [if echo 'r /nonexist-file
193 q' | ex > /dev/null 2>&1
200 if test "$nmh_cv_attvibug" = yes; then
207 AC_CACHE_CHECK(where mail spool is located, nmh_cv_mailspool,
208 [for mailspool in /var/mail dnl
211 /dev/null; dnl Just in case we fall through
213 test -d $mailspool && break
215 nmh_cv_mailspool=$mailspool
217 mailspool=$nmh_cv_mailspool
218 AC_SUBST(mailspool)dnl
220 dnl ------------------
221 dnl CHECK HEADER FILES
222 dnl ------------------
228 AC_CHECK_HEADERS(string.h memory.h stdlib.h unistd.h errno.h fcntl.h \
229 limits.h crypt.h termcap.h termio.h termios.h locale.h \
230 sys/param.h sys/time.h sys/utsname.h arpa/inet.h \
233 AC_CACHE_CHECK(POSIX termios, nmh_cv_sys_posix_termios,
234 [AC_TRY_LINK([#include <sys/types.h>
236 #include <termios.h>],
237 [/* SunOS 4.0.3 has termios.h but not the library calls. */
239 nmh_cv_sys_posix_termios=yes, nmh_cv_sys_posix_termios=no)])
241 if test $nmh_cv_sys_posix_termios = yes; then
242 AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
243 nmh_cv_header_termios_h_tiocgwinsz,
244 [AC_TRY_LINK([#include <sys/types.h>
245 #include <termios.h>],
246 [int x = TIOCGWINSZ;],
247 nmh_cv_header_termios_h_tiocgwinsz=yes,
248 nmh_cv_header_termios_h_tiocgwinsz=no)])
250 nmh_cv_header_termios_h_tiocgwinsz=no
253 if test $nmh_cv_header_termios_h_tiocgwinsz = no; then
254 AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
255 nmh_cv_header_sys_ioctl_h_tiocgwinsz,
256 [AC_TRY_LINK([#include <sys/types.h>
257 #include <sys/ioctl.h>],
258 [int x = TIOCGWINSZ;],
259 nmh_cv_header_sys_ioctl_h_tiocgwinsz=yes,
260 nmh_cv_header_sys_ioctl_h_tiocgwinsz=no)])
261 if test $nmh_cv_header_sys_ioctl_h_tiocgwinsz = yes; then
262 AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
266 AC_CHECK_HEADER([sys/ptem.h], AC_DEFINE(WINSIZE_IN_PTEM))
272 AC_CHECK_FUNCS(waitpid wait3 sigaction sigprocmask sigblock sigsetmask \
273 sighold sigrelse writev lstat uname tzset killpg)
275 dnl sigsetjmp may be a macro
276 AC_MSG_CHECKING(for sigsetjmp)
277 AC_TRY_LINK([#include <setjmp.h>], [sigsetjmp((void *)0, 0);],
278 [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
280 AC_REPLACE_FUNCS(snprintf strerror strdup)
282 dnl -------------------
283 dnl CHECK FOR LIBRARIES
284 dnl -------------------
285 dnl Check location of modf
286 AC_CHECK_FUNC(modf, , AC_CHECK_LIB(m, modf))
288 dnl Checks for network libraries (nsl, socket)
291 dnl Check for bug in libraries such that ruserpass
292 dnl needs to be linked as _ruserpass.
295 termcap_curses_order="termcap curses ncurses"
296 for lib in $termcap_curses_order; do
297 AC_CHECK_LIB(${lib}, tgetent, [TERMLIB="-l$lib"; break])
305 AC_CHECK_FUNC(dbm_open, ,
306 AC_CHECK_LIB(ndbm, dbm_open, ,
307 AC_CHECK_LIB(dbm, dbm_open)))
312 if test x$with_hesiod != x -a x$with_hesiod != xno; then
313 if test x$with_hesiod != xyes; then
314 HESIOD_INCLUDES="-I$with_hesiod/include"
315 HESIOD_LIBS="-L$with_hesiod/lib"
317 AC_CHECK_FUNC(res_send, ,
318 AC_CHECK_LIB(resolv, res_send))
319 AC_CHECK_LIB(hesiod, hes_resolve, [HESIOD_LIBS="$HESIOD_LIBS -lhesiod"],
320 [AC_MSG_ERROR(Hesiod library not found)], $HESIOD_LIBS)
322 AC_SUBST(HESIOD_INCLUDES)dnl
323 AC_SUBST(HESIOD_LIBS)dnl
325 dnl ----------------------------------
326 dnl CHECK FOR KRB4 (Kerberos4 support)
327 dnl ----------------------------------
328 if test x$with_krb4 != x -a x$with_krb4 != xno; then
329 if test x$with_krb4 != xyes; then
330 KRB4_INCLUDES="-I$with_krb4/include"
331 if test -d "$with_krb4/include/kerberosIV"; then
332 KRB4_INCLUDES="$KRB4_INCLUDES -I$with_krb4/include/kerberosIV"
334 KRB4_LIBS="-L$with_krb4/lib"
335 elif test -d /usr/include/kerberosIV; then
336 KRB4_INCLUDES="-I/usr/include/kerberosIV"
338 AC_CHECK_LIB(krb4, krb_rd_req,
339 [KRB4_LIBS="$KRB4_LIBS -lkrb4 -ldes425 -lkrb5 -lcrypto -lcom_err"],
340 [AC_CHECK_LIB(krb, krb_rd_req,
341 [KRB4_LIBS="$KRB4_LIBS -lkrb -ldes"],
342 [AC_MSG_ERROR(Kerberos 4 libraries not found)],
344 $KRB4_LIBS -ldes425 -lkrb5 -lcrypto -lcom_err)
346 AC_SUBST(KRB4_INCLUDES)dnl
347 AC_SUBST(KRB4_LIBS)dnl
349 dnl ---------------------
350 dnl CHECK TERMCAP LIBRARY
351 dnl ---------------------
353 dnl Add the termcap library, so that the following configure
354 dnl tests will find it when it tries to link test programs.
355 nmh_save_LIBS="$LIBS"
356 LIBS="$TERMLIB $LIBS"
358 dnl Checks for external variable ospeed in the termcap library.
359 AC_CACHE_CHECK(if an include file defines ospeed,
360 nmh_cv_decl_ospeed_include_defines,
362 [#include <sys/types.h>
368 #endif], [ospeed = 0;],
369 nmh_cv_decl_ospeed_include_defines=yes,
370 nmh_cv_decl_ospeed_include_defines=no)])
372 if test $nmh_cv_decl_ospeed_include_defines = no; then
373 AC_CACHE_CHECK(if you must define ospeed,
374 nmh_cv_decl_ospeed_must_define,
375 [AC_TRY_LINK( ,[extern short ospeed; ospeed = 0;],
376 nmh_cv_decl_ospeed_must_define=yes,
377 nmh_cv_decl_ospeed_must_define=no)])
380 if test $nmh_cv_decl_ospeed_include_defines = yes; then
381 AC_DEFINE(HAVE_OSPEED)
382 elif test $nmh_cv_decl_ospeed_must_define = yes; then
383 AC_DEFINE(HAVE_OSPEED)
384 AC_DEFINE(MUST_DEFINE_OSPEED)
387 dnl dnl Checks if tgetent accepts NULL and will
388 dnl dnl allocate its own termcap buffer.
389 dnl AC_CACHE_CHECK(if tgetent accepts NULL,
390 dnl nmh_cv_func_tgetent_accepts_null,
391 dnl [AC_TRY_RUN([main(){int i = tgetent((char*)0,"vt100");exit(!i || i == -1);}],
392 dnl nmh_cv_func_tgetent_accepts_null=yes,
393 dnl nmh_cv_func_tgetent_accepts_null=no,
394 dnl nmh_cv_func_tgetent_accepts_null=no)])
395 dnl if test $nmh_cv_func_tgetent_accepts_null = yes; then
396 dnl AC_DEFINE(TGETENT_ACCEPTS_NULL)
399 dnl Now put the libraries back to what it was before we
400 dnl starting checking the termcap library.
401 LIBS="$nmh_save_LIBS"
413 dnl Check for sigset_t. Currently I'm looking in
414 dnl <sys/types.h> and <signal.h>. Others might need
416 AC_CACHE_CHECK(for sigset_t, nmh_cv_type_sigset_t,
418 [#include <sys/types.h>
419 #include <signal.h>], [sigset_t tempsigset;],
420 nmh_cv_type_sigset_t=yes, nmh_cv_type_sigset_t=no)])
421 if test $nmh_cv_type_sigset_t = no; then
422 AC_DEFINE(sigset_t, unsigned int)
430 AC_CACHE_CHECK(for tm_gmtoff in struct tm, nmh_cv_struct_tm_gmtoff,
432 [#ifdef TIME_WITH_SYS_TIME
433 # include <sys/time.h>
436 # ifdef TM_IN_SYS_TIME
437 # include <sys/time.h>
442 [struct tm temptm; temptm.tm_gmtoff = 0;],
443 nmh_cv_struct_tm_gmtoff=yes, nmh_cv_struct_tm_gmtoff=no)])
444 if test $nmh_cv_struct_tm_gmtoff = yes; then
445 AC_DEFINE(HAVE_TM_GMTOFF)
451 dnl What style of signal do you have (POSIX, BSD, or SYSV)?
452 AC_MSG_CHECKING(what style of signals to use)
453 if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then
454 signals_style=POSIX_SIGNALS
455 AC_DEFINE(POSIX_SIGNALS)
456 AC_DEFINE(RELIABLE_SIGNALS)
457 elif test $ac_cv_func_sigblock = yes -a $ac_cv_func_sigsetmask = yes; then
458 signals_style=BSD_SIGNALS
459 AC_DEFINE(BSD_SIGNALS)
460 AC_DEFINE(RELIABLE_SIGNALS)
461 elif test $ac_cv_func_sighold = yes -a $ac_cv_func_sigrelse = yes; then
462 signals_style=SYSV_SIGNALS
463 AC_DEFINE(SYSV_SIGNALS)
465 signals_style=NO_SIGNAL_BLOCKING
466 AC_DEFINE(NO_SIGNAL_BLOCKING)
469 AC_MSG_RESULT($signals_style)
471 dnl Where is <signal.h> located? Needed as input for signames.awk
472 AC_CACHE_CHECK(where signal.h is located, nmh_cv_path_signal_h,
473 [for SIGNAL_H in /usr/include/bsd/sys/signal.h dnl Next
474 /usr/include/asm/signal.h dnl Linux 1.3.0 and above
475 /usr/include/asm/signum.h dnl some versions of Linux/Alpha
476 /usr/include/linux/signal.h dnl Linux up to 1.2.11
477 /usr/include/sys/signal.h dnl Almost everybody else
478 /dev/null; dnl Just in case we fall through
480 test -f $SIGNAL_H && \
481 grep '#[ ]*define[ ][ ]*SIG[0-9A-Z]*[ ]*[0-9][0-9]*' $SIGNAL_H > /dev/null && \
484 nmh_cv_path_signal_h=$SIGNAL_H
486 SIGNAL_H=$nmh_cv_path_signal_h
487 AC_SUBST(SIGNAL_H)dnl
492 AC_OUTPUT(Makefile config/Makefile h/Makefile sbr/Makefile uip/Makefile \
493 zotnet/Makefile zotnet/mts/Makefile zotnet/tws/Makefile \
494 zotnet/mf/Makefile zotnet/bboards/Makefile mts/Makefile \
495 mts/smtp/Makefile mts/sendmail/Makefile mts/mmdf/Makefile \
496 etc/Makefile man/Makefile, \
497 [test -z "$CONFIG_HEADERS" || echo > stamp-h])
499 eval "nmhbin=${bindir}"; eval "nmhbin2=${nmhbin}"
500 eval "nmhsysconf=${sysconfdir}"; eval "nmhsysconf2=${nmhsysconf}"
501 eval "nmhlib=${libdir}"; eval "nmhlib2=${nmhlib}"
502 eval "nmhman=${mandir}"
507 nmh version : ${VERSION}
509 compiler flags : ${CFLAGS}
510 linker flags : ${LDFLAGS}
511 source code location : ${srcdir}
512 binary install path : ${nmhbin2}
513 libary install path : ${nmhlib2}
514 config files install path : ${nmhsysconf2}
515 man page install path : ${nmhman}
516 transport system : ${MTS}
517 default editor : ${editorpath}
518 default pager : ${pagerpath}"