* Add revision string to first time user report.
[alpine.git] / configure.ac
blobb514f9f4306884a6d1118f18f7e162c48b93b3fb
1 dnl Process this file with autoconf to produce a configure script.
3 dnl /* ========================================================================
4 dnl  * Copyright 2013-2018 Eduardo Chappa
5 dnl  * Copyright 2006-2008 University of Washington
6 dnl  *
7 dnl  * Licensed under the Apache License, Version 2.0 (the "License");
8 dnl  * you may not use this file except in compliance with the License.
9 dnl  * You may obtain a copy of the License at
10 dnl  *
11 dnl  *     http://www.apache.org/licenses/LICENSE-2.0
12 dnl  *
13 dnl  * ========================================================================
14 dnl  */
16 AC_PREREQ([2.69])
18 AC_REVISION([Rev:27 by chappa@washington.edu])
20 dnl Alpine Version Number is in $srcdir/VERSION
21 AC_INIT([alpine],[m4_esyscmd(tr -d \\n < VERSION)],[chappa@washington.edu])
23 AC_CONFIG_SRCDIR([include/system.h])
24 AC_CONFIG_HEADERS([include/config.h])
25 AC_CONFIG_MACRO_DIR([m4])
26 AM_INIT_AUTOMAKE([foreign nostdinc])
28 AM_MAINTAINER_MODE
30 AC_CANONICAL_HOST
32 AC_LANG(C)
34 AC_MSG_NOTICE([Configuring for $PACKAGE_STRING ($host)])
36 # start out with intent to build Web Alpine
37 WEB_BUILD=web/src/alpined.d
39 dnl CHECK PROGRAMS
41 AC_PROG_CC
42 AX_PROG_CC_FOR_BUILD
43 AC_PROG_CC_STDC
44 AC_PROG_INSTALL
45 AC_PROG_MAKE_SET
46 AC_PROG_LN_S
47 AC_PROG_AWK
48 LT_INIT
49 AC_SUBST([LIBTOOL_DEPS])
51 AC_PATH_PROG(AR, ar, ar)
52 AC_PATH_PROG(RM, rm, rm)
53 AC_PATH_PROG(CP, cp, cp)
54 AC_PATH_PROG(LN, ln, ln)
55 AC_PATH_PROG(LS, ls, ls)
56 AC_PATH_PROG(SED, sed, sed)
57 AC_PATH_PROG(MAKE, make)
59 dnl COMPILE-TIME OPTIONS
61 AM_GNU_GETTEXT_VERSION([0.16.1])
62 AM_GNU_GETTEXT([external])
64 dnl enable dmalloc per http://dmalloc.com
65 dnl NOTE: does not check c-client
66 AC_MSG_CHECKING([option: dmalloc enabled])
67 AC_ARG_ENABLE(dmalloc, AS_HELP_STRING([--enable-dmalloc],[Enable dmalloc debugging]))
68 if test x$enable_dmalloc = "xyes" ; then
69   AC_MSG_RESULT([yes])
70 else
71   AC_MSG_RESULT([no])
74 AC_ARG_WITH(dmalloc-dir,
75   AS_HELP_STRING([--with-dmalloc-dir=DIR],[Root of dmalloc lib/include path]),
76   [
77     if test "x$withval" != "xno" ; then
78       enable_dmalloc = "yes"
79       CPPFLAGS="$CPPFLAGS -I${withval}"
80       LDFLAGS="$LDFLAGS -L${withval}"
81     fi
82   ])
84 if test x$enable_dmalloc = "xyes" ; then
85   AC_DEFINE(ENABLE_DMALLOC, 1, [Define enable dmalloc debugging])
88 dnl set date and hostname
89 ALPINE_datestamp=`date`
90 AC_ARG_WITH(date-stamp,
91   AS_HELP_STRING([--with-date-stamp=DATE],[Set this as the date this program was built. Default: output of `date`]),
92   [ 
93     if test "x$withval" != "xno" ; then
94      ALPINE_datestamp=$withval
95     fi
96   ])
97 AC_SUBST([ALPINE_DATESTAMP], $ALPINE_datestamp)
99 ALPINE_hoststamp=`hostname`
100 AC_ARG_WITH(host-stamp,
101   AS_HELP_STRING([--with-host-stamp=HOST],[Set name of computer for compilation. Default: output of `hostname`]),
102   [ 
103     if test "x$withval" != "xno" ; then
104       ALPINE_hoststamp="$withval"
105     fi
106   ])
107 AC_SUBST([ALPINE_HOSTSTAMP], $ALPINE_hoststamp)
109 dnl set ps command, this test is fragile, but it should mostly work
110 ALPINE_psefcmd="/bin/ps auxww"
111 ALPINE_psfailed="0"
112 ALPINE_PSTEST="-"
113 AC_ARG_WITH(ps-cmd,
114   AS_HELP_STRING([--with-ps-cmd="CMD"],[Use this command to check running commands. Default: /bin/ps auxww]),
115   [
116     if test "x$withval" = "xno" -o "x$withval" = "xyes" -o "x$withval" = "x" ; then
117         withval=$ALPINE_psefcmd
118     fi
119     ALPINE_PSTEST=`$withval | $EGREP "$withval" | $EGREP -v $EGREP`
120     if test -n "$ALPINE_PSTEST" ; then
121        ALPINE_psefcmd="$withval"
122     else
123        ALPINE_psfailed="1"
124        if test "x$ALPINE_psefcmd" != "x$withval" ; then
125           AC_MSG_WARN(failed command $withval. Trying $ALPINE_psefcmd)
126        fi
127     fi
128   ])
129 if test "$ALPINE_psfailed" = "1" -o "$ALPINE_PSTEST" = "-" ; then
130    withval="$ALPINE_psefcmd"
131    ALPINE_PSTEST=`$withval | $EGREP "$withval" | $EGREP -v $EGREP`
132    if test -z "$ALPINE_PSTEST" ; then
133       ALPINE_psfailed="1"
134    else
135       ALPINE_psfailed="0"
136    fi
138 if test "$ALPINE_psfailed" = "0" ; then
139   AC_DEFINE_UNQUOTED([PSEFCMD], "$ALPINE_psefcmd", [ps command which outputs list of running commands])
142 dnl Set default locale dir.
143 case $host in
144     *apple-darwin*)
145       if test -d /opt/local ; then
146         localedir="/opt/local/share/locale"
147       else
148         localedir="\${datadir}/locale"
149       fi
150       ;;
151     *-*-cygwin)
152         localedir="/usr/share"
153       ;;
154     *)  
155       localedir="\${datadir}/locale"
156       ;;
157 esac
159 AC_ARG_WITH(localedir,
160   AS_HELP_STRING([--with-localedir=DIR],[Name of gettext locale directory]),
161   [
162     case $withval in
163       yes)
164         ;;
165       no)
166         ;;
167       *)
168         localedir=$withval
169         ;;
170     esac
171   ])
172 AC_SUBST(localedir, "[$localedir]")
174 # Setup OS-Specific features
175 case "$host" in
176   *darwin*)
177     dnl OS X Universal Binary Support
178     AC_ARG_ENABLE(osx-universal-binaries,
179       AS_HELP_STRING([--enable-osx-universal-binaries],[Produce universal binaries under OS X [[default=no]]]))
180     if test "x$enable_osx_universal_binaries" = "xyes" ; then
181       if test "x$enable_dependency_tracking" != xno ; then
182         AC_MSG_ERROR([--enable-osx-universal-binary requires --disable-dependency-tracking.
183 Please re-run configure with these options:
184     --disable-dependency-tracking --enable-osx-universal-binary])
185       fi
186       if [test -d /Developer/SDKs/MacOSX10.5.sdk] ; then
187         alpine_sysroot=/Developer/SDKs/MacOSX10.5.sdk
188       elif [test -d /Developer/SDKs/MacOSX10.4u.sdk] ; then
189         alpine_sysroot=/Developer/SDKs/MacOSX10.4u.sdk
190       else
191         AC_MSG_ERROR([No suitable MacOSX SDK found.  Make sure Xcode tools are installed])
192       fi
193       ub_cflags="-isysroot $alpine_sysroot -arch ppc -arch i386"
194       ub_ldflags="-Wl,-syslibroot,$alpine_sysroot -arch ppc -arch i386"
195       AM_CFLAGS="$AM_CFLAGS $ub_cflags"
196       AM_LDFLAGS="$AM_LDFLAGS $ub_ldflags"
197       alpine_c_client_cflags="$alpine_c_client_cflags $ub_cflags"
198       alpine_c_client_ldflags="$alpine_c_client_ldflags $ub_ldflags"
199     fi
200     ;;
201 esac
203 AC_ARG_WITH(include-path,
204   AS_HELP_STRING([--with-include-path=PATHS],[Colon-separated list of directories used for include file search]),
205   [
206     case $withval in
207       no)
208         ;;
209       yes)
210         ;;
211       *)
212         new_cppflags="-I`echo ${withval} | ${SED} 's/:/ -I/g'`"
213         CPPFLAGS="$CPPFLAGS ${new_cppflags}"
214         alpine_c_client_cflags="$alpine_c_client_cflags ${new_cppflags}"
215         ;;
216     esac
217   ])
219 AC_ARG_WITH(lib-path,
220   AS_HELP_STRING([--with-lib-path=PATHS],[Colon-separated list of directories used for library search]),
221   [
222     case $withval in
223       no)
224         ;;
225       yes)
226         ;;
227       *)
228         new_ldflags="-L`echo ${withval} | ${SED} 's/:/ -L/g'`"
229         LDFLAGS="$LDFLAGS $new_ldflags"
230         alpine_c_client_ldflags="$alpine_c_client_ldflags ${new_ldflags}"
231         ;;
232     esac
233   ])
235 AC_ARG_WITH(pubcookie,
236   AS_HELP_STRING([--with-pubcookie],[Include support for UW-Pubcookie Web Authentication]),
237   [
238     if test "x$withval" != "xno" ; then
239       WEB_PUBCOOKIE_BUILD=web/src/pubcookie
240     fi
241   ])
244 AC_ARG_WITH(web-bin,
245   AS_HELP_STRING([--with-web-bin=PATH],[Directory to hold Web Alpine component binary files]),
246   [
247     case "$withval" in
248       no)
249         ;;
250       yes)
251         ;;
252       *)
253         WEB_BINDIR=$withval
254         ;;
255     esac
256   ])
258 dnl disable debug, turned on by default
259 AC_MSG_CHECKING([option: debugging is enabled])
260 AC_ARG_ENABLE(debug, AS_HELP_STRING([--disable-debug],[Exclude debug messages from source]))
261 if test x$enable_debug != "xno" ; then
262   AM_CFLAGS="$AM_CFLAGS -g"
263   AC_DEFINE([DEBUG], [1], [Compile in debugging])
264   AC_DEFINE([DEBUGJOURNAL], [1], [Display debug messages in journal])
265   AC_MSG_RESULT([yes])
266 else
267 dnl ??? set AM_CFLAGS to optimize ???
268   AC_MSG_RESULT([no])
271 dnl disable optimization, on by default
272 AC_MSG_CHECKING([option: optimization is enabled])
273 AC_ARG_ENABLE(optimization, AS_HELP_STRING([--disable-optimization],[Exclude optimizing compiler flags]))
274 if test x$enable_optimization != "xno" ; then
275   AC_MSG_RESULT([yes])
276 else
277   CFLAGS="`echo $AM_CFLAGS | ${SED} 's/-O2//'`"
278   alpine_c_client_gccoptlevel="-O0"
279   AC_MSG_RESULT([no])
282 dnl disable mouse support
283 AC_MSG_CHECKING([option: mouse support enabled])
284 AC_ARG_ENABLE(mouse, AS_HELP_STRING([--disable-mouse],[Disable mouse support]))
285 if test x$enable_mouse != "xno" ; then
286   AC_DEFINE([MOUSE], [], [Compile in mouse support])
287   AC_MSG_RESULT([yes])
288 else
289    AC_MSG_RESULT([no])
292 dnl enable quotas
293 AC_MSG_CHECKING([option: quotas enabled])
294 AC_ARG_ENABLE(quotas, AS_HELP_STRING([--enable-quotas],[Enable disk quota checking on startup]))
295 if test x$enable_quotas = "xyes" ; then
296   AC_DEFINE([USE_QUOTAS], [], [Compile in quota check on startup])
297   AC_MSG_RESULT([yes])
298 else
299    AC_MSG_RESULT([no])
302 AC_MSG_CHECKING([option: From changing enabled])
303 AC_ARG_ENABLE(from_changing, AS_HELP_STRING([--disable-from-changing],[Disallow users changing From addresss]))
304 if test x$enable_from_changing != "xno" ; then
305   AC_MSG_RESULT([yes])
306 else
307   AC_DEFINE([NEVER_ALLOW_CHANGING_FROM], [], [Disallow users changing their From address])
308   AC_MSG_RESULT([no])
311 dnl enable background posting support
312 AC_MSG_CHECKING([option: background post enabled])
313 AC_ARG_ENABLE(background-post, AS_HELP_STRING([--disable-background-post],[Disable background posting]))
314 if test x$enable_background_post != "xno" ; then
315   AC_DEFINE([BACKGROUND_POST], [], [Enable background posting support])
316   AC_MSG_RESULT([yes])
317 else
318     AC_MSG_RESULT([no])
321 dnl enable keyboard locking support
322 AC_MSG_CHECKING([option: keyboard lock enabled])
323 AC_ARG_ENABLE(keyboard-lock, AS_HELP_STRING([--disable-keyboard-lock],[Disable keyboard locking]))
324 if test x$enable_keyboard_lock != "xno" ; then
325   AC_DEFINE([KEYBOARD_LOCK], [], [Enable keyboard lock support])
326   AC_MSG_RESULT([yes])
327 else
328   AC_MSG_RESULT([no])
331 dnl enable from encoding support
332 AC_MSG_CHECKING([option: from encoding enabled])
333 AC_ARG_ENABLE(from-encoding, AS_HELP_STRING([--enable-from-encoding],[Enable From encoding in sent messages]))
334 if test x$enable_from_encoding = "xyes" ; then
335   AC_DEFINE([ENCODE_FROMS], [], [Enable From address encoding in sent messages])
336   AC_MSG_RESULT([yes])
337 else
338   AC_MSG_RESULT([no])
341 dnl OPTION: name of local submission agent
342 dnl         Might not be sendmail, but it MUST speak SMTP on stdin/stdout
343 AC_ARG_WITH(smtp-msa,
344   AS_HELP_STRING([--with-smtp-msa=PATH],[Local Mail Submission Agent (sendmail)]),
345     [
346       case "$withval" in
347         no)
348           ;;
349         yes)
350           AC_PATH_PROG(SENDMAIL, sendmail, "", $PATH:/usr/sbin:/usr/lib)
351           ;;
352         *)
353           SENDMAIL=$withval
354           ;;
355       esac
356     ],
357     [
358           AC_PATH_PROG(SENDMAIL, sendmail, "", $PATH:/usr/sbin:/usr/lib)
359     ])
360 if test -n "$SENDMAIL" ; then
361     AC_DEFINE_UNQUOTED([SENDMAIL], "$SENDMAIL", [Local mail submission agent])
364 dnl OPTION: local msa arguments
365 smtp_msa_flags="-bs -odb -oem"
366 AC_ARG_WITH(smtp-msa-flags,
367   AS_HELP_STRING([--with-smtp-msa-flags=FLAGS],[MSA flags for SMTP on stdin/stdout (-bs -odb -oem)]),
368   [
369     if test "x$withval" != "xno" ; then
370       smtp_msa_flags=$withval
371     fi
372   ])
373 AC_DEFINE_UNQUOTED([SENDMAILFLAGS], "$smtp_msa_flags", [Local MSA flags for SMTP on stdin/stdout])
375 dnl OPTION: name of local news posting agent and flags
376 npa="inews"
377 AC_ARG_WITH(npa,
378   AS_HELP_STRING([--with-npa=PATH],[Posting agent when no nntp-servers defined (inews)]),
379     [
380       case "$withval" in
381         no)
382           ;;
383         yes)
384           AC_PATH_PROG(NPA_PROG, inews, "", $PATH:/usr/sbin:/usr/lib)
385           ;;
386         *)
387           NPA_PROG=$withval
388           ;;
389       esac
390     ],
391     [
392           AC_PATH_PROG(NPA_PROG, inews, "", $PATH:/usr/sbin:/usr/lib)
393     ])
395 npa_flags="-h"
396 AC_ARG_WITH(npa-flags,
397   AS_HELP_STRING([--with-npa-flags=FLAGS],[Flags to allow posting via local agent (-h)]),
398   [
399     if test "x$withval" != "xno" ; then
400       npa_flags=$withval
401     fi
402   ])
403 if test -n "$NPA_PROG" ; then
404   AC_DEFINE_UNQUOTED([SENDNEWS], "$NPA_PROG $npa_flags", [Posting agent to use when no nntp-servers defined])
407 dnl OPTION: password changing program
408 AC_ARG_WITH(password-prog,
409   AS_HELP_STRING([--with-password-prog=PATH],[Password change program (/bin/passwd)]),
410     [
411       case "$withval" in
412         no)
413           ;;
414         yes)
415           AC_PATH_PROG(PWPROG, passwd, "", $PATH:/usr/sbin:/usr/lib)
416           ;;
417         *)
418           AC_PATH_PROG(PWPROG, $withval, "", $PATH:/usr/sbin:/usr/lib)
419           ;;
420       esac
421     ],
422     [
423           AC_PATH_PROG(PWPROG, passwd, "", $PATH:/usr/sbin:/usr/lib)
424     ])
425 if test -n "$PWPROG" ; then
426     AC_DEFINE_UNQUOTED([PASSWD_PROG], "$PWPROG", [Program users use to change their password])
429 dnl OPTION: basic spell checking program
430 AC_ARG_WITH(simple-spellcheck,
431   AS_HELP_STRING([--with-simple-spellcheck=PROG],[Spellcheck program reads stdin, emits misspellings on stdout]),
432     [
433       if test "x$withval" != "xno" ; then
434         SPELLPROG=$withval
435       fi
436     ],
437     [
438       AC_CHECK_PROG([SPELLPROG], [hunspell], [hunspell], [])
439       if test -z "$SPELLPROG" ; then
440         AC_CHECK_PROG([SPELLPROG], [aspell], [aspell], [])
441         if test -z "$SPELLPROG" ; then
442           AC_CHECK_PROG([SPELLPROG], [ispell], [ispell], [])
443           if test -z "$SPELLPROG" ; then
444            SPELLPROG="spell"
445           fi
446         fi
447       fi
448     ])
450 if test "x$SPELLPROG" != "xno" ; then
451   AC_PATH_PROG(alpine_simple_spellcheck, $SPELLPROG)
452   if test -n "$alpine_simple_spellcheck" ; then
453     case "$SPELLPROG" in
454       hunspell)
455         alpine_simple_spellcheck="$alpine_simple_spellcheck -l"
456         ;;
457       aspell)
458         alpine_simple_spellcheck="$alpine_simple_spellcheck --dont-backup --mode=email list"
459         ;;
460       ispell)
461         alpine_simple_spellcheck="$alpine_simple_spellcheck -l"
462         ;;
463       *)
464         ;;
465     esac
466   fi
469 dnl OPTION: interactive spell checking program
470 AC_ARG_WITH(interactive-spellcheck,
471   AS_HELP_STRING([--with-interactive-spellcheck=PROG],[Interactive, filewise spell checker]),
472     [
473       if test "x$withval" != "xno" ; then
474         ISPELLPROG=$withval
475       fi
476     ],
477     [
478       AC_CHECK_PROG([ISPELLPROG], [hunspell], [hunspell], [])
479       if test -z "$ISPELLPROG" ; then
480         AC_CHECK_PROG([ISPELLPROG], [aspell], [aspell], [])
481         if test -z "$SPELLPROG" ; then
482           ISPELLPROG="ispell"
483         fi
484       fi
485     ])
487 if test "x$ISPELLPROG" != "xno" ; then
488   AC_PATH_PROG(alpine_interactive_spellcheck, $ISPELLPROG)
489   if test -n "$alpine_interactive_spellcheck" ; then
490     case "$ISPELLPROG" in
491       aspell)
492         alpine_interactive_spellcheck="$alpine_interactive_spellcheck --dont-backup --mode=email check"
493         ;;
494       *)
495         ;;
496     esac
497   fi
500 if test -n "$alpine_interactive_spellcheck" ; then
501     AC_DEFINE_UNQUOTED([DF_VAR_SPELLER], "$alpine_interactive_spellcheck", [Interactive, filewise spell checker])
504 if test -z "$alpine_simple_spellcheck" -a -n "$alpine_interactive_spellcheck" ; then
505   alpine_simple_spellcheck=test
507 AC_DEFINE_UNQUOTED([SPELLER], "$alpine_simple_spellcheck", [Simple spell checker: reads stdin, emits misspellings on stdout])
509 dnl OPTION: system-pinerc
510 dnl NOTE: historically we used /lib for the config dir.
511 dnl       don't ask, it was a long time ago. but, we can't
512 dnl       change it now without breaking compatibility
513 case "$prefix" in
514   NONE) dpv=/usr/local/lib/pine.conf ;;
515   *) dpv=${prefix}/lib/pine.conf ;;
516 esac
517 AC_ARG_WITH(system-pinerc,
518   AS_HELP_STRING([--with-system-pinerc=VALUE],[System pinerc (/usr/local/lib/pine.conf)]),
519     [
520       case "$withval" in
521         no)
522           ;;
523         yes)
524           ;;
525         *)
526           dpv=$withval
527           ;;
528       esac
529     ])
530 AC_DEFINE_UNQUOTED(SYSTEM_PINERC, "$dpv", [System pinerc])
532 dnl OPTION: system-fixed-pinerc
533 dnl NOTE: historically we used /lib for the config dir.
534 dnl       don't ask, it was a long time ago. but, we can't
535 dnl       change it now without breaking compatibility
536 case "$prefix" in
537   NONE) dpv=/usr/local/lib/pine.conf.fixed ;;
538   *) dpv=${prefix}/lib/pine.conf.fixed ;;
539 esac
540 AC_ARG_WITH(system-fixed-pinerc,
541   AS_HELP_STRING([--with-system-fixed-pinerc=VALUE],[System fixed pinerc (/usr/local/lib/pine.conf.fixed)]),
542     [
543       case "$withval" in
544         no)
545           ;;
546         yes)
547           ;;
548         *)
549           dpv=$withval
550           ;;
551       esac
552     ])
553 AC_DEFINE_UNQUOTED(SYSTEM_PINERC_FIXED, "$dpv", [System fixed pinerc])
555 dnl OPTION: local support information, file that contains information on
556 dnl         how to contact local support for Alpine.
557 dnl NOTE: historically we used /lib for the config dir.
558 dnl       don't ask, it was a long time ago. but, we can't
559 dnl       change it now without breaking compatibility
560 case "$prefix" in
561   NONE) dpv=/usr/local/lib/pine.info ;;
562   *) dpv=${prefix}/lib/pine.info ;;
563 esac
564 AC_ARG_WITH(local-support-info,
565   AS_HELP_STRING([--with-local-support-info=VALUE],[Local Support Info File (/usr/local/lib/pine.info)]),
566     [
567       case "$withval" in
568         no)
569           ;;
570         yes)
571           ;;
572         *)
573           dpv=$withval
574           ;;
575       esac
576     ])
577 AC_DEFINE_UNQUOTED(SYSTEM_PINE_INFO_PATH, "$dpv", [Local Support Info File])
579 dnl Function to simplify setting alpine/pico defaults
580 dnl usage: PINEVAR(configure-name, definition-name, definition-value, help)
581 AC_DEFUN([PINEVAR],
582   [
583     dpv=$3
584     AC_ARG_WITH($1,
585       AS_HELP_STRING([--with-$1=VALUE],[$4 ($3)]),
586       [
587         if test "x$withval" != "xno" ; then
588           dpv=$withval
589         fi
590       ])
591     AC_DEFINE_UNQUOTED($2, "$dpv", [Default configuration value])
592   ])
594 dnl Function to simplify setting pine/pico defaults
595 dnl usage: PINEVAR_UNQUOTED(configure-name, definition-name, definition-value, help)
596 AC_DEFUN([PINEVAR_UNQUOTED],
597   [
598     dpv=$3
599     AC_ARG_WITH($1,
600       AS_HELP_STRING([--with-$1=VALUE],[$4 ($3)]),
601       [
602         if test "x$withval" != "xno" ; then
603           dpv=$withval
604         fi
605       ])
606     AC_DEFINE_UNQUOTED($2, $dpv, [Default configuration value])
607   ])
609 PINEVAR(mailcheck-interval, DF_MAILCHECK, 150, [Specify default mail-check-interval])
610 PINEVAR_UNQUOTED(checkpoint-interval, CHECK_POINT_TIME, 420, [Specify default checkpoint-interval])
611 PINEVAR_UNQUOTED(checkpoint-frequency, CHECK_POINT_FREQ, 12, [State change count before checkpoint])
612 PINEVAR_UNQUOTED(display-rows, DEFAULT_LINES_ON_TERMINAL, 24, [Initial rows on display])
613 PINEVAR_UNQUOTED(display-columns, DEFAULT_COLUMNS_ON_TERMINAL, 80, [Initial columns on display])
614 PINEVAR_UNQUOTED(max-display-rows, MAX_SCREEN_ROWS, 200, [Maximum display rows])
615 PINEVAR_UNQUOTED(max-display-columns, MAX_SCREEN_COLS, 500, [Maximum display columns])
616 PINEVAR(fill-column, DF_FILLCOL, 74, [Default fill column])
617 PINEVAR_UNQUOTED(max_fill-column, MAX_FILLCOL, 80, [Maximum fill column])
618 PINEVAR_UNQUOTED(debug-level, DEFAULT_DEBUG, 2, [Specify default debug verbosity level])
619 PINEVAR_UNQUOTED(debug-files, NUMDEBUGFILES, 4, [Specify number of debug files])
620 PINEVAR(debug-file, DEBUGFILE, [.pine-debug], [Specify debug file name])
621 PINEVAR(forwarded-keyword, FORWARDED_FLAG, ["\$Forwarded"], [IMAP (c-client) keyword to store forwarded status])
622 PINEVAR(display-overlap, DF_OVERLAP, [2], [Lines preserved while paging])
623 PINEVAR(display-margin, DF_MARGIN, [0], [Lines visible while scrolling])
624 PINEVAR(default-fcc, DF_DEFAULT_FCC, [sent-mail], [Default sent mail folder])
625 PINEVAR(default-save-folder, DEFAULT_SAVE, [saved-messages], [Default save folder])
626 PINEVAR(default-legacy-postponed-folder, POSTPONED_MAIL, [postponed-mail], [Pre Pine 3.90 postponed folder])
627 PINEVAR(default-postponed-folder, POSTPONED_MSGS, [postponed-msgs], [Default postponed folder])
628 PINEVAR(default-trash-folder, TRASH_FOLDER, [Trash], [Default Trash folder for Web Alpine])
629 PINEVAR(default-interrupted-mail, INTERRUPTED_MAIL, [.pine-interrupted-mail], [Default folder for interrupted mail])
630 PINEVAR(default-dead-letter-folder, DEADLETTER, [dead.letter], [Default dead letter folder])
631 PINEVAR(default-mail-directory, DF_MAIL_DIRECTORY, [mail], [Default mail directory])
632 PINEVAR(default-inbox-name, INBOX_NAME, [INBOX], [Default inbox name])
633 PINEVAR(default-signature-file, DF_SIGNATURE_FILE, [.signature], [Default signature file])
634 PINEVAR(default-elm-style-save, DF_ELM_STYLE_SAVE, [no], [Default to Elm style save])
635 PINEVAR(default-header-in-reply, DF_HEADER_IN_REPLY, [no], [Include header in reply])
636 PINEVAR(default-old-style-reply, DF_OLD_STYLE_REPLY, [no], [Default to old style reply])
637 PINEVAR(default-use-only-domain-name, DF_USE_ONLY_DOMAIN_NAME, [no], [Default to using only the domain name])
638 PINEVAR(default-save-by-sender, DF_SAVE_BY_SENDER, [no], [Default to save by sender])
639 PINEVAR(default-sort-key, DF_SORT_KEY, [arrival], [Default sort key])
640 PINEVAR(default-addressbook-sort-rule, DF_AB_SORT_RULE, [fullname-with-lists-last], [Default addressbook sort rule])
641 PINEVAR(default-folder-sort-rule, DF_FLD_SORT_RULE, [alphabetical], [Default folder sort rule])
642 PINEVAR(default-saved-message-name-rule, DF_SAVED_MSG_NAME_RULE, [default-folder], [Default saved message name rule])
643 PINEVAR(default-fcc-rule, DF_FCC_RULE, [default-fcc], [Default fcc rule])
644 PINEVAR(default-standard-printer, DF_STANDARD_PRINTER, [lpr], [Default standard printern])
645 PINEVAR(default-ansi-printer, ANSI_PRINTER, [attached-to-ansi], [ANSI printer definition])
646 PINEVAR(default-addressbook, DF_ADDRESSBOOK, [.addressbook], [Default addressbook name])
647 PINEVAR(default-local-fullname, DF_LOCAL_FULLNAME, ["Local Support"], [Default local support fullname])
648 PINEVAR(default-local-address, DF_LOCAL_ADDRESS, [postmaster], [Default local support address])
649 PINEVAR(default-keyboard-lock-count, DF_KBLOCK_PASSWD_COUNT, [1], [Default keyboard lock count])
650 PINEVAR(default-remote-addressbook-history, DF_REMOTE_ABOOK_HISTORY, [3], [Default address book history count])
651 PINEVAR(smime-public-cert-directory, DF_PUBLICCERT_DIR, [.alpine-smime/public], [Default Public Cert Directory])
652 PINEVAR(smime-private-key-directory, DF_PRIVATEKEY_DIR, [.alpine-smime/private], [Default Private Key Directory])
653 PINEVAR(smime-cacert-directory, DF_CACERT_DIR, [.alpine-smime/ca], [Default Cert Authority Directory])
654 PINEVAR_UNQUOTED(default-printer, DF_DEFAULT_PRINTER, [ANSI_PRINTER], [Default printer])
656 AC_DEFINE_UNQUOTED([DF_PUBLIC_CONTAINER], "PublicContainer", [Name of default public container])
657 AC_DEFINE_UNQUOTED([DF_PRIVATE_CONTAINER], "PrivateContainer", [Name of default private container])
658 AC_DEFINE_UNQUOTED([DF_CA_CONTAINER], "CAContainer", [Name of default certificate authority container])
660 dnl set PASSFILE?
661 AC_ARG_WITH(passfile,
662   AS_HELP_STRING([--with-passfile=FILENAME],[Password cache file (recommended when S/MIME is enabled and configured)]),
663     [
664       case "$withval" in
665         no)
666           ;;
667         yes)
668           ;;
669         *)
670           alpine_PASSFILE=$withval
671           ;;
672       esac
673     ])
676 dnl os-specific credential cache?
677 AC_ARG_WITH(local-password-cache,
678  AS_HELP_STRING([--without-local-password-cache],[Disable OS-specific password cache, if supported]),
679    [
680      alpine_os_credential_cache=$withval
681    ])
683 dnl Particular os-specific credential cache?
684 AC_ARG_WITH(local-password-cache-method,
685  AS_HELP_STRING([--with-local-password-cache-method],[OS-specific credential cache (OSX=APPLEKEYCHAIN, Windows=WINCRED)]),
686    [
687      alpine_os_credential_cache_method=$withval
688    ])
690 if test -n "$alpine_PASSFILE" ; then
691   case $alpine_os_credential_cache in
692     no)
693       ;;
694     *)
695       alpine_os_credential_cache="no"
696       AC_MSG_NOTICE([--with-passfile definition overrides OS-Specific password caching])
697       ;;
698   esac
699   AC_DEFINE_UNQUOTED([PASSFILE], "$alpine_PASSFILE", [Password cache file (recommended if S/MIME is enabled and configured)])
702 dnl set DF_SSHPATH?
703 AC_ARG_WITH(default-sshpath,
704   AS_HELP_STRING([--with-default-sshpath=FILENAME],[set default value of ssh command path (defining should cause ssh to be preferred to rsh)]),
705     [
706       case "$withval" in
707         no)
708           ;;
709         yes)
710           ;;
711         *)
712           AC_DEFINE_UNQUOTED([DF_SSHPATH], "$withval", [set default value of ssh command path (defining should cause ssh to be preferred to rsh)])
713           ;;
714       esac
715     ])
717 dnl set DF_SSHCMD?
718 AC_ARG_WITH(default-sshcmd,
719   AS_HELP_STRING([--with-default-sshcmd=PERCENT_S_STRING],[set default value of ssh command string (usually "%s %s -l %s exec /etc/r%sd")]),
720     [
721       case "$withval" in
722         no)
723           ;;
724         yes)
725           ;;
726         *)
727           AC_DEFINE_UNQUOTED([DF_SSHCMD], "$withval", [set default value of ssh command string (usually "%s %s -l %s exec /etc/r%sd")])
728           ;;
729       esac
730     ])
732 dnl Include SSL?
733 dnl Set SSLDIR for c-client make
734 AC_ARG_WITH(ssl,
735   AS_HELP_STRING([--without-ssl],[Disable SSL support (OpenSSL)]),
736   [ with_ssl=$withval ])
738 if test "x$with_ssl" = "xno" ; then
739   alpine_SSLTYPE="none"
740 elif test -d /usr/local/ssl ; then
741 dnl When the system has openssl installed in its default location
742 dnl instead of the one used by the distribution assume that this
743 dnl is the one intended to be used.
744   alpine_SSLDIR="/usr/local/ssl"
745   alpine_SSLINCLUDE="$alpine_SSLDIR/include" 
746   alpine_SSLLIB="$alpine_SSLDIR/lib"
747 else
748   dnl preload c-client default locations/options
749   case $host in
750     *-linux-gnu*|*-k*bsd*-gnu*|*-gnu*)
751       if test -f /etc/fedora-release -o -f /etc/redhat-release -o -f /etc/redhat_version ; then  
752         alpine_SSLTYPE="nopwd"
753         if test -d /etc/pki/tls ; then  
754           alpine_SSLDIR="/etc/pki/tls"
755         else
756           alpine_SSLDIR="/usr/share/ssl"
757         fi
758         alpine_SSLCERTS="$alpine_SSLDIR/certs"
759         alpine_SSLKEYS="$alpine_SSLDIR/private"
760         alpine_SSLINCLUDE="/usr/include/openssl" 
761         alpine_SSLLIB="/usr/lib"
762       elif test -f /etc/mandrake-release ; then
763         alpine_SSLDIR="/usr/lib/ssl"
764         alpine_SSLCERTS="$alpine_SSLDIR/certs" 
765         alpine_SSLKEYS="$alpine_SSLDIR/private"
766         alpine_SSLINCLUDE="/usr/include/openssl" 
767         alpine_SSLLIB="/usr/lib"
768       elif test -f /etc/SuSE-release ; then
769         alpine_SSLTYPE="nopwd"
770         alpine_SSLDIR="/etc/ssl"
771         alpine_SSLCERTS="$alpine_SSLDIR/certs"
772         alpine_SSLKEYS="$alpine_SSLDIR/private"
773         alpine_SSLINCLUDE="/usr/include/openssl" 
774         alpine_SSLLIB="/usr/lib"
775       elif test -d /etc/osso-af-init ; then
776         alpine_SSLTYPE="nopwd"
777         alpine_SSLDIR="/usr"
778         alpine_SSLCERTS="/usr/share/certs"
779         alpine_SSLINCLUDE="/usr/include/openssl"
780         alpine_SSLLIB="/usr/lib"
781       elif test -f /etc/debian_release -o -f /etc/debian_version ; then
782         if test ! -d /etc/osso-af-init ; then
783            alpine_SSLDIR="/etc/ssl"
784            alpine_SSLCERTS="$alpine_SSLDIR/certs"
785            alpine_SSLKEYS="$alpine_SSLDIR/private"
786            alpine_SSLINCLUDE="/usr/include/openssl" 
787            alpine_SSLLIB="/usr/lib"
788         fi
789       elif test -f /etc/manjaro-release ; then
790            alpine_SSLDIR="/etc/ssl"
791            alpine_SSLCERTS="$alpine_SSLDIR/certs"
792            alpine_SSLKEYS="$alpine_SSLDIR/private"
793            alpine_SSLINCLUDE="/usr/include/openssl" 
794            alpine_SSLLIB="/usr/lib"
795       else
796         alpine_SSLTYPE="nopwd"
797         alpine_SSLDIR="/usr"
798         alpine_SSLCERTS="/etc/ssl/certs"
799       fi
800       ;;
801     *-apple-darwin*)
802       alpine_SSLTYPE="nopwd"
803 dnl Originally this is where certs are, and they might still be there, even
804 dnl after installing Homebrew, MacPorts or Fink. We will use it if we cannot
805 dnl find it anywhere else.
806       alpine_SSLCERTS_ORIG="/System/Library/OpenSSL/certs"
807       if test -d /usr/local/opt/openssl ; then
808         alpine_SSLDIR="/usr/local/opt/openssl"
809         alpine_SSLINCLUDE="$alpine_SSLDIR/include"
810         alpine_SSLLIB="$alpine_SSLDIR/lib"
811         alpine_SSLCERTS="/usr/local/etc/openssl"
812         alpine_SSLKEYS="$alpine_SSLDIR/private"
813       elif test -d /opt/local/etc/openssl ; then
814         alpine_SSLDIR="/opt/local"
815         alpine_SSLINCLUDE="$alpine_SSLDIR/include"
816         alpine_SSLLIB="$alpine_SSLDIR/lib"
817         alpine_SSLCERTS="/opt/local/etc/openssl/certs"
818         alpine_SSLKEYS="/opt/local/etc/openssl/private"
819       elif test -d /sw/etc/ssl ; then
820         alpine_SSLDIR="/sw/etc/ssl"
821         alpine_SSLINCLUDE="/sw/include"
822         alpine_SSLLIB="/sw/lib"
823         alpine_SSLCERTS="/sw/etc/ssl/certs"
824         alpine_SSLKEYS="/sw/etc/ssl/private"
825       elif test -d /usr/local/ssl ; then
826         alpine_SSLDIR="/usr/local/ssl"
827       elif test -d /System/Library/OpenSSL ; then
828         alpine_SSLDIR="/System/Library/OpenSSL"
829         alpine_SSLCERTS="$alpine_SSLDIR/certs"
830         alpine_SSLKEYS="$alpine_SSLDIR/private"
831         alpine_SSLLIB="/usr/lib"
832         alpine_SSLINCLUDE="/usr/include/openssl"
833       fi
834       ;;
835     *-*-netbsd*)
836         alpine_SSLDIR="/etc/openssl"
837         alpine_SSLCERTS="$alpine_SSLDIR/certs"
838         alpine_SSLKEYS="$alpine_SSLDIR/private"
839         alpine_SSLINCLUDE="/usr/include/openssl"
840         alpine_SSLLIB="/usr/lib"
841       ;;
842     *-*-dragonfly*)
843         alpine_SSLDIR="/etc/openssl"
844         alpine_SSLCERTS="$alpine_SSLDIR/certs"
845         alpine_SSLKEYS="$alpine_SSLDIR/private"
846         alpine_SSLINCLUDE="/usr/include/openssl"
847         alpine_SSLLIB="/usr/lib"
848       ;;
849     *-openbsd*)
850         alpine_SSLTYPE="nopwd"
851         alpine_SSLDIR="/usr"
852         alpine_SSLCERTS="/etc/ssl/certs"
853       ;;
854     *-*-freebsd*)
855         alpine_SSLDIR="/etc/ssl"
856         alpine_SSLCERTS="$alpine_SSLDIR/certs"
857         alpine_SSLKEYS="$alpine_SSLDIR/private"
858         if test -d /usr/local/include/openssl ; then
859           alpine_SSLINCLUDE="/usr/local/include/openssl" 
860           alpine_SSLLIB="/usr/local/lib"
861         else
862           alpine_SSLINCLUDE="/usr/include/openssl" 
863           alpine_SSLLIB="/usr/lib"
864         fi
865       ;;
866     *-*-openbsd*)
867         alpine_SSLDIR="/etc/ssl"
868         alpine_SSLINCLUDE="/usr/include/openssl"
869         alpine_SSLLIB="/usr/lib"
870         alpine_SSLCERTS="/etc/ssl" 
871         alpine_SSLKEYS="/etc/ssl/private"
872       ;;
873     *-*-cygwin)
874         alpine_SSLDIR="/usr/ssl"
875         alpine_SSLCERTS="$alpine_SSLDIR/certs" 
876         alpine_SSLKEYS="$alpine_SSLDIR/certs"
877         alpine_SSLINCLUDE="/usr/include/openssl" 
878         alpine_SSLLIB="/usr/lib"
879       ;;
880     *-sco-sysv* | *-sysv*UnixWare | *-sysv*OpenUNIX)
881         alpine_SSLTYPE="sco.nopwd"
882         alpine_SSLDIR="/usr/local/ssl"
883       ;;
884     *-*-solaris*)
885       if test -d /usr/include/openssl ; then
886         alpine_SSLINCLUDE="/usr/include/openssl" 
887       elif test -d /usr/sfw/include/openssl ; then
888         alpine_SSLDIR="/usr/sfw"
889       elif test -d /opt/csw/include/openssl ; then
890         alpine_SSLDIR="/opt/csw"
891         if test -d /opt/csw/ssl/certs ; then
892           alpine_SSLCERTS="/opt/csw/ssl/certs"
893         fi
894       fi
895       if test -z "$alpine_SSLCERTS" -a -d /etc/certs ; then
896         alpine_SSLCERTS="/etc/certs"
897       fi
898       ;;
899     *)
900       alpine_SSLTYPE="nopwd"
901       alpine_SSLDIR="/usr/local/ssl"
902       ;;
903   esac
906 if test "x$alpine_SSLTYPE" != "xnone" ; then
907   AC_ARG_WITH(ssl-dir,
908     AS_HELP_STRING([--with-ssl-dir=DIR],[Root of SSL lib/include path]),
909     [
910       if test "x$withval" != "xno" ; then
911         alpine_SSLDIR=$withval
912         alpine_SSLINCLUDE=$alpine_SSLDIR/include
913         alpine_SSLLIB=$alpine_SSLDIR/lib
914       fi
915     ])
917   AC_ARG_WITH(ssl-certs-dir,
918     AS_HELP_STRING([--with-ssl-certs-dir=DIR],[Path to SSL certificate directory]),
919     [
920       if test "x$withval" != "xno" ; then
921         alpine_SSLCERTS=$withval
922       fi
923     ])
925   AC_ARG_WITH(ssl-include-dir,
926     AS_HELP_STRING([--with-ssl-include-dir=DIR],[SSL include file path]),
927     [
928       if test "x$withval" != "xno" ; then
929         alpine_SSLINCLUDE=$withval
930       fi
931     ])
933   AC_ARG_WITH(ssl-lib-dir,
934     AS_HELP_STRING([--with-ssl-lib-dir=DIR],[SSL library path]),
935     [
936       if test "x$withval" != "xno" ; then
937         alpine_SSLLIB=$withval
938       fi
939     ])
941   dnl setup globals so tests below work
942   if test -n "$alpine_SSLINCLUDE" ; then
943     CPPFLAGS="-I$alpine_SSLINCLUDE $CPPFLAGS"
944   elif test -n "$alpine_SSLDIR" ; then
945     CPPFLAGS="-I${alpine_SSLDIR}/include $CPPFLAGS"
946   fi
947   if test -n "$alpine_SSLLIB" ; then
948     LDFLAGS="-L$alpine_SSLLIB $LDFLAGS"
949   elif test -n "$alpine_SSLDIR" ; then
950     LDFLAGS="-L${alpine_SSLDIR}/lib $LDFLAGS"
951   fi
954 if test "x$alpine_SSLTYPE" != "xnone" ; then
955   alpine_default_SSLMIN="no_min"
956   alpine_default_SSLMAX="no_max"
957   alpine_default_RANGE="${alpine_default_SSLMIN},${alpine_default_SSLMAX}"
958   alpine_ENCRYPTION="$alpine_default_SSLMIN ssl3 tls1 tls1_1 tls1_2 tls1_3 $alpine_default_SSLMAX"
959   alpine_SSLMIN="$alpine_default_SSLMIN"
960   alpine_SSLMAX="$alpine_default_SSLMAX"
961   alpine_RANGE="$alpine_default_RANGE"
962   AC_ARG_WITH(encryption-minimum-version,
963     AS_HELP_STRING([--encryption-minimum-version=VERSION],[Minimum SSL encryption version. Default: no_min]),
964     [
965       if test "x$withval" != "xno" ; then
966         alpine_SSLMIN=$withval
967       fi
968     ])
969   AC_ARG_WITH(encryption-maximum-version,
970     AS_HELP_STRING([--encryption-maximum-version=VERSION],[Maximum SSL encryption version. Default: no_max]),
971     [
972       if test "x$withval" != "xno" ; then
973         alpine_SSLMAX=$withval
974       fi
975     ])
976   alpine_RANGE="$alpine_SSLMIN $alpine_SSLMAX"
977   for range in ${alpine_RANGE} ; do
978       for encryption in ${alpine_ENCRYPTION} ; do
979           if test "x$range" = "x$encryption" ; then
980              if test -z $alpine_min ; then
981                 alpine_min="yes"
982              else
983                 alpine_max="yes"
984              fi
985           fi
986       done
987   done
989   if test -z $alpine_max ; then
990      AC_MSG_ERROR(Unrecognized maximum encryption version: $alpine_max)
991   fi
993   if test -z $alpine_min ; then
994      AC_MSG_ERROR(Unrecognized minimum encryption version: $alpine_min)
995   fi
997   if test "x$alpine_SSLMIN" != "x$alpine_SSLMAX" ; then
998      alpine_RANGE_FEASIBLE=`echo "$alpine_ENCRYPTION" | sed "s/^.*$alpine_SSLMIN//" | grep "$alpine_SSLMAX"`
999      if test -n "$alpine_RANGE_FEASIBLE" ; then
1000         alpine_RANGE="${alpine_SSLMIN},${alpine_SSLMAX}"
1001      else
1002         AC_MSG_WARN(Reversing order of minimum and maximum encryption)
1003         alpine_RANGE="${alpine_SSLMAX},${alpine_SSLMIN}"
1004      fi
1005   else
1006      if test "x$alpine_SSLMIN" = "x$alpine_default_SSLMIN" ; then
1007         AC_MSG_WARN(Overriding maximum encryption to default)
1008         alpine_SSLMAX="$alpine_default_SSLMAX"
1009      fi
1010      if test "x$alpine_SSLMAX" = "x$alpine_default_SSLMAX" ; then
1011         AC_MSG_WARN(Overriding minimum encryption to default)
1012         alpine_SSLMIN="$alpine_default_SSLMIN"
1013      fi
1014      alpine_RANGE="${alpine_SSLMIN},${alpine_SSLMAX}"
1015   fi
1016 PINEVAR(encryption-range, DF_ENCRYPTION_RANGE, [$alpine_RANGE] , [Default Encryption Range])
1019 dnl Include Kerberos?
1020 dnl Set GSSDIR for c-client make
1021 AC_ARG_WITH(krb5,
1022   AS_HELP_STRING([--without-krb5],[Disable Kerberos support]),
1023   [ with_krb5=$withval ])
1025 if test "x$with_krb5" = "xno" ; then
1026   alpine_GSSTYPE="none"
1027 else
1028   alpine_GSSTYPE=
1030   AC_ARG_WITH(krb5-dir,
1031     AS_HELP_STRING([--with-krb5-dir=DIR],[Root of Kerberos lib/include path]),
1032     [
1033       if test "x$withval" != "xno" ; then
1034         CPPFLAGS="$CPPFLAGS -I${withval}/include"
1035         LDFLAGS="$LDFLAGS -L${withval}/lib"
1036       fi
1037     ])
1039   AC_ARG_WITH(krb5-include-dir,
1040     AS_HELP_STRING([--with-krb5-include-dir=DIR],[Kerberos include file path]),
1041     [
1042       if test "x$withval" != "xno" ; then
1043         CPPFLAGS="$CPPFLAGS -I$withval"
1044       fi
1045     ])
1047   AC_ARG_WITH(krb5-lib-dir,
1048     AS_HELP_STRING([--with-krb5-lib-dir=DIR],[Kerberos library path]),
1049     [
1050       if test "x$withval" != "xno" ; then
1051         LDFLAGS="$LDFLAGS -L$withval"
1052       fi
1053     ])
1056 dnl Include LDAP?
1057 AC_ARG_WITH(ldap,
1058   AS_HELP_STRING([--without-ldap],[Disable LDAP query support]),
1059   [ with_ldap=$withval ])
1061 if test "x$with_ldap" = "xno" ; then
1062   alpine_with_ldap=
1063   AC_MSG_NOTICE([Excluding LDAP Support])
1064 else
1065   dnl Do stuff to figure out where OpenLDAP is
1067   case $host in
1068     *-*-freebsd*)
1069         alpine_LDAPDIR="/usr/local"
1070         alpine_LDAPINCLUDE="${alpine_LDAPDIR}/include"
1071         alpine_LDAPLIB="${alpine_LDAPDIR}/lib"
1072         ;;
1073   esac;
1075   alpine_with_ldap=yes
1077   AC_ARG_WITH(ldap-dir,
1078     AS_HELP_STRING([--with-ldap-dir=DIR],[Root of LDAP lib/include path]),
1079     [
1080       if test "x$withval" != "xno" ; then 
1081         alpine_LDAPDIR="${withval}"
1082         alpine_LDAPINCLUDE="${alpine_LDAPDIR}/include"
1083         alpine_LDAPLIB="${alpine_LDAPDIR}/lib"
1084       fi
1085     ])
1087   AC_ARG_WITH(ldap-include-dir,
1088     AS_HELP_STRING([--with-ldap-include-dir=DIR],[Directory containing LDAP include files]),
1089     [
1090       if test "x$withval" != "xno" ; then
1091         alpine_LDAPINCLUDE="$withval"
1092       fi
1093     ])
1095   AC_ARG_WITH(ldap-lib-dir,
1096     AS_HELP_STRING([--with-ldap-lib-dir=DIR],[LDAP library path]),
1097     [
1098       if test "x$withval" != "xno" ; then
1099         alpine_LDAPLIB="${withval}"
1100       fi
1101     ])
1103    if test -n "$alpine_LDAPINCLUDE" ; then
1104         CPPFLAGS="$CPPFLAGS -I${alpine_LDAPINCLUDE}/include"
1105    fi
1106    if test -n "$alpine_LDAPLIB" ; then
1107         LDFLAGS="$LDFLAGS -L${alpine_LDAPLIB}/lib"
1108    fi
1111 dnl Include SMIME?
1112 AC_ARG_WITH(smime,
1113   AS_HELP_STRING([--without-smime],[Disable S/MIME]),
1114   [ with_smime=$withval ])
1116 dnl Include TCL?
1117 AC_ARG_WITH(tcl,
1118   AS_HELP_STRING([--without-tcl],[Disable TCL, thus Web Alpine support]),
1119   [ with_tcl=$withval ])
1121 if test "x$with_tcl" = "xno" ; then
1122   WEB_BUILD=
1123   AC_MSG_NOTICE([Excluding TCL Support, and thus Web Alpine Support])
1124 else
1125   AC_ARG_WITH(tcl-lib-dir,
1126     AS_HELP_STRING([--with-tcl-lib-dir=PATH],[Specific TCL Librar dir, like \"/usr/opt/tcl86/lib\"]),
1127     [
1128       if test "x$withval" != "xno" ; then 
1129         alpine_TCLLIBDIR=$withval
1130         if test -n "$alpine_TCLLIBDIR" ; then
1131            LDFLAGS="-L$alpine_TCLLIBDIR $LDFLAGS"
1132         fi
1133       fi
1134     ])
1135   AC_ARG_WITH(tcl-lib,
1136     AS_HELP_STRING([--with-tcl-lib=LIBRARY],[Specific TCL Library, like \"tcl8.6\"]),
1137     [
1138       if test "x$withval" != "xno" ; then 
1139         alpine_TCLLIB=$withval
1140       fi
1141     ])
1142   AC_ARG_WITH(tcl-include,
1143     AS_HELP_STRING([--with-tcl-include=DIR],[Directory containing TCL include files]),
1144     [
1145       if test "x$withval" != "xno" ; then
1146         CPPFLAGS="$CPPFLAGS -I$withval"
1147         alpine_TCLINC=$withval
1148       fi
1149     ])
1152 AC_ARG_WITH(supplied-regex,
1153   AS_HELP_STRING([--with-supplied-regex],[Use regex library supplied with alpine]),
1154   [ alpine_REGEX=$withval ])
1156 AC_ARG_WITH(pthread,
1157   AS_HELP_STRING([--without-pthread],[Do NOT test for nor build with POSIX thread support]),
1158   [ with_pthread=$withval ])
1160 AC_ARG_WITH(system-mail-directory,
1161   AS_HELP_STRING([--with-system-mail-directory=DIR],[Directory where local mail is delivered]),
1162   [
1163     if test "x$withval" != "xno" ; then
1164       alpine_with_local_maildir="$withval"
1165     fi
1166   ])
1168 AC_ARG_WITH(c-client-target,
1169   AS_HELP_STRING([--with-c-client-target=TARGET],[IMAP build target (see imap/Makefile)]),
1170   [
1171     if test "x$withval" != "xno" ;then
1172       alpine_with_c_client_target="$withval"
1173     fi
1174   ])
1177 dnl Assume PAM is *not* required and only set the systems that need it.
1178 alpine_PAM="none"
1180 dnl HOST-OS SPECIFIC DEFINITIONS
1181 dnl Tests and assignments below are mostly to coax the appropriate
1182 dnl build from c-client.  Most of this will go away when c-client
1183 dnl adopts configure
1184 case "$host" in
1185   *-linux-gnu*|*-k*bsd*-gnu*|*-gnu*)
1186     alpine_path_delim="/"
1187     alpine_mode_readonly="(0600)"
1188     if test -f /etc/fedora-release ; then  
1189       systype="LFD"
1190       alpine_PAM="yes"
1191       if test -d /etc/pki/tls ; then  
1192         alpine_c_client_target="lfd"
1193       else
1194         alpine_c_client_target="lrh"
1195       fi
1196     elif test -f /etc/mandrake-release ; then
1197       systype="LMD"
1198       alpine_c_client_target="lmd"
1199       alpine_PAM="yes"
1200     elif test -f /etc/redhat-release -o -f /etc/redhat_version ; then
1201       systype="LRH"
1202       alpine_PAM="yes"
1203       if test -d /etc/pki/tls ; then  
1204         alpine_c_client_target="lr5"
1205       else
1206         alpine_c_client_target="lrh"
1207       fi
1208     elif test -f /etc/debian_release -o -f /etc/debian_version ; then
1209       if test -d /etc/osso-af-init ; then
1210         systype="LN8"
1211         alpine_c_client_target="ln8"
1212       else
1213         systype="DEB"
1214         alpine_c_client_target="ldb"
1215         alpine_PAM="yes"
1216       fi
1217     elif test -f /etc/SuSE-release ; then
1218       systype="LSU"
1219       alpine_c_client_target="lsu"
1220       alpine_PAM="yes"
1221     else
1222       systype="LNX"
1223       AC_CHECK_LIB(pam, pam_start,
1224         [
1225           alpine_c_client_target="lnp"
1226           alpine_PAM="yes"
1227         ],
1228         [
1229           if test -f /etc/shadow ; then
1230             alpine_c_client_target="slx"
1231           else
1232             alpine_c_client_target="lnx"
1233           fi
1234         ])
1235     fi
1236     ;;
1237   *-apple-darwin*)
1238     systype="OSX"
1239     alpine_path_delim="/"
1240     alpine_mode_readonly="(0600)"
1241     LIBS="$LIBS -framework Carbon -framework ApplicationServices -framework Security"
1242     AM_CFLAGS="$AM_CFLAGS -Dbsd"
1243     dnl SEE include/system.h
1244     AC_DEFINE([OSX_TARGET],[1],[OSX TARGET])
1245     case "$alpine_os_credential_cache" in
1246       no)
1247         ;;
1248       *)
1249         AC_DEFINE([APPLEKEYCHAIN], [1], [Use Apple OS X key chain for credential caching])
1250         ;;
1251     esac
1252     AC_CHECK_LIB(pam, pam_start,
1253       [
1254         AC_CHECK_HEADER([security/pam_appl.h],
1255         [
1256           alpine_PAM="yes"
1257           alpine_c_client_target="oxs"
1258         ],
1259         [       AC_CHECK_HEADER([pam/pam_appl.h],
1260                 [
1261                    alpine_PAM="yes"
1262                    alpine_c_client_target="oxp" 
1263                 ],
1264                 [
1265                   alpine_PAM="none"
1266                   alpine_pam_none_reason="header files not found"
1267                 ])
1268         ])
1269       ],
1270       [
1271         alpine_c_client_target="osx"
1272       ])
1273     ;;
1274   *-*-solaris*)
1275     if test x$GCC = "xyes" ; then
1276       systype="GSO"
1277       alpine_c_client_target="gso"
1278       CFLAGS="$CFLAGS -D__USE_LEGACY_PROTOTYPES__"
1279     else
1280       systype="SOC"
1281       alpine_c_client_target="soc"
1282       AC_DEFINE([__EXTENSIONS__], [1], [Enable extended pthread features on Solaris])
1283     fi
1284     alpine_path_delim="/"
1285     alpine_mode_readonly="(0600)"
1286     dnl possible other OS's need this.
1287     dnl Use autoconf 2.61's AC_USE_SYSTEM_EXTENSIONS at some point
1288     ;;
1289   *-*-sunos4*)
1290     systype="SUN"
1291     alpine_path_delim="/"
1292     alpine_mode_readonly="(0600)"
1293     alpine_c_client_target="s40"
1294     ;;
1295   *-*-sco3.2v5*)
1296     if test x$GCC = "xyes" ; then
1297       systype="GO5"
1298       alpine_c_client_target="go5"
1299     else
1300       systype="SC5"
1301       alpine_c_client_target="sc5"
1302     fi
1303     alpine_path_delim="/"
1304     alpine_mode_readonly="(0600)"
1305     dnl possible other OS's need this.
1306     dnl Use autoconf 2.61's AC_USE_SYSTEM_EXTENSIONS at some point
1307     ;;
1308   *-next-*)
1309     systype="NXT"
1310     alpine_path_delim="/"
1311     alpine_mode_readonly="(0600)"
1312     alpine_c_client_target="nx3"
1313     ;;
1314   *-*-netbsd*)
1315     systype="NEB"
1316     alpine_path_delim="/"
1317     alpine_mode_readonly="(0600)"
1318     alpine_c_client_target="neb"
1319     ;;
1320   *-*-dragonfly*)
1321     systype="DFB"
1322     alpine_path_delim="/"
1323     alpine_mode_readonly="(0600)"
1324     alpine_c_client_target="neb"
1325     ;;
1326   *-*-bsdi*)
1327     systype="BSI"
1328     alpine_path_delim="/"
1329     alpine_mode_readonly="(0600)"
1330     alpine_c_client_target="bsi"
1331     ;;
1332   *-*-freebsd*)
1333     systype="BSF"
1334     alpine_path_delim="/"
1335     alpine_mode_readonly="(0600)"
1336     alpine_c_client_target="bsf"
1337     LIBS="$LIBS $LIBINTL"
1338     ;;
1339   *-*-openbsd*)
1340     systype="BSO"
1341     alpine_path_delim="/"
1342     alpine_mode_readonly="(0600)"
1343     alpine_c_client_target="bso"
1344     LIBS="$LIBS $LIBINTL"
1345     ;;
1346   *-*-aix5*)
1347     systype="A52"
1348     alpine_path_delim="/"
1349     alpine_mode_readonly="(0600)"
1350     alpine_c_client_target="a52"
1351     ;;
1352   *-*-aix4*)
1353     systype="A41"
1354     alpine_path_delim="/"
1355     alpine_mode_readonly="(0600)"
1356     alpine_c_client_target="a41"
1357     ;;
1358   *-*-aix3*)
1359     systype="A32"
1360     alpine_path_delim="/"
1361     alpine_mode_readonly="(0600)"
1362     alpine_c_client_target="a32"
1363     ;;
1364   *-*UNIX_SV | *-*-sysv5UnixWare7* | *-*OpenUNIX*)
1365     systype="UW2"
1366     alpine_path_delim="/"
1367     alpine_mode_readonly="(0600)"
1368     alpine_c_client_target="uw2"
1369     ;;
1370   *-*-osf5*)
1371     systype="OSF"
1372     alpine_path_delim="/"
1373     alpine_mode_readonly="(0600)"
1374     alpine_c_client_target="osf"
1375     ;;
1376   *-*-cygwin)
1377     systype="CYG"
1378     alpine_path_delim="/"
1379     alpine_mode_readonly="(S_IREAD | S_IWRITE)"
1380     alpine_c_client_target="cyg"
1381     LIBS="$LIBS $LIBINTL"
1382     ;;
1383   windows* | *-*-pw32*)
1384     systype="WNT"
1385     alpine_path_delim="\\"
1386     alpine_mode_readonly="(S_IREAD | S_IWRITE)"
1387     alpine_c_client_target="wnt"
1388     AC_DEFINE([_WINDOWS], [1], [Windows is just too different])
1389     ;;
1390   *)
1391     AC_MSG_ERROR(Unrecognized system: $host)
1392     ;;
1393 esac
1395 dnl Without IPv6?
1396 AC_ARG_WITH(ipv6,
1397   AS_HELP_STRING([--without-ipv6],[Disable IPv6, primarily to work around resolver problems]),
1398   [ with_ipv6=$withval ])
1400 if test "x$with_ipv6" = "xno" ; then
1401   AC_MSG_NOTICE([Excluding IPv6 Support])
1402   c_client_specials="${c_client_specials}IP6=4 "
1403   c_client_ip6="true"
1404 else
1405   c_client_ip6="touch imap/ip6"
1409 dnl CHECK LIBRARIES
1411 if test x$enable_dmalloc = "xyes" ; then
1412   if test "x$with_pthread" = "xyes" ; then
1413     dmalloc_lib=dmallocth
1414   else
1415     dmalloc_lib=dmalloc
1416   fi
1418   AC_CHECK_LIB($dmalloc_lib,dmalloc_shutdown,,
1419     [
1420       AC_MSG_ERROR($dmalloc_lib requested, but -ldmalloc not found)
1421     ])
1424 dnl which terminal cabability database
1425 AC_CHECK_LIB(tinfo, setupterm,
1426   [
1427     alpine_termdata=info
1428     LIBS="$LIBS -ltinfo"
1429   ],
1430   [
1431     AC_CHECK_LIB(ncurses, setupterm,
1432       [
1433         alpine_termdata=info
1434         LIBS="$LIBS -lncurses"
1435       ],
1436       [
1437         AC_CHECK_LIB(curses, setupterm,
1438           [
1439             alpine_termdata=info
1440             LIBS="$LIBS -lcurses"
1441           ],
1442           [
1443             AC_CHECK_LIB(termlib, tgetent,
1444               [
1445                 alpine_termdata=cap
1446                 LIBS="$LIBS -ltermlib"
1447               ],
1448               [
1449                 AC_CHECK_LIB(termcap, tgetent,
1450                   [
1451                     alpine_termdata=cap
1452                     LIBS="$LIBS -ltermcap"
1453                   ],
1454                   [
1455                     AC_MSG_ERROR(Terminfo/termcap not found)
1456                   ])
1457               ])
1458           ])
1459       ])
1460   ])
1461 case $alpine_termdata in
1462   info)
1463     AC_DEFINE(HAS_TERMINFO, [1], [Define if systems uses terminfo terminal database])
1464     ;;
1465   cap)
1466     AC_DEFINE(HAS_TERMCAP, [1], [Define if systems uses termcap terminal database])
1467     ;;
1468 esac
1470 dnl is -ldl present? if so, add it
1471 AC_SEARCH_LIBS([dlopen], [dl dld],, [ alpine_DL="none" ])
1472 if test "x$alpine_DL" = "xnone" ; then
1473     AC_MSG_ERROR([No library containing dlopen found])
1474     exit 1      
1477 dnl Check if openssl = LibreSSL
1478 if test "x$alpine_SSLTYPE" != "xnone" ; then
1479   AC_MSG_CHECKING([if OpenSSL is LibreSSL])
1480   AC_TRY_COMPILE([
1481 #include <stdio.h>
1482 #include <stdlib.h>
1483 #if HAVE_STDINT_H
1484 #include <stdint.h>
1485 #endif /* HAVE_STDINT_H */
1486 #include <openssl/ssl.h>
1487         ],[
1488 #if OPENSSL_VERSION_NUMBER != 0x20000000L
1489 #error
1490 #endif
1491         ],
1492         [ AC_MSG_RESULT(yes)
1493           alpine_SSLPROVIDER="libressl"
1494         ],
1495         [ AC_MSG_RESULT(no)
1496         ],
1497         [ AC_MSG_WARN([cross compiling: not checking])])
1500 dnl Check Openssl/LibreSSL version first
1501 if test "x$alpine_SSLTYPE" != "xnone" -a "x$alpine_SSLPROVIDER" != "xlibressl" ; then
1502   AC_MSG_CHECKING([Openssl library version >= 1.0.0c])
1503   AC_TRY_COMPILE([
1504 #include <stdio.h>
1505 #include <stdlib.h>
1506 #if HAVE_STDINT_H
1507 #include <stdint.h>
1508 #endif /* HAVE_STDINT_H */
1509 #include <openssl/ssl.h>
1510         ],[
1511 #if OPENSSL_VERSION_NUMBER < 0x1000003fL
1512 #error
1513 #endif
1514         ],
1515         [ AC_MSG_RESULT(yes) 
1516           alpine_SSLPROVIDER="openssl"
1517         ],
1518         [ alpine_SSLTYPE="none" ],
1519         [ AC_MSG_WARN([cross compiling: not checking])])
1521     if test "x$alpine_SSLTYPE" = "xnone" ; then
1522         AC_MSG_ERROR(Install openssl version >= 1.0.0c)
1523         exit 1
1524     fi
1527 dnl Now check if we are working with version 1.1.0 of openssl
1528 if test "x$alpine_SSLTYPE" != "xnone" -a "x$alpine_SSLPROVIDER" != "xlibressl" ; then
1529   AC_MSG_CHECKING([Openssl library version >= 1.1.0])
1530   AC_TRY_COMPILE([
1531 #include <stdio.h>
1532 #include <stdlib.h>
1533 #if HAVE_STDINT_H
1534 #include <stdint.h>
1535 #endif /* HAVE_STDINT_H */
1536 #include <openssl/ssl.h>
1537         ],[
1538 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1539 #error
1540 #endif
1541         ],
1542         [ AC_MSG_RESULT(yes)
1543           alpine_SSLVERSION="new"
1544           CFLAGS="$CFLAGS -DOPENSSL_1_1_0 -DOPENSSL_API_COMPAT=0x10100000L"
1545         ],
1546         [ AC_MSG_RESULT(no)
1547           alpine_SSLVERSION="old" ],
1548         [ AC_MSG_WARN([cross compiling: not checking])])
1551 dnl Crypto support is needed 
1552 if test "x$alpine_SSLTYPE" != "xnone" ; then
1553   if test "x$alpine_SSLVERSION" = "xold" -o "x$alpine_SSLPROVIDER" = "xlibressl" ; then
1554      AC_SEARCH_LIBS(SSLeay,crypto,, [ alpine_CRYPTO="none" ])
1555   else
1556      AC_SEARCH_LIBS(OpenSSL_version_num,crypto,, [ alpine_CRYPTO="none" ])
1557   fi
1558   if test "x$alpine_CRYPTO" = "xnone" ; then
1559      AC_MSG_ERROR(crypto library NOT found)
1560      exit 1
1561   fi
1562   case $host in
1563     *-*-cygwin)
1564         AC_CHECK_HEADER(crypto.h, , [ alpine_CRYPTO_DEVEL="none" ])
1565         if test "x$alpine_CRYPTO_DEVEL" = "xnone" ; then
1566            AC_MSG_ERROR(crypto library file crypto.h NOT found. Install correspoding libcrypt-devel package)
1567            exit 1
1568         fi
1569         ;;
1570     *)  ;;
1571    esac
1574 dnl provide SSL support?
1575 if test "x$alpine_SSLTYPE" != "xnone" ; then
1576   if test "x$alpine_SSLVERSION" = "xold" -o "x$alpine_SSLPROVIDER" = "xlibressl" ; then
1577      AC_SEARCH_LIBS(SSL_library_init,ssl,,[ alpine_SSLTYPE="none" ])
1578      if test "x$alpine_SSLTYPE" = "xnone" ; then
1579         AC_MSG_ERROR(No library containing SSL_library_init found in your path)
1580         exit 1
1581      fi
1582   else
1583      AC_SEARCH_LIBS(OPENSSL_init_ssl,ssl,, [ alpine_SSLTYPE="none" ])
1584      if test "x$aalpiLlpine_SSLTYPE" = "xnone" ; then
1585         AC_MSG_ERROR(No library containing OPENSSL_init_ssl found in your path)
1586         exit 1
1587      fi
1588   fi
1591 dnl provide LDAP support?
1592 if test "$alpine_with_ldap" = "yes" ; then
1593   alpine_has_ldap=
1594   AC_CHECK_LIB(lber, ber_alloc,
1595     [
1596       LIBS="$LIBS -llber"
1597     ])
1598   AC_SEARCH_LIBS(ldap_initialize,ldap,
1599     [
1600       alpine_has_ldap=yes
1601     ],
1602     [
1603       AC_SEARCH_LIBS(ldap_open,ldap,
1604         [
1605           alpine_has_ldap=yes
1606         ])
1607     ])
1609   if test "$alpine_has_ldap" = "yes" ; then
1610     AC_MSG_NOTICE([* * * Including LDAP Support])
1611     AC_DEFINE([ENABLE_LDAP], [], [Enable LDAP query support])
1612   fi
1615 dnl PAM support is needed to build c-client in some linux, and hence Alpine.
1616 if test "x$alpine_PAM" != "xnone" ; then
1617   AC_SEARCH_LIBS(pam_start,pam,
1618       [
1619         LIBS="$LIBS -lpam"
1620         AC_CHECK_HEADER([security/pam_appl.h],
1621         [
1622           alpine_PAM="yes"
1623         ],
1624         dnl Only mac is incompatible, do not spread bad habits.
1625         [ AC_CHECK_HEADER([pam/pam_appl.h],
1626           [
1627                 alpine_PAM="yes"
1628                 if test "x$alpine_c_client_target" != "xoxp" ; then
1629                    alpine_PAM="none"
1630                    alpine_pam_none_reason="header files not in security/ directory"
1631                 fi
1632           ],
1633           [
1634                 alpine_PAM="none"
1635                 alpine_pam_none_reason="header files not found"
1636           ])
1637         ])
1638       ],
1639       [
1640         alpine_PAM="none"
1641         alpine_pam_none_reason="library files not found"
1642       ])
1643     if test -n "$alpine_pam_none_reason" ; then
1644       AC_MSG_ERROR(No PAM support: $alpine_pam_none_reason)
1645   fi
1649 dnl provide KRB5 support?
1650 if test "x$alpine_GSSTYPE" != "xnone" ; then
1651   AC_SEARCH_LIBS(gss_init_sec_context,gss gssapi gssapi_krb5,
1652     [
1653       dnl MIT-based?
1654       LIBS="$LIBS -lkrb5"
1655       AC_CHECK_HEADER([gssapi/gssapi_generic.h],,
1656         [
1657           if test ! -d /usr/kerberos/include ; then
1658             alpine_GSSTYPE="none"
1659             alpine_gss_none_reason="header files not found"
1660           fi
1661         ])
1662     ],
1663     [
1664       alpine_GSSTYPE="none"
1665       alpine_gss_none_reason="libraries not found"
1666     ])
1667   if test -n "$alpine_gss_none_reason" ; then
1668     AC_MSG_NOTICE([NOT including Kerberos Support: $alpine_gss_none_reason])
1669   fi
1672 dnl Include NTLM?
1673 AC_ARG_WITH(ntlm,
1674   AC_HELP_STRING([--without-ntlm],[Disable NTLM client support]),
1675   [with_ntlm=$withval])
1677 dnl provide NTLM support?
1678 if test "x$with_ntlm" = "xno" ; then
1679   alpine_NTLM="none"
1680 else
1681   alpine_NTLM=
1683   AC_SEARCH_LIBS(buildSmbNtlmAuthRequest, ntlm, 
1684      [
1685         AC_CHECK_HEADER([ntlm.h],
1686         [
1687             extra_auth_ntlm=ntl
1688             AC_MSG_NOTICE([including NTLM support])
1689         ],
1690         [
1691             alpine_NTLM="none"
1692             alpine_ntlm_none_reason="header file ntlm.h not found"
1693         ])
1694      ],
1695      [
1696         alpine_NTLM="none"
1697         alpine_ntlm_none_reason="ntlm library not found"
1698      ])
1699   if test -n "$alpine_ntlm_none_reason" ; then
1700      AC_MSG_NOTICE([NOT including NTLM Support: $alpine_ntlm_none_reason])
1701   fi
1704 dnl check for tcl libraries for Web Alpine (HACKY)
1705 if test -n "$WEB_BUILD" ; then
1706 TCL_VERSIONS_DOT="tcl8.6 tcl8.5 tcl8.4 tcl8.3"
1707 TCL_VERSIONS_NODOT="`echo ${TCL_VERSIONS_DOT} | ${SED} 's/\.//g'`"
1708 TCL_VERSIONS="${TCL_VERSIONS_DOT} ${TCL_VERSIONS_NODOT} tcl"
1709   AC_SEARCH_LIBS([Tcl_Eval],[$alpine_TCLLIB ${TCL_VERSIONS}],,
1710     [
1711       WEB_BUILD=
1712     ])
1714   dnl look for header file
1715   if test -n "$alpine_TCLINC" ; then
1716     AC_CHECK_HEADER($alpine_TCLINC/tcl.h,,
1717       [
1718         WEB_BUILD=
1719       ])
1720     if test -z "$WEB_BUILD" ; then
1721       AC_MSG_NOTICE([Tcl Include file NOT found])
1722     fi
1723   else
1724     AC_CHECK_HEADER(tcl.h,,
1725       [
1726         for base in /usr /usr/local ; do
1727          for dir in ${TCL_VERSIONS} ; do
1728           if test -f $base/include/$dir/tcl.h ; then
1729             CPPFLAGS="$CPPFLAGS -I$base/include/$dir"
1730             found=yes
1731             break
1732           fi
1733          done
1734          if test "x$found" = "xyes" ; then
1735             break
1736          fi
1737         done
1738         if test "$found" != "yes" ; then
1739             WEB_BUILD=
1740             AC_MSG_NOTICE([header file tcl.h NOT found: Web Alpine will not be built])
1741         fi
1742       ])
1743   fi
1746 dnl Local or supplied regex?
1747 if test "x$alpine_REGEX" != "xyes" ; then
1748   AC_SEARCH_LIBS([regcomp],posix regexp regex re,,
1749     [
1750       if test x$alpine_REGEX = "xno" ; then
1751         AC_MSG_ERROR(Unable to find system regex library)
1752       else
1753         alpine_REGEX=yes
1754       fi
1755     ])
1757 if test "x$alpine_REGEX" != "xyes" ; then
1758   AC_CHECK_HEADER([regex.h],,
1759     [
1760       if test x$alpine_REGEX = "xno" ; then
1761         AC_MSG_ERROR(Unable to find system regex include file)
1762       else
1763         alpine_REGEX=yes
1764       fi
1765     ])
1767 AC_DEFINE(HAVE_REGEX_H,1,[Regular expression header file exists])
1768 if test "x$alpine_REGEX" = "xyes" ; then
1769   CPPFLAGS="$CPPFLAGS -I${top_builddir}/regex"
1770   LDFLAGS="$LDFLAGS -L${top_builddir}/regex"
1771   REGEX_BUILD=regex
1772   REGEX_MAKEFILE="$REGEX_BUILD/Makefile"
1775 if test "x$with_pthread" != "xno" ; then
1776   AC_MSG_CHECKING([for pthread support])
1777   ACX_PTHREAD(
1778     [
1779       AC_MSG_RESULT([yes])
1780       case "$target" in
1781           *openbsd*)
1782             AC_MSG_NOTICE([WARNING: pthread support on OpenBSD is unstable!])
1783             AM_CFLAGS="$AM_CFLAGS -pthread"
1784             ;;
1785       esac
1786       LIBS="$PTHREAD_LIBS $LIBS"
1787       AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
1788       CC="$PTHREAD_CC"
1789       AC_DEFINE([HAVE_PTHREAD], [1], [System has pthread support])
1790     ],
1791     [
1792       AC_MSG_RESULT([no])
1793     ])
1795   AC_SEARCH_LIBS([nanosleep], [rt posix4],
1796     [
1797       AC_DEFINE([HAVE_NANOSLEEP], [1], [Define if system supports subsecond, non-alarm sleep])
1798     ])
1803 dnl CHECK HEADERS
1805 AC_HEADER_STDC
1806 AC_HEADER_DIRENT
1807 AC_HEADER_STAT
1808 AC_HEADER_SYS_WAIT
1809 AC_HEADER_TIME
1810 AC_HEADER_TIOCGWINSZ
1812 AC_CHECK_HEADERS([unistd.h])
1814 AC_CHECK_HEADERS([errno.h \
1815                   ctype.h \
1816                   fcntl.h \
1817                   signal.h \
1818                   setjmp.h \
1819                   memory.h \
1820                   sys/ioctl.h \
1821                   sys/param.h \
1822                   sys/socket.h \
1823                   sys/uio.h \
1824                   sys/un.h \
1825                   limits.h \
1826                   wchar.h \
1827                   sys/poll.h \
1828                   stropts.h \
1829                   netdb.h \
1830                   syslog.h \
1831                   sys/syslog.h \
1832                   locale.h \
1833                   langinfo.h \
1834                   utime.h \
1835                   sys/utime.h \
1836                   pthread.h \
1837                   pwd.h \
1838                   assert.h])
1840 dnl terminal line discipline?
1841 AC_CHECK_HEADER([termios.h],
1842   AC_DEFINE(HAS_TERMIOS, [1], [Define if systems uses termios terminal control]),
1843   [
1844     AC_CHECK_HEADER([termio.h],
1845       AC_DEFINE(HAS_TERMIO, [1], [Define if systems uses termio terminal control]),
1846       [
1847         AC_CHECK_HEADER([sgtty.h],
1848           AC_DEFINE(HAS_SGTTY, [1], [Define if systems uses old BSD-style terminal control]),
1849         [
1850           AC_MSG_ERROR(Unable to figure out terminal control method)
1851         ])
1852       ])
1853   ])
1856 dnl CHECK TYPEDEFS
1858 AC_DIAGNOSE([obsolete],[your code may safely assume C89 semantics that RETSIGTYPE is void.
1859 Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
1860 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
1861 [AC_LANG_PROGRAM([#include <sys/types.h>
1862 #include <signal.h>
1864                  [return *(signal (0, 0)) (0) == 1;])],
1865                    [ac_cv_type_signal=int],
1866                    [ac_cv_type_signal=void])])
1867 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
1868                     (`int' or `void').])
1870 AC_TYPE_SIZE_T
1871 AC_TYPE_MODE_T
1872 AC_TYPE_PID_T
1873 AC_TYPE_UID_T
1874 AC_STRUCT_TM
1876 AC_CHECK_TYPES([union wait])
1878 AC_CHECK_HEADERS([stdint.h], [uint16=uint16_t], [
1879   AC_CHECK_HEADERS([inttypes.h], [uint16=uint16_t], [
1880     AC_CHECK_HEADERS([sys/types.h], [uint16=u_int16_t], [
1881       AC_CHECK_SIZEOF(unsigned short)
1882       if test $ac_cv_sizeof_unsigned_short -eq 2 ; then
1883         uint16="unsigned short"
1884       else
1885         AC_CHECK_SIZEOF(unsigned int)
1886         if $ac_cv_sizeof_unsigned_int -eq 2 ; then
1887           uint16="unsigned int"
1888         else
1889           AC_MSG_ERROR(Unable to determine 16 bit integer type)
1890         fi
1891       fi
1892     ])
1893   ])
1895 AC_DEFINE_UNQUOTED([UINT16], $uint16, [System defined unsigned 16 bit integer])
1897 AC_CHECK_HEADERS([stdint.h], [uint32=uint32_t], [
1898   AC_CHECK_HEADERS([inttypes.h], [uint32=uint32_t], [
1899     AC_CHECK_HEADERS([sys/types.h], [uint32=u_int32_t], [
1900       AC_CHECK_SIZEOF(unsigned int)
1901       if test $ac_cv_sizeof_unsigned_int -eq 4 ; then
1902         uint32="unsigned int"
1903       else
1904         AC_CHECK_SIZEOF(unsigned long)
1905         if $ac_cv_sizeof_unsigned_long -eq 4 ; then
1906           uint32="unsigned long"
1907         else
1908           AC_MSG_ERROR(Unable to determine 32 bit integer type)
1909         fi
1910       fi
1911     ])
1912   ])
1914 AC_DEFINE_UNQUOTED([UINT32], $uint32, [System defined unsigned 32 bit integer])
1916 AC_CACHE_CHECK(argument pointer type of qsort compare function and base,
1917 ac_cv_func_qsort_argtype,
1918 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1919 #if     HAVE_STDLIB_H
1920 #include "stdlib.h"
1921 #endif
1923 extern void *base;
1924 extern sortf(const void *, const void *);
1925 int sortf(a, b)
1926   const void *a;
1927   const void *b; { return 0; }
1928 ]], [[
1929 qsort(base, 2, sizeof(char *), sortf);
1930 ]])],[ac_cv_func_qsort_argtype=void],[ac_cv_func_qsort_argtype=char])
1932 AC_DEFINE_UNQUOTED([qsort_t], $ac_cv_func_qsort_argtype, [qsort compare function argument type])
1934 dnl check for "struct passwd" ?
1936 AC_FUNC_SELECT_ARGTYPES
1938 AC_FUNC_STRCOLL
1940 dnl CHECK FOR LIBRARY FUNCTIONS
1942 AC_FUNC_FORK
1943 AC_CHECK_FUNCS([strchr \
1944                 memcpy \
1945                 strtol \
1946                 strtoul \
1947                 select \
1948                 poll \
1949                 qsort \
1950                 getuid \
1951                 getpwuid \
1952                 getpwnam \
1953                 gettimeofday \
1954                 tmpfile \
1955                 uname \
1956                 rename \
1957                 read \
1958                 signal \
1959                 setjmp \
1960                 chown \
1961                 wait4 \
1962                 waitpid \
1963                 wait \
1964                 srandom \
1965                 popen \
1966                 pclose \
1967                 fsync \
1968                 truncate \
1969                 listen \
1970                 wcwidth \
1971                 mbstowcs \
1972                 wcrtomb \
1973                 putenv \
1974                 setenv])
1976 AC_SEARCH_LIBS([gethostname],[nsl])
1978 AC_SEARCH_LIBS([socket],[socket],,
1979   [
1980     WEB_BUILD=
1981   ])
1983 AC_SEARCH_LIBS([bind],[bind],,
1984   [
1985     WEB_BUILD=
1986   ])
1988 dnl check for POSIX signal interface
1989 AC_CHECK_FUNCS([sigaction sigemptyset sigaddset sigprocmask],
1990   [
1991     AC_DEFINE([POSIX_SIGNALS], [], [Define if system supports POSIX signal interface])
1992   ],
1993   [
1994     AC_CHECK_FUNCS([sigset sigrelse],
1995       [
1996         AC_DEFINE([SYSV_SIGNALS], [], [Define if system supports SYSV signal interface])
1997       ])
1998   ])
2000 AC_SEARCH_LIBS([syslog], [bsd socket inet],
2001   [
2002     AC_DEFINE([HAVE_SYSLOG], [1], [Define if system supplies syslog() logging])
2003   ])
2006 dnl set pico newmail check directory
2007 if test -n "$alpine_with_local_maildir" ; then
2008     alpine_local_maildir=$alpine_with_local_maildir
2009 elif test -d /var/spool/mail ; then
2010     alpine_local_maildir="/var/spool/mail"
2011 elif test -d /var/mail ; then
2012     alpine_local_maildir="/var/mail"
2013 else
2014     alpine_local_maildir="/usr/spool/mail"
2017 dnl set c-client make target
2018 if test -n "$alpine_with_c_client_target" ; then
2019     alpine_c_client_target=$alpine_with_c_client_target
2022 AC_DEFINE_UNQUOTED([SYSTYPE], "$systype", [Pine-Centric Host Specifier])
2023 AC_DEFINE_UNQUOTED([C_FILESEP],'$alpine_path_delim',[File name separator as character constant])
2024 AC_DEFINE_UNQUOTED([S_FILESEP],"$alpine_path_delim",[File name separator as string constant])
2025 AC_DEFINE_UNQUOTED([MAILDIR],"$alpine_local_maildir",[Path to local inboxes for pico newmail check])
2026 AC_DEFINE_UNQUOTED([MODE_READONLY], $alpine_mode_readonly, [File mode used to set readonly access])
2028 dnl c-client make particulars
2029 AC_SUBST([C_CLIENT_TARGET], $alpine_c_client_target)
2030 AC_SUBST([C_CLIENT_WITH_IPV6], $c_client_ip6)
2031 if test "x$alpine_SSLTYPE" = "xnone" ; then 
2032   AC_MSG_NOTICE([* * *  NOT Including SSL Support])
2033   c_client_specials="${c_client_specials}SSLTYPE=none "
2034 else
2035   dnl issue any warnings for common OpenSSL issues
2037   if test -n "$alpine_SSLCERTS" -a -d "$alpine_SSLCERTS" ; then
2038     certdir="$alpine_SSLCERTS"
2039   elif test -n "$alpine_SSLDIR" -a -d "${alpine_SSLDIR}/certs" ; then
2040     certdir="${alpine_SSLDIR}/certs"
2041   elif test -n "$alpine_SSLDIR" -a -d "${alpine_SSLDIR}/ssl/certs" ; then
2042     certdir="${alpine_SSLDIR}/ssl/certs"
2043   elif test -n "$alpine_SSLCERTS_ORIG" -a -d "$alpine_SSLCERTS_ORIG" ; then
2044     certdir="$alpine_SSLCERTS_ORIG"
2045   elif test -n "$alpine_SSLCERTS" ; then
2046     certdir="$alpine_SSLCERTS"
2047   else
2048     AC_MSG_NOTICE([SSL Problem: certificate directory not found])
2049   fi
2051   if test "x$with_smime" != "xno" ; then
2052     if test -n "$certdir" ; then
2053       AC_MSG_NOTICE([* * * S/MIME support enabled])
2054       AC_DEFINE([SMIME], [], [Enable S/MIME code])
2055       AC_DEFINE_UNQUOTED([SMIME_SSLCERTS],"$certdir",[Directory where S/MIME CACerts are located])
2056     fi
2057   fi
2060   SSL_CERT_LINK="no"
2061   if test -z "`ls ${certdir} | $EGREP '^@<:@0-9A-Fa-f@:>@{8}\.@<:@0-9@:>@'`" ; then
2062      SSL_BUNDLE_EXISTS="no"
2063      SSL_PEM="factory.pem ca-bundle.pem ca-bundle.crt ca-root-nss.crt"
2064      for SSL_BUNDLE in $SSL_PEM
2065      do
2066        if test -f ${certdir}/${SSL_BUNDLE} ; then
2067           SSL_BUNDLE_EXISTS="yes"
2068        fi
2069      done
2070   else
2071      SSL_CERT_LINK="yes"
2072   fi
2074   if test "x$SSL_BUNDLE_EXISTS" = "xno" -a "x$SSL_CERT_LINK" = "xno" ; then
2075      AC_MSG_NOTICE([* * * No certificates found in "${certdir}".])
2076      AC_MSG_NOTICE([* * *   This might indicate that CA certs did not get properly])
2077      AC_MSG_NOTICE([* * *   installed.  If you get certificate validation failures])
2078      AC_MSG_NOTICE([* * *   in Alpine, this might be the reason for them.])
2079   fi
2081   if test -n "$alpine_SSLINCLUDE" ; then
2082     c_client_specials="${c_client_specials}SSLINCLUDE=$alpine_SSLINCLUDE "
2083   fi
2085   if test -n "$alpine_SSLLIB" ; then
2086     c_client_specials="${c_client_specials}SSLLIB=$alpine_SSLLIB "
2087   fi
2089   if test -n "$alpine_SSLDIR" ; then
2090     c_client_specials="${c_client_specials}SSLDIR=$alpine_SSLDIR "
2091   fi
2093   if test -n "$certdir" ; then
2094     c_client_specials="${c_client_specials}SSLCERTS=$certdir "
2095   fi
2097   if test -n "$alpine_SSLKEYS" ; then
2098       c_client_specials="${c_client_specials}SSLKEYS=$alpine_SSLKEYS "
2099   fi
2102 extra_auth_gss=
2103 if test "x$alpine_GSSTYPE" != "xnone" ; then
2104   extra_auth_gss=gss
2105   AC_MSG_NOTICE([* * * Including Kerberos5 functionality])
2108 extra_auth_ntlm=
2109 if test "x$alpine_NTLM" != "xnone" ; then
2110   extra_auth_ntlm=ntl
2111   AC_MSG_NOTICE([* * * Including NTLM Authenticator])
2114 if test -n "$CPPFLAGS" ; then
2115   alpine_c_client_cflags="$alpine_c_client_cflags ${CPPFLAGS}"
2117 if test -n "$CFLAGS" ; then
2118   alpine_c_client_cflags="$alpine_c_client_cflags ${CFLAGS}"
2121 if test -n "$alpine_c_client_cflags" ; then
2122   AC_SUBST(C_CLIENT_CFLAGS, EXTRACFLAGS=\"$alpine_c_client_cflags\")
2125 if test -n "$LDFLAGS" ; then
2126   alpine_c_client_ldflags="$alpine_c_client_ldflags ${LDFLAGS}"
2128 if test -n "$LIBS" ; then
2129   alpine_c_client_ldflags="$alpine_c_client_ldflags ${LIBS}"
2132 if test -n "$alpine_c_client_ldflags" ; then
2133   AC_SUBST(C_CLIENT_LDFLAGS, EXTRALDFLAGS=\"$alpine_c_client_ldflags\")
2136 if test -n "$alpine_c_client_gccoptlevel" ; then
2137   AC_SUBST(C_CLIENT_GCCOPTLEVEL, GCCOPTLEVEL=\"$alpine_c_client_gccoptlevel\")
2140 c_client_auths="$extra_auth_gss $extra_auth_ntlm"
2141 AC_SUBST([C_CLIENT_AUTHS], $c_client_auths)
2143 AC_SUBST([C_CLIENT_SPECIALS], $c_client_specials)
2145 dnl Deal with Web Alpine
2146 if test -z "$WEB_BUILD" ; then
2147   WEB_PUBCOOKIE_BUILD=
2148   AC_MSG_NOTICE([* * * TCL libraries could not be found.])
2149   AC_MSG_NOTICE([* * * WEB ALPINE COMPONENT WILL NOT BE BUILT.])
2150 else
2151   if test -n "$WEB_PUBCOOKIE_BUILD" ; then
2152     if test "x$alpine_GSSTYPE" = "xnone" ; then
2153       WEB_PUBCOOKIE_BUILD=
2154       AC_MSG_NOTICE([* * * Kerberos5 support not found.])
2155       AC_MSG_NOTICE([* * * WEB ALPINE PUBCOOKIE COMPONENT WILL NOT BE BUILT.])
2156     elif test -z "$WEB_BINDIR" ; then
2157       WEB_PUBCOOKIE_BUILD=
2158       AC_MSG_NOTICE([* * * Web Alpine binary directory not provided.])
2159         AC_MSG_ERROR([* * * --with-pubcookie requires --with-web-bin=PATH.
2160         Please re-run configure with these options:
2161         --with-pubcookie --with-web-bin=/usr/local/libexec/alpine/bin])
2162     else
2163       AC_DEFINE([PUBCOOKIE],[1],[Include support for UW Pubcookie Web Authentication])
2164       WEB_PUBCOOKIE_LIB=../pubcookie/libauthgssproxy.a
2165       WEB_PUBCOOKIE_LINK=gssapi_proxy.l
2166     fi
2167   fi
2170 AC_SUBST([REGEX_BUILD])
2172 AC_SUBST([WEB_BUILD])
2173 AC_SUBST([WEB_BINDIR])
2174 AC_SUBST([WEB_PUBCOOKIE_BUILD])
2175 AC_SUBST([WEB_PUBCOOKIE_LIB])
2176 AC_SUBST([WEB_PUBCOOKIE_LINK])
2178 AC_SUBST([AM_CFLAGS])
2179 AC_SUBST([AM_LDFLAGS])
2181 AC_CONFIG_FILES([m4/Makefile po/Makefile.in $REGEX_MAKEFILE \
2182           pith/osdep/Makefile pith/charconv/Makefile pith/Makefile \
2183           pico/osdep/Makefile pico/Makefile \
2184           alpine/osdep/Makefile alpine/Makefile \
2185           web/src/Makefile web/src/pubcookie/Makefile \
2186           web/src/alpined.d/Makefile \
2187           Makefile])
2188 AC_OUTPUT