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