1# vim: set ft=tcl syntax=tcl ts=2 sw=2 expandtab:
2
3# Make sure we use /usr as a default prefix on Linux; we can't use $host_
4# variables because this needs to go before the inclusion of the system module.
5if {![catch {exec uname} out] && $out eq {Linux}} {
6  options-defaults {
7    prefix /usr
8  }
9}
10
11autosetup-require-version 0.6.9
12
13# Standard autosetup modules and our own modules
14use system cc cc-lib mutt-gettext mutt-iconv pkg-config
15
16###############################################################################
17# Names and versions
18define PACKAGE          "neomutt"
19define PACKAGE_VERSION  "20211029"
20define BUGS_ADDRESS     "neomutt-devel@neomutt.org"
21
22# Subdirectories that contain additional Makefile.autosetup files
23set subdirs {po docs contrib}
24###############################################################################
25
26###############################################################################
27# Add any user options here
28options {
29# Curses
30  with-ncurses:path         => "Location of ncurses"
31# Features w/o 3rd party dependencies
32  doc=1                     => "Disable building the documentation"
33  full-doc=0                => "Build the full documentation set"
34  docdir:path               => "Documentation root"
35  with-lock:=fcntl          => "Select fcntl() or flock() to lock files"
36  fmemopen=0                => "Use fmemopen() for temporary in-memory files"
37  inotify=1                 => "Disable file monitoring support (Linux only)"
38  locales-fix=0             => "Enable locales fix"
39  pgp=1                     => "Disable PGP support"
40  smime=1                   => "Disable SMIME support"
41  mixmaster=0               => "Enable Mixmaster support"
42  with-mixmaster:=mixmaster => "Location of the mixmaster executable"
43  homespool=0               => "Enable new mail spooling in the user's HOME"
44  with-homespool:mailbox    => "File in the user's HOME where new mail is spooled"
45  with-mailpath:/var/mail   => "Directory where spool mailboxes are located"
46  with-domain:domain        => "Specify your DNS domain name"
47# Crypto
48  # OpenSSL or GnuTLS
49  ssl=0                     => "Enable TLS support using OpenSSL"
50  with-ssl:path             => "Location of OpenSSL"
51  gnutls=0                  => "Enable TLS support using GnuTLS"
52  with-gnutls:path          => "Location of GnuTLS"
53  # GPGME
54  gpgme=0                   => "Enable GPGME support"
55  with-gpgme:path           => "Location of GPGME"
56  # GSS (IMAP auth)
57  gss=0                     => "Use GSSAPI authentication for IMAP"
58  with-gss:path             => "Location of GSSAPI library"
59  # SASL (IMAP and POP auth)
60  sasl=0                    => "Use the SASL network security library"
61  with-sasl:path            => "Location of the SASL network security library"
62  # AutoCrypt
63  autocrypt=0               => "Enable AutoCrypt support (requires GPGME and SQLite)"
64# Lua
65  lua=0                     => "Enable Lua scripting support"
66  with-lua:path             => "Location of Lua"
67# Notmuch
68  notmuch=0                 => "Enable Notmuch support"
69  with-notmuch:path         => "Location of Notmuch"
70# NLS
71  nls=1                     => "Disable Native Language Support"
72  with-nls:path             => "Location of libintl"
73# IDN
74  idn=1                     => "Disable GNU libidn for internationalized domain names"
75  with-idn:path             => "Location of GNU libidn"
76  idn2=0                    => "Enable GNU libidn2 for internationalized domain names"
77  with-idn2:path            => "Location of GNU libidn2"
78# PCRE2
79  pcre2=0                   => "Enable PCRE2 regular expressions"
80  with-pcre2:path           => "Location of PCRE2"
81# Header cache
82  bdb=0                     => "Use BerkeleyDB for the header cache"
83  with-bdb:path             => "Location of BerkeleyDB"
84  with-bdb-version:version  => "Version of BerkeleyDB"
85  gdbm=0                    => "Use GNU dbm for the header cache"
86  with-gdbm:path            => "Location of GNU dbm"
87  kyotocabinet=0            => "Use KyotoCabinet for the header cache"
88  with-kyotocabinet:path    => "Location of KyotoCabinet"
89  lmdb=0                    => "Use LMDB for the header cache"
90  with-lmdb:path            => "Location of LMDB"
91  qdbm=0                    => "Use QDBM for the header cache"
92  with-qdbm:path            => "Location of QDBM"
93  rocksdb=0                 => "Use RocksDB for the header cache"
94  with-rocksdb:path         => "Location of RocksDB"
95  tdb=0                     => "Use TDB for the header cache"
96  with-tdb:path             => "Location of TDB"
97  tokyocabinet=0            => "Use TokyoCabinet for the header cache"
98  with-tokyocabinet:path    => "Location of TokyoCabinet"
99# sqlite
100  sqlite=0                  => "Enable SQLite support"
101  with-sqlite:path          => "Location of SQLite"
102# compression
103  lz4=0                     => "Enable LZ4 header cache compression support"
104  with-lz4:path             => "Location of LZ4"
105  zlib=0                    => "Enable zlib support"
106  with-zlib:path            => "Location of zlib"
107  zstd=0                    => "Enable Zstandard header cache compression support"
108  with-zstd:path            => "Location of Zstandard"
109# System
110  with-sysroot:path         => "Target system root"
111  with-tmpdir:=/tmp         => "location of the tmp directory"
112# Misc
113  include-path-in-cflags=1  => "Remove include paths from CFLAGS in the output of neomutt -v"
114# Testing
115  asan=0                    => "Enable the Address Sanitizer"
116  coverage=0                => "Enable Coverage Testing"
117  testing=0                 => "Enable Unit Testing"
118# Configure with pkg-config
119  pkgconf=0                 => "Use pkg-config during configure"
120# Enable all options
121  everything=0              => "Enable all options"
122# Debug options
123  debug-backtrace=0         => "DEBUG: Enable backtrace support with libunwind"
124  with-backtrace:path       => "Location of libunwind"
125  debug-email=0             => "DEBUG: Enable Email dump"
126  debug-graphviz=0          => "DEBUG: Enable Graphviz dump"
127  debug-notify=0            => "DEBUG: Enable Notifications dump"
128  debug-parse-test=0        => "DEBUG: Enable 'neomutt -T' for config testing"
129  debug-window=0            => "DEBUG: Enable windows dump"
130# Deprecated stuff
131  with-ui:=deprecated       => "Deprecated"
132  with-slang:deprecated     => "Deprecated"
133}
134###############################################################################
135
136###############################################################################
137# Deprecated config options
138foreach dep {with-ui with-slang} {
139  if {[opt-bool -nodefault $dep] != -1} {
140    user-notice "\nThe configure option \"--$dep\" is not used anymore\n"
141  }
142}
143###############################################################################
144
145###############################################################################
146# All boolean options are converted to want-* definitions here. Further down,
147# their values is checked with [get-define opt].  This facilitates the handling
148# of dependencies among options (see "everything").
149if {1} {
150  # Keep sorted, please.
151  foreach opt {
152    asan autocrypt bdb coverage debug-backtrace debug-email debug-graphviz debug-notify
153    debug-parse-test debug-window doc everything fmemopen full-doc gdbm gnutls
154    gpgme gss homespool idn idn2 include-path-in-cflags inotify kyotocabinet
155    lmdb locales-fix lua lz4 mixmaster nls notmuch pcre2 pgp pkgconf qdbm
156    rocksdb sasl smime sqlite ssl testing tdb tokyocabinet zlib zstd
157  } {
158    define want-$opt [opt-bool $opt]
159  }
160
161  # These options support a --with-opt parameter. If that is set, force the
162  # relative --enable-opt to true. This allows "--with-opt=/usr" to be used as
163  # a shortcut for "--opt --with-opt=/usr".
164  foreach opt {
165    bdb gdbm gnutls gpgme gss homespool idn idn2 kyotocabinet lmdb lua lz4
166    mixmaster nls notmuch pcre2 qdbm rocksdb sasl sqlite ssl tdb tokyocabinet
167    zlib zstd
168  } {
169    if {[opt-val with-$opt] ne {}} {
170      define want-$opt 1
171    }
172  }
173
174  # No more usage of [opt-bool] below this point.
175  proc opt-bool {args} {
176    user-error "opt-bool should not be called here"
177  }
178}
179###############################################################################
180
181###############################################################################
182# Paths
183define BINDIR           [get-define bindir]
184define MUTTLOCALEDIR    [get-define datadir]/locale
185define PKGDATADIR       [get-define datadir]/neomutt
186define PKGDOCDIR        [opt-val docdir [get-define datadir]/doc/neomutt]
187define SYSCONFDIR       [get-define sysconfdir]
188define TMPDIR           [opt-val with-tmpdir /tmp]
189set libdir_tail         [file tail [get-define libdir]] ;# used only locally
190###############################################################################
191
192###############################################################################
193# Helper functions
194if {1} {
195  # Check for a header file and a function in a library
196  proc check-inc-and-lib {name prefix header fun lib} {
197    cc-with [list -cflags -I$prefix/include -libs -L$prefix/$::libdir_tail] {
198      if {[cc-check-includes $header] && [cc-check-function-in-lib $fun $lib]} {
199        define-append CFLAGS  -I$prefix/include
200        define-append LDFLAGS -L$prefix/$::libdir_tail
201        define-feature $name
202      }
203    }
204    have-feature $name
205  }
206
207  proc check-define {incfile macro} {
208    set code {}
209    if {$incfile ne {}} {
210      append code "#include \"$incfile\"\n"
211    }
212    append code "#ifndef $macro\n#error \"$macro not defined\"\n#endif\n$macro"
213    if {[catch {exec {*}[get-define CC] {*}[get-define CFLAGS] -xc - -E | tail -1 << $code} out]} {
214      error
215    }
216    set out
217  }
218
219  # Check whether a macro is defined after preprocessing a header file
220  proc has-define {incfile macro} {
221    expr {[catch {check-define $incfile $macro}] == 0}
222  }
223
224  # Get the value of a macro by preprocessing a header file that defines it
225  proc get-define-value {incfile macro} {
226    if {![catch {check-define $incfile $macro} out]} {
227      return $out
228    }
229  }
230
231  # Convert a string into a representation suitable for a C char[]
232  proc text2c {s} {
233    set result "\n  "
234    set i 0
235    foreach c [split $s {}] {
236      append result "0x[format %02x [scan $c %c]], "
237      if {[expr {[incr i] % 12 == 0}]} {
238        append result "\n  "
239        set i 0
240      }
241    }
242    append result "0x00\n";
243  }
244
245  # Guess what..
246  proc yesno val {
247    expr {$val ? "yes" : "no"}
248  }
249
250  # Wrapper around pkg-config, to optionally fail is a pkg is not found, and to
251  # add the compile/link definitions for the module.
252  proc pkgconf {required module args} {
253    if {[pkg-config $module {*}$args]} {
254
255      # Add only non-duplicate CFLAGS and LDFLAGS
256      foreach which {CFLAGS LDFLAGS} {
257        foreach flag [pkg-config-get $module $which] {
258          if {$flag ni [get-define $which]} {
259            define-append $which $flag
260          }
261        }
262      }
263      # Order of libraries matter, so we cannot skip duplicates
264      define-append LIBS [pkg-config-get $module LIBS]
265      return 1
266    } elseif {[string is bool $required] && $required} {
267      user-error "$module $args"
268    } else {
269      return 0
270    }
271  }
272}
273###############################################################################
274
275###############################################################################
276# C compiler definitions and related tools
277if {1} {
278
279  # First off, require c99
280  if {[cc-check-standards c99] eq {}} {
281    user-error "C99 is required"
282  }
283  define-append CFLAGS_FOR_BUILD -std=c99
284  define LDFLAGS_FOR_BUILD {}
285
286  # Check for tools and programs
287  cc-check-tools ar ranlib strip
288  cc-check-progs install
289  if {![cc-path-progs sendmail]} {
290    define SENDMAIL /usr/sbin/sendmail
291  }
292
293  # GCC-specifc CFLAGS
294  if {![catch {exec {*}[get-define CC] --version} res]} {
295    if {[regexp -nocase gcc $res]} {
296      define-append CFLAGS "-fno-delete-null-pointer-checks"
297    }
298  }
299
300  # Enable extensions (reverse-engineered from AC_SYSTEM_EXTENSIONS)
301  if {1} {
302    if {[cc-check-includes minix/config.h]} {
303      lappend extensions -D_POSIX_SOURCE=1
304      lappend extensions -D_POSIX_1_SOURCE=2
305      lappend extensions -D_MINIX=1
306    }
307    lappend extensions -D_ALL_SOURCE=1
308    lappend extensions -D_GNU_SOURCE=1
309    lappend extensions -D__EXTENSIONS__
310    define-append CFLAGS_FOR_BUILD {*}$extensions
311    define-append CFLAGS {*}$extensions
312  }
313  cc-with [list -cflags [get-define CFLAGS]]
314
315  # Endianness
316  cc-check-endian
317  if {[have-feature BIG_ENDIAN]} {
318    define WORDS_BIGENDIAN
319  }
320
321  # Large file support
322  if {[cc-check-lfs]} {
323    define OFF_T_FMT {"%" PRId64}
324  } else {
325    define OFF_T_FMT {"%" PRId32}
326  }
327  define LOFF_T off_t
328}
329###############################################################################
330
331###############################################################################
332# signal-related checks
333# Let's always use volatile for sig_atomic_t
334cc-check-includes signal.h
335define SIG_ATOMIC_VOLATILE_T "volatile sig_atomic_t"
336
337cc-with {-includes "signal.h unistd.h"} {
338  cc-check-decls sys_siglist
339}
340###############################################################################
341
342###############################################################################
343# Check for includes and functions that in the code are surrounded by
344# '#ifdef HAVE_FOO_H' and '#ifdef HAVE_FUNCTION' and for functions that might
345# be in different libraries
346if {1} {
347  cc-check-includes \
348    ioctl.h \
349    termios.h \
350    sys/ioctl.h \
351    syscall.h \
352    sys/random.h \
353    sys/syscall.h \
354    sysexits.h
355
356  cc-check-functions \
357    clock_gettime \
358    fgetc_unlocked \
359    futimens \
360    getaddrinfo \
361    getrandom \
362    getsid \
363    iswblank \
364    mkdtemp \
365    qsort_s \
366    strsep \
367    tcgetwinsize \
368    utimesnsat \
369    vasprintf \
370    wcscasecmp
371
372  # The following systems have known-bad qsort_r with reversed arguments
373  if {![has-define sys/param.h __FreeBSD_version] &&
374      ![has-define {} __APPLE__]} {
375    cc-check-functions qsort_r
376  }
377
378  cc-check-function-in-lib gethostent nsl
379  cc-check-function-in-lib setsockopt socket
380  cc-check-function-in-lib getaddrinfo_a anl
381
382  cc-with {-includes time.h} {
383    cc-check-types "struct timespec"
384  }
385
386  cc-with {-includes sys/stat.h} {
387    cc-check-members "struct stat.st_atim.tv_nsec"
388  }
389}
390###############################################################################
391
392###############################################################################
393# Various unconditional defines
394define USE_COMP_MBOX
395define USE_IMAP
396define USE_NNTP
397define USE_POP
398define USE_SIDEBAR
399define USE_SMTP
400define SUN_ATTACHMENT
401define TEST_CASE_MAXSIZE 1024
402###############################################################################
403
404set prefix [opt-val with-sysroot][get-define prefix]
405
406###############################################################################
407# Everything
408if {[get-define want-everything]} {
409  foreach opt {bdb gdbm gpgme kyotocabinet lmdb lua lz4 notmuch pgp rocksdb
410               qdbm sasl smime ssl tokyocabinet tdb zlib zstd} {
411    define want-$opt
412    append conf_options "--$opt "
413  }
414} else {
415  set conf_options "$::argv"
416}
417
418###############################################################################
419# Locking
420switch [opt-val with-lock fcntl] {
421  fcntl {
422    define USE_FCNTL
423  }
424
425  flock {
426    define USE_FLOCK
427  }
428
429  default {
430    user-error "Invalid value for --with-lock=[opt-val with-lock], select fcntl\
431                or flock"
432  }
433}
434
435###############################################################################
436# Locales fix
437if {[get-define want-locales-fix]} {define LOCALES_HACK}
438
439###############################################################################
440# Documentation
441if {[get-define want-doc]} {
442  if {![cc-check-progs xsltproc]} {
443    user-error "Unable to find xsltproc"
444  }
445
446  msg-checking "Checking for DocBook DTDs..."
447  set res [exec xmlcatalog --shell << {public "-//OASIS//DTD DocBook XML V4.2//EN"}]
448  if {[string match {> No entry*} $res]} {
449    msg-result "no"
450    user-error "Install DocBook DTDs or './configure --disable-doc'"
451  }
452  msg-result "yes"
453
454  define BUILD_DOC
455}
456if {[get-define want-full-doc]} {define MAKEDOC_FULL}
457
458###############################################################################
459# AutoCrypt
460if {[get-define want-autocrypt]} {
461  define USE_AUTOCRYPT
462  define want-sqlite 1
463  define want-gpgme 1
464}
465
466###############################################################################
467# GPGME
468if {[get-define want-gpgme]} {
469  if {[is-defined _FILE_OFFSET_BITS]} {
470    define-append CFLAGS -D_FILE_OFFSET_BITS=[get-define _FILE_OFFSET_BITS]
471  }
472
473  msg-checking "Checking for GPGME..."
474  if {1} {
475    # Locate gpgme-config
476    set gpgme_prefix [opt-val with-gpgme $prefix]
477    set gpgme_config_guess [file join $gpgme_prefix bin gpgme-config]
478    if {[file-isexec $gpgme_config_guess]} {
479      define GPGME-CONFIG $gpgme_config_guess
480    } else {
481      if {![cc-check-progs gpgme-config]} {
482        user-error "Unable to find gpgme-config"
483      }
484    }
485    set gpgme_config [get-define GPGME-CONFIG]
486
487    # Version
488    if {[catch {exec-with-stderr $gpgme_config --version} gpgme_version err]} {
489      user-error "Could not derive --version from $gpgme_config"
490    }
491    if {[scan $gpgme_version "%d.%d.%d" gpgme_maj gpgme_min gpgme_patch] != 3} {
492      user-error "Could not parse GPGME version $gpgme_version"
493    }
494    msg-result $gpgme_version
495    if {[get-define want-autocrypt]} {
496      if {$gpgme_maj < 1 || $gpgme_min < 8} {
497        user-error "Found GPGME version $gpgme_version, need 1.8.0 for AutoCrypt"
498      }
499    } else {
500      if {$gpgme_maj < 1 || $gpgme_min < 4} {
501        user-error "Found GPGME version $gpgme_version, need 1.4.0"
502      }
503    }
504    define GPGME_VERSION_NUMBER [format "0x%02x%02x%02x" $gpgme_maj $gpgme_min $gpgme_patch]
505
506    # RHEL6 doesn't have this function yet
507    cc-check-function-in-lib gpgme_op_export_keys gpgme
508
509    # CFLAGS
510    if {[catch {exec-with-stderr $gpgme_config --cflags} res err]} {
511      user-error "Could not derive --cflags from $gpgme_config"
512    }
513    define-append CFLAGS $res
514
515    # LIBS
516    if {[catch {exec-with-stderr $gpgme_config --libs} res err]} {
517      user-error "Could not derive --libs from $gpgme_config"
518    }
519    define-append LIBS $res
520  }
521  define-feature gpgme
522
523  msg-checking "Checking for gpg-error..."
524  if {1} {
525    # Locate gpg-error-config
526    set gpg_error_config_guess [file join $gpgme_prefix bin gpg-error-config]
527    if {[file-isexec $gpg_error_config_guess]} {
528      define GPG-ERROR-CONFIG $gpg_error_config_guess
529    } else {
530      if {![cc-check-progs gpg-error-config]} {
531        user-error "Unable to find gpg-error-config"
532      }
533    }
534    set gpg_error_config [get-define GPG-ERROR-CONFIG]
535
536    # Version
537    if {[catch {exec-with-stderr $gpg_error_config --version} gpg_error_version err]} {
538      user-error "Could not derive --version from $gpg_error_config"
539    }
540
541    # CFLAGS
542    if {[catch {exec-with-stderr $gpg_error_config --cflags} res err]} {
543      user-error "Could not derive --cflags from $gpg_error_config"
544    }
545    define-append CFLAGS $res
546
547    # LIBS
548    if {[catch {exec-with-stderr $gpg_error_config --libs} res err]} {
549      user-error "Could not derive --libs from $gpg_error_config"
550    }
551    define-append LIBS $res
552  }
553  msg-result $gpg_error_version
554
555  define CRYPT_BACKEND_GPGME
556}
557
558###############################################################################
559# INOTIFY
560if {[get-define want-inotify]} {
561  if {[cc-check-functions inotify_add_watch inotify_init inotify_rm_watch]} {
562    define USE_INOTIFY
563    cc-check-functions inotify_init1
564    cc-check-includes sys/inotify.h
565  }
566}
567
568###############################################################################
569# PGP
570if {[get-define want-pgp]} {
571  define-feature PGP
572  define CRYPT_BACKEND_CLASSIC_PGP
573}
574
575###############################################################################
576# SMIME
577if {[get-define want-smime]} {
578  define-feature SMIME
579  define CRYPT_BACKEND_CLASSIC_SMIME
580}
581
582###############################################################################
583# SASL
584if {[get-define want-sasl]} {
585  if {[get-define want-pkgconf]} {
586    pkgconf true libsasl2
587    # RHEL6 doesn't have this function yet
588    cc-check-functions sasl_client_done
589    define USE_SASL
590    define-feature SASL
591  } else {
592    foreach sasl_lib {sasl2 sasl} {
593      if {[check-inc-and-lib sasl [opt-val with-sasl $prefix] \
594                             sasl/sasl.h sasl_encode64 $sasl_lib]} {
595        # RHEL6 doesn't have this function yet
596        cc-check-functions sasl_client_done
597        define USE_SASL
598        break
599      }
600    }
601    if {![get-define USE_SASL]} {
602      user-error "Unable to find SASL"
603    }
604  }
605}
606
607###############################################################################
608# Unit Testing
609if {[get-define want-testing]} {
610  define ENABLE_UNIT_TESTS
611  lappend subdirs test
612}
613
614###############################################################################
615# Lua
616if {[get-define want-lua]} {
617
618  if {[get-define want-pkgconf]} {
619    if {![pkgconf false lua] && ![pkgconf false lua-5.4] && ![pkgconf false lua-5.3] && ![pkgconf false lua-5.2]} {
620      user-error "Unable to find LUA"
621    }
622    define USE_LUA
623  } else {
624    set lua_versions { 5.4 5.3 5.2 } ;# Will be checked in order
625
626    apply {{lua_prefix lua_versions} {
627      foreach ver $lua_versions {
628        lassign [split $ver .] maj min
629
630        foreach lua_suffix [list /lua${maj}${min} /lua${maj}.${min} /lua-${maj}${min} /lua-${maj}.${min} /lua {}] {
631          msg-checking "Checking for include$lua_suffix/lua.h..."
632          if {[file exists $lua_prefix/include$lua_suffix/lua.h]} {
633            msg-result "yes"
634            set libs [list lua-${maj}.${min} lua${maj}.${min} lua]
635            cc-with [list -libs "-L$lua_prefix/$::libdir_tail"] {
636              if {![cc-check-function-in-lib luaL_openlibs $libs]} {
637                continue
638              }
639            }
640            define-append CFLAGS -I$lua_prefix/include$lua_suffix
641            define-append LDFLAGS -L$lua_prefix/$::libdir_tail
642            define USE_LUA
643            return
644          }
645          msg-result "no"
646        }
647      }
648      user-error "Unable to find Lua"
649    }} [opt-val with-lua $prefix] $lua_versions
650  }
651}
652
653###############################################################################
654# Notmuch
655if {[get-define want-notmuch]} {
656  if {![check-inc-and-lib notmuch [opt-val with-notmuch $prefix] \
657                          notmuch.h notmuch_database_open notmuch]} {
658    user-error "Unable to find Notmuch"
659  }
660  define USE_NOTMUCH
661  msg-checking "Checking for Notmuch API version 3..."
662  if {[cctest -includes {notmuch.h} -libs {-lnotmuch} -link 1 \
663      -code { notmuch_database_open(NULL, 0, NULL); }]} {
664    define NOTMUCH_API_3
665    msg-result "yes"
666  } else {
667    msg-result "no"
668  }
669  cc-check-function-in-lib notmuch_database_index_file notmuch
670  cc-check-function-in-lib notmuch_database_open_with_config notmuch
671}
672
673###############################################################################
674# Native Language Support (NLS)
675if {[get-define want-nls]} {
676  if {![check-gettext [opt-val with-nls $prefix]]} {
677    user-error "Unable to find gettext. Consider --disable-nls"
678  }
679  if {![cc-check-progs msgfmt msgmerge xgettext]} {
680    user-error "Unable to find gettext tools (msgfmt, msgmerge, xgettext).\
681                Consider --disable-nls"
682  }
683}
684
685###############################################################################
686# SQLite Support
687if {[get-define want-sqlite]} {
688  if {![check-inc-and-lib sqlite [opt-val with-sqlite $prefix] \
689                          sqlite3.h sqlite3_open sqlite3]} {
690    user-error "Unable to find SQLite"
691  }
692  define USE_SQLITE
693}
694
695###############################################################################
696# zlib Support
697if {[get-define want-zlib]} {
698  if {![check-inc-and-lib zlib [opt-val with-zlib $prefix] \
699                          zlib.h deflate z]} {
700    user-error "Unable to find zlib"
701  }
702  define USE_ZLIB
703}
704
705###############################################################################
706# fmemopen(3)
707if {[get-define want-fmemopen]} {
708  if {![cc-check-functions fmemopen]} {
709    user-error "Unable to find fmemopen"
710  }
711  if {![cc-check-functions open_memstream]} {
712    user-error "Unable to find open_memstream"
713  }
714  define USE_FMEMOPEN 1
715} else {
716  define USE_FMEMOPEN 0
717}
718
719###############################################################################
720# Ncurses
721define-append CFLAGS -DNCURSES_WIDECHAR
722set ncurses_prefix [opt-val with-ncurses $prefix]
723
724cc-with [list -libs -L$ncurses_prefix/$::libdir_tail] {
725
726  set tinfo_libs   {tinfow tinfo}
727  set ncurses_libs {ncursesw ncurses curses}
728
729  # Locate the library defining tgetent()
730  # This must be done *before* checking for ncurses functions, see
731  # https://github.com/neomutt/neomutt/issues/1118
732  foreach tinfo_lib [concat $tinfo_libs $ncurses_libs] {
733    if {[cc-check-function-in-lib tgetent $tinfo_lib]} {
734      break
735    }
736  }
737
738  # Locate the library defining waddnwstr()
739  foreach ncurses_lib $ncurses_libs {
740    if {[cc-check-function-in-lib waddnwstr $ncurses_lib]} {
741      break
742    }
743  }
744
745  if {![have-feature waddnwstr] || ![have-feature tgetent]} {
746    user-error "Unable to find ncursesw library"
747  }
748}
749
750# Locate the directory containing ncurses.h
751# See https://github.com/neomutt/neomutt/pull/679
752apply {{ncurses_prefix} {
753  cc-with [list -cflags -I$ncurses_prefix/include] {
754    foreach ncurses_inc {ncursesw/ ncurses/ curses/ {}} {
755      if {[cc-check-includes ${ncurses_inc}ncurses.h] ||
756          [cc-check-includes ${ncurses_inc}curses.h]} {
757        return
758      }
759    }
760    user-error "Unable to find ncurses headers"
761  }
762}} $ncurses_prefix
763
764###############################################################################
765# Iconv - try to mimic AM_ICONV by preferring an installed libiconv
766if {![check-iconv $prefix]} {
767  user-error "Unable to find iconv()"
768}
769
770###############################################################################
771# Mailpath and homespool
772if {[get-define want-homespool]} {
773  define MAILPATH [opt-val with-homespool mailbox]
774  define HOMESPOOL 1
775} else {
776  define MAILPATH [opt-val with-mailpath /var/mail]
777}
778
779###############################################################################
780# Mixmaster
781if {[get-define want-mixmaster]} {
782  define MIXMASTER [opt-val with-mixmaster mixmaster]
783}
784
785###############################################################################
786# Domain
787if {[opt-val with-domain] ne {}} {
788  define DOMAIN [opt-val with-domain]
789}
790
791###############################################################################
792# TLS support
793if {[get-define want-ssl] && ![get-define want-gnutls]} {
794  # OpenSSL
795  if {[get-define want-pkgconf] && [pkgconf false openssl]} {
796    # cool - we do not make pkg-config mandatory for OpenSSL because BSDs still
797    # ship OpenSSL in the base system. Those aren't available through
798    # pkg-config.
799  } else {
800    set ssl_prefix [opt-val with-ssl $prefix]
801    set ssl_cflags -I$ssl_prefix/include
802    set ssl_ldflags -L$ssl_prefix/$::libdir_tail
803    cc-with [list -libs $ssl_ldflags -cflags $ssl_cflags] {
804      if {![cc-check-includes openssl/bio.h openssl/err.h openssl/ssl.h] ||
805          ![cc-check-function-in-lib X509_STORE_CTX_new crypto] ||
806          ![cc-check-function-in-lib SSL_new ssl] ||
807          ![cc-with {-includes openssl/ssl.h} {cc-check-decls SSL_set_mode}]} {
808        user-error "Unable to find OpenSSL"
809      }
810      define-append CFLAGS $ssl_cflags
811      define-append LDFLAGS $ssl_ldflags
812    }
813  }
814
815  cc-check-functions RAND_egd
816  cc-check-function-in-lib deflate z
817  define USE_SSL
818  define USE_SSL_OPENSSL
819  if {[cc-with {-includes openssl/ssl.h} {
820      cc-check-decls X509_V_FLAG_PARTIAL_CHAIN}]} {
821    define-feature SSL_PARTIAL_CHAIN
822  }
823} elseif {[get-define want-gnutls]} {
824  # GnuTLS
825  if {[get-define want-pkgconf]} {
826    pkgconf true gnutls
827  } else {
828    set gnutls_prefix [opt-val with-gnutls $prefix]
829    cc-with [list -cflags -I$gnutls_prefix/include \
830                   -libs -L$gnutls_prefix/$::libdir_tail] {
831      if {![cc-check-function-in-lib gnutls_check_version gnutls]} {
832        user-error "Unable to find GnuTLS"
833      }
834      define-append CFLAGS -I$gnutls_prefix/include
835      define-append LDFLAGS -L$gnutls_prefix/$::libdir_tail
836    }
837  }
838  cc-check-function-in-lib gnutls_priority_set_direct gnutls
839  cc-with {-includes {gnutls/x509.h gnutls/gnutls.h}} {
840    cc-check-decls GNUTLS_VERIFY_DISABLE_TIME_CHECKS
841    cc-check-types gnutls_certificate_credentials_t \
842      gnutls_certificate_status_t \
843      gnutls_datum_t \
844      gnutls_digest_algorithm_t \
845      gnutls_session_t \
846      gnutls_transport_ptr_t \
847      gnutls_x509_crt_t
848  }
849  define USE_SSL
850  define USE_SSL_GNUTLS
851}
852
853###############################################################################
854# GNU libidn
855if {[get-define want-idn] && [get-define want-idn2]} {
856  user-error "Cannot specify both --idn and --idn2"
857}
858if {[get-define want-idn]} {
859  proc find-idn1-includes {} {
860    # These are used to figure which header to include
861    if {!([cc-check-includes stringprep.h] || [cc-check-includes idn/stringprep.h]) ||
862        !([cc-check-includes idna.h] || [cc-check-includes idn/idna.h])} {
863      user-error "Unable to find GNU libidn"
864    }
865  }
866  if {[get-define want-pkgconf]} {
867    pkgconf true libidn
868    find-idn1-includes
869  } else {
870    set idn_prefix [opt-val with-idn $prefix]
871    cc-with [list -cflags -I$idn_prefix/include \
872                   -libs -L$idn_prefix/$::libdir_tail] {
873      find-idn1-includes
874      define-append CFLAGS -I$idn_prefix/include
875      define-append LDFLAGS -L$idn_prefix/$::libdir_tail
876    }
877  }
878  if {![cc-check-function-in-lib stringprep_check_version idn]} {
879    user-error "Unable to find stringprep_check_version in libidn"
880  }
881  cc-check-functions idna_to_unicode_utf8_from_utf8 idna_to_unicode_8z8z
882  cc-check-functions idna_to_ascii_from_utf8 idna_to_ascii_8z
883  cc-check-functions idna_to_ascii_lz idna_to_ascii_from_locale
884  define-feature libidn
885} elseif {[get-define want-idn2]} {
886  proc find-idn2-includes {} {
887    # These are used to figure which header to include
888    if {!([cc-check-includes idn2.h] || [cc-check-includes idn/idn2.h])} {
889      user-error "Unable to find GNU libidn2"
890    }
891  }
892  if {[get-define want-pkgconf]} {
893    pkgconf true libidn2
894    find-idn2-includes
895  } else {
896    set idn_prefix [opt-val with-idn2 $prefix]
897    cc-with [list -cflags -I$idn_prefix/include \
898                  -libs -L$idn_prefix/$::libdir_tail] {
899      find-idn2-includes
900      define-append CFLAGS -I$idn_prefix/include
901      define-append LDFLAGS -L$idn_prefix/$::libdir_tail
902    }
903  }
904  if {![cc-check-function-in-lib idn2_to_ascii_8z     idn2] ||
905      ![cc-check-function-in-lib idn2_to_unicode_8z8z idn2] ||
906      ![cc-check-function-in-lib idn2_check_version   idn2]} {
907    user-error "Unable to find required functions in GNU libidn2.\
908                Please consider using idn1 with './configure --idn'."
909  }
910  define-feature libidn
911}
912
913###############################################################################
914# PCRE2
915if {[get-define want-pcre2]} {
916  if {[get-define want-pkgconf]} {
917    pkgconf true libpcre2-8
918  } else {
919    cc-with {-cflags -DPCRE2_CODE_UNIT_WIDTH=8} {
920      if {![check-inc-and-lib pcre2 [opt-val with-pcre2 $prefix] \
921                              pcre2.h pcre2_compile_8 pcre2-8]} {
922        user-error "Unable to find PCRE2"
923      }
924    }
925  }
926  define-feature pcre2
927} elseif {[check-inc-and-lib pcre2_unwarranted {} {} pcre2_regcomp {}]} {
928  # See https://bugs.exim.org/show_bug.cgi?id=2707 and
929  # https://github.com/neomutt/neomutt/issues/2865
930  user-error "Found libpcre2-posix: please reconfigure with --pcre2"
931}
932
933###############################################################################
934# Header cache - bdb
935if {[get-define want-bdb]} {
936  set bdb_versions [opt-val with-bdb-version { 5.3 6.2 4.8 }] ;# Will be checked in order
937  set bdb_prefix [opt-val with-bdb $prefix]
938
939  foreach ver $bdb_versions {
940    lassign [split $ver .] maj min
941    # This is ugly, but it allows us to not have an inner loop
942    lappend bdb_majors   $maj $maj         $maj           $maj        $maj    $maj
943    lappend bdb_minors   $min $min         $min           $min        $min    $min
944    lappend bdb_exploded ""   db-$maj-$min db${maj}${min} db$maj.$min db-$maj db$maj
945  }
946
947  foreach maj $bdb_majors min $bdb_minors ver $bdb_exploded {
948    set ver_inc_dir $bdb_prefix/include/$ver
949    set ver_lib_dir $bdb_prefix/$::libdir_tail/$ver
950    set ver_inc_file $ver_inc_dir/db.h
951    set ver_lib_file  db-$maj.$min
952
953    # File exists?
954    msg-checking "Checking for BerkeleyDB in $ver_inc_dir..."
955    if {![file exists $ver_inc_file]} {
956      msg-result "no"
957      continue
958    }
959
960    # Version is coherent?
961    set inc_maj [get-define-value $ver_inc_file DB_VERSION_MAJOR]
962    set inc_min [get-define-value $ver_inc_file DB_VERSION_MINOR]
963    if {$inc_maj eq {}   || $inc_min eq {} ||
964        $inc_maj != $maj || $inc_min != $min} {
965      msg-result "no (expecting $maj.$min, got $inc_maj.$inc_min)"
966      continue
967    }
968    msg-result "yes"
969
970    # Can link?
971    cc-with [list -libs -L$ver_lib_dir -cflags -I$ver_inc_dir] {
972      if {![check-inc-and-lib bdb {} db.h db_env_create db-$maj.$min]} {
973        msg-result "no"
974        continue
975      }
976    }
977    define-append CFLAGS  -I$ver_inc_dir
978    define-append LDFLAGS -L$ver_lib_dir
979    define-append LIBS    -ldb-$maj.$min
980    define-append HCACHE_BACKENDS "bdb"
981    define USE_HCACHE
982    break
983  }
984
985  if {![have-feature bdb]} {
986    user-error "Unable to find BerkeleyDB"
987  }
988}
989
990###############################################################################
991# Header cache - QDBM
992# Note: qdbm must come before gdbm because they share library symbols.
993if {[get-define want-qdbm]} {
994  if {[get-define want-pkgconf]} {
995    pkgconf true qdbm
996    define-feature qdbm
997  } else {
998    # On Linux, headers are in a dedicated subdirectory
999    set qdbm_prefix [opt-val with-qdbm $prefix]
1000    if {[file isdirectory $qdbm_prefix/include/qdbm]} {
1001      set qdbm_inc_subdir qdbm/
1002    } else {
1003      set qdbm_inc_subdir ""
1004    }
1005    if {[check-inc-and-lib qdbm [opt-val with-qdbm $qdbm_prefix] \
1006                            ${qdbm_inc_subdir}villa.h vlopen qdbm]} {
1007      define-append CFLAGS -I$qdbm_prefix/include/$qdbm_inc_subdir
1008    } else {
1009      user-error "Unable to find QDBM"
1010    }
1011  }
1012  define-append HCACHE_BACKENDS "qdbm"
1013  define USE_HCACHE
1014}
1015
1016
1017###############################################################################
1018# Header Cache - GNU dbm
1019if {[get-define want-gdbm]} {
1020  if {![check-inc-and-lib gdbm [opt-val with-gdbm $prefix] \
1021                          gdbm.h gdbm_count gdbm]} {
1022    user-error "Unable to find GNU dbm"
1023  }
1024  define-append HCACHE_BACKENDS "gdbm"
1025  define USE_HCACHE
1026}
1027
1028###############################################################################
1029# Header cache - LMDB
1030if {[get-define want-lmdb]} {
1031  if {![check-inc-and-lib lmdb [opt-val with-lmdb $prefix] \
1032                          lmdb.h mdb_env_create lmdb]} {
1033    user-error "Unable to find LMDB"
1034  }
1035  define-append HCACHE_BACKENDS "lmdb"
1036  define USE_HCACHE
1037}
1038
1039###############################################################################
1040# Header cache - KyotoCabinet
1041if {[get-define want-kyotocabinet]} {
1042  if {[get-define want-pkgconf]} {
1043    pkgconf true kyotocabinet
1044    define-feature kc
1045  } else {
1046    if {![check-inc-and-lib kc [opt-val with-kyotocabinet $prefix] \
1047                            kclangc.h kcdbopen kyotocabinet]} {
1048      user-error "Unable to find KyotoCabinet"
1049    }
1050  }
1051  define-append HCACHE_BACKENDS "kyotocabinet"
1052  define USE_HCACHE
1053}
1054
1055###############################################################################
1056# Header cache - RocksDB
1057if {[get-define want-rocksdb]} {
1058  if {![check-inc-and-lib rocksdb [opt-val with-rocksdb $prefix] \
1059                          rocksdb/c.h rocksdb_open rocksdb]} {
1060    user-error "Unable to find RocksDB"
1061  }
1062  define-append HCACHE_BACKENDS "rocksdb"
1063  define USE_HCACHE
1064}
1065
1066###############################################################################
1067# Header Cache - TDB
1068if {[get-define want-tdb]} {
1069  if {[get-define want-pkgconf]} {
1070    pkgconf true tdb
1071    define-feature tdb
1072  } else {
1073    cc-with {-includes {sys/stat.h stddef.h} } {
1074      if {![check-inc-and-lib tdb [opt-val with-tdb $prefix] \
1075                              tdb.h tdb_close tdb]} {
1076        user-error "Unable to find TDB"
1077      }
1078    }
1079  }
1080  define-append HCACHE_BACKENDS "tdb"
1081  define USE_HCACHE
1082}
1083
1084###############################################################################
1085# Header Cache - TokyoCabinet
1086if {[get-define want-tokyocabinet]} {
1087  if {[get-define want-pkgconf]} {
1088    pkgconf true tokyocabinet
1089    define-feature tc
1090  } else {
1091    if {![check-inc-and-lib tc [opt-val with-tokyocabinet $prefix] \
1092                            tcbdb.h tcbdbopen tokyocabinet]} {
1093      user-error "Unable to find TokyoCabinet"
1094    }
1095  }
1096  define-append HCACHE_BACKENDS "tokyocabinet"
1097  define USE_HCACHE
1098}
1099
1100###############################################################################
1101# Header Cache Compression with LZ4
1102if {[get-define want-lz4]} {
1103  if {![check-inc-and-lib lz4 [opt-val with-lz4 $prefix] \
1104                          lz4.h LZ4_compress_default lz4]} {
1105    user-error "Unable to find LZ4"
1106  }
1107  define-append LIBS -llz4
1108  define USE_LZ4
1109  define USE_HCACHE_COMPRESSION
1110  define-append COMPRESS_BACKENDS "lz4"
1111}
1112
1113###############################################################################
1114# Header Cache Compression with zlib
1115if {[get-define want-zlib]} {
1116  if {![check-inc-and-lib zlib [opt-val with-zlib $prefix] \
1117                          zlib.h deflate z]} {
1118    user-error "Unable to find zlib"
1119  }
1120  define-append LIBS -lz
1121  define USE_ZLIB
1122  define USE_HCACHE_COMPRESSION
1123  define-append COMPRESS_BACKENDS "zlib"
1124}
1125
1126###############################################################################
1127# Header Cache Compression with Zstandard
1128if {[get-define want-zstd]} {
1129  if {![check-inc-and-lib zstd [opt-val with-zstd $prefix] \
1130                          zstd.h ZSTD_compress zstd]} {
1131    user-error "Unable to find Zstandard"
1132  }
1133  define-append LIBS -lzstd
1134  define USE_ZSTD
1135  define USE_HCACHE_COMPRESSION
1136  define-append COMPRESS_BACKENDS "zstd"
1137}
1138
1139###############################################################################
1140# GSS
1141if {[get-define want-gss]} {
1142
1143  # TODO - Use krb5-config only, which should be enough in any moderately
1144  # modern OS. If people report breakage, I'll implement the manual logic
1145  # later.
1146  set gss_prefix [opt-val with-gss $prefix]
1147  set krb5_config_guess [file join $gss_prefix bin krb5-config]
1148  if {[file-isexec $krb5_config_guess]} {
1149    define KRB5-CONFIG $krb5_config_guess
1150  } else {
1151    if {![cc-check-progs krb5-config]} {
1152      user-error "Unable to find krb5-config"
1153    }
1154  }
1155
1156  msg-checking "Checking for a GSSAPI implementation..."
1157
1158  # Cflags
1159  set krb5_config [get-define KRB5-CONFIG]
1160  if {[catch {exec-with-stderr $krb5_config --cflags gssapi} res err]} {
1161    user-error "Could not derive --cflags from $krb5_config"
1162  }
1163  define-append CFLAGS $res
1164
1165  # Libs
1166  if {[catch {exec-with-stderr $krb5_config --libs gssapi} res err]} {
1167    user-error "Could not derive --libs from $krb5_config"
1168  }
1169  define-append LDFLAGS $res
1170
1171  # Implementation
1172  if {[catch {exec-with-stderr $krb5_config --version} res err]} {
1173    user-error "Could not derive --version from $krb5_config"
1174  }
1175  switch -glob $res {
1176    "Kerberos 5 *" { set GSSAPI_IMPL "MIT" }
1177    "*eimdal*"     { set GSSAPI_IMPL "Heimdal" }
1178    "Solaris*"     { set GSSAPI_IMPL "Solaris" }
1179    default        { set GSSAPI_IMPL "Unknown" }
1180  }
1181  msg-result $GSSAPI_IMPL
1182
1183  if {$GSSAPI_IMPL in {Heimdal Solaris}} {
1184    define HAVE_HEIMDAL
1185  }
1186  define USE_GSS
1187}
1188
1189###############################################################################
1190# DEBUG options
1191
1192# Backtrace support with libunwind
1193if {[get-define want-debug-backtrace]} {
1194  if {![check-inc-and-lib libunwind [opt-val with-backtrace $prefix] \
1195                          libunwind.h unw_backtrace unwind]} {
1196    user-error "Unable to find libunwind"
1197  }
1198  define LIBS "-lunwind-generic [get-define LIBS]"
1199}
1200
1201# Email dump
1202if {[get-define want-debug-email]} {
1203  define USE_DEBUG_EMAIL 1
1204}
1205
1206# Graphviz dump
1207if {[get-define want-debug-graphviz]} {
1208  define USE_DEBUG_GRAPHVIZ 1
1209}
1210
1211# Notifications dump
1212if {[get-define want-debug-notify]} {
1213  define USE_DEBUG_NOTIFY 1
1214}
1215
1216# Parse Test
1217if {[get-define want-debug-parse-test]} {
1218  define USE_DEBUG_PARSE_TEST 1
1219}
1220
1221# Windows dump
1222if {[get-define want-debug-window]} {
1223  define USE_DEBUG_WINDOW 1
1224}
1225
1226###############################################################################
1227# Address Sanitizer
1228if {[get-define want-asan]} {
1229  msg-checking "Checking for ASAN..."
1230  if {![cctest -link 1 -cflags -fsanitize=address]} {
1231    user-error "Unable to compile with -fsanitize=address"
1232  }
1233  msg-result "yes"
1234  define-append CFLAGS -fsanitize=address -O0 -fno-omit-frame-pointer -fno-common
1235  define-append LDFLAGS -fsanitize=address
1236  define USE_ASAN
1237}
1238
1239###############################################################################
1240# Coverage Testing
1241if {[get-define want-coverage]} {
1242  define ENABLE_COVERAGE
1243  define-append CFLAGS -fprofile-arcs -ftest-coverage
1244  define-append LDFLAGS -fprofile-arcs -ftest-coverage
1245}
1246
1247###############################################################################
1248# Generate conststrings.c
1249set conststrings "\
1250  unsigned char cc_cflags\[\] = {[text2c [expr {
1251    [get-define want-include-path-in-cflags]
1252    ? [get-define CFLAGS]
1253    : [lmap x [get-define CFLAGS] {
1254        expr {[string equal -length 2 $x {-I}] ? [continue] : $x}
1255      }]
1256  }]]};\n\
1257  unsigned char configure_options\[\] = {[text2c $conf_options]};\n"
1258if {[catch {set fd [open conststrings.c w]
1259            puts $fd $conststrings
1260            close $fd} msg]} {
1261  user-error "Cannot write conststrings.c: $msg"
1262}
1263
1264###############################################################################
1265# Definitions that are going to be substituted in Makefiles and config.h
1266set auto_rep {
1267  _*
1268  *_TARGETS
1269  BINDIR
1270  BUILD_DOC
1271  CRYPT_*
1272  DOMAIN
1273  ENABLE_*
1274  HAVE_*
1275  HOMESPOOL
1276  LOCALES_HACK
1277  MAILPATH
1278  MAKEDOC_FULL
1279  MIXMASTER
1280  MUTTLOCALEDIR
1281  NOTMUCH_API_3
1282  PACKAGE
1283  PKGDATADIR
1284  PKGDOCDIR
1285  SENDMAIL
1286  SUN_ATTACHMENT
1287  SYSCONFDIR
1288  TEST_CASE_MAXSIZE
1289  TMPDIR
1290  USE_*
1291  VPATH
1292  WORDS_BIGENDIAN
1293}
1294set bare_rep {
1295  ICONV_CONST
1296  LOFF_T
1297  OFF_T_FMT
1298  SIG_ATOMIC_VOLATILE_T
1299}
1300set str_rep {
1301  PACKAGE_VERSION
1302}
1303
1304###############################################################################
1305# Use ccache - don't do it earlier than here
1306if {[get-define CCACHE] ne {none}} {
1307  define CC "[get-define CCACHE] [get-define CC]"
1308  define CC_FOR_BUILD "[get-define CCACHE] [get-define CC_FOR_BUILD]"
1309}
1310
1311###############################################################################
1312# Generate targets and Makefile variables for subdirectories
1313set vpath "\$(SRCDIR)"
1314foreach dir $subdirs {
1315  append vpath ":\$(SRCDIR)/$dir"
1316  define-append ALL_TARGETS all-$dir
1317  define-append CLEAN_TARGETS clean-$dir
1318  define-append INSTALL_TARGETS install-$dir
1319  define-append UNINSTALL_TARGETS uninstall-$dir
1320  define-append VPATH
1321}
1322define VPATH $vpath
1323
1324###############################################################################
1325# Define package timestamp (UTC) based on PACKAGE_VERSION for:
1326# docs/neomuttrc.5, docs/neomutt.1
1327define PACKAGE_DATE \
1328  [regsub {(....)(..)(..)} [get-define PACKAGE_VERSION] {\1-\2-\3}]
1329
1330###############################################################################
1331# Generate Makefile and config.h
1332define PWD [pwd]
1333make-template Makefile.autosetup Makefile
1334make-config-header config.h -auto $auto_rep -bare $bare_rep -str $str_rep
1335
1336###############################################################################
1337# Generate .clang_complete
1338define cflags-one-per-line [string map {" " "\n"} [get-define CFLAGS]]
1339make-template .clang_complete.in
1340
1341###############################################################################
1342# Print a summary
1343user-notice "Summary of build options:
1344
1345  Version:               [get-define PACKAGE_VERSION]
1346  Host OS:               [get-define host_os]
1347  Install prefix:        [get-define prefix]
1348  Compiler:              [get-define CC]
1349  CFlags:                [get-define CFLAGS]
1350  LDFlags:               [get-define LDFLAGS]
1351  Libs:                  [get-define LIBS]
1352
1353  GPGME:                 [yesno [get-define CRYPT_BACKEND_GPGME]]
1354  PGP:                   [yesno [get-define CRYPT_BACKEND_CLASSIC_PGP]]
1355  SMIME:                 [yesno [get-define CRYPT_BACKEND_CLASSIC_SMIME]]
1356  Notmuch:               [yesno [get-define USE_NOTMUCH]]
1357  Header Cache(s):       [get-define HCACHE_BACKENDS {}]
1358  Header Compression(s): [get-define COMPRESS_BACKENDS {}]
1359  Lua:                   [yesno [get-define USE_LUA]]
1360"
1361