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