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