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