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