* New alpha version 2.24.1
[alpine.git] / configure.ac
blob0c2d9c7f06299b2ee0933ed91fdabbc89806a9de
1 dbl Process this file with autoconf to produce a configure script.
3 dnl /* ========================================================================
4 dnl  * Copyright 2013-2021 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])
629 AC_DEFINE_UNQUOTED([DEFAULT_SSLUSERCAPATH], ".alpine-certs", [Default directory for user trusted certificates])
630 AC_DEFINE_UNQUOTED([DEFAULT_SSLUSERCAFILE], ".alpine-certs/certs.pem", [Name of default container for user trusted certificates])
632 dnl set PASSFILE?
633 AC_ARG_WITH(passfile,
634   AS_HELP_STRING([--with-passfile=FILENAME],[Password cache file (recommended when S/MIME is enabled and configured)]),
635     [
636       case "$withval" in
637         no)
638           ;;
639         yes)
640           ;;
641         *)
642           alpine_PASSFILE=$withval
643           ;;
644       esac
645     ])
648 dnl os-specific credential cache?
649 AC_ARG_WITH(local-password-cache,
650  AS_HELP_STRING([--without-local-password-cache],[Disable OS-specific password cache, if supported]),
651    [
652      alpine_os_credential_cache=$withval
653    ])
655 dnl Particular os-specific credential cache?
656 AC_ARG_WITH(local-password-cache-method,
657  AS_HELP_STRING([--with-local-password-cache-method],[OS-specific credential cache (OSX=APPLEKEYCHAIN, Windows=WINCRED)]),
658    [
659      alpine_os_credential_cache_method=$withval
660    ])
662 if test -n "$alpine_PASSFILE" ; then
663   case $alpine_os_credential_cache in
664     no)
665       ;;
666     *)
667       alpine_os_credential_cache="no"
668       AC_MSG_NOTICE([--with-passfile definition overrides OS-Specific password caching])
669       ;;
670   esac
671   AC_DEFINE_UNQUOTED([PASSFILE], "$alpine_PASSFILE", [Password cache file (recommended if S/MIME is enabled and configured)])
674 dnl set DF_SSHPATH?
675 AC_ARG_WITH(default-sshpath,
676   AS_HELP_STRING([--with-default-sshpath=FILENAME],[set default value of ssh command path (defining should cause ssh to be preferred to rsh)]),
677     [
678       case "$withval" in
679         no)
680           ;;
681         yes)
682           ;;
683         *)
684           AC_DEFINE_UNQUOTED([DF_SSHPATH], "$withval", [set default value of ssh command path (defining should cause ssh to be preferred to rsh)])
685           ;;
686       esac
687     ])
689 dnl set DF_SSHCMD?
690 AC_ARG_WITH(default-sshcmd,
691   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")]),
692     [
693       case "$withval" in
694         no)
695           ;;
696         yes)
697           ;;
698         *)
699           AC_DEFINE_UNQUOTED([DF_SSHCMD], "$withval", [set default value of ssh command string (usually "%s %s -l %s exec /etc/r%sd")])
700           ;;
701       esac
702     ])
704 dnl Include SSL?
705 dnl Set SSLDIR for c-client make
706 AC_ARG_WITH(ssl,
707   AS_HELP_STRING([--without-ssl],[Disable SSL support (OpenSSL)]),
708   [ with_ssl=$withval ])
710 if test "x$with_ssl" = "xno" ; then
711   alpine_SSLTYPE="none"
712 elif test -d /usr/local/ssl ; then
713 dnl When the system has openssl installed in its default location
714 dnl instead of the one used by the distribution assume that this
715 dnl is the one intended to be used.
716   alpine_SSLDIR="/usr/local/ssl"
717   alpine_SSLINCLUDE="$alpine_SSLDIR/include" 
718   alpine_SSLLIB="$alpine_SSLDIR/lib"
719   alpine_SSLCERTS="$alpine_SSLDIR/certs"
720   alpine_SSLTYPE="nopwd"
721 else
722   dnl preload c-client default locations/options
723   case $host in
724     *-linux*|*-k*bsd*-gnu*|*-gnu*)
725       if test -f /etc/fedora-release -o -f /etc/redhat-release -o -f /etc/redhat_version ; then  
726         alpine_SSLTYPE="nopwd"
727         if test -d /etc/pki/tls ; then  
728           alpine_SSLDIR="/etc/pki/tls"
729         else
730           alpine_SSLDIR="/usr/share/ssl"
731         fi
732         alpine_SSLCERTS="$alpine_SSLDIR/certs"
733         alpine_SSLKEYS="$alpine_SSLDIR/private"
734         alpine_SSLINCLUDE="/usr/include/openssl" 
735         alpine_SSLLIB="/usr/lib"
736       elif test -f /etc/mandrake-release ; then
737         alpine_SSLDIR="/usr/lib/ssl"
738         alpine_SSLCERTS="$alpine_SSLDIR/certs" 
739         alpine_SSLKEYS="$alpine_SSLDIR/private"
740         alpine_SSLINCLUDE="/usr/include/openssl" 
741         alpine_SSLLIB="/usr/lib"
742       elif test -f /etc/SuSE-release ; then
743         alpine_SSLTYPE="nopwd"
744         alpine_SSLDIR="/etc/ssl"
745         alpine_SSLCERTS="$alpine_SSLDIR/certs"
746         alpine_SSLKEYS="$alpine_SSLDIR/private"
747         alpine_SSLINCLUDE="/usr/include/openssl" 
748         alpine_SSLLIB="/usr/lib"
749       elif test -d /etc/osso-af-init ; then
750         alpine_SSLTYPE="nopwd"
751         alpine_SSLDIR="/usr"
752         alpine_SSLCERTS="/usr/share/certs"
753         alpine_SSLINCLUDE="/usr/include/openssl"
754         alpine_SSLLIB="/usr/lib"
755       elif test -f /etc/debian_release -o -f /etc/debian_version ; then
756         if test ! -d /etc/osso-af-init ; then
757            alpine_SSLDIR="/etc/ssl"
758            alpine_SSLCERTS="$alpine_SSLDIR/certs"
759            alpine_SSLKEYS="$alpine_SSLDIR/private"
760            alpine_SSLINCLUDE="/usr/include/openssl" 
761            alpine_SSLLIB="/usr/lib"
762         fi
763       elif test -f /etc/manjaro-release ; then
764            alpine_SSLDIR="/etc/ssl"
765            alpine_SSLCERTS="$alpine_SSLDIR/certs"
766            alpine_SSLKEYS="$alpine_SSLDIR/private"
767            alpine_SSLINCLUDE="/usr/include/openssl" 
768            alpine_SSLLIB="/usr/lib"
769       else
770         alpine_SSLTYPE="nopwd"
771         alpine_SSLDIR="/usr"
772         alpine_SSLCERTS="/etc/ssl/certs"
773       fi
774       ;;
775     *-apple-darwin*)
776       alpine_SSLTYPE="nopwd"
777 dnl Originally this is where certs are, and they might still be there, even
778 dnl after installing Homebrew, MacPorts or Fink. We will use it if we cannot
779 dnl find it anywhere else.
780       alpine_SSLCERTS_ORIG="/System/Library/OpenSSL/certs"
781       if test -d /usr/local/opt/openssl ; then
782         alpine_SSLDIR="/usr/local/opt/openssl"
783         alpine_SSLINCLUDE="$alpine_SSLDIR/include"
784         alpine_SSLLIB="$alpine_SSLDIR/lib"
785         alpine_SSLCERTS="/usr/local/etc/openssl"
786         alpine_SSLKEYS="$alpine_SSLDIR/private"
787       elif test -d /opt/local/etc/openssl ; then
788         alpine_SSLDIR="/opt/local"
789         alpine_SSLINCLUDE="$alpine_SSLDIR/include"
790         alpine_SSLLIB="$alpine_SSLDIR/lib"
791         alpine_SSLCERTS="/opt/local/etc/openssl/certs"
792         alpine_SSLKEYS="/opt/local/etc/openssl/private"
793       elif test -d /sw/etc/ssl ; then
794         alpine_SSLDIR="/sw/etc/ssl"
795         alpine_SSLINCLUDE="/sw/include"
796         alpine_SSLLIB="/sw/lib"
797         alpine_SSLCERTS="/sw/etc/ssl/certs"
798         alpine_SSLKEYS="/sw/etc/ssl/private"
799       elif test -d /usr/local/ssl ; then
800         alpine_SSLDIR="/usr/local/ssl"
801       elif test -d /System/Library/OpenSSL ; then
802         alpine_SSLDIR="/System/Library/OpenSSL"
803         alpine_SSLCERTS="$alpine_SSLDIR/certs"
804         alpine_SSLKEYS="$alpine_SSLDIR/private"
805         alpine_SSLLIB="/usr/lib"
806         alpine_SSLINCLUDE="/usr/include/openssl"
807       fi
808       ;;
809     *-*-netbsd*)
810         alpine_SSLDIR="/etc/openssl"
811         alpine_SSLCERTS="$alpine_SSLDIR/certs"
812         alpine_SSLKEYS="$alpine_SSLDIR/private"
813         alpine_SSLINCLUDE="/usr/include/openssl"
814         alpine_SSLLIB="/usr/lib"
815       ;;
816     *-*-dragonfly*)
817         alpine_SSLDIR="/etc/openssl"
818         alpine_SSLCERTS="$alpine_SSLDIR/certs"
819         alpine_SSLKEYS="$alpine_SSLDIR/private"
820         alpine_SSLINCLUDE="/usr/include/openssl"
821         alpine_SSLLIB="/usr/lib"
822       ;;
823     *-openbsd*)
824         alpine_SSLTYPE="nopwd"
825         alpine_SSLDIR="/usr"
826         alpine_SSLCERTS="/etc/ssl/certs"
827       ;;
828     *-*-freebsd*)
829         alpine_SSLDIR="/etc/ssl"
830         alpine_SSLCERTS="$alpine_SSLDIR/certs"
831         alpine_SSLKEYS="$alpine_SSLDIR/private"
832         if test -d /usr/local/include/openssl ; then
833           alpine_SSLINCLUDE="/usr/local/include/openssl" 
834           alpine_SSLLIB="/usr/local/lib"
835         else
836           alpine_SSLINCLUDE="/usr/include/openssl" 
837           alpine_SSLLIB="/usr/lib"
838         fi
839       ;;
840     *-*-openbsd*)
841         alpine_SSLDIR="/etc/ssl"
842         alpine_SSLINCLUDE="/usr/include/openssl"
843         alpine_SSLLIB="/usr/lib"
844         alpine_SSLCERTS="/etc/ssl" 
845         alpine_SSLKEYS="/etc/ssl/private"
846       ;;
847     *-*-cygwin)
848         alpine_SSLDIR="/usr/ssl"
849         alpine_SSLCERTS="$alpine_SSLDIR/certs" 
850         alpine_SSLKEYS="$alpine_SSLDIR/certs"
851         alpine_SSLINCLUDE="/usr/include/openssl" 
852         alpine_SSLLIB="/usr/lib"
853       ;;
854     *-sco-sysv* | *-sysv*UnixWare | *-sysv*OpenUNIX)
855         alpine_SSLTYPE="sco.nopwd"
856         alpine_SSLDIR="/usr/local/ssl"
857       ;;
858     *-*-solaris*)
859       if test -d /usr/include/openssl ; then
860         alpine_SSLINCLUDE="/usr/include/openssl" 
861       elif test -d /usr/sfw/include/openssl ; then
862         alpine_SSLDIR="/usr/sfw"
863       elif test -d /opt/csw/include/openssl ; then
864         alpine_SSLDIR="/opt/csw"
865         if test -d /opt/csw/ssl/certs ; then
866           alpine_SSLCERTS="/opt/csw/ssl/certs"
867         fi
868       fi
869       if test -z "$alpine_SSLCERTS" -a -d /etc/certs ; then
870         alpine_SSLCERTS="/etc/certs"
871       fi
872       ;;
873     *)
874       alpine_SSLTYPE="nopwd"
875       alpine_SSLDIR="/usr/local/ssl"
876       ;;
877   esac
880 if test "x$alpine_SSLTYPE" != "xnone" ; then
881   AC_ARG_WITH(ssl-dir,
882     AS_HELP_STRING([--with-ssl-dir=DIR],[Root of SSL lib/include path]),
883     [
884       if test "x$withval" != "xno" ; then
885         alpine_SSLDIR=$withval
886         alpine_SSLINCLUDE=$alpine_SSLDIR/include
887         alpine_SSLLIB=$alpine_SSLDIR/lib
888       fi
889     ])
891   AC_ARG_WITH(ssl-certs-dir,
892     AS_HELP_STRING([--with-ssl-certs-dir=DIR],[Path to SSL certificate directory]),
893     [
894       if test "x$withval" != "xno" ; then
895         alpine_SSLCERTS=$withval
896       fi
897     ])
899   AC_ARG_WITH(ssl-include-dir,
900     AS_HELP_STRING([--with-ssl-include-dir=DIR],[SSL include file path]),
901     [
902       if test "x$withval" != "xno" ; then
903         alpine_SSLINCLUDE=$withval
904       fi
905     ])
907   AC_ARG_WITH(ssl-lib-dir,
908     AS_HELP_STRING([--with-ssl-lib-dir=DIR],[SSL library path]),
909     [
910       if test "x$withval" != "xno" ; then
911         alpine_SSLLIB=$withval
912       fi
913     ])
915   dnl setup globals so tests below work
916   if test -n "$alpine_SSLINCLUDE" ; then
917     CPPFLAGS="-I$alpine_SSLINCLUDE $CPPFLAGS"
918   elif test -n "$alpine_SSLDIR" ; then
919     CPPFLAGS="-I${alpine_SSLDIR}/include $CPPFLAGS"
920   fi
921   if test -n "$alpine_SSLLIB" ; then
922     LDFLAGS="-L$alpine_SSLLIB $LDFLAGS"
923   elif test -n "$alpine_SSLDIR" ; then
924     LDFLAGS="-L${alpine_SSLDIR}/lib $LDFLAGS"
925   fi
928 if test "x$alpine_SSLTYPE" != "xnone" ; then
929   alpine_default_SSLMIN="no_min"
930   alpine_default_SSLMAX="no_max"
931   alpine_default_RANGE="${alpine_default_SSLMIN},${alpine_default_SSLMAX}"
932   alpine_ENCRYPTION="$alpine_default_SSLMIN ssl3 tls1 tls1_1 tls1_2 tls1_3 $alpine_default_SSLMAX"
933   alpine_SSLMIN="$alpine_default_SSLMIN"
934   alpine_SSLMAX="$alpine_default_SSLMAX"
935   alpine_RANGE="$alpine_default_RANGE"
936   AC_ARG_WITH(encryption-minimum-version,
937     AS_HELP_STRING([--encryption-minimum-version=VERSION],[Minimum SSL encryption version. Default: no_min]),
938     [
939       if test "x$withval" != "xno" ; then
940         alpine_SSLMIN=$withval
941       fi
942     ])
943   AC_ARG_WITH(encryption-maximum-version,
944     AS_HELP_STRING([--encryption-maximum-version=VERSION],[Maximum SSL encryption version. Default: no_max]),
945     [
946       if test "x$withval" != "xno" ; then
947         alpine_SSLMAX=$withval
948       fi
949     ])
950   alpine_RANGE="$alpine_SSLMIN $alpine_SSLMAX"
951   for range in ${alpine_RANGE} ; do
952       for encryption in ${alpine_ENCRYPTION} ; do
953           if test "x$range" = "x$encryption" ; then
954              if test -z $alpine_min ; then
955                 alpine_min="yes"
956              else
957                 alpine_max="yes"
958              fi
959           fi
960       done
961   done
963   if test -z $alpine_max ; then
964      AC_MSG_ERROR(Unrecognized maximum encryption version: $alpine_max)
965   fi
967   if test -z $alpine_min ; then
968      AC_MSG_ERROR(Unrecognized minimum encryption version: $alpine_min)
969   fi
971   if test "x$alpine_SSLMIN" != "x$alpine_SSLMAX" ; then
972      alpine_RANGE_FEASIBLE=`echo "$alpine_ENCRYPTION" | sed "s/^.*$alpine_SSLMIN//" | grep "$alpine_SSLMAX"`
973      if test -n "$alpine_RANGE_FEASIBLE" ; then
974         alpine_RANGE="${alpine_SSLMIN},${alpine_SSLMAX}"
975      else
976         AC_MSG_WARN(Reversing order of minimum and maximum encryption)
977         alpine_RANGE="${alpine_SSLMAX},${alpine_SSLMIN}"
978      fi
979   else
980      if test "x$alpine_SSLMIN" = "x$alpine_default_SSLMIN" ; then
981         AC_MSG_WARN(Overriding maximum encryption to default)
982         alpine_SSLMAX="$alpine_default_SSLMAX"
983      fi
984      if test "x$alpine_SSLMAX" = "x$alpine_default_SSLMAX" ; then
985         AC_MSG_WARN(Overriding minimum encryption to default)
986         alpine_SSLMIN="$alpine_default_SSLMIN"
987      fi
988      alpine_RANGE="${alpine_SSLMIN},${alpine_SSLMAX}"
989   fi
990 PINEVAR(encryption-range, DF_ENCRYPTION_RANGE, [$alpine_RANGE] , [Default Encryption Range])
993 dnl Include Kerberos?
994 dnl Set GSSDIR for c-client make
995 AC_ARG_WITH(krb5,
996   AS_HELP_STRING([--without-krb5],[Disable Kerberos support]),
997   [ with_krb5=$withval ])
999 if test "x$with_krb5" = "xno" ; then
1000   alpine_GSSTYPE="none"
1001 else
1002   alpine_GSSTYPE=
1004   AC_ARG_WITH(krb5-dir,
1005     AS_HELP_STRING([--with-krb5-dir=DIR],[Root of Kerberos lib/include path]),
1006     [
1007       if test "x$withval" != "xno" ; then
1008         CPPFLAGS="$CPPFLAGS -I${withval}/include"
1009         LDFLAGS="$LDFLAGS -L${withval}/lib"
1010       fi
1011     ])
1013   AC_ARG_WITH(krb5-include-dir,
1014     AS_HELP_STRING([--with-krb5-include-dir=DIR],[Kerberos include file path]),
1015     [
1016       if test "x$withval" != "xno" ; then
1017         CPPFLAGS="$CPPFLAGS -I$withval"
1018       fi
1019     ])
1021   AC_ARG_WITH(krb5-lib-dir,
1022     AS_HELP_STRING([--with-krb5-lib-dir=DIR],[Kerberos library path]),
1023     [
1024       if test "x$withval" != "xno" ; then
1025         LDFLAGS="$LDFLAGS -L$withval"
1026       fi
1027     ])
1030 dnl Include LDAP?
1031 AC_ARG_WITH(ldap,
1032   AS_HELP_STRING([--without-ldap],[Disable LDAP query support]),
1033   [ with_ldap=$withval ])
1035 if test "x$with_ldap" = "xno" ; then
1036   alpine_with_ldap=
1037   AC_MSG_NOTICE([Excluding LDAP Support])
1038 else
1039   dnl Do stuff to figure out where OpenLDAP is
1041   case $host in
1042     *-*-freebsd*)
1043         alpine_LDAPDIR="/usr/local"
1044         alpine_LDAPINCLUDE="${alpine_LDAPDIR}/include"
1045         alpine_LDAPLIB="${alpine_LDAPDIR}/lib"
1046         ;;
1047   esac;
1049   alpine_with_ldap=yes
1051   AC_ARG_WITH(ldap-dir,
1052     AS_HELP_STRING([--with-ldap-dir=DIR],[Root of LDAP lib/include path]),
1053     [
1054       if test "x$withval" != "xno" ; then 
1055         alpine_LDAPDIR="${withval}"
1056         alpine_LDAPINCLUDE="${alpine_LDAPDIR}/include"
1057         alpine_LDAPLIB="${alpine_LDAPDIR}/lib"
1058       fi
1059     ])
1061   AC_ARG_WITH(ldap-include-dir,
1062     AS_HELP_STRING([--with-ldap-include-dir=DIR],[Directory containing LDAP include files]),
1063     [
1064       if test "x$withval" != "xno" ; then
1065         alpine_LDAPINCLUDE="$withval"
1066       fi
1067     ])
1069   AC_ARG_WITH(ldap-lib-dir,
1070     AS_HELP_STRING([--with-ldap-lib-dir=DIR],[LDAP library path]),
1071     [
1072       if test "x$withval" != "xno" ; then
1073         alpine_LDAPLIB="${withval}"
1074       fi
1075     ])
1077    if test -n "$alpine_LDAPINCLUDE" ; then
1078         CPPFLAGS="$CPPFLAGS -I${alpine_LDAPINCLUDE}/include"
1079    fi
1080    if test -n "$alpine_LDAPLIB" ; then
1081         LDFLAGS="$LDFLAGS -L${alpine_LDAPLIB}/lib"
1082    fi
1085 dnl Include SMIME?
1086 AC_ARG_WITH(smime,
1087   AS_HELP_STRING([--without-smime],[Disable S/MIME]),
1088   [ with_smime=$withval ])
1090 dnl Include TCL?
1091 AC_ARG_WITH(tcl,
1092   AS_HELP_STRING([--without-tcl],[Disable TCL, thus Web Alpine support]),
1093   [ with_tcl=$withval ])
1095 if test "x$with_tcl" = "xno" ; then
1096   WEB_BUILD=
1097   AC_MSG_NOTICE([Excluding TCL Support, and thus Web Alpine Support])
1098 else
1099   AC_ARG_WITH(tcl-lib-dir,
1100     AS_HELP_STRING([--with-tcl-lib-dir=PATH],[Specific TCL Librar dir, like \"/usr/opt/tcl86/lib\"]),
1101     [
1102       if test "x$withval" != "xno" ; then 
1103         alpine_TCLLIBDIR=$withval
1104         if test -n "$alpine_TCLLIBDIR" ; then
1105            LDFLAGS="-L$alpine_TCLLIBDIR $LDFLAGS"
1106         fi
1107       fi
1108     ])
1109   AC_ARG_WITH(tcl-lib,
1110     AS_HELP_STRING([--with-tcl-lib=LIBRARY],[Specific TCL Library, like \"tcl8.6\"]),
1111     [
1112       if test "x$withval" != "xno" ; then 
1113         alpine_TCLLIB=$withval
1114       fi
1115     ])
1116   AC_ARG_WITH(tcl-include,
1117     AS_HELP_STRING([--with-tcl-include=DIR],[Directory containing TCL include files]),
1118     [
1119       if test "x$withval" != "xno" ; then
1120         CPPFLAGS="$CPPFLAGS -I$withval"
1121         alpine_TCLINC=$withval
1122       fi
1123     ])
1126 AC_ARG_WITH(supplied-regex,
1127   AS_HELP_STRING([--with-supplied-regex],[Use regex library supplied with alpine]),
1128   [ alpine_REGEX=$withval ])
1130 AC_ARG_WITH(pthread,
1131   AS_HELP_STRING([--without-pthread],[Do NOT test for nor build with POSIX thread support]),
1132   [ with_pthread=$withval ])
1134 AC_ARG_WITH(system-mail-directory,
1135   AS_HELP_STRING([--with-system-mail-directory=DIR],[Directory where local mail is delivered]),
1136   [
1137     if test "x$withval" != "xno" ; then
1138       alpine_with_local_maildir="$withval"
1139     fi
1140   ])
1142 AC_ARG_WITH(c-client-target,
1143   AS_HELP_STRING([--with-c-client-target=TARGET],[IMAP build target (see imap/Makefile)]),
1144   [
1145     if test "x$withval" != "xno" ;then
1146       alpine_with_c_client_target="$withval"
1147     fi
1148   ])
1151 dnl Do not build bundled tools (Default)
1152 alpine_c_client_bundled="no"
1153 AC_ARG_WITH(bundled-tools,
1154   AS_HELP_STRING([--with-bundled-tools],[ Build additional tools (mtest, imapd, etc.) Default: --with-bundled-tools=no]),
1155   [ 
1156     if test "x$withval" = "xyes" ; then
1157      alpine_c_client_bundled=""
1158     fi
1159   ])
1161 dnl Assume PAM is *not* required and only set the systems that need it.
1162 alpine_PAM="none"
1164 dnl HOST-OS SPECIFIC DEFINITIONS
1165 dnl Tests and assignments below are mostly to coax the appropriate
1166 dnl build from c-client.  Most of this will go away when c-client
1167 dnl adopts configure
1168 case "$host" in
1169   *-linux*|*-k*bsd*-gnu*|*-gnu*)
1170     alpine_path_delim="/"
1171     alpine_mode_readonly="(0600)"
1172     if test -f /etc/fedora-release ; then  
1173       systype="LFD"
1174       alpine_PAM="yes"
1175       if test -d /etc/pki/tls ; then  
1176         alpine_c_client_target="lfd"
1177       else
1178         alpine_c_client_target="lrh"
1179       fi
1180     elif test -f /etc/mandrake-release ; then
1181       systype="LMD"
1182       alpine_c_client_target="lmd"
1183       alpine_PAM="yes"
1184     elif test -f /etc/redhat-release -o -f /etc/redhat_version ; then
1185       systype="LRH"
1186       alpine_PAM="yes"
1187       if test -d /etc/pki/tls ; then  
1188         alpine_c_client_target="lr5"
1189       else
1190         alpine_c_client_target="lrh"
1191       fi
1192     elif test -f /etc/debian_release -o -f /etc/debian_version ; then
1193       if test -d /etc/osso-af-init ; then
1194         systype="LN8"
1195         alpine_c_client_target="ln8"
1196       else
1197         systype="DEB"
1198         alpine_c_client_target="ldb"
1199         alpine_PAM="yes"
1200       fi
1201     elif test -f /etc/SuSE-release; then
1202       systype="LSU"
1203       alpine_c_client_target="lsu"
1204       alpine_PAM="yes"
1205     else
1206       systype="LNX"
1207       if test -z "$alpine_c_client_bundled" ; then
1208         AC_CHECK_LIB(pam, am_start,
1209         [
1210           alpine_c_client_target="lnp"
1211           alpine_PAM="yes"
1212         ],
1213         [
1214           if test -f /etc/shadow ; then
1215             alpine_c_client_target="slx"
1216           else
1217             alpine_c_client_target="lnx"
1218           fi
1219         ])
1220       else
1221           if test -f /etc/shadow ; then
1222             alpine_c_client_target="slx"
1223           else
1224             alpine_c_client_target="lnx"
1225           fi
1226       fi
1227     fi
1228     ;;
1229   *-apple-darwin*)
1230     systype="OSX"
1231     alpine_path_delim="/"
1232     alpine_mode_readonly="(0600)"
1233     LIBS="$LIBS -framework Carbon -framework ApplicationServices -framework Security"
1234     AM_CFLAGS="$AM_CFLAGS -Dbsd"
1235     dnl SEE include/system.h
1236     AC_DEFINE([OSX_TARGET],[1],[OSX TARGET])
1237     case "$alpine_os_credential_cache" in
1238       no)
1239         ;;
1240       *)
1241         AC_DEFINE([APPLEKEYCHAIN], [1], [Use Apple OS X key chain for credential caching])
1242         ;;
1243     esac
1244     if test -z "$alpine_c_client_bundled" ; then
1245       AC_CHECK_LIB(pam, pam_start,
1246       [
1247         AC_CHECK_HEADER([security/pam_appl.h],
1248         [
1249           alpine_PAM="yes"
1250           alpine_c_client_target="oxs"
1251         ],
1252         [       AC_CHECK_HEADER([pam/pam_appl.h],
1253                 [
1254                    alpine_PAM="yes"
1255                    alpine_c_client_target="oxp" 
1256                 ],
1257                 [
1258                   alpine_PAM="none"
1259                   alpine_pam_none_reason="header files not found"
1260                 ])
1261         ])
1262       ],
1263       [
1264         alpine_c_client_target="osx"
1265       ])
1266     else
1267         alpine_c_client_target="osx"
1268     fi
1269     ;;
1270   *-*-solaris*)
1271     if test x$GCC = "xyes" ; then
1272       systype="GSO"
1273       alpine_c_client_target="gso"
1274       CFLAGS="$CFLAGS -D__USE_LEGACY_PROTOTYPES__"
1275     else
1276       systype="SOC"
1277       alpine_c_client_target="soc"
1278       AC_DEFINE([__EXTENSIONS__], [1], [Enable extended pthread features on Solaris])
1279     fi
1280     alpine_path_delim="/"
1281     alpine_mode_readonly="(0600)"
1282     dnl possible other OS's need this.
1283     dnl Use autoconf 2.61's AC_USE_SYSTEM_EXTENSIONS at some point
1284     ;;
1285   *-*-sunos4*)
1286     systype="SUN"
1287     alpine_path_delim="/"
1288     alpine_mode_readonly="(0600)"
1289     alpine_c_client_target="s40"
1290     ;;
1291   *-*-sco3.2v5*)
1292     if test x$GCC = "xyes" ; then
1293       systype="GO5"
1294       alpine_c_client_target="go5"
1295     else
1296       systype="SC5"
1297       alpine_c_client_target="sc5"
1298     fi
1299     alpine_path_delim="/"
1300     alpine_mode_readonly="(0600)"
1301     dnl possible other OS's need this.
1302     dnl Use autoconf 2.61's AC_USE_SYSTEM_EXTENSIONS at some point
1303     ;;
1304   *-next-*)
1305     systype="NXT"
1306     alpine_path_delim="/"
1307     alpine_mode_readonly="(0600)"
1308     alpine_c_client_target="nx3"
1309     ;;
1310   *-*-netbsd*)
1311     systype="NEB"
1312     alpine_path_delim="/"
1313     alpine_mode_readonly="(0600)"
1314     alpine_c_client_target="neb"
1315     ;;
1316   *-*-hpux9*)
1317     systype="HPP"
1318     alpine_path_delim="/"
1319     alpine_mode_readonly="(0600)"
1320     alpine_c_client_target="gh9"
1321     ;;
1322   *-*-dragonfly*)
1323     systype="DFB"
1324     alpine_path_delim="/"
1325     alpine_mode_readonly="(0600)"
1326     alpine_c_client_target="neb"
1327     ;;
1328   *-*-bsdi*)
1329     systype="BSI"
1330     alpine_path_delim="/"
1331     alpine_mode_readonly="(0600)"
1332     alpine_c_client_target="bsi"
1333     ;;
1334   *-*-freebsd*)
1335     systype="BSF"
1336     alpine_path_delim="/"
1337     alpine_mode_readonly="(0600)"
1338     alpine_c_client_target="bsf"
1339     LIBS="$LIBS $LIBINTL"
1340     ;;
1341   *-*-openbsd*)
1342     systype="BSO"
1343     alpine_path_delim="/"
1344     alpine_mode_readonly="(0600)"
1345     alpine_c_client_target="bso"
1346     LIBS="$LIBS $LIBINTL"
1347     ;;
1348   *-*-aix5*)
1349     systype="A52"
1350     alpine_path_delim="/"
1351     alpine_mode_readonly="(0600)"
1352     alpine_c_client_target="a52"
1353     ;;
1354   *-*-aix4*)
1355     systype="A41"
1356     alpine_path_delim="/"
1357     alpine_mode_readonly="(0600)"
1358     alpine_c_client_target="a41"
1359     ;;
1360   *-*-aix3*)
1361     systype="A32"
1362     alpine_path_delim="/"
1363     alpine_mode_readonly="(0600)"
1364     alpine_c_client_target="a32"
1365     ;;
1366   *-*UNIX_SV | *-*-sysv5UnixWare7* | *-*OpenUNIX*)
1367     systype="UW2"
1368     alpine_path_delim="/"
1369     alpine_mode_readonly="(0600)"
1370     alpine_c_client_target="uw2"
1371     ;;
1372   *-*-osf5*)
1373     systype="OSF"
1374     alpine_path_delim="/"
1375     alpine_mode_readonly="(0600)"
1376     alpine_c_client_target="osf"
1377     ;;
1378   *-*-cygwin)
1379     systype="CYG"
1380     alpine_path_delim="/"
1381     alpine_mode_readonly="(S_IREAD | S_IWRITE)"
1382     alpine_c_client_target="cyg"
1383     LIBS="$LIBS $LIBINTL"
1384     ;;
1385   windows* | *-*-pw32*)
1386     systype="WNT"
1387     alpine_path_delim="\\"
1388     alpine_mode_readonly="(S_IREAD | S_IWRITE)"
1389     alpine_c_client_target="wnt"
1390     AC_DEFINE([_WINDOWS], [1], [Windows is just too different])
1391     ;;
1392   *)
1393     AC_MSG_ERROR(Unrecognized system: $host)
1394     ;;
1395 esac
1397 dnl Without IPv6?
1398 AC_ARG_WITH(ipv6,
1399   AS_HELP_STRING([--without-ipv6],[Disable IPv6, primarily to work around resolver problems]),
1400   [ with_ipv6=$withval ])
1402 if test "x$with_ipv6" = "xno" ; then
1403   AC_MSG_NOTICE([Excluding IPv6 Support])
1404   c_client_specials="${c_client_specials}IP6=4 "
1405   c_client_ip6="true"
1406 else
1407   c_client_ip6="touch imap/ip6"
1411 dnl CHECK LIBRARIES
1413 if test x$enable_dmalloc = "xyes" ; then
1414   if test "x$with_pthread" = "xyes" ; then
1415     dmalloc_lib=dmallocth
1416   else
1417     dmalloc_lib=dmalloc
1418   fi
1420   AC_CHECK_LIB($dmalloc_lib,dmalloc_shutdown,,
1421     [
1422       AC_MSG_ERROR($dmalloc_lib requested, but -ldmalloc not found)
1423     ])
1426 dnl which terminal cabability database
1427 AC_CHECK_LIB(tinfo, setupterm,
1428   [
1429     alpine_termdata=info
1430     LIBS="$LIBS -ltinfo"
1431   ],
1432   [
1433     AC_CHECK_LIB(ncurses, setupterm,
1434       [
1435         alpine_termdata=info
1436         LIBS="$LIBS -lncurses"
1437       ],
1438       [
1439         AC_CHECK_LIB(curses, setupterm,
1440           [
1441             alpine_termdata=info
1442             LIBS="$LIBS -lcurses"
1443           ],
1444           [
1445             AC_CHECK_LIB(termlib, tgetent,
1446               [
1447                 alpine_termdata=cap
1448                 LIBS="$LIBS -ltermlib"
1449               ],
1450               [
1451                 AC_CHECK_LIB(termcap, tgetent,
1452                   [
1453                     alpine_termdata=cap
1454                     LIBS="$LIBS -ltermcap"
1455                   ],
1456                   [
1457                     AC_MSG_ERROR(Terminfo/termcap not found)
1458                   ])
1459               ])
1460           ])
1461       ])
1462   ])
1463 case $alpine_termdata in
1464   info)
1465     AC_DEFINE(HAS_TERMINFO, [1], [Define if systems uses terminfo terminal database])
1466     ;;
1467   cap)
1468     AC_DEFINE(HAS_TERMCAP, [1], [Define if systems uses termcap terminal database])
1469     ;;
1470 esac
1472 dnl check if user want us to add dl or ldl before we actually test for it
1473 alpine_dlopen="yes"
1474 AC_ARG_WITH(dlopen,
1475  AS_HELP_STRING([--without-dlopen],[Do not test for dlopen because this system does not need it]),
1476    [
1477      alpine_dlopen=$withval
1478    ])
1480 dnl is -ldl present? if so, add it
1481 if test "x$alpine_dlopen" != "xno" ; then
1482   AC_SEARCH_LIBS([dlopen], [dl dld],, [ alpine_DL="none" ])
1483   if test "x$alpine_DL" = "xnone" ; then
1484     AC_MSG_ERROR([No library containing dlopen found])
1485     exit 1      
1486   fi
1488 dnl Check if openssl = LibreSSL
1489 if test "x$alpine_SSLTYPE" != "xnone" ; then
1490   AC_MSG_CHECKING([if OpenSSL is LibreSSL])
1491   AC_TRY_COMPILE([
1492 #include <stdio.h>
1493 #include <stdlib.h>
1494 #if HAVE_STDINT_H
1495 #include <stdint.h>
1496 #endif /* HAVE_STDINT_H */
1497 #include <openssl/ssl.h>
1498         ],[
1499 #if OPENSSL_VERSION_NUMBER != 0x20000000L
1500 #error
1501 #endif
1502         ],
1503         [ AC_MSG_RESULT(yes)
1504           alpine_SSLPROVIDER="libressl"
1505         ],
1506         [ AC_MSG_RESULT(no)
1507         ],
1508         [ AC_MSG_WARN([cross compiling: not checking])])
1511 dnl Check Openssl/LibreSSL version first
1512 if test "x$alpine_SSLTYPE" != "xnone" -a "x$alpine_SSLPROVIDER" != "xlibressl" ; then
1513   AC_MSG_CHECKING([Openssl library version >= 1.0.0c])
1514   AC_TRY_COMPILE([
1515 #include <stdio.h>
1516 #include <stdlib.h>
1517 #if HAVE_STDINT_H
1518 #include <stdint.h>
1519 #endif /* HAVE_STDINT_H */
1520 #include <openssl/ssl.h>
1521         ],[
1522 #if OPENSSL_VERSION_NUMBER < 0x1000003fL
1523 #error
1524 #endif
1525         ],
1526         [ AC_MSG_RESULT(yes) 
1527           alpine_SSLPROVIDER="openssl"
1528         ],
1529         [ alpine_SSLTYPE="none" ],
1530         [ AC_MSG_WARN([cross compiling: not checking])])
1532     if test "x$alpine_SSLTYPE" = "xnone" ; then
1533         AC_MSG_ERROR(Install openssl version >= 1.0.0c)
1534         exit 1
1535     fi
1538 dnl Now check if we are working with version 1.1.0 of openssl
1539 if test "x$alpine_SSLTYPE" != "xnone" -a "x$alpine_SSLPROVIDER" != "xlibressl" ; then
1540   AC_MSG_CHECKING([Openssl library version >= 1.1.0])
1541   AC_TRY_COMPILE([
1542 #include <stdio.h>
1543 #include <stdlib.h>
1544 #if HAVE_STDINT_H
1545 #include <stdint.h>
1546 #endif /* HAVE_STDINT_H */
1547 #include <openssl/ssl.h>
1548         ],[
1549 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1550 #error
1551 #endif
1552         ],
1553         [ AC_MSG_RESULT(yes)
1554           alpine_SSLVERSION="new"
1555           CFLAGS="$CFLAGS -DOPENSSL_1_1_0 -DOPENSSL_API_COMPAT=0x10100000L"
1556         ],
1557         [ AC_MSG_RESULT(no)
1558           alpine_SSLVERSION="old" ],
1559         [ AC_MSG_WARN([cross compiling: not checking])])
1562 dnl Crypto support is needed 
1563 if test "x$alpine_SSLTYPE" != "xnone" ; then
1564   if test "x$alpine_SSLVERSION" = "xold" ; then
1565      AC_SEARCH_LIBS(SSLeay,crypto,, [ alpine_CRYPTO="none" ])
1566   else
1567      AC_SEARCH_LIBS(OpenSSL_version_num,crypto,, [ alpine_CRYPTO="none" ])
1568   fi
1569   if test "x$alpine_CRYPTO" = "xnone" ; then
1570      AC_MSG_ERROR(crypto library NOT found)
1571      exit 1
1572   fi
1573   case $host in
1574     *-*-cygwin)
1575         AC_CHECK_HEADER(crypto.h, , [ alpine_CRYPTO_DEVEL="none" ])
1576         if test "x$alpine_CRYPTO_DEVEL" = "xnone" ; then
1577            AC_MSG_ERROR(crypto library file crypto.h NOT found. Install corresponding libcrypt-devel package)
1578            exit 1
1579         fi
1580         ;;
1581     *)  ;;
1582    esac
1585 dnl provide SSL support?
1586 if test "x$alpine_SSLTYPE" != "xnone" ; then
1587   if test "x$alpine_SSLVERSION" = "xold" ; then
1588      AC_SEARCH_LIBS(SSL_library_init,ssl,,[ alpine_SSLTYPE="none" ])
1589      if test "x$alpine_SSLTYPE" = "xnone" ; then
1590         AC_MSG_ERROR(No library containing SSL_library_init found in your path)
1591         exit 1
1592      fi
1593   else
1594      AC_SEARCH_LIBS(OPENSSL_init_ssl,ssl,, [ alpine_SSLTYPE="none" ])
1595      if test "x$aalpiLlpine_SSLTYPE" = "xnone" ; then
1596         AC_MSG_ERROR(No library containing OPENSSL_init_ssl found in your path)
1597         exit 1
1598      fi
1599   fi
1602 dnl provide LDAP support?
1603 if test "$alpine_with_ldap" = "yes" ; then
1604   alpine_has_ldap=
1605   AC_CHECK_LIB(lber, ber_alloc,
1606     [
1607       LIBS="$LIBS -llber"
1608     ])
1609   AC_SEARCH_LIBS(ldap_initialize,ldap,
1610     [
1611       alpine_has_ldap=yes
1612     ],
1613     [
1614       AC_SEARCH_LIBS(ldap_open,ldap,
1615         [
1616           alpine_has_ldap=yes
1617         ])
1618     ])
1620   if test "$alpine_has_ldap" = "yes" ; then
1621     AC_MSG_NOTICE([* * * Including LDAP Support])
1622     AC_DEFINE([ENABLE_LDAP], [], [Enable LDAP query support])
1623   fi
1626 dnl PAM support is needed to build c-client in some linux, and hence Alpine.
1627 if test -z "$alpine_c_client_bundled" ; then
1628   if test "x$alpine_PAM" != "xnone" ; then
1629      AC_SEARCH_LIBS(pam_start,pam,
1630       [
1631         LIBS="$LIBS -lpam"
1632         AC_CHECK_HEADER([security/pam_appl.h],
1633         [
1634           alpine_PAM="yes"
1635         ],
1636         dnl Only mac is incompatible, do not spread bad habits.
1637         [ AC_CHECK_HEADER([pam/pam_appl.h],
1638           [
1639                 alpine_PAM="yes"
1640                 if test "x$alpine_c_client_target" != "xoxp" ; then
1641                    alpine_PAM="none"
1642                    alpine_pam_none_reason="header files not in security/ directory"
1643                 fi
1644           ],
1645           [
1646                 alpine_PAM="none"
1647                 alpine_pam_none_reason="header files not found"
1648           ])
1649         ])
1650       ],
1651       [
1652         alpine_PAM="none"
1653         alpine_pam_none_reason="library files not found"
1654       ])
1655     if test -n "$alpine_pam_none_reason" ; then
1656        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)
1657     fi
1658   fi
1661 if test -n "$alpine_c_client_bundled" ; then
1662      AC_SEARCH_LIBS(crypt,crypt,,
1663       [
1664        AC_MSG_ERROR([crypt library not found.])
1665       ])
1668 AC_SUBST([C_CLIENT_BUNDLED], $alpine_c_client_bundled)
1670 dnl provide KRB5 support?
1671 if test "x$alpine_GSSTYPE" != "xnone" ; then
1672   AC_SEARCH_LIBS(gss_init_sec_context,gss gssapi gssapi_krb5,
1673     [
1674       dnl MIT-based?
1675       LIBS="$LIBS -lkrb5"
1676       AC_CHECK_HEADER([gssapi/gssapi_generic.h],,
1677         [
1678           if test ! -d /usr/kerberos/include ; then
1679             alpine_GSSTYPE="none"
1680             alpine_gss_none_reason="header files not found"
1681           fi
1682         ])
1683     ],
1684     [
1685       alpine_GSSTYPE="none"
1686       alpine_gss_none_reason="libraries not found"
1687     ])
1688   if test -n "$alpine_gss_none_reason" ; then
1689     AC_MSG_NOTICE([NOT including Kerberos Support: $alpine_gss_none_reason])
1690   fi
1693 dnl Include NTLM?
1694 AC_ARG_WITH(ntlm,
1695   AC_HELP_STRING([--without-ntlm],[Disable NTLM client support]),
1696   [with_ntlm=$withval])
1698 dnl provide NTLM support?
1699 if test "x$with_ntlm" = "xno" ; then
1700   alpine_NTLM="none"
1701 else
1702   alpine_NTLM=
1704   AC_SEARCH_LIBS(buildSmbNtlmAuthRequest, ntlm, 
1705      [
1706         AC_CHECK_HEADER([ntlm.h],
1707         [
1708             extra_auth_ntlm=ntl
1709             AC_MSG_NOTICE([including NTLM support])
1710         ],
1711         [
1712             alpine_NTLM="none"
1713             alpine_ntlm_none_reason="header file ntlm.h not found"
1714         ])
1715      ],
1716      [
1717         alpine_NTLM="none"
1718         alpine_ntlm_none_reason="ntlm library not found"
1719      ])
1720   if test -n "$alpine_ntlm_none_reason" ; then
1721      AC_MSG_NOTICE([NOT including NTLM Support: $alpine_ntlm_none_reason])
1722   fi
1725 dnl check for tcl libraries for Web Alpine (HACKY)
1726 if test -n "$WEB_BUILD" ; then
1727 TCL_VERSIONS_DOT="tcl8.6 tcl8.5 tcl8.4 tcl8.3"
1728 TCL_VERSIONS_NODOT="`echo ${TCL_VERSIONS_DOT} | ${SED} 's/\.//g'`"
1729 TCL_VERSIONS="${TCL_VERSIONS_DOT} ${TCL_VERSIONS_NODOT} tcl"
1730   dnl look for header file
1731   if test -n "$alpine_TCLINC" ; then
1732     AC_CHECK_HEADER($alpine_TCLINC/tcl.h,,
1733       [
1734         WEB_BUILD=
1735       ])
1736     if test -z "$WEB_BUILD" ; then
1737       AC_MSG_NOTICE([Tcl Include file NOT found])
1738     fi
1739   else
1740     AC_CHECK_HEADER(tcl.h,,
1741       [
1742         for base in /usr /usr/local ; do
1743          for dir in ${TCL_VERSIONS} ; do
1744           if test -f $base/include/$dir/tcl.h ; then
1745             CPPFLAGS="$CPPFLAGS -I$base/include/$dir"
1746             found=yes
1747             break
1748           fi
1749          done
1750          if test "x$found" = "xyes" ; then
1751             break
1752          fi
1753         done
1754         if test "$found" != "yes" ; then
1755             WEB_BUILD=
1756             AC_MSG_NOTICE([header file tcl.h NOT found: Web Alpine will not be built])
1757         fi
1758       ])
1759   fi
1760   if test -n "$WEB_BUILD" ; then
1761     AC_SEARCH_LIBS([Tcl_Eval],[$alpine_TCLLIB ${TCL_VERSIONS}],,
1762       [
1763         WEB_BUILD=
1764       ])
1765     fi
1768 dnl Local or supplied regex?
1769 if test "x$alpine_REGEX" != "xyes" ; then
1770   AC_SEARCH_LIBS([regcomp],posix regexp regex re,,
1771     [
1772       if test x$alpine_REGEX = "xno" ; then
1773         AC_MSG_ERROR(Unable to find system regex library)
1774       else
1775         alpine_REGEX=yes
1776       fi
1777     ])
1779 if test "x$alpine_REGEX" != "xyes" ; then
1780   AC_CHECK_HEADER([regex.h],,
1781     [
1782       if test x$alpine_REGEX = "xno" ; then
1783         AC_MSG_ERROR(Unable to find system regex include file)
1784       else
1785         alpine_REGEX=yes
1786       fi
1787     ])
1789 AC_DEFINE(HAVE_REGEX_H,1,[Regular expression header file exists])
1790 if test "x$alpine_REGEX" = "xyes" ; then
1791   CPPFLAGS="$CPPFLAGS -I${top_builddir}/regex"
1792   LDFLAGS="$LDFLAGS -L${top_builddir}/regex"
1793   REGEX_BUILD=regex
1794   REGEX_MAKEFILE="$REGEX_BUILD/Makefile"
1797 if test "x$with_pthread" != "xno" ; then
1798   AC_MSG_CHECKING([for pthread support])
1799   ACX_PTHREAD(
1800     [
1801       AC_MSG_RESULT([yes])
1802       case "$target" in
1803           *openbsd*)
1804             AC_MSG_NOTICE([WARNING: pthread support on OpenBSD is unstable!])
1805             AM_CFLAGS="$AM_CFLAGS -pthread"
1806             ;;
1807       esac
1808       LIBS="$PTHREAD_LIBS $LIBS"
1809       AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
1810       CC="$PTHREAD_CC"
1811       AC_DEFINE([HAVE_PTHREAD], [1], [System has pthread support])
1812     ],
1813     [
1814       AC_MSG_RESULT([no])
1815     ])
1817   AC_SEARCH_LIBS([nanosleep], [rt posix4],
1818     [
1819       AC_DEFINE([HAVE_NANOSLEEP], [1], [Define if system supports subsecond, non-alarm sleep])
1820     ])
1825 dnl CHECK HEADERS
1827 AC_HEADER_STDC
1828 AC_HEADER_DIRENT
1829 AC_HEADER_STAT
1830 AC_HEADER_SYS_WAIT
1831 AC_HEADER_TIME
1832 AC_HEADER_TIOCGWINSZ
1834 AC_CHECK_HEADERS([unistd.h])
1836 AC_CHECK_HEADERS([errno.h \
1837                   ctype.h \
1838                   fcntl.h \
1839                   signal.h \
1840                   setjmp.h \
1841                   memory.h \
1842                   sys/ioctl.h \
1843                   sys/param.h \
1844                   sys/socket.h \
1845                   sys/uio.h \
1846                   sys/un.h \
1847                   limits.h \
1848                   wchar.h \
1849                   sys/poll.h \
1850                   stropts.h \
1851                   netdb.h \
1852                   syslog.h \
1853                   sys/syslog.h \
1854                   locale.h \
1855                   langinfo.h \
1856                   utime.h \
1857                   sys/utime.h \
1858                   pthread.h \
1859                   pwd.h \
1860                   assert.h])
1862 dnl terminal line discipline?
1863 AC_CHECK_HEADER([termios.h],
1864   AC_DEFINE(HAS_TERMIOS, [1], [Define if systems uses termios terminal control]),
1865   [
1866     AC_CHECK_HEADER([termio.h],
1867       AC_DEFINE(HAS_TERMIO, [1], [Define if systems uses termio terminal control]),
1868       [
1869         AC_CHECK_HEADER([sgtty.h],
1870           AC_DEFINE(HAS_SGTTY, [1], [Define if systems uses old BSD-style terminal control]),
1871         [
1872           AC_MSG_ERROR(Unable to figure out terminal control method)
1873         ])
1874       ])
1875   ])
1878 dnl CHECK TYPEDEFS
1880 AC_DIAGNOSE([obsolete],[your code may safely assume C89 semantics that RETSIGTYPE is void.
1881 Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
1882 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
1883 [AC_LANG_PROGRAM([#include <sys/types.h>
1884 #include <signal.h>
1886                  [return *(signal (0, 0)) (0) == 1;])],
1887                    [ac_cv_type_signal=int],
1888                    [ac_cv_type_signal=void])])
1889 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
1890                     (`int' or `void').])
1892 AC_TYPE_SIZE_T
1893 AC_TYPE_MODE_T
1894 AC_TYPE_PID_T
1895 AC_TYPE_UID_T
1896 AC_STRUCT_TM
1898 AC_CHECK_TYPES([union wait])
1900 AC_CHECK_HEADERS([stdint.h], [uint16=uint16_t], [
1901   AC_CHECK_HEADERS([inttypes.h], [uint16=uint16_t], [
1902     AC_CHECK_HEADERS([sys/types.h], [uint16=u_int16_t], [
1903       AC_CHECK_SIZEOF(unsigned short)
1904       if test $ac_cv_sizeof_unsigned_short -eq 2 ; then
1905         uint16="unsigned short"
1906       else
1907         AC_CHECK_SIZEOF(unsigned int)
1908         if $ac_cv_sizeof_unsigned_int -eq 2 ; then
1909           uint16="unsigned int"
1910         else
1911           AC_MSG_ERROR(Unable to determine 16 bit integer type)
1912         fi
1913       fi
1914     ])
1915   ])
1917 AC_DEFINE_UNQUOTED([UINT16], $uint16, [System defined unsigned 16 bit integer])
1919 AC_CHECK_HEADERS([stdint.h], [uint32=uint32_t], [
1920   AC_CHECK_HEADERS([inttypes.h], [uint32=uint32_t], [
1921     AC_CHECK_HEADERS([sys/types.h], [uint32=u_int32_t], [
1922       AC_CHECK_SIZEOF(unsigned int)
1923       if test $ac_cv_sizeof_unsigned_int -eq 4 ; then
1924         uint32="unsigned int"
1925       else
1926         AC_CHECK_SIZEOF(unsigned long)
1927         if $ac_cv_sizeof_unsigned_long -eq 4 ; then
1928           uint32="unsigned long"
1929         else
1930           AC_MSG_ERROR(Unable to determine 32 bit integer type)
1931         fi
1932       fi
1933     ])
1934   ])
1936 AC_DEFINE_UNQUOTED([UINT32], $uint32, [System defined unsigned 32 bit integer])
1938 AC_CACHE_CHECK(argument pointer type of qsort compare function and base,
1939 ac_cv_func_qsort_argtype,
1940 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1941 #if     HAVE_STDLIB_H
1942 #include "stdlib.h"
1943 #endif
1945 extern void *base;
1946 extern sortf(const void *, const void *);
1947 int sortf(a, b)
1948   const void *a;
1949   const void *b; { return 0; }
1950 ]], [[
1951 qsort(base, 2, sizeof(char *), sortf);
1952 ]])],[ac_cv_func_qsort_argtype=void],[ac_cv_func_qsort_argtype=char])
1954 AC_DEFINE_UNQUOTED([qsort_t], $ac_cv_func_qsort_argtype, [qsort compare function argument type])
1956 dnl check for "struct passwd" ?
1958 AC_FUNC_SELECT_ARGTYPES
1960 AC_FUNC_STRCOLL
1962 dnl CHECK FOR LIBRARY FUNCTIONS
1964 AC_FUNC_FORK
1965 AC_CHECK_FUNCS([strchr \
1966                 memcpy \
1967                 strtol \
1968                 strtoul \
1969                 select \
1970                 poll \
1971                 qsort \
1972                 getuid \
1973                 getpwuid \
1974                 getpwnam \
1975                 gettimeofday \
1976                 tmpfile \
1977                 uname \
1978                 rename \
1979                 read \
1980                 signal \
1981                 setjmp \
1982                 chown \
1983                 wait4 \
1984                 waitpid \
1985                 wait \
1986                 srandom \
1987                 popen \
1988                 pclose \
1989                 fsync \
1990                 truncate \
1991                 listen \
1992                 wcwidth \
1993                 mbstowcs \
1994                 wcrtomb \
1995                 putenv \
1996                 setenv])
1998 AC_SEARCH_LIBS([gethostname],[nsl])
2000 AC_SEARCH_LIBS([socket],[socket],,
2001   [
2002     WEB_BUILD=
2003   ])
2005 AC_SEARCH_LIBS([bind],[bind],,
2006   [
2007     WEB_BUILD=
2008   ])
2010 dnl check for POSIX signal interface
2011 AC_CHECK_FUNCS([sigaction sigemptyset sigaddset sigprocmask],
2012   [
2013     AC_DEFINE([POSIX_SIGNALS], [], [Define if system supports POSIX signal interface])
2014   ],
2015   [
2016     AC_CHECK_FUNCS([sigset sigrelse],
2017       [
2018         AC_DEFINE([SYSV_SIGNALS], [], [Define if system supports SYSV signal interface])
2019       ])
2020   ])
2022 AC_SEARCH_LIBS([syslog], [bsd socket inet],
2023   [
2024     AC_DEFINE([HAVE_SYSLOG], [1], [Define if system supplies syslog() logging])
2025   ])
2028 dnl set pico newmail check directory
2029 if test -n "$alpine_with_local_maildir" ; then
2030     alpine_local_maildir=$alpine_with_local_maildir
2031 elif test -d /var/spool/mail ; then
2032     alpine_local_maildir="/var/spool/mail"
2033 elif test -d /var/mail ; then
2034     alpine_local_maildir="/var/mail"
2035 else
2036     alpine_local_maildir="/usr/spool/mail"
2039 dnl set c-client make target
2040 if test -n "$alpine_with_c_client_target" ; then
2041     alpine_c_client_target=$alpine_with_c_client_target
2044 AC_DEFINE_UNQUOTED([SYSTYPE], "$systype", [Pine-Centric Host Specifier])
2045 AC_DEFINE_UNQUOTED([C_FILESEP],'$alpine_path_delim',[File name separator as character constant])
2046 AC_DEFINE_UNQUOTED([S_FILESEP],"$alpine_path_delim",[File name separator as string constant])
2047 AC_DEFINE_UNQUOTED([MAILDIR],"$alpine_local_maildir",[Path to local inboxes for pico newmail check])
2048 AC_DEFINE_UNQUOTED([MODE_READONLY], $alpine_mode_readonly, [File mode used to set readonly access])
2049 AC_DEFINE_UNQUOTED([HTML_EXT],"html",[Default extension for html files])
2051 dnl c-client make particulars
2052 AC_SUBST([C_CLIENT_TARGET], $alpine_c_client_target)
2053 AC_SUBST([C_CLIENT_WITH_IPV6], $c_client_ip6)
2054 if test "x$alpine_SSLTYPE" = "xnone" ; then 
2055   AC_MSG_NOTICE([* * *  NOT Including SSL Support])
2056   c_client_specials="${c_client_specials}SSLTYPE=none "
2057 else
2058   dnl issue any warnings for common OpenSSL issues
2060   if test -n "$alpine_SSLCERTS" -a -d "$alpine_SSLCERTS" ; then
2061     certdir="$alpine_SSLCERTS"
2062   elif test -n "$alpine_SSLDIR" -a -d "${alpine_SSLDIR}/certs" ; then
2063     certdir="${alpine_SSLDIR}/certs"
2064   elif test -n "$alpine_SSLDIR" -a -d "${alpine_SSLDIR}/ssl/certs" ; then
2065     certdir="${alpine_SSLDIR}/ssl/certs"
2066   elif test -n "$alpine_SSLCERTS_ORIG" -a -d "$alpine_SSLCERTS_ORIG" ; then
2067     certdir="$alpine_SSLCERTS_ORIG"
2068   elif test -n "$alpine_SSLCERTS" ; then
2069     certdir="$alpine_SSLCERTS"
2070   else
2071     AC_MSG_NOTICE([SSL Problem: certificate directory not found])
2072   fi
2074   if test "x$with_smime" != "xno" ; then
2075     if test -n "$certdir" ; then
2076       AC_MSG_NOTICE([* * * S/MIME support enabled])
2077       AC_DEFINE([SMIME], [], [Enable S/MIME code])
2078       AC_DEFINE_UNQUOTED([SMIME_SSLCERTS],"$certdir",[Directory where S/MIME CACerts are located])
2079     fi
2080   fi
2083   SSL_CERT_LINK="no"
2084   if test -z "`ls ${certdir} | $EGREP '^@<:@0-9A-Fa-f@:>@{8}\.@<:@0-9@:>@'`" ; then
2085      SSL_BUNDLE_EXISTS="no"
2086      SSL_PEM="factory.pem ca-bundle.pem cert.pem ca-bundle.crt ca-root-nss.crt"
2087      for SSL_BUNDLE in $SSL_PEM
2088      do
2089        if test -f ${certdir}/${SSL_BUNDLE} ; then
2090           SSL_BUNDLE_EXISTS="yes"
2091        fi
2092      done
2093   else
2094      SSL_CERT_LINK="yes"
2095   fi
2097   if test "x$SSL_BUNDLE_EXISTS" = "xno" -a "x$SSL_CERT_LINK" = "xno" ; then
2098      AC_MSG_NOTICE([* * * No certificates found in "${certdir}".])
2099      AC_MSG_NOTICE([* * *   This might indicate that CA certs did not get properly])
2100      AC_MSG_NOTICE([* * *   installed.  If you get certificate validation failures])
2101      AC_MSG_NOTICE([* * *   in Alpine, this might be the reason for them.])
2102   fi
2104   if test -n "$alpine_SSLINCLUDE" ; then
2105     c_client_specials="${c_client_specials}SSLINCLUDE=$alpine_SSLINCLUDE "
2106   fi
2108   if test -n "$alpine_SSLLIB" ; then
2109     c_client_specials="${c_client_specials}SSLLIB=$alpine_SSLLIB "
2110   fi
2112   if test -n "$alpine_SSLDIR" ; then
2113     c_client_specials="${c_client_specials}SSLDIR=$alpine_SSLDIR "
2114   fi
2116   if test -n "$certdir" ; then
2117     c_client_specials="${c_client_specials}SSLCERTS=$certdir "
2118   fi
2120   if test -n "$alpine_SSLKEYS" ; then
2121       c_client_specials="${c_client_specials}SSLKEYS=$alpine_SSLKEYS "
2122   fi
2125 extra_auth_gss=
2126 if test "x$alpine_GSSTYPE" != "xnone" ; then
2127   extra_auth_gss=gss
2128   AC_MSG_NOTICE([* * * Including Kerberos5 functionality])
2131 extra_auth_ntlm=
2132 if test "x$alpine_NTLM" != "xnone" ; then
2133   extra_auth_ntlm=ntl
2134   AC_MSG_NOTICE([* * * Including NTLM Authenticator])
2137 if test -n "$CPPFLAGS" ; then
2138   alpine_c_client_cflags="$alpine_c_client_cflags ${CPPFLAGS}"
2140 if test -n "$CFLAGS" ; then
2141   alpine_c_client_cflags="$alpine_c_client_cflags ${CFLAGS}"
2144 if test -n "$alpine_c_client_cflags" ; then
2145   AC_SUBST(C_CLIENT_CFLAGS, EXTRACFLAGS=\"$alpine_c_client_cflags\")
2148 if test -n "$LDFLAGS" ; then
2149   alpine_c_client_ldflags="$alpine_c_client_ldflags ${LDFLAGS}"
2151 if test -n "$LIBS" ; then
2152   alpine_c_client_ldflags="$alpine_c_client_ldflags ${LIBS}"
2155 if test -n "$alpine_c_client_ldflags" ; then
2156   AC_SUBST(C_CLIENT_LDFLAGS, EXTRALDFLAGS=\"$alpine_c_client_ldflags\")
2159 if test -n "$alpine_c_client_gccoptlevel" ; then
2160   AC_SUBST(C_CLIENT_GCCOPTLEVEL, GCCOPTLEVEL=\"$alpine_c_client_gccoptlevel\")
2163 c_client_auths="$extra_auth_gss $extra_auth_ntlm"
2164 AC_SUBST([C_CLIENT_AUTHS], $c_client_auths)
2166 AC_SUBST([C_CLIENT_SPECIALS], $c_client_specials)
2168 dnl Deal with Web Alpine
2169 if test -z "$WEB_BUILD" ; then
2170   WEB_PUBCOOKIE_BUILD=
2171   AC_MSG_NOTICE([* * * TCL libraries could not be found.])
2172   AC_MSG_NOTICE([* * * WEB ALPINE COMPONENT WILL NOT BE BUILT.])
2173 else
2174   if test -n "$WEB_PUBCOOKIE_BUILD" ; then
2175     if test "x$alpine_GSSTYPE" = "xnone" ; then
2176       WEB_PUBCOOKIE_BUILD=
2177       AC_MSG_NOTICE([* * * Kerberos5 support not found.])
2178       AC_MSG_NOTICE([* * * WEB ALPINE PUBCOOKIE COMPONENT WILL NOT BE BUILT.])
2179     elif test -z "$WEB_BINDIR" ; then
2180       WEB_PUBCOOKIE_BUILD=
2181       AC_MSG_NOTICE([* * * Web Alpine binary directory not provided.])
2182         AC_MSG_ERROR([* * * --with-pubcookie requires --with-web-bin=PATH.
2183         Please re-run configure with these options:
2184         --with-pubcookie --with-web-bin=/usr/local/libexec/alpine/bin])
2185     else
2186       AC_DEFINE([PUBCOOKIE],[1],[Include support for UW Pubcookie Web Authentication])
2187       WEB_PUBCOOKIE_LIB=../pubcookie/libauthgssproxy.a
2188       WEB_PUBCOOKIE_LINK=gssapi_proxy.l
2189     fi
2190   fi
2193 AC_SUBST([REGEX_BUILD])
2195 AC_SUBST([WEB_BUILD])
2196 AC_SUBST([WEB_BINDIR])
2197 AC_SUBST([WEB_PUBCOOKIE_BUILD])
2198 AC_SUBST([WEB_PUBCOOKIE_LIB])
2199 AC_SUBST([WEB_PUBCOOKIE_LINK])
2201 AC_SUBST([AM_CFLAGS])
2202 AC_SUBST([AM_LDFLAGS])
2204 AC_CONFIG_FILES([m4/Makefile po/Makefile.in $REGEX_MAKEFILE \
2205           pith/osdep/Makefile pith/charconv/Makefile pith/Makefile \
2206           pico/osdep/Makefile pico/Makefile \
2207           alpine/osdep/Makefile alpine/Makefile \
2208           web/src/Makefile web/src/pubcookie/Makefile \
2209           web/src/alpined.d/Makefile \
2210           Makefile])
2211 AC_OUTPUT