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