* Unix only: Support for local .pinerc files that are symbolic links
[alpine.git] / configure.ac
blob9a6c230b4f97eb0ce3cfb5e335ee807898bd6727
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:1 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])
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"
1032     ],
1033     [
1034       alpine_SSLTYPE = "none"
1035     ])
1036   if test "x$alpine_SSLTYPE" = "xnone" ; then
1037     AC_MSG_NOTICE([OpenSSL libraries NOT found])
1038   else
1039     AC_MSG_NOTICE([OpenSSL libraries FOUND])
1040   fi
1043 dnl Crypto support is needed 
1044 if test "x$alpine_SSLTYPE" != "xnone" ; then
1045   AC_SEARCH_LIBS(SSLeay,crypto,
1046     [
1047       LIBS="$LIBS -lcrypto"
1048     ],
1049     [
1050       alpine_CRYPTO = "none"
1051     ])
1052   if test "x$alpine_CRYPTO" = "xnone" ; then
1053     AC_MSG_ERROR(crypto library NOT found)
1054   else
1055     AC_MSG_NOTICE([crypto library found])
1056   fi
1059 dnl PAM support is needed to build c-client, and hence Alpine.
1060 if test "x$alpine_PAM" != "xnone" ; then
1061   AC_SEARCH_LIBS(pam_start,pam,
1062     [
1063       LIBS="$LIBS -lpam"
1064       AC_CHECK_HEADER([security/pam_appl.h],,
1065         [
1066           alpine_PAM="none"
1067           alpine_pam_none_reason="header files not found"
1068         ])
1069     ],
1070     [
1071         alpine_PAM="none"
1072         alpine_pam_none_reason="library files not found"
1073     ])
1074   if test -n "$alpine_pam_none_reason" ; then
1075     AC_MSG_ERROR(No PAM support: $alpine_pam_none_reason)
1076   fi
1080 dnl provide KRB5 support?
1081 if test "x$alpine_GSSTYPE" != "xnone" ; then
1082   AC_SEARCH_LIBS(gss_init_sec_context,gss gssapi gssapi_krb5,
1083     [
1084       dnl MIT-based?
1085       LIBS="$LIBS -lkrb5"
1086       AC_CHECK_HEADER([gssapi/gssapi_generic.h],,
1087         [
1088           if test ! -d /usr/kerberos/include ; then
1089             alpine_GSSTYPE="none"
1090             alpine_gss_none_reason="header files not found"
1091           fi
1092         ])
1093     ],
1094     [
1095       alpine_GSSTYPE="none"
1096       alpine_gss_none_reason="libraries not found"
1097     ])
1098   if test -n "$alpine_gss_none_reason" ; then
1099     AC_MSG_NOTICE([NOT including Kerberos Support: $alpine_gss_none_reason])
1100   fi
1103 dnl check for tcl libraries for Web Alpine (HACKY)
1104 if test -n "$WEB_BUILD" ; then
1105   AC_SEARCH_LIBS([Tcl_Eval],[$alpine_TCLLIB tcl8.5 tcl8.4 tcl8.3 tcl84 tcl83 tcl],,
1106     [
1107       WEB_BUILD=
1108     ])
1110   dnl look for header file
1111   if test -n "$alpine_TCLINC" ; then
1112     AC_CHECK_HEADER($alpine_TCLINC,,
1113       [
1114         WEB_BUILD=
1115       ])
1116     if test -z "$WEB_BUILD" ; then
1117       AC_MSG_NOTICE([Tcl Include file NOT found])
1118     fi
1119   else
1120     AC_CHECK_HEADER(tcl.h,,
1121       [
1122         for dir in tcl8.5 tcl8.4 tcl8.3 tcl84 tcl83 ; do
1123           AC_CHECK_FILE([/usr/include/$dir/tcl.h],
1124             [
1125               found=yes
1126             ])
1127           if test "$found" = "yes" ; then
1128             CPPFLAGS="$CPPFLAGS -I/usr/include/$dir"
1129             break
1130           fi
1131         done
1132         if test "$found" != "yes" ; then
1133             WEB_BUILD=
1134             AC_MSG_NOTICE([header file tcl.h NOT found: Web Alpine will not be built])
1135         fi
1136       ])
1137   fi
1140 dnl Local or supplied regex?
1141 if test x$alpine_REGEX != "xyes" ; then
1142   AC_SEARCH_LIBS([regcomp],posix regexp regex re,,
1143     [
1144       if test x$alpine_REGEX = "xno" ; then
1145         AC_MSG_ERROR(Unable to find system regex library)
1146       else
1147         alpine_REGEX=yes
1148       fi
1149     ])
1151 if test x$alpine_REGEX != "xyes" ; then
1152   AC_CHECK_HEADER([regex.h],,
1153     [
1154       if test x$alpine_REGEX = "xno" ; then
1155         AC_MSG_ERROR(Unable to find system regex include file)
1156       else
1157         alpine_REGEX=yes
1158       fi
1159     ])
1161 AC_DEFINE(HAVE_REGEX_H,1,[Regular expression header file exists])
1162 if test x$alpine_REGEX = "xyes" ; then
1163   CPPFLAGS="$CPPFLAGS -I${top_builddir}/regex"
1164   LDFLAGS="$LDFLAGS -L${top_builddir}/regex -lregex"
1165   REGEX_BUILD=regex
1168 if test "x$with_pthread" != "xno" ; then
1169   AC_MSG_CHECKING([for pthread support])
1170   ACX_PTHREAD(
1171     [
1172       AC_MSG_RESULT([yes])
1173       case "$target" in
1174           *openbsd*)
1175             AC_MSG_NOTICE([WARNING: pthread support on OpenBSD is unstable!])
1176             AM_CFLAGS="$AM_CFLAGS -pthread"
1177             ;;
1178       esac
1179       LIBS="$PTHREAD_LIBS $LIBS"
1180       AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
1181       CC="$PTHREAD_CC"
1182       AC_DEFINE([HAVE_PTHREAD], [1], [System has pthread support])
1183     ],
1184     [
1185       AC_MSG_RESULT([no])
1186     ])
1188   AC_SEARCH_LIBS([nanosleep], [rt posix4],
1189     [
1190       AC_DEFINE([HAVE_NANOSLEEP], [1], [Define if system supports subsecond, non-alarm sleep])
1191     ])
1196 dnl CHECK HEADERS
1198 AC_HEADER_STDC
1199 AC_HEADER_DIRENT
1200 AC_HEADER_STAT
1201 AC_HEADER_SYS_WAIT
1202 AC_HEADER_TIME
1203 AC_HEADER_TIOCGWINSZ
1205 AC_CHECK_HEADERS([unistd.h])
1207 AC_CHECK_HEADERS([errno.h \
1208                   ctype.h \
1209                   fcntl.h \
1210                   signal.h \
1211                   setjmp.h \
1212                   memory.h \
1213                   sys/param.h \
1214                   sys/socket.h \
1215                   sys/uio.h \
1216                   sys/un.h \
1217                   limits.h \
1218                   wchar.h \
1219                   sys/poll.h \
1220                   stropts.h \
1221                   netdb.h \
1222                   syslog.h \
1223                   sys/syslog.h \
1224                   locale.h \
1225                   langinfo.h \
1226                   utime.h \
1227                   sys/utime.h \
1228                   pthread.h \
1229                   pwd.h \
1230                   assert.h])
1232 dnl terminal line discipline?
1233 AC_CHECK_HEADER([termios.h],
1234   AC_DEFINE(HAS_TERMIOS, [1], [Define if systems uses termios terminal control]),
1235   [
1236     AC_CHECK_HEADER([termio.h],
1237       AC_DEFINE(HAS_TERMIO, [1], [Define if systems uses termio terminal control]),
1238       [
1239         AC_CHECK_HEADER([sgtty.h],
1240           AC_DEFINE(HAS_SGTTY, [1], [Define if systems uses old BSD-style terminal control]),
1241         [
1242           AC_MSG_ERROR(Unable to figure out terminal control method)
1243         ])
1244       ])
1245   ])
1248 dnl CHECK TYPEDEFS
1250 AC_DIAGNOSE([obsolete],[your code may safely assume C89 semantics that RETSIGTYPE is void.
1251 Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
1252 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
1253 [AC_LANG_PROGRAM([#include <sys/types.h>
1254 #include <signal.h>
1256                  [return *(signal (0, 0)) (0) == 1;])],
1257                    [ac_cv_type_signal=int],
1258                    [ac_cv_type_signal=void])])
1259 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
1260                     (`int' or `void').])
1262 AC_TYPE_SIZE_T
1263 AC_TYPE_MODE_T
1264 AC_TYPE_PID_T
1265 AC_TYPE_UID_T
1266 AC_STRUCT_TM
1268 AC_CHECK_TYPES([union wait])
1270 AC_CHECK_HEADERS([stdint.h], [uint16=uint16_t], [
1271   AC_CHECK_HEADERS([inttypes.h], [uint16=uint16_t], [
1272     AC_CHECK_HEADERS([sys/types.h], [uint16=u_int16_t], [
1273       AC_CHECK_SIZEOF(unsigned short)
1274       if test $ac_cv_sizeof_unsigned_short -eq 2 ; then
1275         uint16="unsigned short"
1276       else
1277         AC_CHECK_SIZEOF(unsigned int)
1278         if $ac_cv_sizeof_unsigned_int -eq 2 ; then
1279           uint16="unsigned int"
1280         else
1281           AC_MSG_ERROR(Unable to determine 16 bit integer type)
1282         fi
1283       fi
1284     ])
1285   ])
1287 AC_DEFINE_UNQUOTED([UINT16], $uint16, [System defined unsigned 16 bit integer])
1289 AC_CHECK_HEADERS([stdint.h], [uint32=uint32_t], [
1290   AC_CHECK_HEADERS([inttypes.h], [uint32=uint32_t], [
1291     AC_CHECK_HEADERS([sys/types.h], [uint32=u_int32_t], [
1292       AC_CHECK_SIZEOF(unsigned int)
1293       if test $ac_cv_sizeof_unsigned_int -eq 4 ; then
1294         uint32="unsigned int"
1295       else
1296         AC_CHECK_SIZEOF(unsigned long)
1297         if $ac_cv_sizeof_unsigned_long -eq 4 ; then
1298           uint32="unsigned long"
1299         else
1300           AC_MSG_ERROR(Unable to determine 32 bit integer type)
1301         fi
1302       fi
1303     ])
1304   ])
1306 AC_DEFINE_UNQUOTED([UINT32], $uint32, [System defined unsigned 32 bit integer])
1308 AC_CACHE_CHECK(argument pointer type of qsort compare function and base,
1309 ac_cv_func_qsort_argtype,
1310 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1311 #if     HAVE_STDLIB_H
1312 #include "stdlib.h"
1313 #endif
1315 extern void *base;
1316 extern sortf(const void *, const void *);
1317 int sortf(a, b)
1318   const void *a;
1319   const void *b; { return 0; }
1320 ]], [[
1321 qsort(base, 2, sizeof(char *), sortf);
1322 ]])],[ac_cv_func_qsort_argtype=void],[ac_cv_func_qsort_argtype=char])
1324 AC_DEFINE_UNQUOTED([qsort_t], $ac_cv_func_qsort_argtype, [qsort compare function argument type])
1326 dnl check for "struct passwd" ?
1328 AC_FUNC_SELECT_ARGTYPES
1330 AC_FUNC_STRCOLL
1332 dnl CHECK FOR LIBRARY FUNCTIONS
1334 AC_FUNC_FORK
1335 AC_CHECK_FUNCS([strchr \
1336                 memcpy \
1337                 strtol \
1338                 strtoul \
1339                 select \
1340                 poll \
1341                 qsort \
1342                 getuid \
1343                 getpwuid \
1344                 getpwnam \
1345                 gettimeofday \
1346                 tmpfile \
1347                 uname \
1348                 rename \
1349                 read \
1350                 signal \
1351                 setjmp \
1352                 chown \
1353                 wait4 \
1354                 waitpid \
1355                 wait \
1356                 srandom \
1357                 popen \
1358                 pclose \
1359                 fsync \
1360                 truncate \
1361                 listen \
1362                 wcwidth \
1363                 mbstowcs \
1364                 wcrtomb \
1365                 putenv \
1366                 setenv])
1368 AC_SEARCH_LIBS([gethostname],[nsl])
1370 AC_SEARCH_LIBS([socket],[socket],,
1371   [
1372     WEB_BUILD=
1373   ])
1375 AC_SEARCH_LIBS([bind],[bind],,
1376   [
1377     WEB_BUILD=
1378   ])
1380 dnl check for POSIX signal interface
1381 AC_CHECK_FUNCS([sigaction sigemptyset sigaddset sigprocmask],
1382   [
1383     AC_DEFINE([POSIX_SIGNALS], [], [Define if system supports POSIX signal interface])
1384   ],
1385   [
1386     AC_CHECK_FUNCS([sigset sigrelse],
1387       [
1388         AC_DEFINE([SYSV_SIGNALS], [], [Define if system supports SYSV signal interface])
1389       ])
1390   ])
1392 AC_SEARCH_LIBS([syslog], [bsd socket inet],
1393   [
1394     AC_DEFINE([HAVE_SYSLOG], [1], [Define if system supplies syslog() logging])
1395   ])
1398 dnl HOST-OS SPECIFIC DEFINITIONS
1399 dnl Tests and assignments below are mostly to coax the appropriate
1400 dnl build from c-client.  Most of this will go away when c-client
1401 dnl adopts configure
1402 case "$host" in
1403   *-linux-gnu*|*-k*bsd*-gnu*)
1404     alpine_path_delim="/"
1405     alpine_mode_readonly="(0600)"
1406     if test -f /etc/fedora-release ; then  
1407       systype="LFD"
1408       if test -d /etc/pki/tls ; then  
1409         alpine_c_client_target="lfd"
1410       else
1411         alpine_c_client_target="lrh"
1412       fi
1413     elif test -f /etc/mandrake-release ; then
1414       systype="LMD"
1415       alpine_c_client_target="lmd"
1416     elif test -f /etc/redhat-release -o -f /etc/redhat_version ; then
1417       systype="LRH"
1418       if test -d /etc/pki/tls ; then  
1419         alpine_c_client_target="lr5"
1420       else
1421         alpine_c_client_target="lrh"
1422       fi
1423     elif test -f /etc/debian_release -o -f /etc/debian_version ; then
1424       if test -d /etc/osso-af-init ; then
1425         systype="LN8"
1426         alpine_c_client_target="ln8"
1427       else
1428         systype="DEB"
1429         alpine_c_client_target="ldb"
1430       fi
1431     elif test -f /etc/SuSE-release ; then
1432       systype="LSU"
1433       alpine_c_client_target="lsu"
1434     else
1435       systype="LNX"
1436       AC_CHECK_LIB(pam, pam_start,
1437         [
1438           alpine_c_client_target="lnp"
1439         ],
1440         [
1441           if test -f /etc/shadow ; then
1442             alpine_c_client_target="slx"
1443           else
1444             alpine_c_client_target="lnx"
1445           fi
1446         ])
1447     fi
1448     ;;
1449   *-apple-darwin*)
1450     systype="OSX"
1451     alpine_path_delim="/"
1452     alpine_mode_readonly="(0600)"
1453     LIBS="$LIBS -framework Carbon -framework ApplicationServices -framework Security"
1454     AM_CFLAGS="$AM_CFLAGS -Dbsd"
1455     dnl SEE include/system.h
1456     AC_DEFINE([OSX_TARGET],[1],[OSX TARGET])
1457     case "$alpine_os_credential_cache" in
1458       no)
1459         ;;
1460       *)
1461         AC_DEFINE([APPLEKEYCHAIN], [1], [Use Apple OS X key chain for credential caching])
1462         ;;
1463     esac
1464     AC_CHECK_LIB(pam, pam_start,
1465       [
1466         alpine_c_client_target="oxp"
1467       ],
1468       [
1469         alpine_c_client_target="osx"
1470       ])
1471     ;;
1472   *-*-solaris*)
1473     if test x$GCC = "xyes" ; then
1474       systype="GSO"
1475       alpine_c_client_target="gso"
1476     else
1477       systype="SOC"
1478       alpine_c_client_target="soc"
1479       AC_DEFINE([__EXTENSIONS__], [1], [Enable extended pthread features on Solaris])
1480     fi
1481     alpine_path_delim="/"
1482     alpine_mode_readonly="(0600)"
1483     dnl possible other OS's need this.
1484     dnl Use autoconf 2.61's AC_USE_SYSTEM_EXTENSIONS at some point
1485     ;;
1486   *-*-sunos4*)
1487     systype="SUN"
1488     alpine_path_delim="/"
1489     alpine_mode_readonly="(0600)"
1490     alpine_c_client_target="s40"
1491     ;;
1492   *-*-sco3.2v5*)
1493     if test x$GCC = "xyes" ; then
1494       systype="GO5"
1495       alpine_c_client_target="go5"
1496     else
1497       systype="SC5"
1498       alpine_c_client_target="sc5"
1499     fi
1500     alpine_path_delim="/"
1501     alpine_mode_readonly="(0600)"
1502     dnl possible other OS's need this.
1503     dnl Use autoconf 2.61's AC_USE_SYSTEM_EXTENSIONS at some point
1504     ;;
1505   *-next-*)
1506     systype="NXT"
1507     alpine_path_delim="/"
1508     alpine_mode_readonly="(0600)"
1509     alpine_c_client_target="nx3"
1510     ;;
1511   *-*-netbsd*)
1512     systype="NEB"
1513     alpine_path_delim="/"
1514     alpine_mode_readonly="(0600)"
1515     alpine_c_client_target="neb"
1516     ;;
1517   *-*-dragonfly*)
1518     systype="DFB"
1519     alpine_path_delim="/"
1520     alpine_mode_readonly="(0600)"
1521     alpine_c_client_target="neb"
1522     ;;
1523   *-*-bsdi*)
1524     systype="BSI"
1525     alpine_path_delim="/"
1526     alpine_mode_readonly="(0600)"
1527     alpine_c_client_target="bsi"
1528     ;;
1529   *-*-freebsd*)
1530     systype="BSF"
1531     alpine_path_delim="/"
1532     alpine_mode_readonly="(0600)"
1533     alpine_c_client_target="bsf"
1534     LIBS="$LIBS $LIBINTL"
1535     ;;
1536   *-*-openbsd*)
1537     systype="BSO"
1538     alpine_path_delim="/"
1539     alpine_mode_readonly="(0600)"
1540     alpine_c_client_target="bso"
1541     LIBS="$LIBS $LIBINTL"
1542     ;;
1543   *-*-aix5*)
1544     systype="A52"
1545     alpine_path_delim="/"
1546     alpine_mode_readonly="(0600)"
1547     alpine_c_client_target="a52"
1548     ;;
1549   *-*-aix4*)
1550     systype="A41"
1551     alpine_path_delim="/"
1552     alpine_mode_readonly="(0600)"
1553     alpine_c_client_target="a41"
1554     ;;
1555   *-*-aix3*)
1556     systype="A32"
1557     alpine_path_delim="/"
1558     alpine_mode_readonly="(0600)"
1559     alpine_c_client_target="a32"
1560     ;;
1561   *-*UNIX_SV | *-*-sysv5UnixWare7* | *-*OpenUNIX*)
1562     systype="UW2"
1563     alpine_path_delim="/"
1564     alpine_mode_readonly="(0600)"
1565     alpine_c_client_target="uw2"
1566     ;;
1567   *-*-osf5*)
1568     systype="OSF"
1569     alpine_path_delim="/"
1570     alpine_mode_readonly="(0600)"
1571     alpine_c_client_target="osf"
1572     ;;
1573   *-*-cygwin)
1574     systype="CYG"
1575     alpine_path_delim="/"
1576     alpine_mode_readonly="(S_IREAD | S_IWRITE)"
1577     alpine_c_client_target="cyg"
1578     LIBS="$LIBS $LIBINTL"
1579     ;;
1580   windows* | *-*-pw32*)
1581     systype="WNT"
1582     alpine_path_delim="\\"
1583     alpine_mode_readonly="(S_IREAD | S_IWRITE)"
1584     alpine_c_client_target="wnt"
1585     AC_DEFINE([_WINDOWS], [1], [Windows is just too different])
1586     ;;
1587   *)
1588     AC_MSG_ERROR(Unrecognized system: $host)
1589     ;;
1590 esac
1592 dnl set pico newmail check directory
1593 if test -n "$alpine_with_local_maildir" ; then
1594     alpine_local_maildir=$alpine_with_local_maildir
1595 elif test -d /var/spool/mail ; then
1596     alpine_local_maildir="/var/spool/mail"
1597 elif test -d /var/mail ; then
1598     alpine_local_maildir="/var/mail"
1599 else
1600     alpine_local_maildir="/usr/spool/mail"
1603 dnl set c-client make target
1604 if test -n "$alpine_with_c_client_target" ; then
1605     alpine_c_client_target=$alpine_with_c_client_target
1608 AC_DEFINE_UNQUOTED([SYSTYPE], "$systype", [Pine-Centric Host Specifier])
1609 AC_DEFINE_UNQUOTED([C_FILESEP],'$alpine_path_delim',[File name separator as character constant])
1610 AC_DEFINE_UNQUOTED([S_FILESEP],"$alpine_path_delim",[File name separator as string constant])
1611 AC_DEFINE_UNQUOTED([MAILDIR],"$alpine_local_maildir",[Path to local inboxes for pico newmail check])
1612 AC_DEFINE_UNQUOTED([MODE_READONLY], $alpine_mode_readonly, [File mode used to set readonly access])
1614 dnl c-client make particulars
1615 AC_SUBST([C_CLIENT_TARGET], $alpine_c_client_target)
1616 AC_SUBST([C_CLIENT_WITH_IPV6], $c_client_ip6)
1617 if test "x$alpine_SSLTYPE" = "xnone" ; then 
1618   AC_MSG_NOTICE([* * *  NOT Including SSL Support])
1619   c_client_specials="${c_client_specials}SSLTYPE=none "
1620 else
1621   dnl issue any warnings for common OpenSSL issues
1623   if test -n "$alpine_SSLCERTS" -a -d "$alpine_SSLCERTS" ; then
1624     certdir="$alpine_SSLCERTS"
1625   elif test -n "$alpine_SSLDIR" -a -d "${alpine_SSLDIR}/certs" ; then
1626     certdir="${alpine_SSLDIR}/certs"
1627   else
1628     AC_MSG_NOTICE([SSL Problem: certificate directory not found])
1629   fi
1631   if test "x$with_smime" != "xno" ; then
1632     if test -n "$certdir" ; then
1633       AC_DEFINE([SMIME], [], [Enable S/MIME code])
1634       AC_DEFINE_UNQUOTED([SMIME_SSLCERTS],"$certdir",[Directory where S/MIME CACerts are located])
1635     fi
1636   fi
1638   if test ! -f ${certdir}/factory.pem ; then
1639     AC_MSG_NOTICE([* * * SSL file "${certdir}/factory.pem" is missing.])
1640     AC_MSG_NOTICE([* * *   This might indicate that CA certs did not get properly])
1641     AC_MSG_NOTICE([* * *   installed.  If you get certificate validation failures])
1642     AC_MSG_NOTICE([* * *   in Alpine, this might be the reason for them.])
1643   fi
1645   if test -z "`ls ${certdir} | $EGREP '^@<:@0-9A-Fa-f@:>@{8}\.@<:@0-9@:>@'`" ; then
1646     AC_MSG_NOTICE([* * * No 8-hexdigit symlinks in certificate directory "${certdir}".])
1647     AC_MSG_NOTICE([* * *   This might indicate that CA certs did not get properly])
1648     AC_MSG_NOTICE([* * *   installed.  If you get certificate validation failures])
1649     AC_MSG_NOTICE([* * *   in Alpine, this might be the reason for them.])
1650   fi
1652   if test -n "$alpine_SSLDIR" ; then
1653     c_client_specials="${c_client_specials}SSLDIR=$alpine_SSLDIR "
1654   fi
1656   if test -n "$alpine_SSLCERTS" ; then
1657     c_client_specials="${c_client_specials}SSLCERTS=$alpine_SSLCERTS "
1658   fi
1660   if test -n "$alpine_SSLINCLUDE" ; then
1661     c_client_specials="${c_client_specials}SSLINCLUDE=$alpine_SSLINCLUDE "
1662   fi
1664   if test -n "$alpine_SSLLIB" ; then
1665     c_client_specials="${c_client_specials}SSLLIB=$alpine_SSLLIB "
1666   fi
1670 if test "x$alpine_GSSTYPE" != "xnone" ; then
1671   c_client_specials="${c_client_specials}EXTRAAUTHENTICATORS=gss "
1672   AC_MSG_NOTICE([* * * Including Kerberos5 functionality])
1675 if test -n "$CPPFLAGS" ; then
1676   alpine_c_client_cflags="$alpine_c_client_cflags ${CPPFLAGS}"
1678 if test -n "$CFLAGS" ; then
1679   alpine_c_client_cflags="$alpine_c_client_cflags ${CFLAGS}"
1682 if test -n "$alpine_c_client_cflags" ; then
1683   AC_SUBST(C_CLIENT_CFLAGS, EXTRACFLAGS=\"$alpine_c_client_cflags\")
1686 if test -n "$LDFLAGS" ; then
1687   alpine_c_client_ldflags="$alpine_c_client_ldflags ${LDFLAGS}"
1689 if test -n "$LIBS" ; then
1690   alpine_c_client_ldflags="$alpine_c_client_ldflags ${LIBS}"
1693 if test -n "$alpine_c_client_ldflags" ; then
1694   AC_SUBST(C_CLIENT_LDFLAGS, EXTRALDFLAGS=\"$alpine_c_client_ldflags\")
1697 if test -n "$alpine_c_client_gccoptlevel" ; then
1698   AC_SUBST(C_CLIENT_GCCOPTLEVEL, GCCOPTLEVEL=\"$alpine_c_client_gccoptlevel\")
1701 AC_SUBST([C_CLIENT_SPECIALS], $c_client_specials)
1703 dnl Deal with Web Alpine
1704 if test -z "$WEB_BUILD" ; then
1705   WEB_PUBCOOKIE_BUILD=
1706   AC_MSG_NOTICE([* * * TCL libraries could not be found.])
1707   AC_MSG_NOTICE([* * * WEB ALPINE COMPONENT WILL NOT BE BUILT.])
1708 else
1709   if test -n "$WEB_PUBCOOKIE_BUILD" ; then
1710     if test "x$alpine_GSSTYPE" = "xnone" ; then
1711       WEB_PUBCOOKIE_BUILD=
1712       AC_MSG_NOTICE([* * * Kerberos5 support not found.])
1713       AC_MSG_NOTICE([* * * WEB ALPINE PUBCOOKIE COMPONENT WILL NOT BE BUILT.])
1714     elif test -z "$WEB_BINDIR" ; then
1715       WEB_PUBCOOKIE_BUILD=
1716       AC_MSG_NOTICE([* * * Web Alpine binary directory not provided.])
1717         AC_MSG_ERROR([* * * --with-pubcookie requires --with-web-bin=PATH.
1718         Please re-run configure with these options:
1719         --with-pubcookie --with-web-bin=/usr/local/libexec/alpine/bin])
1720     else
1721       AC_DEFINE([PUBCOOKIE],[1],[Include support for UW Pubcookie Web Authentication])
1722       WEB_PUBCOOKIE_LIB=../pubcookie/libauthgssproxy.a
1723       WEB_PUBCOOKIE_LINK=gssapi_proxy.l
1724     fi
1725   fi
1728 AC_SUBST([REGEX_BUILD])
1730 AC_SUBST([WEB_BUILD])
1731 AC_SUBST([WEB_BINDIR])
1732 AC_SUBST([WEB_PUBCOOKIE_BUILD])
1733 AC_SUBST([WEB_PUBCOOKIE_LIB])
1734 AC_SUBST([WEB_PUBCOOKIE_LINK])
1736 AC_SUBST([AM_CFLAGS])
1737 AC_SUBST([AM_LDFLAGS])
1739 AC_CONFIG_FILES([m4/Makefile po/Makefile.in regex/Makefile \
1740           pith/osdep/Makefile pith/charconv/Makefile pith/Makefile \
1741           pico/osdep/Makefile pico/Makefile \
1742           alpine/osdep/Makefile alpine/Makefile \
1743           web/src/Makefile web/src/pubcookie/Makefile \
1744           web/src/alpined.d/Makefile \
1745           Makefile])
1746 AC_OUTPUT