* reverse backward search momemtarily, it will be released as patch,
[alpine.git] / configure.ac
blobdbfdcc3725a245c58fe47adbe032fdc58fce7378
1 dnl Process this file with autoconf to produce a configure script.
3 dnl /* ========================================================================
4 dnl  * Copyright 2013 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:2 by chappa@washington.edu])
20 dnl Alpine Version Number is in $srcdir/VERSION
21 AC_INIT([alpine],[m4_normalize(m4_include(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 AC_PROG_CC_STDC
43 AC_PROG_INSTALL
44 AC_PROG_MAKE_SET
45 AC_PROG_LN_S
46 AC_PROG_AWK
47 AC_PROG_RANLIB
48 LT_INIT
50 AC_PATH_PROG(AR, ar, ar)
51 AC_PATH_PROG(RM, rm, rm)
52 AC_PATH_PROG(CP, cp, cp)
53 AC_PATH_PROG(LN, ln, ln)
54 AC_PATH_PROG(SED, sed, sed)
55 AC_PATH_PROG(MAKE, make)
57 dnl COMPILE-TIME OPTIONS
59 AM_GNU_GETTEXT_VERSION([0.16.1])
60 AM_GNU_GETTEXT([external])
62 dnl enable dmalloc per http://dmalloc.com
63 dnl NOTE: does not check c-client
64 AC_MSG_CHECKING([option: dmalloc enabled])
65 AC_ARG_ENABLE(dmalloc, AS_HELP_STRING([--enable-dmalloc],[Enable dmalloc debugging]))
66 if test x$enable_dmalloc = "xyes" ; then
67   AC_MSG_RESULT([yes])
68 else
69   AC_MSG_RESULT([no])
72 AC_ARG_WITH(dmalloc-dir,
73   AS_HELP_STRING([--with-dmalloc-dir=DIR],[Root of dmalloc lib/include path]),
74   [
75     if test "x$withval" != "xno" ; then
76       enable_dmalloc = "yes"
77       CPPFLAGS="$CPPCFLAGS -I${withval}"
78       LDFLAGS="$LDFLAGS -L${withval}"
79     fi
80   ])
82 if test x$enable_dmalloc = "xyes" ; then
83   AC_DEFINE(ENABLE_DMALLOC, 1, [Define enable dmalloc debugging])
86 localedir="\${datadir}/locale"
87 AC_ARG_WITH(localedir,
88   AS_HELP_STRING([--with-localedir=DIR],[Name of gettext locale directory]),
89   [
90     case $withval in
91       yes)
92         ;;
93       no)
94         ;;
95       *)
96         localedir=$withval
97         ;;
98     esac
99   ])
100 AC_SUBST(localedir, "[$localedir]")
102 # Setup OS-Specific features
103 case "$host" in
104   *darwin*)
105     dnl OS X Universal Binary Support
106     AC_ARG_ENABLE(osx-universal-binaries,
107       AS_HELP_STRING([--enable-osx-universal-binaries],[Produce universal binaries under OS X [[default=no]]]))
108     if test "x$enable_osx_universal_binaries" = "xyes" ; then
109       if test "x$enable_dependency_tracking" != xno ; then
110         AC_MSG_ERROR([--enable-osx-universal-binary requires --disable-dependency-tracking.
111 Please re-run configure with these options:
112     --disable-dependency-tracking --enable-osx-universal-binary])
113       fi
114       if [test -d /Developer/SDKs/MacOSX10.5.sdk] ; then
115         alpine_sysroot=/Developer/SDKs/MacOSX10.5.sdk
116       elif [test -d /Developer/SDKs/MacOSX10.4u.sdk] ; then
117         alpine_sysroot=/Developer/SDKs/MacOSX10.4u.sdk
118       else
119         AC_MSG_ERROR([No suitable MacOSX SDK found.  Make sure Xcode tools are installed])
120       fi
121       ub_cflags="-isysroot $alpine_sysroot -arch ppc -arch i386"
122       ub_ldflags="-Wl,-syslibroot,$alpine_sysroot -arch ppc -arch i386"
123       AM_CFLAGS="$AM_CFLAGS $ub_cflags"
124       AM_LDFLAGS="$AM_LDFLAGS $ub_ldflags"
125       alpine_c_client_cflags="$alpine_c_client_cflags $ub_cflags"
126       alpine_c_client_ldflags="$alpine_c_client_ldflags $ub_ldflags"
127     fi
128     ;;
129 esac
131 AC_ARG_WITH(include-path,
132   AS_HELP_STRING([--with-include-path=PATHS],[Colon-separated list of directories used for include file search]),
133   [
134     case $withval in
135       no)
136         ;;
137       yes)
138         ;;
139       *)
140         new_cppflags="-I`echo ${withval} | ${SED} 's/:/ -I/g'`"
141         CPPFLAGS="$CPPFLAGS ${new_cppflags}"
142         alpine_c_client_cflags="$alpine_c_client_cflags ${new_cppflags}"
143         ;;
144     esac
145   ])
147 AC_ARG_WITH(lib-path,
148   AS_HELP_STRING([--with-lib-path=PATHS],[Colon-separated list of directories used for library search]),
149   [
150     case $withval in
151       no)
152         ;;
153       yes)
154         ;;
155       *)
156         new_ldflags="-L`echo ${withval} | ${SED} 's/:/ -L/g'`"
157         LDFLAGS="$LDFLAGS $new_ldflags"
158         alpine_c_client_ldflags="$alpine_c_client_ldflags ${new_ldflags}"
159         ;;
160     esac
161   ])
163 AC_ARG_WITH(pubcookie,
164   AS_HELP_STRING([--with-pubcookie],[Include support for UW-Pubcookie Web Authentication]),
165   [
166     if test "x$withval" != "xno" ; then
167       WEB_PUBCOOKIE_BUILD=web/src/pubcookie
168     fi
169   ])
172 AC_ARG_WITH(web-bin,
173   AS_HELP_STRING([--with-web-bin=PATH],[Directory to hold Web Alpine component binary files]),
174   [
175     case "$withval" in
176       no)
177         ;;
178       yes)
179         ;;
180       *)
181         WEB_BINDIR=$withval
182         ;;
183     esac
184   ])
186 dnl disable debug, turned on by default
187 AC_MSG_CHECKING([option: debugging is enabled])
188 AC_ARG_ENABLE(debug, AS_HELP_STRING([--disable-debug],[Exclude debug messages from source]))
189 if test x$enable_debug != "xno" ; then
190   AM_CFLAGS="$AM_CFLAGS -g"
191   AC_DEFINE([DEBUG], [1], [Compile in debugging])
192   AC_DEFINE([DEBUGJOURNAL], [1], [Display debug messages in journal])
193   AC_MSG_RESULT([yes])
194 else
195 dnl ??? set AM_CFLAGS to optimize ???
196   AC_MSG_RESULT([no])
199 dnl disable optimization, on by default
200 AC_MSG_CHECKING([option: optimization is enabled])
201 AC_ARG_ENABLE(optimization, AS_HELP_STRING([--disable-optimization],[Exclude optimizing compiler flags]))
202 if test x$enable_optimization != "xno" ; then
203   AC_MSG_RESULT([yes])
204 else
205   CFLAGS="`echo $AM_CFLAGS | ${SED} 's/-O2//'`"
206   alpine_c_client_gccoptlevel="-O0"
207   AC_MSG_RESULT([no])
210 dnl disable mouse support
211 AC_MSG_CHECKING([option: mouse support enabled])
212 AC_ARG_ENABLE(mouse, AS_HELP_STRING([--disable-mouse],[Disable mouse support]))
213 if test x$enable_mouse != "xno" ; then
214   AC_DEFINE([MOUSE], [], [Compile in mouse support])
215   AC_MSG_RESULT([yes])
216 else
217    AC_MSG_RESULT([no])
220 dnl enable quotas
221 AC_MSG_CHECKING([option: quotas enabled])
222 AC_ARG_ENABLE(quotas, AS_HELP_STRING([--enable-quotas],[Enable disk quota checking on startup]))
223 if test x$enable_quotas = "xyes" ; then
224   AC_DEFINE([USE_QUOTAS], [], [Compile in quota check on startup])
225   AC_MSG_RESULT([yes])
226 else
227    AC_MSG_RESULT([no])
230 AC_MSG_CHECKING([option: From changing enabled])
231 AC_ARG_ENABLE(from_changing, AS_HELP_STRING([--disable-from-changing],[Disallow users changing From addresss]))
232 if test x$enable_from_changing != "xno" ; then
233   AC_MSG_RESULT([yes])
234 else
235   AC_DEFINE([NEVER_ALLOW_CHANGING_FROM], [], [Disallow users changing their From address])
236   AC_MSG_RESULT([no])
239 dnl enable background posting support
240 AC_MSG_CHECKING([option: background post enabled])
241 AC_ARG_ENABLE(background-post, AS_HELP_STRING([--disable-background-post],[Disable background posting]))
242 if test x$enable_background_post != "xno" ; then
243   AC_DEFINE([BACKGROUND_POST], [], [Enable background posting support])
244   AC_MSG_RESULT([yes])
245 else
246     AC_MSG_RESULT([no])
249 dnl enable keyboard locking support
250 AC_MSG_CHECKING([option: keyboard lock enabled])
251 AC_ARG_ENABLE(keyboard-lock, AS_HELP_STRING([--disable-keyboard-lock],[Disable keyboard locking]))
252 if test x$enable_keyboard_lock != "xno" ; then
253   AC_DEFINE([KEYBOARD_LOCK], [], [Enable keyboard lock support])
254   AC_MSG_RESULT([yes])
255 else
256   AC_MSG_RESULT([no])
259 dnl enable from encoding support
260 AC_MSG_CHECKING([option: from encoding enabled])
261 AC_ARG_ENABLE(from-encoding, AS_HELP_STRING([--enable-from-encoding],[Enable From encoding in sent messages]))
262 if test x$enable_from_encoding = "xyes" ; then
263   AC_DEFINE([ENCODE_FROMS], [], [Enable From address encoding in sent messages])
264   AC_MSG_RESULT([yes])
265 else
266   AC_MSG_RESULT([no])
269 dnl OPTION: name of local submission agent
270 dnl         Might not be sendmail, but it MUST speak SMTP on stdin/stdout
271 AC_ARG_WITH(smtp-msa,
272   AS_HELP_STRING([--with-smtp-msa=PATH],[Local Mail Submission Agent (sendmail)]),
273     [
274       case "$withval" in
275         no)
276           ;;
277         yes)
278           AC_PATH_PROG(SENDMAIL, sendmail, "", $PATH:/usr/sbin:/usr/lib)
279           ;;
280         *)
281           SENDMAIL=$withval
282           ;;
283       esac
284     ],
285     [
286           AC_PATH_PROG(SENDMAIL, sendmail, "", $PATH:/usr/sbin:/usr/lib)
287     ])
288 if test -n "$SENDMAIL" ; then
289     AC_DEFINE_UNQUOTED([SENDMAIL], "$SENDMAIL", [Local mail submission agent])
292 dnl OPTION: local msa arguments
293 smtp_msa_flags="-bs -odb -oem"
294 AC_ARG_WITH(smtp-msa-flags,
295   AS_HELP_STRING([--with-smtp-msa-flags=FLAGS],[MSA flags for SMTP on stdin/stdout (-bs -odb -oem)]),
296   [
297     if test "x$withval" != "xno" ; then
298       smtp_msa_flags=$withval
299     fi
300   ])
301 AC_DEFINE_UNQUOTED([SENDMAILFLAGS], "$smtp_msa_flags", [Local MSA flags for SMTP on stdin/stdout])
303 dnl OPTION: name of local news posting agent and flags
304 npa="inews"
305 AC_ARG_WITH(npa,
306   AS_HELP_STRING([--with-npa=PATH],[Posting agent when no nntp-servers defined (inews)]),
307     [
308       case "$withval" in
309         no)
310           ;;
311         yes)
312           AC_PATH_PROG(NPA_PROG, inews, "", $PATH:/usr/sbin:/usr/lib)
313           ;;
314         *)
315           NPA_PROG=$withval
316           ;;
317       esac
318     ],
319     [
320           AC_PATH_PROG(NPA_PROG, inews, "", $PATH:/usr/sbin:/usr/lib)
321     ])
323 npa_flags="-h"
324 AC_ARG_WITH(npa-flags,
325   AS_HELP_STRING([--with-npa-flags=FLAGS],[Flags to allow posting via local agent (-h)]),
326   [
327     if test "x$withval" != "xno" ; then
328       npa_flags=$withval
329     fi
330   ])
331 if test -n "$NPA_PROG" ; then
332   AC_DEFINE_UNQUOTED([SENDNEWS], "$NPA_PROG $npa_flags", [Posting agent to use when no nntp-servers defined])
335 dnl OPTION: password changing program
336 AC_ARG_WITH(password-prog,
337   AS_HELP_STRING([--with-password-prog=PATH],[Password change program (/bin/passwd)]),
338     [
339       case "$withval" in
340         no)
341           ;;
342         yes)
343           AC_PATH_PROG(PWPROG, passwd, "", $PATH:/usr/sbin:/usr/lib)
344           ;;
345         *)
346           AC_PATH_PROG(PWPROG, $withval, "", $PATH:/usr/sbin:/usr/lib)
347           ;;
348       esac
349     ],
350     [
351           AC_PATH_PROG(PWPROG, passwd, "", $PATH:/usr/sbin:/usr/lib)
352     ])
353 if test -n "$PWPROG" ; then
354     AC_DEFINE_UNQUOTED([PASSWD_PROG], "$PWPROG", [Program users use to change their password])
357 dnl OPTION: basic spell checking program
358 AC_ARG_WITH(simple-spellcheck,
359   AS_HELP_STRING([--with-simple-spellcheck=PROG],[Spellcheck program reads stdin, emits misspellings on stdout]),
360     [
361       if test "x$withval" != "xno" ; then
362         SPELLPROG=$withval
363       fi
364     ],
365     [
366       AC_CHECK_PROG([SPELLPROG], [hunspell], [hunspell], [])
367       if test -z "$SPELLPROG" ; then
368         AC_CHECK_PROG([SPELLPROG], [aspell], [aspell], [])
369         if test -z "$SPELLPROG" ; then
370           AC_CHECK_PROG([SPELLPROG], [ispell], [ispell], [])
371           if test -z "$SPELLPROG" ; then
372            SPELLPROG="spell"
373           fi
374         fi
375       fi
376     ])
378 if test "x$SPELLPROG" != "xno" ; then
379   AC_PATH_PROG(alpine_simple_spellcheck, $SPELLPROG)
380   if test -n "$alpine_simple_spellcheck" ; then
381     case "$SPELLPROG" in
382       hunspell)
383         alpine_simple_spellcheck="$alpine_simple_spellcheck -l"
384         ;;
385       aspell)
386         alpine_simple_spellcheck="$alpine_simple_spellcheck --dont-backup --mode=email list"
387         ;;
388       ispell)
389         alpine_simple_spellcheck="$alpine_simple_spellcheck -l"
390         ;;
391       *)
392         ;;
393     esac
394   fi
397 dnl OPTION: interactive spell checking program
398 AC_ARG_WITH(interactive-spellcheck,
399   AS_HELP_STRING([--with-interactive-spellcheck=PROG],[Interactive, filewise spell checker]),
400     [
401       if test "x$withval" != "xno" ; then
402         ISPELLPROG=$withval
403       fi
404     ],
405     [
406       AC_CHECK_PROG([ISPELLPROG], [hunspell], [hunspell], [])
407       if test -z "$ISPELLPROG" ; then
408         AC_CHECK_PROG([ISPELLPROG], [aspell], [aspell], [])
409         if test -z "$SPELLPROG" ; then
410           ISPELLPROG="ispell"
411         fi
412       fi
413     ])
415 if test "x$ISPELLPROG" != "xno" ; then
416   AC_PATH_PROG(alpine_interactive_spellcheck, $ISPELLPROG)
417   if test -n "$alpine_interactive_spellcheck" ; then
418     case "$ISPELLPROG" in
419       aspell)
420         alpine_interactive_spellcheck="$alpine_interactive_spellcheck --dont-backup --mode=email check"
421         ;;
422       *)
423         ;;
424     esac
425   fi
428 if test -n "$alpine_interactive_spellcheck" ; then
429     AC_DEFINE_UNQUOTED([DF_VAR_SPELLER], "$alpine_interactive_spellcheck", [Interactive, filewise spell checker])
432 if test -z "$alpine_simple_spellcheck" -a -n "$alpine_interactive_spellcheck" ; then
433   alpine_simple_spellcheck=test
435 AC_DEFINE_UNQUOTED([SPELLER], "$alpine_simple_spellcheck", [Simple spell checker: reads stdin, emits misspellings on stdout])
437 dnl OPTION: system-pinerc
438 dnl NOTE: historically we used /lib for the config dir.
439 dnl       don't ask, it was a long time ago. but, we can't
440 dnl       change it now without breaking compatibility
441 case "$prefix" in
442   NONE) dpv=/usr/local/lib/pine.conf ;;
443   *) dpv=${prefix}/lib/pine.conf ;;
444 esac
445 AC_ARG_WITH(system-pinerc,
446   AS_HELP_STRING([--with-system-pinerc=VALUE],[System pinerc (/usr/local/lib/pine.conf)]),
447     [
448       case "$withval" in
449         no)
450           ;;
451         yes)
452           ;;
453         *)
454           dpv=$withval
455           ;;
456       esac
457     ])
458 AC_DEFINE_UNQUOTED(SYSTEM_PINERC, "$dpv", [System pinerc])
460 dnl OPTION: system-fixed-pinerc
461 dnl NOTE: historically we used /lib for the config dir.
462 dnl       don't ask, it was a long time ago. but, we can't
463 dnl       change it now without breaking compatibility
464 case "$prefix" in
465   NONE) dpv=/usr/local/lib/pine.conf.fixed ;;
466   *) dpv=${prefix}/lib/pine.conf.fixed ;;
467 esac
468 AC_ARG_WITH(system-fixed-pinerc,
469   AS_HELP_STRING([--with-system-fixed-pinerc=VALUE],[System fixed pinerc (/usr/local/lib/pine.conf.fixed)]),
470     [
471       case "$withval" in
472         no)
473           ;;
474         yes)
475           ;;
476         *)
477           dpv=$withval
478           ;;
479       esac
480     ])
481 AC_DEFINE_UNQUOTED(SYSTEM_PINERC_FIXED, "$dpv", [System fixed pinerc])
483 dnl OPTION: local support information, file that contains information on
484 dnl         how to contact local support for Alpine.
485 dnl NOTE: historically we used /lib for the config dir.
486 dnl       don't ask, it was a long time ago. but, we can't
487 dnl       change it now without breaking compatibility
488 case "$prefix" in
489   NONE) dpv=/usr/local/lib/pine.info ;;
490   *) dpv=${prefix}/lib/pine.info ;;
491 esac
492 AC_ARG_WITH(local-support-info,
493   AS_HELP_STRING([--with-local-support-info=VALUE],[Local Support Info File (/usr/local/lib/pine.info)]),
494     [
495       case "$withval" in
496         no)
497           ;;
498         yes)
499           ;;
500         *)
501           dpv=$withval
502           ;;
503       esac
504     ])
505 AC_DEFINE_UNQUOTED(SYSTEM_PINE_INFO_PATH, "$dpv", [Local Support Info File])
507 dnl Function to simplify setting alpine/pico defaults
508 dnl usage: PINEVAR(configure-name, definition-name, definition-value, help)
509 AC_DEFUN([PINEVAR],
510   [
511     dpv=$3
512     AC_ARG_WITH($1,
513       AS_HELP_STRING([--with-$1=VALUE],[$4 ($3)]),
514       [
515         if test "x$withval" != "xno" ; then
516           dpv=$withval
517         fi
518       ])
519     AC_DEFINE_UNQUOTED($2, "$dpv", [Default configuration value])
520   ])
522 dnl Function to simplify setting pine/pico defaults
523 dnl usage: PINEVAR_UNQUOTED(configure-name, definition-name, definition-value, help)
524 AC_DEFUN([PINEVAR_UNQUOTED],
525   [
526     dpv=$3
527     AC_ARG_WITH($1,
528       AS_HELP_STRING([--with-$1=VALUE],[$4 ($3)]),
529       [
530         if test "x$withval" != "xno" ; then
531           dpv=$withval
532         fi
533       ])
534     AC_DEFINE_UNQUOTED($2, $dpv, [Default configuration value])
535   ])
537 PINEVAR(mailcheck-interval, DF_MAILCHECK, 150, [Specify default mail-check-interval])
538 PINEVAR_UNQUOTED(checkpoint-interval, CHECK_POINT_TIME, 420, [Specify default checkpoint-interval])
539 PINEVAR_UNQUOTED(checkpoint-frequency, CHECK_POINT_FREQ, 12, [State change count before checkpoint])
540 PINEVAR_UNQUOTED(display-rows, DEFAULT_LINES_ON_TERMINAL, 24, [Initial rows on display])
541 PINEVAR_UNQUOTED(display-columns, DEFAULT_COLUMNS_ON_TERMINAL, 80, [Initial columns on display])
542 PINEVAR_UNQUOTED(max-display-rows, MAX_SCREEN_ROWS, 200, [Maximum display rows])
543 PINEVAR_UNQUOTED(max-display-columns, MAX_SCREEN_COLS, 500, [Maximum display columns])
544 PINEVAR(fill-column, DF_FILLCOL, 74, [Default fill column])
545 PINEVAR_UNQUOTED(max_fill-column, MAX_FILLCOL, 80, [Maximum fill column])
546 PINEVAR_UNQUOTED(debug-level, DEFAULT_DEBUG, 2, [Specify default debug verbosity level])
547 PINEVAR_UNQUOTED(debug-files, NUMDEBUGFILES, 4, [Specify number of debug files])
548 PINEVAR(debug-file, DEBUGFILE, [.pine-debug], [Specify debug file name])
549 PINEVAR(forwarded-keyword, FORWARDED_FLAG, ["\$Forwarded"], [IMAP (c-client) keyword to store forwarded status])
550 PINEVAR(display-overlap, DF_OVERLAP, [2], [Lines preserved while paging])
551 PINEVAR(display-margin, DF_MARGIN, [0], [Lines visible while scrolling])
552 PINEVAR(default-fcc, DF_DEFAULT_FCC, [sent-mail], [Default sent mail folder])
553 PINEVAR(default-save-folder, DEFAULT_SAVE, [saved-messages], [Default save folder])
554 PINEVAR(default-legacy-postponed-folder, POSTPONED_MAIL, [postponed-mail], [Pre Pine 3.90 postponed folder])
555 PINEVAR(default-postponed-folder, POSTPONED_MSGS, [postponed-msgs], [Default postponed folder])
556 PINEVAR(default-trash-folder, TRASH_FOLDER, [Trash], [Default Trash folder for Web Alpine])
557 PINEVAR(default-interrupted-mail, INTERRUPTED_MAIL, [.pine-interrupted-mail], [Default folder for interrupted mail])
558 PINEVAR(default-dead-letter-folder, DEADLETTER, [dead.letter], [Default dead letter folder])
559 PINEVAR(default-mail-directory, DF_MAIL_DIRECTORY, [mail], [Default mail directory])
560 PINEVAR(default-inbox-name, INBOX_NAME, [INBOX], [Default inbox name])
561 PINEVAR(default-signature-file, DF_SIGNATURE_FILE, [.signature], [Default signature file])
562 PINEVAR(default-elm-style-save, DF_ELM_STYLE_SAVE, [no], [Default to Elm style save])
563 PINEVAR(default-header-in-reply, DF_HEADER_IN_REPLY, [no], [Include header in reply])
564 PINEVAR(default-old-style-reply, DF_OLD_STYLE_REPLY, [no], [Default to old style reply])
565 PINEVAR(default-use-only-domain-name, DF_USE_ONLY_DOMAIN_NAME, [no], [Default to using only the domain name])
566 PINEVAR(default-save-by-sender, DF_SAVE_BY_SENDER, [no], [Default to save by sender])
567 PINEVAR(default-sort-key, DF_SORT_KEY, [arrival], [Default sort key])
568 PINEVAR(default-addressbook-sort-rule, DF_AB_SORT_RULE, [fullname-with-lists-last], [Default addressbook sort rule])
569 PINEVAR(default-folder-sort-rule, DF_FLD_SORT_RULE, [alphabetical], [Default folder sort rule])
570 PINEVAR(default-saved-message-name-rule, DF_SAVED_MSG_NAME_RULE, [default-folder], [Default saved message name rule])
571 PINEVAR(default-fcc-rule, DF_FCC_RULE, [default-fcc], [Default fcc rule])
572 PINEVAR(default-standard-printer, DF_STANDARD_PRINTER, [lpr], [Default standard printern])
573 PINEVAR(default-ansi-printer, ANSI_PRINTER, [attached-to-ansi], [ANSI printer definition])
574 PINEVAR(default-addressbook, DF_ADDRESSBOOK, [.addressbook], [Default addressbook name])
575 PINEVAR(default-local-fullname, DF_LOCAL_FULLNAME, ["Local Support"], [Default local support fullname])
576 PINEVAR(default-local-address, DF_LOCAL_ADDRESS, [postmaster], [Default local support address])
577 PINEVAR(default-keyboard-lock-count, DF_KBLOCK_PASSWD_COUNT, [1], [Default keyboard lock count])
578 PINEVAR(default-remote-addressbook-history, DF_REMOTE_ABOOK_HISTORY, [3], [Default address book history count])
579 PINEVAR(smime-public-cert-directory, DF_PUBLICCERT_DIR, [.alpine-smime/public], [Default Public Cert Directory])
580 PINEVAR(smime-private-key-directory, DF_PRIVATEKEY_DIR, [.alpine-smime/private], [Default Private Key Directory])
581 PINEVAR(smime-cacert-directory, DF_CACERT_DIR, [.alpine-smime/ca], [Default Cert Authority Directory])
582 PINEVAR_UNQUOTED(default-printer, DF_DEFAULT_PRINTER, [ANSI_PRINTER], [Default printer])
584 dnl set PASSFILE?
585 AC_ARG_WITH(passfile,
586   AS_HELP_STRING([--with-passfile=FILENAME],[Password cache file (NOT secure, NOT recommended)]),
587     [
588       case "$withval" in
589         no)
590           ;;
591         yes)
592           ;;
593         *)
594           alpine_PASSFILE=$withval
595           ;;
596       esac
597     ])
599 dnl os-specific credential cache?
600 AC_ARG_WITH(local-password-cache,
601  AS_HELP_STRING([--without-local-password-cache],[Disable OS-specific password cache, if supported]),
602    [
603      alpine_os_credential_cache=$withval
604    ])
606 dnl Particular os-specific credential cache?
607 AC_ARG_WITH(local-password-cache-method,
608  AS_HELP_STRING([--with-local-password-cache-method],[OS-specific credential cache (OSX=APPLEKEYCHAIN, Windows=WINCRED)]),
609    [
610      alpine_os_credential_cache_method=$withval
611    ])
613 if test -n "$alpine_PASSFILE" ; then
614   case $alpine_os_credential_cache in
615     no)
616       ;;
617     *)
618       alpine_os_credential_cache="no"
619       AC_MSG_NOTICE([--with-passfile definition overrides OS-Specific password caching])
620       ;;
621   esac
622   AC_DEFINE_UNQUOTED([PASSFILE], "$alpine_PASSFILE", [Password cache file (NOT secure. NOT recommended)])
625 dnl set DF_SSHPATH?
626 AC_ARG_WITH(default-sshpath,
627   AS_HELP_STRING([--with-default-sshpath=FILENAME],[set default value of ssh command path (defining should cause ssh to be preferred to rsh)]),
628     [
629       case "$withval" in
630         no)
631           ;;
632         yes)
633           ;;
634         *)
635           AC_DEFINE_UNQUOTED([DF_SSHPATH], "$withval", [set default value of ssh command path (defining should cause ssh to be preferred to rsh)])
636           ;;
637       esac
638     ])
640 dnl set DF_SSHCMD?
641 AC_ARG_WITH(default-sshcmd,
642   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")]),
643     [
644       case "$withval" in
645         no)
646           ;;
647         yes)
648           ;;
649         *)
650           AC_DEFINE_UNQUOTED([DF_SSHCMD], "$withval", [set default value of ssh command string (usually "%s %s -l %s exec /etc/r%sd")])
651           ;;
652       esac
653     ])
655 dnl Include SSL?
656 dnl Set SSLDIR for c-client make
657 AC_ARG_WITH(ssl,
658   AS_HELP_STRING([--without-ssl],[Disable SSL support (OpenSSL)]),
659   [ with_ssl=$withval ])
661 if test "x$with_ssl" = "xno" ; then
662   alpine_SSLTYPE="none"
663 else
664   dnl preload c-client default locations/options
665   case $host in
666     *-linux-gnu*)
667       if test -f /etc/fedora-release -o -f /etc/redhat-release -o -f /etc/redhat_version ; then  
668         alpine_SSLTYPE="nopwd"
669         if test -d /etc/pki/tls ; then  
670           alpine_SSLDIR="/etc/pki/tls"
671         else
672           alpine_SSLDIR="/usr/share/ssl"
673         fi
674       elif test -f /etc/SuSE-release ; then
675         alpine_SSLTYPE="nopwd"
676         alpine_SSLDIR="/usr/share/ssl"
677         alpine_SSLCERTS="/etc/ssl/certs"
678       elif test -d /etc/osso-af-init ; then
679         alpine_SSLTYPE="nopwd"
680         alpine_SSLDIR="/usr"
681         alpine_SSLCERTS="/usr/share/certs"
682       else
683         alpine_SSLTYPE="nopwd"
684         alpine_SSLDIR="/usr"
685         alpine_SSLCERTS="/etc/ssl/certs"
686       fi
687       ;;
688     *-apple-darwin*)
689       alpine_SSLTYPE="nopwd"
690       alpine_SSLCERTS="/System/Library/OpenSSL/certs"
691       ;;
692     *-openbsd*)
693       alpine_SSLTYPE="nopwd"
694       alpine_SSLDIR="/usr"
695       alpine_SSLCERTS="/etc/ssl/certs"
696       ;;
697     *-sco-sysv* | *-sysv*UnixWare | *-sysv*OpenUNIX)
698       alpine_SSLTYPE="sco.nopwd"
699       alpine_SSLDIR=/usr/local/ssl
700       ;;
701     *-*-solaris*)
702       if test -d /usr/sfw/include/openssl ; then
703         alpine_SSLDIR="/usr/sfw"
704       elif test -d /opt/csw/include/openssl ; then
705         alpine_SSLDIR="/opt/csw"
706         if test -d /opt/csw/ssl/certs ; then
707           alpine_SSLCERTS="/opt/csw/ssl/certs"
708         fi
709       fi
710       if test -z "$alpine_SSLCERTS" -a -d /etc/certs ; then
711         alpine_SSLCERTS="/etc/certs"
712       fi
713       ;;
714     *)
715       alpine_SSLTYPE="nopwd"
716       alpine_SSLDIR=/usr/local/ssl
717       ;;
718   esac
720   AC_ARG_WITH(ssl-dir,
721     AS_HELP_STRING([--with-ssl-dir=DIR],[Root of SSL lib/include path]),
722     [
723       if test "x$withval" != "xno" ; then
724         alpine_SSLDIR=$withval
725       fi
726     ])
728   AC_ARG_WITH(ssl-certs-dir,
729     AS_HELP_STRING([--with-ssl-certs-dir=DIR],[Path to SSL certificate directory]),
730     [
731       if test "x$withval" != "xno" ; then
732         alpine_SSLCERTS=$withval
733       fi
734     ])
736   AC_ARG_WITH(ssl-include-dir,
737     AS_HELP_STRING([--with-ssl-include-dir=DIR],[SSL include file path]),
738     [
739       if test "x$withval" != "xno" ; then
740         alpine_SSLINCLUDE=$withval
741       fi
742     ])
744   AC_ARG_WITH(ssl-lib-dir,
745     AS_HELP_STRING([--with-ssl-lib-dir=DIR],[SSL library path]),
746     [
747       if test "x$withval" != "xno" ; then
748         alpine_SSLLIB=$withval
749       fi
750     ])
751   dnl setup globals so tests below work
752   if test -n "$alpine_SSLINCLUDE" ; then
753     CPPCFLAGS="-I$alpine_SSLINCLUDE $CPPFLAGS"
754   elif test -n "$alpine_SSLDIR" ; then
755     CPPFLAGS="-I${alpine_SSLDIR}/include $CPPFLAGS"
756   fi
757   if test -n "$alpine_SSLLIB" ; then
758     LDFLAGS="-L$alpine_SSLLIB $LDFLAGS"
759   elif test -n "$alpine_SSLDIR" ; then
760     LDFLAGS="-L${alpine_SSLDIR}/lib $LDFLAGS"
761   fi
764 dnl Include Kerberos?
765 dnl Set GSSDIR for c-client make
766 AC_ARG_WITH(krb5,
767   AS_HELP_STRING([--without-krb5],[Disable Kerberos support]),
768   [ with_krb5=$withval ])
770 if test "x$with_krb5" = "xno" ; then
771   alpine_GSSTYPE="none"
772 else
773   alpine_GSSTYPE=
775   AC_ARG_WITH(krb5-dir,
776     AS_HELP_STRING([--with-krb5-dir=DIR],[Root of Kerberos lib/include path]),
777     [
778       if test "x$withval" != "xno" ; then
779         CPPFLAGS="$CPPFLAGS -I${withval}/include"
780         LDFLAGS="$LDFLAGS -L${withval}/lib"
781       fi
782     ])
784   AC_ARG_WITH(krb5-include-dir,
785     AS_HELP_STRING([--with-krb5-include-dir=DIR],[Kerberos include file path]),
786     [
787       if test "x$withval" != "xno" ; then
788         CPPFLAGS="$CPPFLAGS -I$withval"
789       fi
790     ])
792   AC_ARG_WITH(krb5-lib-dir,
793     AS_HELP_STRING([--with-krb5-lib-dir=DIR],[Kerberos library path]),
794     [
795       if test "x$withval" != "xno" ; then
796         LDFLAGS="$LDFLAGS -L$withval"
797       fi
798     ])
801 dnl Include LDAP?
802 AC_ARG_WITH(ldap,
803   AS_HELP_STRING([--without-ldap],[Disable LDAP query support]),
804   [ with_ldap=$withval ])
806 if test "x$with_ldap" = "xno" ; then
807   alpine_with_ldap=
808   AC_MSG_NOTICE([Excluding LDAP Support])
809 else
810   dnl Do stuff to figure out where OpenLDAP is
812   alpine_with_ldap=yes
813   AC_ARG_WITH(ldap-dir,
814     AS_HELP_STRING([--with-ldap-dir=DIR],[Root of LDAP lib/include path]),
815     [
816       if test "x$withval" != "xno" ; then 
817         CPPFLAGS="$CPPFLAGS -I${withval}/include"
818         LDFLAGS="$LDFLAGS -L${withval}/lib"
819       fi
820     ])
822   AC_ARG_WITH(ldap-include-dir,
823     AS_HELP_STRING([--with-ldap-include-dir=DIR],[Directory containing LDAP include files]),
824     [
825       if test "x$withval" != "xno" ; then
826         CPPFLAGS="$CPPFLAGS -I$withval"
827       fi
828     ])
830   AC_ARG_WITH(ldap-lib-dir,
831     AS_HELP_STRING([--with-ldap-lib-dir=DIR],[LDAP library path]),
832     [
833       if test "x$withval" != "xno" ; then
834         LDFLAGS="$LDFLAGS -L$withval"
835       fi
836     ])
839 dnl Include SMIME?
840 AC_ARG_WITH(smime,
841   AS_HELP_STRING([--without-smime],[Disable S/MIME]),
842   [ with_smime=$withval ])
844 dnl Include TCL?
845 AC_ARG_WITH(tcl,
846   AS_HELP_STRING([--without-tcl],[Disable TCL, thus Web Alpine support]),
847   [ with_tcl=$withval ])
849 if test "x$with_tcl" = "xno" ; then
850   WEB_BUILD=
851   AC_MSG_NOTICE([Excluding TCL Support, and thus Web Alpine Support])
852 else
853   AC_ARG_WITH(tcl-lib,
854     AS_HELP_STRING([--with-tcl-lib=LIBRARY],[Specific TCL Library, like \"tcl8.5\"]),
855     [
856       if test "x$withval" != "xno" ; then 
857         alpine_TCLLIB=$withval
858       fi
859     ])
860   AC_ARG_WITH(tcl-include,
861     AS_HELP_STRING([--with-tcl-include=DIR],[Directory containing TCL include files]),
862     [
863       if test "x$withval" != "xno" ; then
864         CPPFLAGS="$CPPFLAGS -I$withval"
865         alpine_TCLINC=$withval
866       fi
867     ])
870 AC_ARG_WITH(supplied-regex,
871   AS_HELP_STRING([--with-supplied-regex],[Use regex library supplied with alpine]),
872   [ alpine_REGEX=$withval ])
874 AC_ARG_WITH(pthread,
875   AS_HELP_STRING([--without-pthread],[Do NOT test for nor build with POSIX thread support]),
876   [ with_pthread=$withval ])
878 AC_ARG_WITH(system-mail-directory,
879   AS_HELP_STRING([--with-system-mail-directory=DIR],[Directory where local mail is delivered]),
880   [
881     if test "x$withval" != "xno" ; then
882       alpine_with_local_maildir="$withval"
883     fi
884   ])
886 AC_ARG_WITH(c-client-target,
887   AS_HELP_STRING([--with-c-client-target=TARGET],[IMAP build target (see imap/Makefile)]),
888   [
889     if test "x$withval" != "xno" ;then
890       alpine_with_c_client_target="$withval"
891     fi
892   ])
895 dnl Without IPv6?
896 AC_ARG_WITH(ipv6,
897   AS_HELP_STRING([--without-ipv6],[Disable IPv6, primarily to work around resolver problems]),
898   [ with_ipv6=$withval ])
900 if test "x$with_ipv6" = "xno" ; then
901   AC_MSG_NOTICE([Excluding IPv6 Support])
902   c_client_specials="${c_client_specials}IP6=4 "
903   c_client_ip6="true"
904 else
905   c_client_ip6="touch imap/ip6"
909 dnl CHECK LIBRARIES
911 if test x$enable_dmalloc = "xyes" ; then
912   if test "x$with_pthread" = "xyes" ; then
913     dmalloc_lib=dmallocth
914   else
915     dmalloc_lib=dmalloc
916   fi
918   AC_CHECK_LIB($dmalloc_lib,dmalloc_shutdown,,
919     [
920       AC_MSG_ERROR($dmalloc_lib requested, but -ldmalloc not found)
921     ])
924 dnl which terminal cabability database
925 AC_CHECK_LIB(tinfo, setupterm,
926   [
927     alpine_termdata=info
928     LIBS="$LIBS -ltinfo"
929   ],
930   [
931     AC_CHECK_LIB(ncurses, setupterm,
932       [
933         alpine_termdata=info
934         LIBS="$LIBS -lncurses"
935       ],
936       [
937         AC_CHECK_LIB(curses, setupterm,
938           [
939             alpine_termdata=info
940             LIBS="$LIBS -lcurses"
941           ],
942           [
943             AC_CHECK_LIB(termlib, tgetent,
944               [
945                 alpine_termdata=cap
946                 LIBS="$LIBS -ltermlib"
947               ],
948               [
949                 AC_CHECK_LIB(termcap, tgetent,
950                   [
951                     alpine_termdata=cap
952                     LIBS="$LIBS -ltermcap"
953                   ],
954                   [
955                     AC_MSG_ERROR(Terminfo/termcap not found)
956                   ])
957               ])
958           ])
959       ])
960   ])
961 case $alpine_termdata in
962   info)
963     AC_DEFINE(HAS_TERMINFO, [1], [Define if systems uses terminfo terminal database])
964     ;;
965   cap)
966     AC_DEFINE(HAS_TERMCAP, [1], [Define if systems uses termcap terminal database])
967     ;;
968 esac
970 dnl provide LDAP support?
971 if test "$alpine_with_ldap" = "yes" ; then
972   alpine_has_ldap=
973   AC_CHECK_LIB(lber, ber_alloc,
974     [
975       LIBS="$LIBS -llber"
976     ])
977   AC_SEARCH_LIBS(ldap_init,ldap,
978     [
979       alpine_has_ldap=yes
980     ],
981     [
982       AC_SEARCH_LIBS(ldap_open,ldap,
983         [
984           alpine_has_ldap=yes
985         ])
986     ])
988   if test "$alpine_has_ldap" = "yes" ; then
989     AC_MSG_NOTICE([Including LDAP Support])
990     AC_DEFINE([ENABLE_LDAP], [], [Enable LDAP query support])
992     dnl we use deprecated functions (ldap_get_values)
993     dnl OpenLDAP 2.3.x doesn't define LDAP_DEPRECATED by default like 2.2.x
994     AC_MSG_CHECKING([if we should define LDAP_DEPRECATED])
995     AC_RUN_IFELSE(
996         [AC_LANG_SOURCE([[
997 #include <stdio.h>
998 #include <string.h>
999 #include <ldap.h>
1000 int main(void) {
1002         if (LDAP_VENDOR_VERSION >= 20300)
1003                 exit(0);
1005         exit(2);
1007         ]])],
1008         [
1009                 AC_MSG_RESULT(yes)
1010                 AC_DEFINE(LDAP_DEPRECATED, 1,
1011                 [Define if you use OpenLDAP 2.3.x deprecated functions])
1013         ],
1014         [
1015                 AC_MSG_RESULT(no)
1016         ],
1017         [
1018                 AC_MSG_WARN([cross compiling: not checking])
1019         ]
1020     )
1022   else
1023     AC_MSG_NOTICE([Cannot find LDAP functions!  Excluding LDAP support.])
1024   fi
1027 dnl provide SSL support?
1028 if test "x$alpine_SSLTYPE" != "xnone" ; then
1029   AC_SEARCH_LIBS(SSL_library_init,ssl,
1030     [
1031       LIBS="$LIBS -lssl"
1033      AC_MSG_CHECKING([Openssl library version >= 1.0.0c])
1034      AC_RUN_IFELSE(
1035         [AC_LANG_SOURCE([[
1036 #include <stdio.h>
1037 #include <openssl/ssl.h>
1038 int main(void) {
1040         if (OPENSSL_VERSION_NUMBER >= 0x1000003f)
1041                 exit(0);
1043         exit(2);
1045         ]])],
1046         [
1047                 AC_MSG_RESULT(yes)
1048         ],
1049         [
1050                 AC_MSG_ERROR(Install openssl version >= 1.0.1c)
1051                 exit 1
1052         ],
1053         [
1054                 AC_MSG_WARN([cross compiling: not checking])
1055         ]
1056     )
1057     ],
1058     [alpine_SSLTYPE="none"])
1059   if test "x$alpine_SSLTYPE" = "xnone" ; then
1060     AC_MSG_NOTICE([OpenSSL libraries NOT found])
1061   else
1062     AC_MSG_NOTICE([OpenSSL libraries FOUND])
1063   fi
1066 dnl Crypto support is needed 
1067 if test "x$alpine_SSLTYPE" != "xnone" ; then
1068   AC_SEARCH_LIBS(SSLeay,crypto,
1069     [
1070       LIBS="$LIBS -lcrypto"
1071     ],
1072     [
1073       alpine_CRYPTO = "none"
1074     ])
1075   if test "x$alpine_CRYPTO" = "xnone" ; then
1076     AC_MSG_ERROR(crypto library NOT found)
1077   else
1078     AC_MSG_NOTICE([crypto library found])
1079   fi
1082 dnl PAM support is needed to build c-client, and hence Alpine.
1083 if test "x$alpine_PAM" != "xnone" ; then
1084   AC_SEARCH_LIBS(pam_start,pam,
1085     [
1086       LIBS="$LIBS -lpam"
1087       AC_CHECK_HEADER([security/pam_appl.h],,
1088         [
1089           alpine_PAM="none"
1090           alpine_pam_none_reason="header files not found"
1091         ])
1092     ],
1093     [
1094         alpine_PAM="none"
1095         alpine_pam_none_reason="library files not found"
1096     ])
1097   if test -n "$alpine_pam_none_reason" ; then
1098     AC_MSG_ERROR(No PAM support: $alpine_pam_none_reason)
1099   fi
1103 dnl provide KRB5 support?
1104 if test "x$alpine_GSSTYPE" != "xnone" ; then
1105   AC_SEARCH_LIBS(gss_init_sec_context,gss gssapi gssapi_krb5,
1106     [
1107       dnl MIT-based?
1108       LIBS="$LIBS -lkrb5"
1109       AC_CHECK_HEADER([gssapi/gssapi_generic.h],,
1110         [
1111           if test ! -d /usr/kerberos/include ; then
1112             alpine_GSSTYPE="none"
1113             alpine_gss_none_reason="header files not found"
1114           fi
1115         ])
1116     ],
1117     [
1118       alpine_GSSTYPE="none"
1119       alpine_gss_none_reason="libraries not found"
1120     ])
1121   if test -n "$alpine_gss_none_reason" ; then
1122     AC_MSG_NOTICE([NOT including Kerberos Support: $alpine_gss_none_reason])
1123   fi
1126 dnl check for tcl libraries for Web Alpine (HACKY)
1127 if test -n "$WEB_BUILD" ; then
1128   AC_SEARCH_LIBS([Tcl_Eval],[$alpine_TCLLIB tcl8.5 tcl8.4 tcl8.3 tcl84 tcl83 tcl],,
1129     [
1130       WEB_BUILD=
1131     ])
1133   dnl look for header file
1134   if test -n "$alpine_TCLINC" ; then
1135     AC_CHECK_HEADER($alpine_TCLINC,,
1136       [
1137         WEB_BUILD=
1138       ])
1139     if test -z "$WEB_BUILD" ; then
1140       AC_MSG_NOTICE([Tcl Include file NOT found])
1141     fi
1142   else
1143     AC_CHECK_HEADER(tcl.h,,
1144       [
1145         for dir in tcl8.5 tcl8.4 tcl8.3 tcl84 tcl83 ; do
1146           AC_CHECK_FILE([/usr/include/$dir/tcl.h],
1147             [
1148               found=yes
1149             ])
1150           if test "$found" = "yes" ; then
1151             CPPFLAGS="$CPPFLAGS -I/usr/include/$dir"
1152             break
1153           fi
1154         done
1155         if test "$found" != "yes" ; then
1156             WEB_BUILD=
1157             AC_MSG_NOTICE([header file tcl.h NOT found: Web Alpine will not be built])
1158         fi
1159       ])
1160   fi
1163 dnl Local or supplied regex?
1164 if test x$alpine_REGEX != "xyes" ; then
1165   AC_SEARCH_LIBS([regcomp],posix regexp regex re,,
1166     [
1167       if test x$alpine_REGEX = "xno" ; then
1168         AC_MSG_ERROR(Unable to find system regex library)
1169       else
1170         alpine_REGEX=yes
1171       fi
1172     ])
1174 if test x$alpine_REGEX != "xyes" ; then
1175   AC_CHECK_HEADER([regex.h],,
1176     [
1177       if test x$alpine_REGEX = "xno" ; then
1178         AC_MSG_ERROR(Unable to find system regex include file)
1179       else
1180         alpine_REGEX=yes
1181       fi
1182     ])
1184 AC_DEFINE(HAVE_REGEX_H,1,[Regular expression header file exists])
1185 if test x$alpine_REGEX = "xyes" ; then
1186   CPPFLAGS="$CPPFLAGS -I${top_builddir}/regex"
1187   LDFLAGS="$LDFLAGS -L${top_builddir}/regex -lregex"
1188   REGEX_BUILD=regex
1191 if test "x$with_pthread" != "xno" ; then
1192   AC_MSG_CHECKING([for pthread support])
1193   ACX_PTHREAD(
1194     [
1195       AC_MSG_RESULT([yes])
1196       case "$target" in
1197           *openbsd*)
1198             AC_MSG_NOTICE([WARNING: pthread support on OpenBSD is unstable!])
1199             AM_CFLAGS="$AM_CFLAGS -pthread"
1200             ;;
1201       esac
1202       LIBS="$PTHREAD_LIBS $LIBS"
1203       AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
1204       CC="$PTHREAD_CC"
1205       AC_DEFINE([HAVE_PTHREAD], [1], [System has pthread support])
1206     ],
1207     [
1208       AC_MSG_RESULT([no])
1209     ])
1211   AC_SEARCH_LIBS([nanosleep], [rt posix4],
1212     [
1213       AC_DEFINE([HAVE_NANOSLEEP], [1], [Define if system supports subsecond, non-alarm sleep])
1214     ])
1219 dnl CHECK HEADERS
1221 AC_HEADER_STDC
1222 AC_HEADER_DIRENT
1223 AC_HEADER_STAT
1224 AC_HEADER_SYS_WAIT
1225 AC_HEADER_TIME
1226 AC_HEADER_TIOCGWINSZ
1228 AC_CHECK_HEADERS([unistd.h])
1230 AC_CHECK_HEADERS([errno.h \
1231                   ctype.h \
1232                   fcntl.h \
1233                   signal.h \
1234                   setjmp.h \
1235                   memory.h \
1236                   sys/param.h \
1237                   sys/socket.h \
1238                   sys/uio.h \
1239                   sys/un.h \
1240                   limits.h \
1241                   wchar.h \
1242                   sys/poll.h \
1243                   stropts.h \
1244                   netdb.h \
1245                   syslog.h \
1246                   sys/syslog.h \
1247                   locale.h \
1248                   langinfo.h \
1249                   utime.h \
1250                   sys/utime.h \
1251                   pthread.h \
1252                   pwd.h \
1253                   assert.h])
1255 dnl terminal line discipline?
1256 AC_CHECK_HEADER([termios.h],
1257   AC_DEFINE(HAS_TERMIOS, [1], [Define if systems uses termios terminal control]),
1258   [
1259     AC_CHECK_HEADER([termio.h],
1260       AC_DEFINE(HAS_TERMIO, [1], [Define if systems uses termio terminal control]),
1261       [
1262         AC_CHECK_HEADER([sgtty.h],
1263           AC_DEFINE(HAS_SGTTY, [1], [Define if systems uses old BSD-style terminal control]),
1264         [
1265           AC_MSG_ERROR(Unable to figure out terminal control method)
1266         ])
1267       ])
1268   ])
1271 dnl CHECK TYPEDEFS
1273 AC_DIAGNOSE([obsolete],[your code may safely assume C89 semantics that RETSIGTYPE is void.
1274 Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
1275 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
1276 [AC_LANG_PROGRAM([#include <sys/types.h>
1277 #include <signal.h>
1279                  [return *(signal (0, 0)) (0) == 1;])],
1280                    [ac_cv_type_signal=int],
1281                    [ac_cv_type_signal=void])])
1282 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
1283                     (`int' or `void').])
1285 AC_TYPE_SIZE_T
1286 AC_TYPE_MODE_T
1287 AC_TYPE_PID_T
1288 AC_TYPE_UID_T
1289 AC_STRUCT_TM
1291 AC_CHECK_TYPES([union wait])
1293 AC_CHECK_HEADERS([stdint.h], [uint16=uint16_t], [
1294   AC_CHECK_HEADERS([inttypes.h], [uint16=uint16_t], [
1295     AC_CHECK_HEADERS([sys/types.h], [uint16=u_int16_t], [
1296       AC_CHECK_SIZEOF(unsigned short)
1297       if test $ac_cv_sizeof_unsigned_short -eq 2 ; then
1298         uint16="unsigned short"
1299       else
1300         AC_CHECK_SIZEOF(unsigned int)
1301         if $ac_cv_sizeof_unsigned_int -eq 2 ; then
1302           uint16="unsigned int"
1303         else
1304           AC_MSG_ERROR(Unable to determine 16 bit integer type)
1305         fi
1306       fi
1307     ])
1308   ])
1310 AC_DEFINE_UNQUOTED([UINT16], $uint16, [System defined unsigned 16 bit integer])
1312 AC_CHECK_HEADERS([stdint.h], [uint32=uint32_t], [
1313   AC_CHECK_HEADERS([inttypes.h], [uint32=uint32_t], [
1314     AC_CHECK_HEADERS([sys/types.h], [uint32=u_int32_t], [
1315       AC_CHECK_SIZEOF(unsigned int)
1316       if test $ac_cv_sizeof_unsigned_int -eq 4 ; then
1317         uint32="unsigned int"
1318       else
1319         AC_CHECK_SIZEOF(unsigned long)
1320         if $ac_cv_sizeof_unsigned_long -eq 4 ; then
1321           uint32="unsigned long"
1322         else
1323           AC_MSG_ERROR(Unable to determine 32 bit integer type)
1324         fi
1325       fi
1326     ])
1327   ])
1329 AC_DEFINE_UNQUOTED([UINT32], $uint32, [System defined unsigned 32 bit integer])
1331 AC_CACHE_CHECK(argument pointer type of qsort compare function and base,
1332 ac_cv_func_qsort_argtype,
1333 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1334 #if     HAVE_STDLIB_H
1335 #include "stdlib.h"
1336 #endif
1338 extern void *base;
1339 extern sortf(const void *, const void *);
1340 int sortf(a, b)
1341   const void *a;
1342   const void *b; { return 0; }
1343 ]], [[
1344 qsort(base, 2, sizeof(char *), sortf);
1345 ]])],[ac_cv_func_qsort_argtype=void],[ac_cv_func_qsort_argtype=char])
1347 AC_DEFINE_UNQUOTED([qsort_t], $ac_cv_func_qsort_argtype, [qsort compare function argument type])
1349 dnl check for "struct passwd" ?
1351 AC_FUNC_SELECT_ARGTYPES
1353 AC_FUNC_STRCOLL
1355 dnl CHECK FOR LIBRARY FUNCTIONS
1357 AC_FUNC_FORK
1358 AC_CHECK_FUNCS([strchr \
1359                 memcpy \
1360                 strtol \
1361                 strtoul \
1362                 select \
1363                 poll \
1364                 qsort \
1365                 getuid \
1366                 getpwuid \
1367                 getpwnam \
1368                 gettimeofday \
1369                 tmpfile \
1370                 uname \
1371                 rename \
1372                 read \
1373                 signal \
1374                 setjmp \
1375                 chown \
1376                 wait4 \
1377                 waitpid \
1378                 wait \
1379                 srandom \
1380                 popen \
1381                 pclose \
1382                 fsync \
1383                 truncate \
1384                 listen \
1385                 wcwidth \
1386                 mbstowcs \
1387                 wcrtomb \
1388                 putenv \
1389                 setenv])
1391 AC_SEARCH_LIBS([gethostname],[nsl])
1393 AC_SEARCH_LIBS([socket],[socket],,
1394   [
1395     WEB_BUILD=
1396   ])
1398 AC_SEARCH_LIBS([bind],[bind],,
1399   [
1400     WEB_BUILD=
1401   ])
1403 dnl check for POSIX signal interface
1404 AC_CHECK_FUNCS([sigaction sigemptyset sigaddset sigprocmask],
1405   [
1406     AC_DEFINE([POSIX_SIGNALS], [], [Define if system supports POSIX signal interface])
1407   ],
1408   [
1409     AC_CHECK_FUNCS([sigset sigrelse],
1410       [
1411         AC_DEFINE([SYSV_SIGNALS], [], [Define if system supports SYSV signal interface])
1412       ])
1413   ])
1415 AC_SEARCH_LIBS([syslog], [bsd socket inet],
1416   [
1417     AC_DEFINE([HAVE_SYSLOG], [1], [Define if system supplies syslog() logging])
1418   ])
1421 dnl HOST-OS SPECIFIC DEFINITIONS
1422 dnl Tests and assignments below are mostly to coax the appropriate
1423 dnl build from c-client.  Most of this will go away when c-client
1424 dnl adopts configure
1425 case "$host" in
1426   *-linux-gnu*|*-k*bsd*-gnu*)
1427     alpine_path_delim="/"
1428     alpine_mode_readonly="(0600)"
1429     if test -f /etc/fedora-release ; then  
1430       systype="LFD"
1431       if test -d /etc/pki/tls ; then  
1432         alpine_c_client_target="lfd"
1433       else
1434         alpine_c_client_target="lrh"
1435       fi
1436     elif test -f /etc/mandrake-release ; then
1437       systype="LMD"
1438       alpine_c_client_target="lmd"
1439     elif test -f /etc/redhat-release -o -f /etc/redhat_version ; then
1440       systype="LRH"
1441       if test -d /etc/pki/tls ; then  
1442         alpine_c_client_target="lr5"
1443       else
1444         alpine_c_client_target="lrh"
1445       fi
1446     elif test -f /etc/debian_release -o -f /etc/debian_version ; then
1447       if test -d /etc/osso-af-init ; then
1448         systype="LN8"
1449         alpine_c_client_target="ln8"
1450       else
1451         systype="DEB"
1452         alpine_c_client_target="ldb"
1453       fi
1454     elif test -f /etc/SuSE-release ; then
1455       systype="LSU"
1456       alpine_c_client_target="lsu"
1457     else
1458       systype="LNX"
1459       AC_CHECK_LIB(pam, pam_start,
1460         [
1461           alpine_c_client_target="lnp"
1462         ],
1463         [
1464           if test -f /etc/shadow ; then
1465             alpine_c_client_target="slx"
1466           else
1467             alpine_c_client_target="lnx"
1468           fi
1469         ])
1470     fi
1471     ;;
1472   *-apple-darwin*)
1473     systype="OSX"
1474     alpine_path_delim="/"
1475     alpine_mode_readonly="(0600)"
1476     LIBS="$LIBS -framework Carbon -framework ApplicationServices -framework Security"
1477     AM_CFLAGS="$AM_CFLAGS -Dbsd"
1478     dnl SEE include/system.h
1479     AC_DEFINE([OSX_TARGET],[1],[OSX TARGET])
1480     case "$alpine_os_credential_cache" in
1481       no)
1482         ;;
1483       *)
1484         AC_DEFINE([APPLEKEYCHAIN], [1], [Use Apple OS X key chain for credential caching])
1485         ;;
1486     esac
1487     AC_CHECK_LIB(pam, pam_start,
1488       [
1489         alpine_c_client_target="oxp"
1490       ],
1491       [
1492         alpine_c_client_target="osx"
1493       ])
1494     ;;
1495   *-*-solaris*)
1496     if test x$GCC = "xyes" ; then
1497       systype="GSO"
1498       alpine_c_client_target="gso"
1499     else
1500       systype="SOC"
1501       alpine_c_client_target="soc"
1502       AC_DEFINE([__EXTENSIONS__], [1], [Enable extended pthread features on Solaris])
1503     fi
1504     alpine_path_delim="/"
1505     alpine_mode_readonly="(0600)"
1506     dnl possible other OS's need this.
1507     dnl Use autoconf 2.61's AC_USE_SYSTEM_EXTENSIONS at some point
1508     ;;
1509   *-*-sunos4*)
1510     systype="SUN"
1511     alpine_path_delim="/"
1512     alpine_mode_readonly="(0600)"
1513     alpine_c_client_target="s40"
1514     ;;
1515   *-*-sco3.2v5*)
1516     if test x$GCC = "xyes" ; then
1517       systype="GO5"
1518       alpine_c_client_target="go5"
1519     else
1520       systype="SC5"
1521       alpine_c_client_target="sc5"
1522     fi
1523     alpine_path_delim="/"
1524     alpine_mode_readonly="(0600)"
1525     dnl possible other OS's need this.
1526     dnl Use autoconf 2.61's AC_USE_SYSTEM_EXTENSIONS at some point
1527     ;;
1528   *-next-*)
1529     systype="NXT"
1530     alpine_path_delim="/"
1531     alpine_mode_readonly="(0600)"
1532     alpine_c_client_target="nx3"
1533     ;;
1534   *-*-netbsd*)
1535     systype="NEB"
1536     alpine_path_delim="/"
1537     alpine_mode_readonly="(0600)"
1538     alpine_c_client_target="neb"
1539     ;;
1540   *-*-dragonfly*)
1541     systype="DFB"
1542     alpine_path_delim="/"
1543     alpine_mode_readonly="(0600)"
1544     alpine_c_client_target="neb"
1545     ;;
1546   *-*-bsdi*)
1547     systype="BSI"
1548     alpine_path_delim="/"
1549     alpine_mode_readonly="(0600)"
1550     alpine_c_client_target="bsi"
1551     ;;
1552   *-*-freebsd*)
1553     systype="BSF"
1554     alpine_path_delim="/"
1555     alpine_mode_readonly="(0600)"
1556     alpine_c_client_target="bsf"
1557     LIBS="$LIBS $LIBINTL"
1558     ;;
1559   *-*-openbsd*)
1560     systype="BSO"
1561     alpine_path_delim="/"
1562     alpine_mode_readonly="(0600)"
1563     alpine_c_client_target="bso"
1564     LIBS="$LIBS $LIBINTL"
1565     ;;
1566   *-*-aix5*)
1567     systype="A52"
1568     alpine_path_delim="/"
1569     alpine_mode_readonly="(0600)"
1570     alpine_c_client_target="a52"
1571     ;;
1572   *-*-aix4*)
1573     systype="A41"
1574     alpine_path_delim="/"
1575     alpine_mode_readonly="(0600)"
1576     alpine_c_client_target="a41"
1577     ;;
1578   *-*-aix3*)
1579     systype="A32"
1580     alpine_path_delim="/"
1581     alpine_mode_readonly="(0600)"
1582     alpine_c_client_target="a32"
1583     ;;
1584   *-*UNIX_SV | *-*-sysv5UnixWare7* | *-*OpenUNIX*)
1585     systype="UW2"
1586     alpine_path_delim="/"
1587     alpine_mode_readonly="(0600)"
1588     alpine_c_client_target="uw2"
1589     ;;
1590   *-*-osf5*)
1591     systype="OSF"
1592     alpine_path_delim="/"
1593     alpine_mode_readonly="(0600)"
1594     alpine_c_client_target="osf"
1595     ;;
1596   *-*-cygwin)
1597     systype="CYG"
1598     alpine_path_delim="/"
1599     alpine_mode_readonly="(S_IREAD | S_IWRITE)"
1600     alpine_c_client_target="cyg"
1601     LIBS="$LIBS $LIBINTL"
1602     ;;
1603   windows* | *-*-pw32*)
1604     systype="WNT"
1605     alpine_path_delim="\\"
1606     alpine_mode_readonly="(S_IREAD | S_IWRITE)"
1607     alpine_c_client_target="wnt"
1608     AC_DEFINE([_WINDOWS], [1], [Windows is just too different])
1609     ;;
1610   *)
1611     AC_MSG_ERROR(Unrecognized system: $host)
1612     ;;
1613 esac
1615 dnl set pico newmail check directory
1616 if test -n "$alpine_with_local_maildir" ; then
1617     alpine_local_maildir=$alpine_with_local_maildir
1618 elif test -d /var/spool/mail ; then
1619     alpine_local_maildir="/var/spool/mail"
1620 elif test -d /var/mail ; then
1621     alpine_local_maildir="/var/mail"
1622 else
1623     alpine_local_maildir="/usr/spool/mail"
1626 dnl set c-client make target
1627 if test -n "$alpine_with_c_client_target" ; then
1628     alpine_c_client_target=$alpine_with_c_client_target
1631 AC_DEFINE_UNQUOTED([SYSTYPE], "$systype", [Pine-Centric Host Specifier])
1632 AC_DEFINE_UNQUOTED([C_FILESEP],'$alpine_path_delim',[File name separator as character constant])
1633 AC_DEFINE_UNQUOTED([S_FILESEP],"$alpine_path_delim",[File name separator as string constant])
1634 AC_DEFINE_UNQUOTED([MAILDIR],"$alpine_local_maildir",[Path to local inboxes for pico newmail check])
1635 AC_DEFINE_UNQUOTED([MODE_READONLY], $alpine_mode_readonly, [File mode used to set readonly access])
1637 dnl c-client make particulars
1638 AC_SUBST([C_CLIENT_TARGET], $alpine_c_client_target)
1639 AC_SUBST([C_CLIENT_WITH_IPV6], $c_client_ip6)
1640 if test "x$alpine_SSLTYPE" = "xnone" ; then 
1641   AC_MSG_NOTICE([* * *  NOT Including SSL Support])
1642   c_client_specials="${c_client_specials}SSLTYPE=none "
1643 else
1644   dnl issue any warnings for common OpenSSL issues
1646   if test -n "$alpine_SSLCERTS" -a -d "$alpine_SSLCERTS" ; then
1647     certdir="$alpine_SSLCERTS"
1648   elif test -n "$alpine_SSLDIR" -a -d "${alpine_SSLDIR}/certs" ; then
1649     certdir="${alpine_SSLDIR}/certs"
1650   else
1651     AC_MSG_NOTICE([SSL Problem: certificate directory not found])
1652   fi
1654   if test "x$with_smime" != "xno" ; then
1655     if test -n "$certdir" ; then
1656       AC_DEFINE([SMIME], [], [Enable S/MIME code])
1657       AC_DEFINE_UNQUOTED([SMIME_SSLCERTS],"$certdir",[Directory where S/MIME CACerts are located])
1658     fi
1659   fi
1661   if test ! -f ${certdir}/factory.pem ; then
1662     AC_MSG_NOTICE([* * * SSL file "${certdir}/factory.pem" is missing.])
1663     AC_MSG_NOTICE([* * *   This might indicate that CA certs did not get properly])
1664     AC_MSG_NOTICE([* * *   installed.  If you get certificate validation failures])
1665     AC_MSG_NOTICE([* * *   in Alpine, this might be the reason for them.])
1666   fi
1668   if test -z "`ls ${certdir} | $EGREP '^@<:@0-9A-Fa-f@:>@{8}\.@<:@0-9@:>@'`" ; then
1669     AC_MSG_NOTICE([* * * No 8-hexdigit symlinks in certificate directory "${certdir}".])
1670     AC_MSG_NOTICE([* * *   This might indicate that CA certs did not get properly])
1671     AC_MSG_NOTICE([* * *   installed.  If you get certificate validation failures])
1672     AC_MSG_NOTICE([* * *   in Alpine, this might be the reason for them.])
1673   fi
1675   if test -n "$alpine_SSLDIR" ; then
1676     c_client_specials="${c_client_specials}SSLDIR=$alpine_SSLDIR "
1677   fi
1679   if test -n "$alpine_SSLCERTS" ; then
1680     c_client_specials="${c_client_specials}SSLCERTS=$alpine_SSLCERTS "
1681   fi
1683   if test -n "$alpine_SSLINCLUDE" ; then
1684     c_client_specials="${c_client_specials}SSLINCLUDE=$alpine_SSLINCLUDE "
1685   fi
1687   if test -n "$alpine_SSLLIB" ; then
1688     c_client_specials="${c_client_specials}SSLLIB=$alpine_SSLLIB "
1689   fi
1693 if test "x$alpine_GSSTYPE" != "xnone" ; then
1694   c_client_specials="${c_client_specials}EXTRAAUTHENTICATORS=gss "
1695   AC_MSG_NOTICE([* * * Including Kerberos5 functionality])
1698 if test -n "$CPPFLAGS" ; then
1699   alpine_c_client_cflags="$alpine_c_client_cflags ${CPPFLAGS}"
1701 if test -n "$CFLAGS" ; then
1702   alpine_c_client_cflags="$alpine_c_client_cflags ${CFLAGS}"
1705 if test -n "$alpine_c_client_cflags" ; then
1706   AC_SUBST(C_CLIENT_CFLAGS, EXTRACFLAGS=\"$alpine_c_client_cflags\")
1709 if test -n "$LDFLAGS" ; then
1710   alpine_c_client_ldflags="$alpine_c_client_ldflags ${LDFLAGS}"
1712 if test -n "$LIBS" ; then
1713   alpine_c_client_ldflags="$alpine_c_client_ldflags ${LIBS}"
1716 if test -n "$alpine_c_client_ldflags" ; then
1717   AC_SUBST(C_CLIENT_LDFLAGS, EXTRALDFLAGS=\"$alpine_c_client_ldflags\")
1720 if test -n "$alpine_c_client_gccoptlevel" ; then
1721   AC_SUBST(C_CLIENT_GCCOPTLEVEL, GCCOPTLEVEL=\"$alpine_c_client_gccoptlevel\")
1724 AC_SUBST([C_CLIENT_SPECIALS], $c_client_specials)
1726 dnl Deal with Web Alpine
1727 if test -z "$WEB_BUILD" ; then
1728   WEB_PUBCOOKIE_BUILD=
1729   AC_MSG_NOTICE([* * * TCL libraries could not be found.])
1730   AC_MSG_NOTICE([* * * WEB ALPINE COMPONENT WILL NOT BE BUILT.])
1731 else
1732   if test -n "$WEB_PUBCOOKIE_BUILD" ; then
1733     if test "x$alpine_GSSTYPE" = "xnone" ; then
1734       WEB_PUBCOOKIE_BUILD=
1735       AC_MSG_NOTICE([* * * Kerberos5 support not found.])
1736       AC_MSG_NOTICE([* * * WEB ALPINE PUBCOOKIE COMPONENT WILL NOT BE BUILT.])
1737     elif test -z "$WEB_BINDIR" ; then
1738       WEB_PUBCOOKIE_BUILD=
1739       AC_MSG_NOTICE([* * * Web Alpine binary directory not provided.])
1740         AC_MSG_ERROR([* * * --with-pubcookie requires --with-web-bin=PATH.
1741         Please re-run configure with these options:
1742         --with-pubcookie --with-web-bin=/usr/local/libexec/alpine/bin])
1743     else
1744       AC_DEFINE([PUBCOOKIE],[1],[Include support for UW Pubcookie Web Authentication])
1745       WEB_PUBCOOKIE_LIB=../pubcookie/libauthgssproxy.a
1746       WEB_PUBCOOKIE_LINK=gssapi_proxy.l
1747     fi
1748   fi
1751 AC_SUBST([REGEX_BUILD])
1753 AC_SUBST([WEB_BUILD])
1754 AC_SUBST([WEB_BINDIR])
1755 AC_SUBST([WEB_PUBCOOKIE_BUILD])
1756 AC_SUBST([WEB_PUBCOOKIE_LIB])
1757 AC_SUBST([WEB_PUBCOOKIE_LINK])
1759 AC_SUBST([AM_CFLAGS])
1760 AC_SUBST([AM_LDFLAGS])
1762 AC_CONFIG_FILES([m4/Makefile po/Makefile.in regex/Makefile \
1763           pith/osdep/Makefile pith/charconv/Makefile pith/Makefile \
1764           pico/osdep/Makefile pico/Makefile \
1765           alpine/osdep/Makefile alpine/Makefile \
1766           web/src/Makefile web/src/pubcookie/Makefile \
1767           web/src/alpined.d/Makefile \
1768           Makefile])
1769 AC_OUTPUT