source: trunk/third/nmh/configure.in @ 13870

Revision 13870, 14.5 KB checked in by tb, 25 years ago (diff)
Check for <db.h> and <ndbm.h>
RevLine 
[12454]1dnl
2dnl configure.in -- autoconf template for nmh
3dnl
[13870]4dnl $Id: configure.in,v 1.3 1999-11-08 20:26:35 tb Exp $
[12454]5dnl
6
7AC_INIT(h/nmh.h)
8AC_CONFIG_HEADER(config.h)
9
10dnl What version of nmh are we building?
11VERSION=`sed -e 's/nmh-//' ${srcdir}/VERSION`
12echo "configuring for nmh-$VERSION"
13AC_SUBST(VERSION)dnl
14
15dnl -------------------------
16dnl CHECK COMMAND LINE OPTION
17dnl -------------------------
18dnl What method of posting should post use?
19undefine([mts])dnl
20AC_ARG_WITH(mts,
21[  --with-mts=MTS          specify the mail transport agent])
22
23if test x$with_mts = xsmtp; then
24  MTS="smtp"
25  MTSLIB="mts/smtp/libsmtp.a"
26  AC_DEFINE(SMTPMTS)dnl
27elif test x$with_mts = xsendmail; then
28  MTS="sendmail"
29  MTSLIB="mts/sendmail/libsend.a"
30  AC_DEFINE(SENDMTS)dnl
31else
32  MTS="smtp"
33  MTSLIB="mts/smtp/libsmtp.a"
34  AC_DEFINE(SMTPMTS)dnl
35fi
36
37AC_SUBST(MTS)
38AC_SUBST(MTSLIB)
39
40dnl What should be the default editor?
41undefine([editor])dnl
42AC_ARG_WITH(editor,
43[  --with-editor=EDITOR    specify the default editor])
44
45if test -n "$with_editor"; then
46  editorpath="$with_editor"
47fi
48
49dnl What should be the default pager?
50undefine([pager])dnl
51AC_ARG_WITH(pager,
52[  --with-pager=PAGER      specify the default pager])
53
54if test -n "$with_pager"; then
55  pagerpath="$with_pager"
56fi
57
58dnl Do you want mhe support?
59undefine([nmh-mhe])dnl
60AC_ARG_ENABLE(nmh-mhe,
61[  --enable-nmh-mhe        enable mhe support (DEFAULT)])
62
63dnl mhe support is on by default, so define it unless
64dnl explicitly disabled.
65if test x$enable_nmh_mhe != xno; then
66  AC_DEFINE(MHE)dnl
67fi
68
69dnl Do you want client-side support for pop
70undefine([nmh-pop])dnl
71AC_ARG_ENABLE(nmh-pop,
72[  --enable-nmh-pop        enable client-side support for pop])
73if test x$enable_nmh_pop = xyes; then
74  AC_DEFINE(POP)dnl
75  POPLIB=popsbr.o
76  POPSED='/^%nmhbeginpop%/d;/^%nmhendpop%/d'
77else
78  POPSED='/^%nmhbeginpop%/,/^%nmhendpop%/d'
79fi
80AC_SUBST(POPLIB)dnl
81AC_SUBST(POPSED)dnl
82
83dnl Do you want client-side support for kpop
84AC_ARG_WITH(krb4,
85[  --with-krb4=PREFIX      specify location of Kerberos V4 for kpop support])
86if test x$with_krb4 != x -a x$with_krb4 != xno; then
87  AC_DEFINE(KPOP)dnl
88  AC_DEFINE(KPOP_PRINCIPAL, "pop")dnl
89fi
90
91dnl Do you want support for hesiod
92AC_ARG_WITH(hesiod,
93[  --with-hesiod=PREFIX    specify location of Hesiod])
94if test x$with_hesiod != x -a x$with_hesiod != xno; then
95  AC_DEFINE(HESIOD)dnl
96fi
97
98dnl Do you want to debug nmh?
99undefine([nmh-debug])dnl
100AC_ARG_ENABLE(nmh-debug,
101[  --enable-nmh-debug      enable nmh code debugging])
102
103dnl ----------------------------------------------------
104dnl Default location is /usr/local/nmh/{bin,etc,lib,man}
105dnl ----------------------------------------------------
106AC_PREFIX_DEFAULT(/usr/local/nmh)
107
108dnl ------------------
109dnl CHECK THE COMPILER
110dnl ------------------
111dnl We want these before the checks,
112dnl so the checks can modify their values.
113test -z "$CFLAGS" && CFLAGS= auto_cflags=1
114if test x$enable_nmh_debug = xyes; then
115  test -z "$LDFLAGS" && LDFLAGS=-g
116fi
117
118AC_PROG_CC
119
120dnl if the user hasn't specified CFLAGS, then
121dnl   if compiler is gcc, then
122dnl     use -O2 and some warning flags
123dnl   else use -O
124if test -n "$auto_cflags"; then
125  if test x$enable_nmh_debug = xyes; then
126    if test -n "$GCC"; then
127      test -z "$CFLAGS" && CFLAGS="-Wall -g" || CFLAGS="$CFLAGS -Wall -g"
128    else
129      test -z "$CFLAGS" && CFLAGS=-g || CFLAGS="$CFLAGS -g"
130    fi
131  else
132    test -z "$LDFLAGS" && LDFLAGS=-s
133    if test -n "$GCC"; then
134      test -z "$CFLAGS" && CFLAGS=-O2 || CFLAGS="$CFLAGS -O2"
135    else
136      test -z "$CFLAGS" && CFLAGS=-O  || CFLAGS="$CFLAGS -O"
137    fi
138  fi
139fi
140
141AC_C_CONST              dnl Does compiler support `const'.
142
143dnl ------------------
144dnl CHECK FOR PROGRAMS
145dnl ------------------
146AC_PROG_MAKE_SET        dnl Does make define $MAKE
147AC_PROG_INSTALL         dnl Check for BSD compatible `install'
148AC_PROG_RANLIB          dnl Check for `ranlib'
149AC_PROG_AWK             dnl Check for mawk,gawk,nawk, then awk
150AC_PROG_LEX             dnl Check for lex/flex
151
152dnl Check for lorder and tsort commands
153AC_CHECK_PROG(LORDER, lorder, lorder, no)dnl
154AC_CHECK_PROG(TSORT, tsort, tsort, no)dnl
155
156dnl If either doesn't exist, replace them with echo and cat
157if test x$ac_cv_prog_LORDER != xlorder -o x$ac_cv_prog_TSORT != xtsort; then
158  LORDER=echo
159  TSORT=cat
160  AC_SUBST(LORDER)dnl
161  AC_SUBST(TSORT)dnl
162fi
163
164dnl Look for `sendmail'
165pathtmp=/usr/lib:/usr/sbin:/usr/etc:/usr/ucblib:/usr/bin:/bin
166AC_PATH_PROG(sendmailpath, sendmail, no, [$pathtmp])
167
168dnl Look for `more'
169pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
170AC_PATH_PROG(morepath, more, no, [$pathtmp])
171
172dnl If pager is not specified yet,
173dnl then use `more' as the default.
174if test -z "$pagerpath"; then
175  pagerpath="$morepath"
176fi
177AC_SUBST(pagerpath)dnl
178
179dnl Look for `vi'
180pathtmp=/usr/bin:/bin:/usr/ucb:/usr/local/bin
181AC_PATH_PROG(vipath, vi, no, [$pathtmp])
182
183dnl If editor is not specified yet,
184dnl then use `vi' as the default.
185if test -z "$editorpath"; then
186  editorpath="$vipath"
187fi
188AC_SUBST(editorpath)dnl
189
190dnl Check for broken vi
191AC_CACHE_CHECK(for broken vi, nmh_cv_attvibug,
192[if echo 'r /nonexist-file
193q' | ex > /dev/null 2>&1
194then
195        nmh_cv_attvibug=no
196else
197        nmh_cv_attvibug=yes
198fi])
199 
200if test "$nmh_cv_attvibug" = yes; then
201  AC_DEFINE(ATTVIBUG)
202fi
203
204dnl ---------------
205dnl FIND MAIL SPOOL
206dnl ---------------
207AC_CACHE_CHECK(where mail spool is located, nmh_cv_mailspool,
208[for mailspool in /var/mail        dnl
209                  /var/spool/mail  dnl
210                  /usr/spool/mail  dnl
211                  /dev/null;       dnl Just in case we fall through
212do
213  test -d $mailspool && break
214done
215nmh_cv_mailspool=$mailspool
216])
217mailspool=$nmh_cv_mailspool
218AC_SUBST(mailspool)dnl
219
220dnl ------------------
221dnl CHECK HEADER FILES
222dnl ------------------
223AC_HEADER_DIRENT
224AC_HEADER_STDC
225AC_HEADER_TIME
226AC_HEADER_SYS_WAIT
227AC_HEADER_STAT
228AC_CHECK_HEADERS(string.h memory.h stdlib.h unistd.h errno.h fcntl.h \
229                 limits.h crypt.h termcap.h termio.h termios.h locale.h \
230                 sys/param.h sys/time.h sys/utsname.h arpa/inet.h \
[13870]231                 arpa/ftp.h ndbm.h db.h)
[12454]232
233AC_CACHE_CHECK(POSIX termios, nmh_cv_sys_posix_termios,
234[AC_TRY_LINK([#include <sys/types.h>
235#include <unistd.h>
236#include <termios.h>],
237[/* SunOS 4.0.3 has termios.h but not the library calls.  */
238tcgetattr(0, 0);],
239  nmh_cv_sys_posix_termios=yes, nmh_cv_sys_posix_termios=no)])
240 
241if test $nmh_cv_sys_posix_termios = yes; then
242  AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
243  nmh_cv_header_termios_h_tiocgwinsz,
244  [AC_TRY_LINK([#include <sys/types.h>
245#include <termios.h>],
246  [int x = TIOCGWINSZ;],
247  nmh_cv_header_termios_h_tiocgwinsz=yes,
248  nmh_cv_header_termios_h_tiocgwinsz=no)])
249else
250  nmh_cv_header_termios_h_tiocgwinsz=no
251fi
252 
253if test $nmh_cv_header_termios_h_tiocgwinsz = no; then
254  AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
255  nmh_cv_header_sys_ioctl_h_tiocgwinsz,
256  [AC_TRY_LINK([#include <sys/types.h>
257#include <sys/ioctl.h>],
258  [int x = TIOCGWINSZ;],
259  nmh_cv_header_sys_ioctl_h_tiocgwinsz=yes,
260  nmh_cv_header_sys_ioctl_h_tiocgwinsz=no)])
261  if test $nmh_cv_header_sys_ioctl_h_tiocgwinsz = yes; then
262    AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
263  fi
264fi
265 
266AC_CHECK_HEADER([sys/ptem.h], AC_DEFINE(WINSIZE_IN_PTEM))
267
268dnl ---------------
269dnl CHECK FUNCTIONS
270dnl ---------------
271AC_FUNC_VFORK
272AC_CHECK_FUNCS(waitpid wait3 sigaction sigprocmask sigblock sigsetmask \
273               sighold sigrelse writev lstat uname tzset killpg \
274               sigsetjmp)
275
276AC_REPLACE_FUNCS(snprintf strerror strdup)
277
278dnl -------------------
279dnl CHECK FOR LIBRARIES
280dnl -------------------
281dnl Checks for network libraries (nsl, socket)
282AC_CHECK_NETLIBS
283
284dnl Check for bug in libraries such that ruserpass
285dnl needs to be linked as _ruserpass.
286AC_CHECK_RUSERPASS
287
288termcap_curses_order="termcap curses ncurses"
289for lib in $termcap_curses_order; do
290  AC_CHECK_LIB(${lib}, tgetent, [TERMLIB="-l$lib"; break])
291done
292AC_SUBST(TERMLIB)dnl
293
294dnl --------------
295dnl CHECK FOR NDBM
296dnl --------------
297dnl Checks for ndbm
298AC_CHECK_FUNC(dbm_open, ,
299  AC_CHECK_LIB(ndbm, dbm_open, ,
300    AC_CHECK_LIB(dbm, dbm_open)))
301
302dnl ----------------
303dnl CHECK FOR HESIOD
304dnl ----------------
305if test x$with_hesiod != x -a x$with_hesiod != xno; then
306  if test x$with_hesiod != xyes; then
307    HESIOD_INCLUDES="-I$with_hesiod/include"
308    HESIOD_LIBS="-L$with_hesiod/lib"
309  fi
310  AC_CHECK_FUNC(res_send, ,
311    AC_CHECK_LIB(resolv, res_send))
312  AC_CHECK_LIB(hesiod, hes_resolve, [HESIOD_LIBS="$HESIOD_LIBS -lhesiod"],
313    [AC_MSG_ERROR(Hesiod library not found)], $HESIOD_LIBS)
314fi
315AC_SUBST(HESIOD_INCLUDES)dnl
316AC_SUBST(HESIOD_LIBS)dnl
317
318dnl ----------------------------------
319dnl CHECK FOR KRB4 (Kerberos4 support)
320dnl ----------------------------------
321if test x$with_krb4 != x -a x$with_krb4 != xno; then
322  if test x$with_krb4 != xyes; then
323    KRB4_INCLUDES="-I$with_krb4/include"
324    if test -d "$with_krb4/include/kerberosIV"; then
325      KRB4_INCLUDES="$KRB4_INCLUDES -I$with_krb4/include/kerberosIV"
326    fi
327    KRB4_LIBS="-L$with_krb4/lib"
328  elif test -d /usr/include/kerberosIV; then
329    KRB4_INCLUDES="-I/usr/include/kerberosIV"
330  fi
331  AC_CHECK_LIB(krb4, krb_rd_req,
[13768]332    [KRB4_LIBS="$KRB4_LIBS -lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
[12454]333    [AC_CHECK_LIB(krb, krb_rd_req,
334      [KRB4_LIBS="-lkrb -ldes"],
335      [AC_MSG_ERROR(Kerberos 4 libraries not found)],
336      $KRB4_LIBS -ldes)],
[13768]337    $KRB4_LIBS -ldes425 -lkrb5 -lk5crypto -lcom_err)
[12454]338fi
339AC_SUBST(KRB4_INCLUDES)dnl
340AC_SUBST(KRB4_LIBS)dnl
341
342dnl ---------------------
343dnl CHECK TERMCAP LIBRARY
344dnl ---------------------
345
346dnl Add the termcap library, so that the following configure
347dnl tests will find it when it tries to link test programs.
348nmh_save_LIBS="$LIBS"
349LIBS="$TERMLIB $LIBS"
350
351dnl Checks for external variable ospeed in the termcap library.
352AC_CACHE_CHECK(if an include file defines ospeed,
353nmh_cv_decl_ospeed_include_defines,
354[AC_TRY_LINK(
355[#include <sys/types.h>
356#if HAVE_TERMIOS_H
357#include <termios.h>
358#endif
359#if HAVE_TERMCAP_H
360#include <termcap.h>
361#endif], [ospeed = 0;],
362nmh_cv_decl_ospeed_include_defines=yes,
363nmh_cv_decl_ospeed_include_defines=no)])
364 
365if test $nmh_cv_decl_ospeed_include_defines = no; then
366  AC_CACHE_CHECK(if you must define ospeed,
367  nmh_cv_decl_ospeed_must_define,
368  [AC_TRY_LINK( ,[extern short ospeed; ospeed = 0;],
369  nmh_cv_decl_ospeed_must_define=yes,
370  nmh_cv_decl_ospeed_must_define=no)])
371fi
372 
373if test $nmh_cv_decl_ospeed_include_defines = yes; then
374  AC_DEFINE(HAVE_OSPEED)
375elif test $nmh_cv_decl_ospeed_must_define = yes; then
376  AC_DEFINE(HAVE_OSPEED)
377  AC_DEFINE(MUST_DEFINE_OSPEED)
378fi
379
380dnl dnl Checks if tgetent accepts NULL and will
381dnl dnl allocate its own termcap buffer.
382dnl AC_CACHE_CHECK(if tgetent accepts NULL,
383dnl nmh_cv_func_tgetent_accepts_null,
384dnl [AC_TRY_RUN([main(){int i = tgetent((char*)0,"vt100");exit(!i || i == -1);}],
385dnl   nmh_cv_func_tgetent_accepts_null=yes,
386dnl   nmh_cv_func_tgetent_accepts_null=no,
387dnl   nmh_cv_func_tgetent_accepts_null=no)])
388dnl if test $nmh_cv_func_tgetent_accepts_null = yes; then
389dnl   AC_DEFINE(TGETENT_ACCEPTS_NULL)
390dnl fi
391
392dnl Now put the libraries back to what it was before we
393dnl starting checking the termcap library.
394LIBS="$nmh_save_LIBS"
395
396dnl --------------
397dnl CHECK TYPEDEFS
398dnl --------------
399AC_TYPE_SIGNAL
400AC_TYPE_PID_T
401AC_TYPE_OFF_T
402AC_TYPE_UID_T
403AC_TYPE_MODE_T
404AC_TYPE_SIZE_T
405
406dnl Check for sigset_t.  Currently I'm looking in
407dnl <sys/types.h> and <signal.h>.  Others might need
408dnl to be added.
409AC_CACHE_CHECK(for sigset_t, nmh_cv_type_sigset_t,
410[AC_TRY_COMPILE(
411[#include <sys/types.h>
412#include <signal.h>], [sigset_t tempsigset;],
413  nmh_cv_type_sigset_t=yes, nmh_cv_type_sigset_t=no)])
414if test $nmh_cv_type_sigset_t = no; then
415  AC_DEFINE(sigset_t, unsigned int)
416fi
417
418dnl ----------------
419dnl CHECK STRUCTURES
420dnl ----------------
421AC_STRUCT_ST_BLKSIZE
422
423AC_CACHE_CHECK(for tm_gmtoff in struct tm, nmh_cv_struct_tm_gmtoff,
424[AC_TRY_COMPILE(
425[#ifdef TIME_WITH_SYS_TIME
426# include <sys/time.h>
427# include <time.h>
428#else
429# ifdef TM_IN_SYS_TIME
430#  include <sys/time.h>
431# else
432#  include <time.h>
433# endif
434#endif],
435[struct tm temptm; temptm.tm_gmtoff = 0;],
436  nmh_cv_struct_tm_gmtoff=yes, nmh_cv_struct_tm_gmtoff=no)])
437if test $nmh_cv_struct_tm_gmtoff = yes; then
438  AC_DEFINE(HAVE_TM_GMTOFF)
439fi
440
441dnl -------------
442dnl CHECK SIGNALS
443dnl -------------
444dnl What style of signal do you have (POSIX, BSD, or SYSV)?
445AC_MSG_CHECKING(what style of signals to use)
446if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then
447  signals_style=POSIX_SIGNALS
448  AC_DEFINE(POSIX_SIGNALS)
449  AC_DEFINE(RELIABLE_SIGNALS)
450elif test $ac_cv_func_sigblock = yes -a $ac_cv_func_sigsetmask = yes; then
451  signals_style=BSD_SIGNALS
452  AC_DEFINE(BSD_SIGNALS)
453  AC_DEFINE(RELIABLE_SIGNALS)
454elif test $ac_cv_func_sighold = yes -a $ac_cv_func_sigrelse = yes; then
455  signals_style=SYSV_SIGNALS
456  AC_DEFINE(SYSV_SIGNALS)
457else
458  signals_style=NO_SIGNAL_BLOCKING
459  AC_DEFINE(NO_SIGNAL_BLOCKING)
460fi
461
462AC_MSG_RESULT($signals_style)
463
464dnl Where is <signal.h> located?  Needed as input for signames.awk
465AC_CACHE_CHECK(where signal.h is located, nmh_cv_path_signal_h,
466[for SIGNAL_H in /usr/include/bsd/sys/signal.h  dnl Next
467                 /usr/include/asm/signal.h      dnl Linux 1.3.0 and above
468                 /usr/include/asm/signum.h      dnl some versions of Linux/Alpha
469                 /usr/include/linux/signal.h    dnl Linux up to 1.2.11
470                 /usr/include/sys/signal.h      dnl Almost everybody else
471                 /dev/null;                     dnl Just in case we fall through
472do
473  test -f $SIGNAL_H && \
474  grep '#[      ]*define[       ][      ]*SIG[0-9A-Z]*[         ]*[0-9][0-9]*' $SIGNAL_H > /dev/null && \
475  break
476done
477nmh_cv_path_signal_h=$SIGNAL_H
478])
479SIGNAL_H=$nmh_cv_path_signal_h
480AC_SUBST(SIGNAL_H)dnl
481
482dnl ----------------
483dnl OUTPUT MAKEFILES
484dnl ----------------
485AC_OUTPUT(Makefile config/Makefile h/Makefile sbr/Makefile uip/Makefile \
486          zotnet/Makefile zotnet/mts/Makefile zotnet/tws/Makefile \
487          zotnet/mf/Makefile zotnet/bboards/Makefile mts/Makefile \
488          mts/smtp/Makefile mts/sendmail/Makefile mts/mmdf/Makefile \
489          etc/Makefile man/Makefile, \
490          [test -z "$CONFIG_HEADERS" || echo > stamp-h])
491
492eval "nmhbin=${bindir}";         eval "nmhbin2=${nmhbin}"
493eval "nmhsysconf=${sysconfdir}"; eval "nmhsysconf2=${nmhsysconf}"
494eval "nmhlib=${libdir}";         eval "nmhlib2=${nmhlib}"
495eval "nmhman=${mandir}"
496
497echo "
498nmh configuration
499-----------------
500nmh version               : ${VERSION}
501compiler                  : ${CC}
502compiler flags            : ${CFLAGS}
503linker flags              : ${LDFLAGS}
504source code location      : ${srcdir}
505binary install path       : ${nmhbin2}
506libary install path       : ${nmhlib2}
507config files install path : ${nmhsysconf2}
508man page install path     : ${nmhman}
509transport system          : ${MTS}
510default editor            : ${editorpath}
511default pager             : ${pagerpath}"
512echo ""
Note: See TracBrowser for help on using the repository browser.