When I added my --enable-masquerade option, you'll note that I didn't make it
[mmh] / 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   tmptest=`$LIBTOOL --version 2>&1 | grep GNU`
18   if test x"$tmptest" != x  ; then
19     GNU_LIBTOOL=1
20     AC_SUBST(GNU_LIBTOOL)dnl
21   fi
22 ] )
23   
24
25 dnl What version of nmh are we building?
26 VERSION=`sed -e 's/nmh-//' ${srcdir}/VERSION`
27 echo "configuring for nmh-$VERSION"
28 AC_SUBST(VERSION)dnl
29
30 dnl --------------------------
31 dnl CHECK COMMAND LINE OPTIONS
32 dnl --------------------------
33
34 dnl Do you want to debug nmh?
35 undefine([debug])dnl
36 AC_ARG_ENABLE(debug,
37 [  --enable-debug          enable nmh code debugging])
38 dnl The old redundant --enable-nmh-debug is deprecated and undocumented.
39 if test x"$enable_nmh_debug" = x"yes"; then
40   enable_debug=yes
41 fi
42
43 dnl Allow users to send email from addresses other than their default?
44 undefine([masquerade])dnl
45 AC_ARG_ENABLE(masquerade,
46   [  --enable-masquerade[='draft_from[ mmailid[ username_extension]]']
47                           enable 3 types of email address masquerading [none]],
48   [if test x"$enable_masquerade" = x"yes"; then
49     masquerade="draft_from mmailid username_extension"
50   else
51     masquerade="$enable_masquerade"
52   fi])
53 AC_SUBST(masquerade)dnl
54
55 dnl Do you want mhe support?
56 undefine([mhe])dnl
57 AC_ARG_ENABLE(mhe,
58 [  --enable-mhe            enable mhe support (DEFAULT)])
59
60 dnl mhe support is on by default, so define it unless --disable-mhe or the
61 dnl deprecated, undocumented --disable-nmh-mhe are specified.
62 if test x"$enable_mhe" != x"no" -a x"$enable_nmh_mhe" != x"no"; then
63   AC_DEFINE(MHE)dnl
64 fi
65
66 dnl Do you want client-side support for pop?
67 undefine([pop])dnl
68 AC_ARG_ENABLE(pop,
69 [  --enable-pop            enable client-side support for pop])
70 dnl The old redundant --enable-nmh-pop is deprecated and undocumented.
71 if test x"$enable_nmh_pop" = x"yes"; then
72   enable_pop=yes
73 fi
74 if test x"$enable_pop" = x"yes"; then
75   AC_DEFINE(POP)dnl
76   POPLIB=popsbr.o
77   POPSED='/^%nmhbeginpop%/d;/^%nmhendpop%/d'
78 else
79   POPSED='/^%nmhbeginpop%/,/^%nmhendpop%/d'
80 fi
81 AC_SUBST(POPLIB)dnl
82 AC_SUBST(POPSED)dnl
83
84 dnl What should be the default editor?
85 undefine([editor])dnl
86 AC_ARG_WITH(editor,
87 [  --with-editor=EDITOR    specify the default editor])
88
89 if test -n "$with_editor"; then
90   editorpath="$with_editor"
91 fi
92
93 dnl Do you want support for hesiod
94 AC_ARG_WITH(hesiod,
95 [  --with-hesiod=PREFIX    specify location of Hesiod])
96 if test x"$with_hesiod" != x -a x"$with_hesiod" != x"no"; then
97   AC_DEFINE(HESIOD)dnl
98 fi
99
100 dnl Do you want client-side support for kpop
101 AC_ARG_WITH(krb4,
102 [  --with-krb4=PREFIX      specify location of Kerberos V4 for kpop support])
103 if test x"$with_krb4" != x -a x"$with_krb4" != x"no"; then
104   AC_DEFINE(KPOP)dnl
105   AC_DEFINE(KPOP_PRINCIPAL, "pop")dnl
106 fi
107
108 dnl What method of posting should post use?
109 undefine([mts])dnl
110 AC_ARG_WITH(mts,
111 [  --with-mts=MTS          specify the mail transport agent])
112
113 if test x"$with_mts" = x"smtp"; then
114   MTS="smtp"
115   MTSLIB="mts/smtp/libsmtp.a"
116   AC_DEFINE(SMTPMTS)dnl
117 elif test x"$with_mts" = x"sendmail"; then
118   MTS="sendmail"
119   MTSLIB="mts/sendmail/libsend.a"
120   AC_DEFINE(SENDMTS)dnl
121 else
122   MTS="smtp"
123   MTSLIB="mts/smtp/libsmtp.a"
124   AC_DEFINE(SMTPMTS)dnl
125 fi
126
127 AC_SUBST(MTS)dnl
128 AC_SUBST(MTSLIB)dnl
129
130 dnl What should be the default pager?
131 undefine([pager])dnl
132 AC_ARG_WITH(pager,
133 [  --with-pager=PAGER      specify the default pager])
134
135 if test -n "$with_pager"; then
136   pagerpath="$with_pager"
137 fi
138
139 dnl What should be the default mail server(s)?
140 undefine([smtpservers])dnl
141 AC_ARG_WITH(smtpservers,
142 [  --with-smtpservers='SMTPSERVER1[ SMTPSERVER2...]'
143                           specify the default smtp server(s) [localhost]])
144 if test -n "$with_smtpservers"; then
145   smtpservers="$with_smtpservers"
146 else
147   smtpservers="localhost"
148 fi
149 AC_SUBST(smtpservers)dnl
150
151 dnl ----------------------------------------------------
152 dnl Default location is /usr/local/nmh/{bin,etc,lib,man}
153 dnl ----------------------------------------------------
154 AC_PREFIX_DEFAULT(/usr/local/nmh)
155
156 dnl ------------------
157 dnl CHECK THE COMPILER
158 dnl ------------------
159 dnl We want these before the checks,
160 dnl so the checks can modify their values.
161 test -z "$CFLAGS" && CFLAGS= auto_cflags=1
162 if test x"$enable_debug" = x"yes"; then
163   test -z "$LDFLAGS" && LDFLAGS=-g
164 fi
165
166 AC_PROG_CC
167
168 dnl if the user hasn't specified CFLAGS, then
169 dnl   if compiler is gcc, then
170 dnl     use -O2 and some warning flags
171 dnl   else use -O
172 if test -n "$auto_cflags"; then
173   if test x"$enable_debug" = x"yes"; then
174     if test -n "$GCC"; then
175       test -z "$CFLAGS" && CFLAGS="-Wall -g" || CFLAGS="$CFLAGS -Wall -g"
176     else
177       test -z "$CFLAGS" && CFLAGS=-g || CFLAGS="$CFLAGS -g"
178     fi
179   else
180     test -z "$LDFLAGS" && LDFLAGS=-s
181     if test -n "$GCC"; then
182       test -z "$CFLAGS" && CFLAGS=-O2 || CFLAGS="$CFLAGS -O2"
183     else
184       test -z "$CFLAGS" && CFLAGS=-O  || CFLAGS="$CFLAGS -O"
185     fi
186   fi
187 fi
188
189 AC_C_CONST              dnl Does compiler support `const'.
190
191 dnl ------------------
192 dnl CHECK FOR PROGRAMS
193 dnl ------------------
194 AC_PROG_MAKE_SET        dnl Does make define $MAKE
195 AC_PROG_INSTALL         dnl Check for BSD compatible `install'
196 AC_PROG_RANLIB          dnl Check for `ranlib'
197 AC_PROG_AWK             dnl Check for mawk,gawk,nawk, then awk
198 AC_PROG_LEX             dnl Check for lex/flex
199
200 dnl Look for `cut'
201 pathtmp=/usr/bin:/bin:/usr/local/bin:/usr/xpg4/bin:/usr/ucb
202 AC_PATH_PROG(cutpath, cut, no, [$pathtmp])
203
204
205 dnl try to figure out which one we've got
206 AC_CHECK_PROG(LIBTOOL, libtool, libtool, , [$pathtmp])
207 NMH_PROG_GNU_LIBTOOL
208
209 dnl Check for lorder and tsort commands
210 AC_CHECK_PROG(LORDER, lorder, lorder, no)dnl
211 AC_CHECK_PROG(TSORT, tsort, tsort, no)dnl
212
213 dnl If either doesn't exist, replace them with echo and cat
214 if test x$ac_cv_prog_LORDER != xlorder -o x$ac_cv_prog_TSORT != xtsort; then
215   LORDER=echo
216   TSORT=cat
217   AC_SUBST(LORDER)dnl
218   AC_SUBST(TSORT)dnl
219 dnl Mac OS X has lorder, but sh is too broken for it to work
220 dnl elif test -z "`lorder config/config.c 2>&1 | grep config/config.c`" ; then
221 dnl   LORDER=echo
222 dnl   TSORT=cat
223 dnl   AC_SUBST(LORDER)dnl
224 dnl   AC_SUBST(TSORT)dnl
225 fi
226
227 dnl Look for `ls'
228 pathtmp=/usr/bin:/bin:/usr/local/bin:/usr/xpg4/bin:/usr/ucb
229 AC_PATH_PROG(lspath, ls, no, [$pathtmp])
230
231 dnl See how we get ls to display the owner and the group
232 if test "$lspath" != "no"; then
233   AC_CACHE_CHECK(how to get ls to show us the group ownership of a file, 
234                  nmh_cv_ls_grpopt,
235   [if test x"`$lspath -dl / | $AWK '{print $9}'`" = x"/"; then
236     dnl There were 9 parameters, so unless this is a really bizarre, nonstandard
237     dnl ls, it would seem -l gave us both the user and group.  On this type of
238     dnl ls, -g makes _only_ the group be displayed (and not the user).
239     nmh_cv_ls_grpopt="-l"
240   else
241     dnl Looks like -l only gave us the user, so we need -g to get the group too.
242     nmh_cv_ls_grpopt="-lg"
243   fi])
244 fi
245
246 dnl Look for `more'
247 pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
248 AC_PATH_PROG(morepath, more, no, [$pathtmp])
249
250 dnl If pager is not specified yet,
251 dnl then use `more' as the default.
252 if test -z "$pagerpath"; then
253   pagerpath="$morepath"
254 fi
255 AC_SUBST(pagerpath)dnl
256
257 dnl Look for `sendmail'
258 pathtmp=/usr/lib:/usr/sbin:/usr/etc:/usr/ucblib:/usr/bin:/bin
259 AC_PATH_PROG(sendmailpath, sendmail, no, [$pathtmp])
260
261 dnl Look for `vi'
262 pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
263 AC_PATH_PROG(vipath, vi, no, [$pathtmp])
264
265 dnl If editor is not specified yet,
266 dnl then use `vi' as the default.
267 if test -z "$editorpath"; then
268   editorpath="$vipath"
269 fi
270 AC_SUBST(editorpath)dnl
271
272 dnl Check for broken vi
273 AC_CACHE_CHECK(for broken vi, nmh_cv_attvibug,
274 [if echo 'r /nonexist-file
275 q' | ex > /dev/null 2>&1
276 then
277         nmh_cv_attvibug=no
278 else
279         nmh_cv_attvibug=yes
280 fi])
281  
282 if test "$nmh_cv_attvibug" = yes; then
283   AC_DEFINE(ATTVIBUG)dnl
284 fi
285
286 dnl ----------------------------------------------------------
287 dnl FIND MAIL SPOOL AND SEE IF WE NEED TO MAKE inc SETGID MAIL
288 dnl ----------------------------------------------------------
289 AC_CACHE_CHECK(where mail spool is located, nmh_cv_mailspool,
290 [for mailspool in /var/mail        dnl
291                   /var/spool/mail  dnl
292                   /usr/spool/mail  dnl
293                   /dev/null;       dnl Just in case we fall through
294 do
295   test -d $mailspool && break
296 done
297 nmh_cv_mailspool=$mailspool
298 ])
299 mailspool=$nmh_cv_mailspool
300 AC_SUBST(mailspool)dnl
301
302 dnl See whether the mail spool directory is world-writable.
303 if test "$lspath" != "no" -a "$cutpath" != "no"; then
304   AC_CACHE_CHECK(whether the mail spool is world-writable, 
305                  nmh_cv_mailspool_world_writable,
306   [if test "`$lspath -dlL $mailspool | $cutpath -c9`" = "-"; then
307     nmh_cv_mailspool_world_writable=no
308   else
309     nmh_cv_mailspool_world_writable=yes
310   fi])
311 fi
312
313 dnl ...If it's not, we need to #define MAILGROUP to 1 and make inc setgid.
314 if test x"$nmh_cv_mailspool_world_writable" = x"no"; then
315   dnl do we really need both of these?
316   AC_DEFINE(MAILGROUP)dnl
317   SETGID_MAIL=1
318 fi
319 AC_SUBST(SETGID_MAIL)dnl
320
321 dnl Use ls to see which group owns the mail spool directory.
322 AC_CACHE_CHECK(what group owns the mail spool, nmh_cv_ls_mail_grp,
323 [nmh_cv_ls_mail_grp=`$lspath -dL $nmh_cv_ls_grpopt $mailspool|$AWK '{print $4}'`
324 ])
325 MAIL_SPOOL_GRP=$nmh_cv_ls_mail_grp
326 AC_SUBST(MAIL_SPOOL_GRP)dnl
327
328 dnl ------------------
329 dnl CHECK HEADER FILES
330 dnl ------------------
331 AC_HEADER_DIRENT
332 AC_HEADER_STDC
333 AC_HEADER_TIME
334 AC_HEADER_SYS_WAIT
335 AC_HEADER_STAT
336 AC_CHECK_HEADERS(string.h memory.h stdlib.h unistd.h errno.h fcntl.h \
337                  limits.h crypt.h termcap.h termio.h termios.h locale.h \
338                  netdb.h sys/param.h sys/time.h sys/utsname.h arpa/inet.h \
339                  arpa/ftp.h)
340
341
342 AC_CACHE_CHECK(POSIX termios, nmh_cv_sys_posix_termios,
343 [AC_TRY_LINK([#include <sys/types.h>
344 #include <unistd.h>
345 #include <termios.h>],
346 [/* SunOS 4.0.3 has termios.h but not the library calls.  */
347 tcgetattr(0, 0);],
348   nmh_cv_sys_posix_termios=yes, nmh_cv_sys_posix_termios=no)])
349  
350 if test $nmh_cv_sys_posix_termios = yes; then
351   AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
352   nmh_cv_header_termios_h_tiocgwinsz,
353   [AC_TRY_LINK([#include <sys/types.h>
354 #include <termios.h>],
355   [int x = TIOCGWINSZ;],
356   nmh_cv_header_termios_h_tiocgwinsz=yes,
357   nmh_cv_header_termios_h_tiocgwinsz=no)])
358 else
359   nmh_cv_header_termios_h_tiocgwinsz=no
360 fi
361  
362 if test $nmh_cv_header_termios_h_tiocgwinsz = no; then
363   AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
364   nmh_cv_header_sys_ioctl_h_tiocgwinsz,
365   [AC_TRY_LINK([#include <sys/types.h>
366 #include <sys/ioctl.h>],
367   [int x = TIOCGWINSZ;],
368   nmh_cv_header_sys_ioctl_h_tiocgwinsz=yes,
369   nmh_cv_header_sys_ioctl_h_tiocgwinsz=no)])
370   if test $nmh_cv_header_sys_ioctl_h_tiocgwinsz = yes; then
371     AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
372   fi
373 fi
374  
375 dnl
376 dnl Checks for _IO_write_ptr. A Linuxism used by nmh on linux. We
377 dnl really use a whole set of them, but this check should be
378 dnl sufficient.
379 dnl
380 AC_CHECK_HEADER(libio.h, [
381   AC_EGREP_HEADER(_IO_write_ptr, libio.h, [
382     AC_DEFINE(LINUX_STDIO) ]) ]) 
383
384 AC_CHECK_HEADER([sys/ptem.h], AC_DEFINE(WINSIZE_IN_PTEM))
385
386 dnl ---------------
387 dnl CHECK FUNCTIONS
388 dnl ---------------
389 AC_FUNC_VFORK
390 AC_CHECK_LIB(mkstemp,mkstemp)
391 AC_CHECK_FUNCS(waitpid wait3 sigaction sigprocmask sigblock sigsetmask \
392                sighold sigrelse writev lstat uname tzset killpg mkstemp \
393                sethostent)
394
395 dnl solaris screws this up
396 AC_CHECK_FUNC(gethostbyname, [AC_DEFINE(HAVE_GETHOSTBYNAME)],
397   AC_CHECK_LIB(nsl, gethostbyname, [AC_DEFINE(HAVE_GETHOSTBYNAME)] ) )
398
399 dnl sigsetjmp may be a macro
400 AC_MSG_CHECKING(for sigsetjmp)
401 AC_TRY_LINK([#include <setjmp.h>], [sigsetjmp((void *)0, 0);],
402         [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
403
404 AC_REPLACE_FUNCS(snprintf strerror strdup)
405
406 dnl Look for the initgroups() declaration.  On AIX 4.[13], Solaris 4.1.3, and
407 dnl ULTRIX 4.2A the function is defined in libc but there's no declaration in
408 dnl any system header.  
409 dnl
410 dnl On Solaris 2.[456], the declaration is in <grp.h>.  On HP-UX 9-11 and
411 dnl (reportedly) FreeBSD 3.[23], it's in <unistd.h>.  Any other locations we
412 dnl need to check? 
413 AC_EGREP_HEADER(initgroups, grp.h, AC_DEFINE(INITGROUPS_HEADER, <grp.h>),
414                 AC_EGREP_HEADER(initgroups, unistd.h, 
415                                 AC_DEFINE(INITGROUPS_HEADER, <unistd.h>)))
416
417 dnl On AIX 4.1, snprintf() is defined in libc.a but there's no prototype in
418 dnl <stdio.h> or elsewhere.  Apparently it's not officially supported (though it
419 dnl seems to work perfectly and IBM apparently uses it in internal code).
420 dnl Anyhow, if we omit our own snprintf() and vsnprintf() prototypes when we
421 dnl HAVE_SNPRINTF, we get a billion warnings at compile time.  Use the C
422 dnl preprocessor to preprocess stdio.h and make sure that there's actually a 
423 dnl prototype. 
424 AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_PROTOTYPE))
425
426 dnl -------------------
427 dnl CHECK FOR LIBRARIES
428 dnl -------------------
429 dnl Check location of modf
430 AC_CHECK_FUNC(modf, , AC_CHECK_LIB(m, modf))
431
432 dnl Checks for network libraries (nsl, socket)
433 AC_CHECK_NETLIBS
434
435 dnl Check for bug in libraries such that ruserpass
436 dnl needs to be linked as _ruserpass.
437 AC_CHECK_RUSERPASS
438
439 termcap_curses_order="termcap curses ncurses"
440 for lib in $termcap_curses_order; do
441   AC_CHECK_LIB(${lib}, tgetent, [TERMLIB="-l$lib"; break])
442 done
443 AC_SUBST(TERMLIB)dnl
444
445
446 dnl --------------
447 dnl CHECK FOR NDBM
448 dnl --------------
449 dnl Checks for ndbm
450 AC_CHECK_FUNC(dbm_open, ,
451   AC_CHECK_LIB(ndbm, dbm_open, ,
452     AC_CHECK_LIB(dbm, dbm_open)))
453
454 dnl ----------------
455 dnl CHECK FOR NDBM.H
456 dnl ----------------
457 AC_CHECK_HEADERS(db1/ndbm.h)
458
459 dnl ----------------
460 dnl CHECK FOR HESIOD
461 dnl ----------------
462 if test x"$with_hesiod" != x -a x"$with_hesiod" != x"no"; then
463   if test x"$with_hesiod" != x"yes"; then
464     HESIOD_INCLUDES="-I$with_hesiod/include"
465     HESIOD_LIBS="-L$with_hesiod/lib"
466   fi
467   AC_CHECK_FUNC(res_send, ,
468     AC_CHECK_LIB(resolv, res_send))
469   AC_CHECK_LIB(hesiod, hes_resolve, [HESIOD_LIBS="$HESIOD_LIBS -lhesiod"],
470     [AC_MSG_ERROR(Hesiod library not found)], $HESIOD_LIBS)
471 fi
472 AC_SUBST(HESIOD_INCLUDES)dnl
473 AC_SUBST(HESIOD_LIBS)dnl
474
475 dnl ----------------------------------
476 dnl CHECK FOR KRB4 (Kerberos4 support)
477 dnl ----------------------------------
478 if test x"$with_krb4" != x -a x"$with_krb4" != x"no"; then
479   if test x"$with_krb4" != x"yes"; then
480     KRB4_INCLUDES="-I$with_krb4/include"
481     if test -d "$with_krb4/include/kerberosIV"; then
482       KRB4_INCLUDES="$KRB4_INCLUDES -I$with_krb4/include/kerberosIV"
483     fi
484     KRB4_LIBS="-L$with_krb4/lib"
485   elif test -d /usr/include/kerberosIV; then
486     KRB4_INCLUDES="-I/usr/include/kerberosIV"
487   fi
488   AC_CHECK_LIB(krb4, krb_rd_req,
489     [KRB4_LIBS="$KRB4_LIBS -lkrb4 -ldes425 -lkrb5 -lcrypto -lcom_err"],
490     [AC_CHECK_LIB(krb, krb_rd_req,
491       [KRB4_LIBS="$KRB4_LIBS -lkrb -ldes"],
492       [AC_MSG_ERROR(Kerberos 4 libraries not found)],
493       $KRB4_LIBS -ldes)],
494     $KRB4_LIBS -ldes425 -lkrb5 -lcrypto -lcom_err)
495 fi
496 AC_SUBST(KRB4_INCLUDES)dnl
497 AC_SUBST(KRB4_LIBS)dnl
498
499 dnl ---------------------
500 dnl CHECK TERMCAP LIBRARY
501 dnl ---------------------
502
503 dnl Add the termcap library, so that the following configure
504 dnl tests will find it when it tries to link test programs.
505 nmh_save_LIBS="$LIBS"
506 LIBS="$TERMLIB $LIBS"
507
508 dnl Checks for external variable ospeed in the termcap library.
509 AC_CACHE_CHECK(if an include file defines ospeed,
510 nmh_cv_decl_ospeed_include_defines,
511 [AC_TRY_LINK(
512 [#include <sys/types.h>
513 #if HAVE_TERMIOS_H
514 #include <termios.h>
515 #endif
516 #if HAVE_TERMCAP_H
517 #include <termcap.h>
518 #endif], [ospeed = 0;],
519 nmh_cv_decl_ospeed_include_defines=yes,
520 nmh_cv_decl_ospeed_include_defines=no)])
521  
522 if test $nmh_cv_decl_ospeed_include_defines = no; then
523   AC_CACHE_CHECK(if you must define ospeed,
524   nmh_cv_decl_ospeed_must_define,
525   [AC_TRY_LINK( ,[extern short ospeed; ospeed = 0;],
526   nmh_cv_decl_ospeed_must_define=yes,
527   nmh_cv_decl_ospeed_must_define=no)])
528 fi
529  
530 if test $nmh_cv_decl_ospeed_include_defines = yes; then
531   AC_DEFINE(HAVE_OSPEED)
532 elif test $nmh_cv_decl_ospeed_must_define = yes; then
533   AC_DEFINE(HAVE_OSPEED)
534   AC_DEFINE(MUST_DEFINE_OSPEED)
535 fi
536
537 dnl dnl Checks if tgetent accepts NULL and will
538 dnl dnl allocate its own termcap buffer.
539 dnl AC_CACHE_CHECK(if tgetent accepts NULL,
540 dnl nmh_cv_func_tgetent_accepts_null,
541 dnl [AC_TRY_RUN([main(){int i = tgetent((char*)0,"vt100");exit(!i || i == -1);}],
542 dnl   nmh_cv_func_tgetent_accepts_null=yes,
543 dnl   nmh_cv_func_tgetent_accepts_null=no,
544 dnl   nmh_cv_func_tgetent_accepts_null=no)])
545 dnl if test $nmh_cv_func_tgetent_accepts_null = yes; then
546 dnl   AC_DEFINE(TGETENT_ACCEPTS_NULL)
547 dnl fi
548
549 dnl Now put the libraries back to what it was before we
550 dnl starting checking the termcap library.
551 LIBS="$nmh_save_LIBS"
552
553 dnl --------------
554 dnl CHECK TYPEDEFS
555 dnl --------------
556 AC_TYPE_SIGNAL
557 AC_TYPE_PID_T
558 AC_TYPE_OFF_T
559 AC_TYPE_UID_T
560 AC_TYPE_MODE_T
561 AC_TYPE_SIZE_T
562
563 dnl Check for sigset_t.  Currently I'm looking in
564 dnl <sys/types.h> and <signal.h>.  Others might need
565 dnl to be added.
566 AC_CACHE_CHECK(for sigset_t, nmh_cv_type_sigset_t,
567 [AC_TRY_COMPILE(
568 [#include <sys/types.h>
569 #include <signal.h>], [sigset_t tempsigset;],
570   nmh_cv_type_sigset_t=yes, nmh_cv_type_sigset_t=no)])
571 if test $nmh_cv_type_sigset_t = no; then
572   AC_DEFINE(sigset_t, unsigned int)
573 fi
574
575 dnl ----------------
576 dnl CHECK STRUCTURES
577 dnl ----------------
578 AC_STRUCT_ST_BLKSIZE
579
580 AC_CACHE_CHECK(for tm_gmtoff in struct tm, nmh_cv_struct_tm_gmtoff,
581 [AC_TRY_COMPILE(
582 [#ifdef TIME_WITH_SYS_TIME
583 # include <sys/time.h>
584 # include <time.h>
585 #else
586 # ifdef TM_IN_SYS_TIME
587 #  include <sys/time.h>
588 # else
589 #  include <time.h>
590 # endif
591 #endif],
592 [struct tm temptm; temptm.tm_gmtoff = 0;],
593   nmh_cv_struct_tm_gmtoff=yes, nmh_cv_struct_tm_gmtoff=no)])
594 if test $nmh_cv_struct_tm_gmtoff = yes; then
595   AC_DEFINE(HAVE_TM_GMTOFF)
596 fi
597
598 dnl -------------
599 dnl CHECK SIGNALS
600 dnl -------------
601 dnl What style of signal do you have (POSIX, BSD, or SYSV)?
602 AC_MSG_CHECKING(what style of signals to use)
603 if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then
604   signals_style=POSIX_SIGNALS
605   AC_DEFINE(POSIX_SIGNALS)
606   AC_DEFINE(RELIABLE_SIGNALS)
607 elif test $ac_cv_func_sigblock = yes -a $ac_cv_func_sigsetmask = yes; then
608   signals_style=BSD_SIGNALS
609   AC_DEFINE(BSD_SIGNALS)
610   AC_DEFINE(RELIABLE_SIGNALS)
611 elif test $ac_cv_func_sighold = yes -a $ac_cv_func_sigrelse = yes; then
612   signals_style=SYSV_SIGNALS
613   AC_DEFINE(SYSV_SIGNALS)
614 else
615   signals_style=NO_SIGNAL_BLOCKING
616   AC_DEFINE(NO_SIGNAL_BLOCKING)
617 fi
618
619 AC_MSG_RESULT($signals_style)
620
621 dnl Where is <signal.h> located?  Needed as input for signames.awk
622 AC_CACHE_CHECK(where signal.h is located, nmh_cv_path_signal_h,
623 [for SIGNAL_H in /usr/include/bsd/sys/signal.h  dnl Next
624                  /usr/include/asm/signal.h      dnl Linux 1.3.0 and above
625                  /usr/include/asm/signum.h      dnl some versions of Linux/Alpha
626                  /usr/include/linux/signal.h    dnl Linux up to 1.2.11
627                  /usr/include/sys/signal.h      dnl Almost everybody else
628                  /dev/null;                     dnl Just in case we fall through
629 do
630   test -f $SIGNAL_H && \
631   grep '#[      ]*define[       ][      ]*SIG[0-9A-Z]*[         ]*[0-9][0-9]*' $SIGNAL_H > /dev/null && \
632   break
633 done
634 nmh_cv_path_signal_h=$SIGNAL_H
635 ])
636 SIGNAL_H=$nmh_cv_path_signal_h
637 AC_SUBST(SIGNAL_H)dnl
638
639 dnl ----------------
640 dnl OS SPECIFIC DEFINES
641 dnl ----------------
642 case "$target_os" in
643
644   solaris2*)
645     AC_DEFINE(SYS5)
646     AC_DEFINE(SVR4)
647     ;;
648   irix*)
649     AC_DEFINE(SYS5)
650     AC_DEFINE(SVR4)
651     ;;
652   osf*)
653     AC_DEFINE(SYS5)
654     AC_DEFINE(SVR4)
655     ;;
656   aix*)
657     AC_DEFINE(SYS5)
658     AC_DEFINE(SVR4)
659     ;;
660   sunos4*)
661     AC_DEFINE(BSD42)
662     ;;
663   freebsd*)  
664     AC_DEFINE(BSD42)
665     AC_DEFINE(BSD44)
666     ;;
667   netbsd*)
668     AC_DEFINE(BSD42)
669     AC_DEFINE(BSD44)
670     ;;
671   openbsd*)
672     AC_DEFINE(BSD42)
673     AC_DEFINE(BSD44)
674     ;;
675   bsd/os*)
676     AC_DEFINE(BSD42)
677     AC_DEFINE(BSD44)
678     ;;
679   sco5*)
680     AC_DEFINE(SYS5)
681     AC_DEFINE(SCO_5_STDIO)
682     ;;
683 esac
684
685
686 dnl ----------------
687 dnl OUTPUT MAKEFILES
688 dnl ----------------
689 AC_OUTPUT(Makefile config/Makefile h/Makefile sbr/Makefile uip/Makefile \
690           zotnet/Makefile zotnet/mts/Makefile zotnet/tws/Makefile \
691           zotnet/mf/Makefile zotnet/bboards/Makefile mts/Makefile \
692           mts/smtp/Makefile mts/sendmail/Makefile mts/mmdf/Makefile \
693           etc/Makefile man/Makefile, \
694           [test -z "$CONFIG_HEADERS" || echo > stamp-h])
695
696 dnl Umm, what's the point of these assignments??  -- <dan-nmh@dilvish.speed.net>
697 eval "nmhbin=${bindir}";         eval "nmhbin2=${nmhbin}"
698 eval "nmhsysconf=${sysconfdir}"; eval "nmhsysconf2=${nmhsysconf}"
699 eval "nmhlib=${libdir}";         eval "nmhlib2=${nmhlib}"
700 eval "nmhman=${mandir}"
701
702 if test x"$enable_pop" = x; then
703   enable_pop=no
704 fi
705
706 echo "
707 nmh configuration
708 -----------------
709 nmh version                : ${VERSION}
710 target os                  : ${target}
711 compiler                   : ${CC}
712 compiler flags             : ${CFLAGS}
713 linker flags               : ${LDFLAGS}
714 source code location       : ${srcdir}
715 binary install path        : ${nmhbin2}
716 libary install path        : ${nmhlib2}
717 config files install path  : ${nmhsysconf2}
718 man page install path      : ${nmhman}
719 transport system           : ${MTS}
720 default smtp servers       : ${smtpservers}
721 default editor             : ${editorpath}
722 default pager              : ${pagerpath}
723 email address masquerading : ${masquerade}
724 pop is enabled             : ${enable_pop}"
725 echo ""