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