5 # Test whether this shell is capable of parameter substring processing.
6 ( option='a/b'; : ${option#*/} ) 2>/dev/null || {
8 The shell interpreting '$0' is lacking some required features.
10 To work around this problem you may try to execute:
19 # Store original IFS value so it can be changed (and restored) in many places.
20 readonly DEFAULT_IFS="$IFS"
22 # The top-level directory for the source. This ./configure and all Makefiles
23 # are good with ${srcdir} usually being relative. Some components (e.g. tests)
24 # are executed in subdirectories and for those it is simpler to use
25 # ${NOTMUCH_SRCDIR} which holds absolute path to the source.
26 srcdir=$(dirname "$0")
27 NOTMUCH_SRCDIR=$(cd "$srcdir" && pwd)
29 case $NOTMUCH_SRCDIR in ( *\'* | *['\"`$']* )
30 echo "Definitely unsafe characters in source path '$NOTMUCH_SRCDIR'".
34 case $PWD in ( *\'* | *['\"`$']* )
35 echo "Definitely unsafe characters in current directory '$PWD'".
39 # In case of whitespace, builds may work, tests definitely will not.
40 case $NOTMUCH_SRCDIR in ( *["$IFS"]* )
41 echo "Whitespace in source path '$NOTMUCH_SRCDIR' not supported".
45 case $PWD in ( *["$IFS"]* )
46 echo "Whitespace in current directory '$PWD' not supported".
50 subdirs="util compat lib parse-time-string completion doc emacs"
51 subdirs="${subdirs} performance-test test"
52 subdirs="${subdirs} bindings"
54 # For a non-srcdir configure invocation (such as ../configure), create
55 # the directory structure and copy Makefiles.
56 if [ "$srcdir" != "." ]; then
60 for dir in . ${subdirs}; do
62 cp "$srcdir"/"$dir"/Makefile.local "$dir"
63 cp "$srcdir"/"$dir"/Makefile "$dir"
66 # Emacs only likes to generate compiled files next to the .el files
67 # by default so copy these as well (which is not ideal).
68 cp -a "$srcdir"/emacs/*.el emacs
70 # We were not able to create fully working Makefile using ruby mkmf.rb
71 # so ruby bindings source files are copied as well (ditto -- not ideal).
73 cp -a "$srcdir"/bindings/ruby/*.[ch] bindings/ruby
74 cp -a "$srcdir"/bindings/ruby/extconf.rb bindings/ruby
76 # Use the same hack to replicate python-cffi source for
77 # out-of-tree builds (again, not ideal).
78 mkdir bindings/python-cffi
79 cp -a "$srcdir"/bindings/python-cffi/tests \
80 "$srcdir"/bindings/python-cffi/notmuch2 \
81 "$srcdir"/bindings/python-cffi/setup.py \
84 NOTMUCH_BUILDDIR=$NOTMUCH_SRCDIR
87 # Set several defaults (optionally specified by the user in
88 # environment variables)
89 BASHCMD=${BASHCMD:-bash}
93 CFLAGS=${CFLAGS:--g -O2}
94 CPPFLAGS=${CPPFLAGS:-}
95 CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
96 CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
98 XAPIAN_CONFIG=${XAPIAN_CONFIG:-}
102 # We don't allow the EMACS or GZIP Makefile variables inherit values
103 # from the environment as we do with CC and CXX above. The reason is
104 # that these names as environment variables have existing uses other
105 # than the program name that we want. (EMACS is set to 't' when a
106 # shell is running within emacs and GZIP specifies arguments to pass
107 # on the gzip command line).
109 # Set the defaults for values the user can specify with command-line
127 Usage: ./configure [options]...
129 This script configures notmuch to build on your system.
131 It verifies that dependencies are available, determines flags needed
132 to compile and link against various required libraries, and identifies
133 whether various system functions can be used or if locally-provided
134 replacements will be built instead.
136 Finally, it allows you to control various aspects of the build and
137 installation process.
139 First, some common variables can specified via environment variables:
141 CC The C compiler to use
142 CFLAGS Flags to pass to the C compiler
143 CPPFLAGS Flags to pass to the C preprocessor
144 CXX The C++ compiler to use
145 CXXFLAGS Flags to pass to the C compiler
146 LDFLAGS Flags to pass when linking
148 Each of these values can further be controlled by specifying them
149 later on the "make" command line.
151 Other environment variables can be used to control configure itself,
152 (and for which there is no equivalent build-time control):
154 XAPIAN_CONFIG The program to use to determine flags for
155 compiling and linking against the Xapian
156 library. [$XAPIAN_CONFIG]
157 PYTHON Name of python command to use in
158 configure and the test suite.
159 RUBY Name of ruby command to use in
160 configure and the test suite.
162 Additionally, various options can be specified on the configure
165 --prefix=PREFIX Install files in PREFIX [$PREFIX]
167 By default, "make install" will install the resulting program to
168 $PREFIX/bin, documentation to $PREFIX/man, etc. You can
169 specify an installation prefix other than $PREFIX using
170 --prefix, for instance:
172 ./configure --prefix=\$HOME
174 Fine tuning of some installation directories is available:
176 --libdir=DIR Install libraries to DIR [PREFIX/lib]
177 --includedir=DIR Install header files to DIR [PREFIX/include]
178 --mandir=DIR Install man pages to DIR [PREFIX/share/man]
179 --infodir=DIR Install man pages to DIR [PREFIX/share/man]
180 --sysconfdir=DIR Read-only single-machine data [PREFIX/etc]
181 --emacslispdir=DIR Emacs code [PREFIX/share/emacs/site-lisp]
182 --emacsetcdir=DIR Emacs miscellaneous files [PREFIX/share/emacs/site-lisp]
183 --bashcompletiondir=DIR Bash completions files [PREFIX/share/bash-completion/completions]
184 --zshcompletiondir=DIR Zsh completions files [PREFIX/share/zsh/site-functions]
186 Some features can be disabled (--with-feature=no is equivalent to
189 --without-bash-completion Do not install bash completions files
190 --without-docs Do not install documentation
191 --without-api-docs Do not install API man page
192 --without-emacs Do not install lisp file
193 --without-desktop Do not install desktop file
194 --without-ruby Do not install ruby bindings
195 --without-zsh-completion Do not install zsh completions files
196 --without-retry-lock Do not use blocking xapian opens, even if available
198 Additional options are accepted for compatibility with other
199 configure-script calling conventions, but don't do anything yet:
201 --build=<cpu>-<vendor>-<os> Currently ignored
202 --host=<cpu>-<vendor>-<os> Currently ignored
203 --datadir=DIR Currently ignored
204 --localstatedir=DIR Currently ignored
205 --libexecdir=DIR Currently ignored
206 --disable-maintainer-mode Currently ignored
207 --disable-dependency-tracking Currently ignored
212 # Parse command-line options
214 if [ "${option}" = '--help' ] ; then
217 elif [ "${option%%=*}" = '--prefix' ] ; then
218 PREFIX="${option#*=}"
219 elif [ "${option%%=*}" = '--libdir' ] ; then
220 LIBDIR="${option#*=}"
221 elif [ "${option%%=*}" = '--includedir' ] ; then
222 INCLUDEDIR="${option#*=}"
223 elif [ "${option%%=*}" = '--mandir' ] ; then
224 MANDIR="${option#*=}"
225 elif [ "${option%%=*}" = '--infodir' ] ; then
226 INFODIR="${option#*=}"
227 elif [ "${option%%=*}" = '--sysconfdir' ] ; then
228 SYSCONFDIR="${option#*=}"
229 elif [ "${option%%=*}" = '--emacslispdir' ] ; then
230 EMACSLISPDIR="${option#*=}"
231 elif [ "${option%%=*}" = '--emacsetcdir' ] ; then
232 EMACSETCDIR="${option#*=}"
233 elif [ "${option%%=*}" = '--bashcompletiondir' ] ; then
234 BASHCOMPLETIONDIR="${option#*=}"
235 elif [ "${option%%=*}" = '--zshcompletiondir' ] ; then
236 ZSHCOMLETIONDIR="${option#*=}"
237 elif [ "${option%%=*}" = '--with-docs' ]; then
238 if [ "${option#*=}" = 'no' ]; then
244 elif [ "${option}" = '--without-docs' ] ; then
247 elif [ "${option%%=*}" = '--with-api-docs' ]; then
248 if [ "${option#*=}" = 'no' ]; then
253 elif [ "${option}" = '--without-api-docs' ] ; then
255 elif [ "${option%%=*}" = '--with-emacs' ]; then
256 if [ "${option#*=}" = 'no' ]; then
261 elif [ "${option}" = '--without-emacs' ] ; then
263 elif [ "${option%%=*}" = '--with-desktop' ]; then
264 if [ "${option#*=}" = 'no' ]; then
269 elif [ "${option}" = '--without-desktop' ] ; then
271 elif [ "${option%%=*}" = '--with-bash-completion' ]; then
272 if [ "${option#*=}" = 'no' ]; then
277 elif [ "${option}" = '--without-bash-completion' ] ; then
279 elif [ "${option%%=*}" = '--with-rpath' ]; then
280 if [ "${option#*=}" = 'no' ]; then
285 elif [ "${option}" = '--without-rpath' ] ; then
287 elif [ "${option%%=*}" = '--with-ruby' ]; then
288 if [ "${option#*=}" = 'no' ]; then
293 elif [ "${option}" = '--without-ruby' ] ; then
295 elif [ "${option%%=*}" = '--with-retry-lock' ]; then
296 if [ "${option#*=}" = 'no' ]; then
301 elif [ "${option}" = '--without-retry-lock' ] ; then
303 elif [ "${option%%=*}" = '--with-zsh-completion' ]; then
304 if [ "${option#*=}" = 'no' ]; then
309 elif [ "${option}" = '--without-zsh-completion' ] ; then
311 elif [ "${option%%=*}" = '--build' ] ; then
313 elif [ "${option%%=*}" = '--host' ] ; then
315 elif [ "${option%%=*}" = '--bindir' ] ; then
317 elif [ "${option%%=*}" = '--sbindir' ] ; then
319 elif [ "${option%%=*}" = '--datadir' ] ; then
321 elif [ "${option%%=*}" = '--localstatedir' ] ; then
323 elif [ "${option%%=*}" = '--sharedstatedir' ] ; then
325 elif [ "${option%%=*}" = '--libexecdir' ] ; then
327 elif [ "${option%%=*}" = '--exec-prefix' ] ; then
329 elif [ "${option%%=*}" = '--program-prefix' ] ; then
331 elif [ "${option}" = '--disable-maintainer-mode' ] ; then
333 elif [ "${option}" = '--disable-dependency-tracking' ] ; then
336 echo "Unrecognized option: ${option}"
344 # We set this value early, (rather than just while printing the
345 # Makefile.config file later like most values), because we need to
346 # actually investigate this value compared to the ldconfig_paths value
348 if [ -z "$LIBDIR" ] ; then
349 libdir_expanded="${PREFIX}/lib"
351 # very non-general variable expansion
352 libdir_expanded=$(printf %s "$LIBDIR" | sed "s|\${prefix}|${PREFIX}|; s|\$prefix\>|${PREFIX}|; s|//*|/|g")
356 Welcome to Notmuch, a system for indexing, searching and tagging your email.
358 We hope that the process of building and installing notmuch is quick
359 and smooth so that you can soon be reading and processing your email
360 more efficiently than ever.
362 If anything goes wrong in the configure process, you can override any
363 decisions it makes by manually editing the Makefile.config file that
364 it creates. Also please do as much as you can to figure out what could
365 be different on your machine compared to those of the notmuch
366 developers. Then, please email those details to the Notmuch list
367 (notmuch@notmuchmail.org) so that we can hopefully make future
368 versions of notmuch easier for you to use.
370 We'll now investigate your system to verify that all required
371 dependencies are available:
376 printf "int main(void){return 0;}\n" > minimal.c
378 printf "Sanity checking C compilation environment... "
379 test_cmdline="${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal"
380 if ${test_cmdline} > /dev/null 2>&1
385 errors=$((errors + 1))
386 printf Executed:; printf ' %s' ${test_cmdline}; echo
390 printf "Sanity checking C++ compilation environment... "
391 test_cmdline="${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal"
392 if ${test_cmdline} > /dev/null 2>&1
397 errors=$((errors + 1))
398 printf Executed:; printf ' %s' ${test_cmdline}; echo
403 if [ $errors -gt 0 ]; then
405 *** Error: Initial sanity checking of environment failed. Please try
406 running configure in a clean environment, and if the problem persists,
409 rm -f minimal minimal.c
413 printf "C compiler supports address sanitizer... "
414 test_cmdline="${CC} ${CFLAGS} ${CPPFLAGS} -fsanitize=address minimal.c ${LDFLAGS} -o minimal"
415 if ${test_cmdline} >/dev/null 2>&1 && ./minimal
420 printf "Nope, skipping those tests.\n"
425 printf "Reading libnotmuch version from source... "
426 cat > _libversion.c <<EOF
428 #include "lib/notmuch.h"
430 printf("libnotmuch_version_major=%d\n",
431 LIBNOTMUCH_MAJOR_VERSION);
432 printf("libnotmuch_version_minor=%d\n",
433 LIBNOTMUCH_MINOR_VERSION);
434 printf("libnotmuch_version_release=%d\n",
435 LIBNOTMUCH_MICRO_VERSION);
439 if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
440 && ./_libversion > _libversion.sh && . ./_libversion.sh
446 *** Error: Reading lib/notmuch.h failed.
447 Please try running configure again in a clean environment, and if the
448 problem persists, report a bug.
450 rm -f _libversion _libversion.c _libversion.sh
454 if pkg-config --version > /dev/null 2>&1; then
462 printf "Checking for Xapian development files (>= 1.4.0)... "
464 for xapian_config in ${XAPIAN_CONFIG} xapian-config; do
465 if ${xapian_config} --version > /dev/null 2>&1; then
466 xapian_version=$(${xapian_config} --version | sed -e 's/.* //')
467 case $xapian_version in
468 1.[4-9]* | 1.[1-9][0-9]* | [2-9]* | [1-9][0-9]*)
469 printf "Yes (%s).\n" ${xapian_version}
471 xapian_cxxflags=$(${xapian_config} --cxxflags)
472 xapian_ldflags=$(${xapian_config} --libs)
474 *) printf "Xapian $xapian_version not supported... "
479 if [ ${have_xapian} = "0" ]; then
481 errors=$((errors + 1))
486 printf "Checking for GMime development files (>= $GMIME_MINVER)... "
487 if pkg-config --exists "gmime-3.0 >= $GMIME_MINVER"; then
490 gmime_cflags=$(pkg-config --cflags gmime-3.0)
491 gmime_ldflags=$(pkg-config --libs gmime-3.0)
493 printf "Checking for GMime session key extraction support... "
495 cat > _check_session_keys.c <<EOF
496 #include <gmime/gmime.h>
500 GError *error = NULL;
501 GMimeParser *parser = NULL;
502 GMimeMultipartEncrypted *body = NULL;
503 GMimeDecryptResult *decrypt_result = NULL;
504 GMimeObject *output = NULL;
507 parser = g_mime_parser_new ();
508 g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/crypto/basic-encrypted.eml", "r", &error));
509 if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/crypto/basic-encrypted.eml\n");
511 body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL)));
512 if (body == NULL) return !! fprintf (stderr, "did not find a multipart encrypted message\n");
514 output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_EXPORT_SESSION_KEY, NULL, &decrypt_result, &error);
515 if (error || output == NULL) return !! fprintf (stderr, "decryption failed\n");
517 if (decrypt_result == NULL) return !! fprintf (stderr, "no GMimeDecryptResult found\n");
518 if (decrypt_result->session_key == NULL) return !! fprintf (stderr, "GMimeDecryptResult has no session key\n");
520 printf ("%s\n", decrypt_result->session_key);
524 if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then
525 printf 'No.\nCould not make tempdir for testing session-key support.\n'
526 errors=$((errors + 1))
527 elif ${CC} ${CFLAGS} ${gmime_cflags} _check_session_keys.c ${gmime_ldflags} -o _check_session_keys \
528 && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < "$srcdir"/test/gnupg-secret-key.asc \
529 && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \
530 && [ $SESSION_KEY = 9:0BACD64099D1468AB07C796F0C0AC4851948A658A15B34E803865E9FC635F2F5 ]
536 *** Error: Could not extract session keys from encrypted message.
538 This is likely due to your GMime having been built against a old
541 Please try to rebuild your version of GMime against a more recent
542 version of GPGME (at least GPGME 1.8.0).
544 if command -v gpgme-config >/dev/null; then
545 printf 'Your current GPGME development version is: %s\n' "$(gpgme-config --version)"
547 printf 'You do not have the GPGME development libraries installed.\n'
549 errors=$((errors + 1))
551 if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then
555 cat > _check_gmime_cert.c <<EOF
557 #include <gmime/gmime.h>
560 GError *error = NULL;
561 GMimeParser *parser = NULL;
562 GMimeApplicationPkcs7Mime *body = NULL;
563 GMimeSignatureList *sig_list = NULL;
564 GMimeSignature *sig = NULL;
565 GMimeCertificate *cert = NULL;
566 GMimeObject *output = NULL;
570 parser = g_mime_parser_new ();
571 g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/pkcs7/smime-onepart-signed.eml", "r", &error));
572 if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/pkcs7/smime-onepart-signed.eml\n");
574 body = GMIME_APPLICATION_PKCS7_MIME(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL)));
575 if (body == NULL) return !! fprintf (stderr, "did not find a application/pkcs7 message\n");
577 sig_list = g_mime_application_pkcs7_mime_verify (body, GMIME_VERIFY_NONE, &output, &error);
578 if (error || output == NULL) return !! fprintf (stderr, "verify failed\n");
580 if (sig_list == NULL) return !! fprintf (stderr, "no GMimeSignatureList found\n");
581 len = g_mime_signature_list_length (sig_list);
582 if (len != 1) return !! fprintf (stderr, "expected 1 signature, got %d\n", len);
583 sig = g_mime_signature_list_get_signature (sig_list, 0);
584 if (sig == NULL) return !! fprintf (stderr, "no GMimeSignature found at position 0\n");
585 cert = g_mime_signature_get_certificate (sig);
586 if (cert == NULL) return !! fprintf (stderr, "no GMimeCertificate found\n");
587 #ifdef CHECK_VALIDITY
588 GMimeValidity validity = g_mime_certificate_get_id_validity (cert);
589 if (validity != GMIME_VALIDITY_FULL) return !! fprintf (stderr, "Got validity %d, expected %d\n", validity, GMIME_VALIDITY_FULL);
592 const char *email = g_mime_certificate_get_email (cert);
593 if (! email) return !! fprintf (stderr, "no email returned");
594 if (email[0] == '<') return 2;
600 # see https://github.com/jstedfast/gmime/pull/90
601 # should be fixed in GMime in 3.2.7, but some distros might patch
602 printf "Checking for GMime X.509 certificate validity... "
604 if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then
605 printf 'No.\nCould not make tempdir for testing X.509 certificate validity support.\n'
606 errors=$((errors + 1))
607 elif ${CC} -DCHECK_VALIDITY ${CFLAGS} ${gmime_cflags} _check_gmime_cert.c ${gmime_ldflags} -o _check_x509_validity \
608 && echo disable-crl-checks > "$TEMP_GPG/gpgsm.conf" \
609 && echo "4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> "$TEMP_GPG/trustlist.txt" \
610 && GNUPGHOME=${TEMP_GPG} gpgsm --batch --quiet --import < "$srcdir"/test/smime/ca.crt
612 if GNUPGHOME=${TEMP_GPG} ./_check_x509_validity; then
613 gmime_x509_cert_validity=1
616 gmime_x509_cert_validity=0
618 if pkg-config --exists "gmime-3.0 >= 3.2.7"; then
620 *** Error: GMime fails to calculate X.509 certificate validity, and
621 is later than 3.2.7, which should have fixed this issue.
623 Please follow up on https://github.com/jstedfast/gmime/pull/90 with
626 errors=$((errors + 1))
629 printf "Checking whether GMime emits email addresses with angle brackets... "
630 if ${CC} -DCHECK_EMAIL ${CFLAGS} ${gmime_cflags} _check_gmime_cert.c ${gmime_ldflags} -o _check_email &&
631 GNUPGHOME=${TEMP_GPG} ./_check_email; then
632 gmime_emits_angle_brackets=0
635 gmime_emits_angle_brackets=1
639 printf 'No.\nFailed to set up gpgsm for testing X.509 certificate validity support.\n'
640 errors=$((errors + 1))
642 if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then
646 # see https://dev.gnupg.org/T3464
647 # there are problems verifying signatures when decrypting with session keys with GPGME 1.13.0 and 1.13.1
648 printf "Checking signature verification when decrypting using session keys... "
650 cat > _verify_sig_with_session_key.c <<EOF
652 #include <gmime/gmime.h>
655 GError *error = NULL;
656 GMimeParser *parser = NULL;
657 GMimeMultipartEncrypted *body = NULL;
658 GMimeDecryptResult *result = NULL;
659 GMimeSignatureList *sig_list = NULL;
660 GMimeSignature *sig = NULL;
661 GMimeObject *output = NULL;
662 GMimeSignatureStatus status;
666 parser = g_mime_parser_new ();
667 g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/crypto/encrypted-signed.eml", "r", &error));
668 if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/pkcs7/smime-onepart-signed.eml\n");
670 body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL)));
671 if (body == NULL) return !! fprintf (stderr, "did not find a multipart/encrypted message\n");
673 output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_NONE, "9:13607E4217515A70EC8DF9DBC16C5327B94577561D98AD1246FA8756659C7899", &result, &error);
674 if (error || output == NULL) return !! fprintf (stderr, "decrypt failed\n");
676 sig_list = g_mime_decrypt_result_get_signatures (result);
677 if (sig_list == NULL) return !! fprintf (stderr, "sig_list is NULL\n");
679 if (sig_list == NULL) return !! fprintf (stderr, "no GMimeSignatureList found\n");
680 len = g_mime_signature_list_length (sig_list);
681 if (len != 1) return !! fprintf (stderr, "expected 1 signature, got %d\n", len);
682 sig = g_mime_signature_list_get_signature (sig_list, 0);
683 if (sig == NULL) return !! fprintf (stderr, "no GMimeSignature found at position 0\n");
684 status = g_mime_signature_get_status (sig);
685 if (status & GMIME_SIGNATURE_STATUS_KEY_MISSING) return !! fprintf (stderr, "signature status contains KEY_MISSING (see https://dev.gnupg.org/T3464)\n");
690 if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then
691 printf 'No.\nCould not make tempdir for testing signature verification when decrypting with session keys.\n'
692 errors=$((errors + 1))
693 elif ${CC} ${CFLAGS} ${gmime_cflags} _verify_sig_with_session_key.c ${gmime_ldflags} -o _verify_sig_with_session_key \
694 && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < "$srcdir"/test/gnupg-secret-key.asc \
695 && rm -f ${TEMP_GPG}/private-keys-v1.d/*.key
697 if GNUPGHOME=${TEMP_GPG} ./_verify_sig_with_session_key; then
698 gmime_verify_with_session_key=1
701 gmime_verify_with_session_key=0
704 *** Error: GMime fails to verify signatures when decrypting with a session key.
706 This is most likely due to a buggy version of GPGME, which should be fixed in 1.13.2 or later.
707 See https://dev.gnupg.org/T3464 for more details.
711 printf 'No.\nFailed to set up gpg for testing signature verification while decrypting with a session key.\n'
712 errors=$((errors + 1))
714 if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then
720 errors=$((errors + 1))
723 # GMime already depends on Glib >= 2.12, but we use at least one Glib
724 # function that only exists as of 2.22, (g_array_unref)
725 printf "Checking for Glib development files (>= 2.22)... "
727 if pkg-config --exists 'glib-2.0 >= 2.22'; then
730 # these are included in gmime cflags and ldflags
731 # glib_cflags=$(pkg-config --cflags glib-2.0)
732 # glib_ldflags=$(pkg-config --libs glib-2.0)
735 errors=$((errors + 1))
738 if ! pkg-config --exists zlib; then
739 ${CC} -o compat/gen_zlib_pc "$srcdir"/compat/gen_zlib_pc.c >/dev/null 2>&1 &&
740 compat/gen_zlib_pc > compat/zlib.pc &&
741 PKG_CONFIG_PATH=${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}compat &&
742 export PKG_CONFIG_PATH
743 rm -f compat/gen_zlib_pc
746 printf "Checking for zlib (>= 1.2.5.2)... "
748 if pkg-config --atleast-version=1.2.5.2 zlib; then
751 zlib_cflags=$(pkg-config --cflags zlib)
752 zlib_ldflags=$(pkg-config --libs zlib)
755 errors=$((errors + 1))
758 printf "Checking for talloc development files... "
759 if pkg-config --exists talloc; then
762 talloc_cflags=$(pkg-config --cflags talloc)
763 talloc_ldflags=$(pkg-config --libs talloc)
768 errors=$((errors + 1))
771 printf "Checking for bash... "
772 if command -v ${BASHCMD} > /dev/null; then
774 bash_absolute=$(command -v ${BASHCMD})
775 printf "Yes (%s).\n" "$bash_absolute"
779 printf "No. (%s not found)\n" "${BASHCMD}"
782 printf "Checking for perl... "
783 if command -v ${PERL} > /dev/null; then
785 perl_absolute=$(command -v ${PERL})
786 printf "Yes (%s).\n" "$perl_absolute"
790 printf "No. (%s not found)\n" "${PERL}"
793 printf "Checking for python... "
796 for name in ${PYTHON} python3 python python2; do
797 if command -v $name > /dev/null; then
800 printf "Yes (%s).\n" "$name"
805 if [ $have_python -eq 0 ]; then
807 errors=$((errors + 1))
811 if [ $have_python -eq 1 ]; then
812 printf "Checking for python3 (>= 3.5)..."
813 if "$python" -c 'import sys, sysconfig; assert sys.version_info >= (3,5)'; >/dev/null 2>&1; then
817 printf "No (will not install CFFI-based python bindings).\n"
822 if [ $have_python3 -eq 1 ]; then
823 printf "Checking for python3 version ..."
824 python3_version=$("$python" -c 'import sysconfig; print(sysconfig.get_python_version());')
825 printf "(%s)\n" $python3_version
827 printf "Checking for python $python3_version development files..."
828 if pkg-config --exists "python-$python3_version"; then
833 printf "No (will not install CFFI-based python bindings).\n"
838 have_python3_pytest=0
839 if [ $have_python3_dev -eq 1 ]; then
840 printf "Checking for python3 cffi and setuptools... "
841 if "$python" -c 'import cffi,setuptools; cffi.FFI().verify()' >/dev/null 2>&1; then
847 printf "No (will not install CFFI-based python bindings).\n"
849 rm -rf __pycache__ # cffi.FFI().verify() uses this space
851 printf "Checking for python3 pytest (>= 3.0)... "
853 printf "[pytest]\nminversion=3.0\n" > $conf
854 if "$python" -m pytest -c $conf --version >/dev/null 2>&1; then
856 have_python3_pytest=1
858 printf "No (will not test CFFI-based python bindings).\n"
863 printf "Checking for valgrind development files... "
864 if pkg-config --exists valgrind; then
867 valgrind_cflags=$(pkg-config --cflags valgrind)
869 printf "No (but that's fine).\n"
874 printf "Checking for bash-completion (>= 1.90)... "
875 if pkg-config --atleast-version=1.90 bash-completion; then
878 printf "No (will not install bash completion).\n"
882 printf "Checking for sfsexp... "
883 if pkg-config --exists sfsexp; then
886 sfsexp_cflags=$(pkg-config --cflags sfsexp)
887 sfsexp_ldflags=$(pkg-config --libs sfsexp)
889 printf "No (will not enable s-expression queries).\n"
895 if [ -z "${EMACSLISPDIR-}" ]; then
896 EMACSLISPDIR="\$(prefix)/share/emacs/site-lisp"
899 if [ -z "${EMACSETCDIR-}" ]; then
900 EMACSETCDIR="\$(prefix)/share/emacs/site-lisp"
903 if [ $WITH_EMACS = "1" ]; then
904 printf "Checking if emacs (>= 25) is available... "
905 if emacs --quick --batch --eval '(if (< emacs-major-version 25) (kill-emacs 1))' > /dev/null 2>&1; then
908 printf "No (disabling emacs related parts of build)\n"
914 if [ $WITH_API_DOCS = "1" ] ; then
915 printf "Checking if doxygen is available... "
916 if command -v doxygen > /dev/null; then
920 printf "No (so will not install api docs)\n"
925 if [ $WITH_RUBY = "1" ] ; then
926 printf "Checking for ruby development files... "
927 if ${RUBY} -e "require 'mkmf'"> /dev/null 2>&1; then
931 printf "No (skipping ruby bindings)\n"
938 if [ $WITH_DOCS = "1" ] ; then
939 printf "Checking if sphinx is available and supports nroff output... "
940 if command -v sphinx-build > /dev/null && ${python} -m sphinx.writers.manpage > /dev/null 2>&1 ; then
944 printf "No (so will not install man pages).\n"
946 printf "Checking if makeinfo is available... "
947 if command -v makeinfo > /dev/null; then
951 printf "No (so will not build info pages).\n"
953 printf "Checking if install-info is available... "
954 if command -v install-info > /dev/null; then
958 printf "No (so will not install info pages).\n"
962 if [ $WITH_DESKTOP = "1" ]; then
963 printf "Checking if desktop-file-install is available... "
964 if command -v desktop-file-install > /dev/null; then
967 printf "No (so will not install .desktop file).\n"
972 printf "Checking for cppcheck... "
973 if command -v cppcheck > /dev/null; then
983 printf "Checking which platform we are on... "
985 if [ $uname = "Darwin" ] ; then
988 linker_resolves_library_dependencies=0
989 elif [ $uname = "SunOS" ] ; then
992 linker_resolves_library_dependencies=0
993 elif [ $uname = "FreeBSD" ] ; then
996 linker_resolves_library_dependencies=0
997 elif [ $uname = "OpenBSD" ] ; then
1000 linker_resolves_library_dependencies=0
1001 elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
1002 printf "%s\n" "$uname"
1004 linker_resolves_library_dependencies=1
1006 printf "Checking for %s in ldconfig... " "$libdir_expanded"
1007 ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
1008 # Separate ldconfig_paths only on newline (not on any potential
1009 # embedded space characters in any filenames). Note, we use a
1010 # literal newline in the source here rather than something like:
1012 # IFS=$(printf '\n')
1014 # because the shell's command substitution deletes any trailing newlines.
1017 for path in $ldconfig_paths; do
1018 if [ "$path" -ef "$libdir_expanded" ]; then
1019 libdir_in_ldconfig=1
1023 if [ "$libdir_in_ldconfig" = '0' ]; then
1024 printf "No (will set RPATH)\n"
1031 linker_resolves_library_dependencies=0
1034 *** Warning: Unknown platform. Notmuch might or might not build correctly.
1039 if [ $errors -gt 0 ]; then
1042 *** Error: The dependencies of notmuch could not be satisfied. You will
1043 need to install the following packages before being able to compile
1047 if [ $have_python -eq 0 ]; then
1048 echo " python interpreter"
1050 if [ $have_xapian -eq 0 ]; then
1051 echo " Xapian library (>= version 1.4.0, including development files such as headers)"
1052 echo " https://xapian.org/"
1054 if [ $have_zlib -eq 0 ]; then
1055 echo " zlib library (>= version 1.2.5.2, including development files such as headers)"
1056 echo " https://zlib.net/"
1059 if [ $have_gmime -eq 0 ]; then
1060 echo " GMime library >= $GMIME_MINVER"
1061 echo " (including development files such as headers)"
1062 echo " https://github.com/jstedfast/gmime/"
1065 if [ $have_glib -eq 0 ]; then
1066 echo " Glib library >= 2.22 (including development files such as headers)"
1067 echo " https://ftp.gnome.org/pub/gnome/sources/glib/"
1070 if [ $have_talloc -eq 0 ]; then
1071 echo " The talloc library (including development files such as headers)"
1072 echo " https://talloc.samba.org/"
1076 With any luck, you're using a modern, package-based operating system
1077 that has all of these packages available in the distribution. In that
1078 case a simple command will install everything you need. For example:
1080 On Debian and similar systems:
1082 sudo apt-get install libxapian-dev libgmime-3.0-dev libtalloc-dev zlib1g-dev
1084 Or on Fedora and similar systems:
1086 sudo dnf install xapian-core-devel gmime30-devel libtalloc-devel zlib-devel
1088 On other systems, similar commands can be used, but the details of the
1089 package names may be different.
1092 if [ $have_pkg_config -eq 0 ]; then
1094 Note: the pkg-config program is not available. This configure script
1095 uses pkg-config to find the compilation flags required to link against
1096 the various libraries needed by notmuch. It's possible you simply need
1097 to install pkg-config with a command such as:
1099 sudo apt-get install pkg-config
1101 sudo dnf install pkgconfig
1103 But if pkg-config is not available for your system, then you will need
1104 to modify the configure script to manually set the cflags and ldflags
1105 variables to the correct values to link against each library in each
1106 case that pkg-config could not be used to determine those values.
1111 When you have installed the necessary dependencies, you can run
1112 configure again to ensure the packages can be found, or simply run
1113 "make" to compile notmuch.
1119 printf "Checking for canonicalize_file_name... "
1120 if ${CC} -o compat/have_canonicalize_file_name "$srcdir"/compat/have_canonicalize_file_name.c > /dev/null 2>&1
1123 have_canonicalize_file_name=1
1125 printf "No (will use our own instead).\n"
1126 have_canonicalize_file_name=0
1128 rm -f compat/have_canonicalize_file_name
1131 printf "Checking for getline... "
1132 if ${CC} -o compat/have_getline "$srcdir"/compat/have_getline.c > /dev/null 2>&1
1137 printf "No (will use our own instead).\n"
1140 rm -f compat/have_getline
1142 printf "Checking for strcasestr... "
1143 if ${CC} -o compat/have_strcasestr "$srcdir"/compat/have_strcasestr.c > /dev/null 2>&1
1148 printf "No (will use our own instead).\n"
1151 rm -f compat/have_strcasestr
1153 printf "Checking for strsep... "
1154 if ${CC} -o compat/have_strsep "$srcdir"/compat/have_strsep.c > /dev/null 2>&1
1159 printf "No (will use our own instead).\n"
1162 rm -f compat/have_strsep
1164 printf "Checking for timegm... "
1165 if ${CC} -o compat/have_timegm "$srcdir"/compat/have_timegm.c > /dev/null 2>&1
1170 printf "No (will use our own instead).\n"
1173 rm -f compat/have_timegm
1175 cat <<EOF > _time_t.c
1178 static_assert(sizeof(time_t) >= 8, "sizeof(time_t) < 8");
1181 printf "Checking for 64 bit time_t... "
1182 if ${CC} -c _time_t.c -o /dev/null
1191 printf "Checking for dirent.d_type... "
1192 if ${CC} -o compat/have_d_type "$srcdir"/compat/have_d_type.c > /dev/null 2>&1
1197 printf "No (will use stat instead).\n"
1200 rm -f compat/have_d_type
1202 printf "Checking for standard version of getpwuid_r... "
1203 if ${CC} -o compat/check_getpwuid "$srcdir"/compat/check_getpwuid.c > /dev/null 2>&1
1208 printf "No (will define _POSIX_PTHREAD_SEMANTICS to get it).\n"
1211 rm -f compat/check_getpwuid
1213 printf "Checking for standard version of asctime_r... "
1214 if ${CC} -o compat/check_asctime "$srcdir"/compat/check_asctime.c > /dev/null 2>&1
1219 printf "No (will define _POSIX_PTHREAD_SEMANTICS to get it).\n"
1222 rm -f compat/check_asctime
1224 printf "Checking for rpath support... "
1225 if [ $WITH_RPATH = "1" ] && ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1
1228 rpath_ldflags="-Wl,--enable-new-dtags -Wl,-rpath,\$(libdir)"
1230 printf "No (nothing to worry about).\n"
1234 printf "Checking for -Wl,--as-needed... "
1235 if ${CC} -Wl,--as-needed -o minimal minimal.c >/dev/null 2>&1
1238 as_needed_ldflags="-Wl,--as-needed"
1240 printf "No (nothing to worry about).\n"
1241 as_needed_ldflags=""
1244 printf "Checking for -Wl,--no-undefined... "
1245 if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1
1248 no_undefined_ldflags="-Wl,--no-undefined"
1250 printf "No (nothing to worry about).\n"
1251 no_undefined_ldflags=""
1255 printf "Checking for available C++ compiler warning flags... "
1256 for flag in -Wall -Wextra -Wwrite-strings; do
1257 if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1
1259 WARN_CXXFLAGS="${WARN_CXXFLAGS}${WARN_CXXFLAGS:+ }${flag}"
1262 printf "\n\t%s\n" "${WARN_CXXFLAGS}"
1264 WARN_CFLAGS="${WARN_CXXFLAGS}"
1265 printf "Checking for available C compiler warning flags... "
1266 for flag in -Wmissing-declarations; do
1267 if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1
1269 WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}"
1272 printf "\n\t%s\n" "${WARN_CFLAGS}"
1274 rm -f minimal minimal.c _time_t.c _libversion.c _libversion _libversion.sh _check_session_keys.c _check_session_keys _check_gmime_cert.c _check_x509_validity _check_email \
1275 _verify_sig_with_session_key.c _verify_sig_with_session_key
1277 # construct the Makefile.config
1278 cat > Makefile.config <<EOF
1279 # This Makefile.config was automatically generated by the ./configure
1280 # script of notmuch. If the configure script identified anything
1281 # incorrectly, then you can edit this file to try to correct things,
1282 # but be warned that if configure is run again it will destroy your
1283 # changes, (and this could happen by simply calling "make" if the
1284 # configure script is updated).
1286 # The top-level directory for the source, (the directory containing
1287 # the configure script). This may be different than the build
1288 # directory (the current directory at the time configure was run).
1290 NOTMUCH_SRCDIR = ${NOTMUCH_SRCDIR}
1291 NOTMUCH_BUILDDIR = ${NOTMUCH_BUILDDIR}
1293 # subdirectories to build
1294 subdirs = ${subdirs}
1296 configure_options = $@
1298 # We use vpath directives (rather than the VPATH variable) since the
1299 # VPATH variable matches targets as well as prerequisites, (which is
1300 # not useful since then a target left-over from a srcdir build would
1301 # cause a target to not be built in the non-srcdir build).
1303 # Also, we don't use a single "vpath % \$(srcdir)" here because we
1304 # don't want the vpath to trigger for our emacs lisp compilation,
1305 # (unless we first find a way to convince emacs to build the .elc
1306 # target in a directory other than the directory of the .el
1307 # prerequisite). In the meantime, we're actually copying in the .el
1308 # files, (which is quite ugly).
1309 vpath %.c \$(srcdir)
1310 vpath %.cc \$(srcdir)
1311 vpath Makefile.% \$(srcdir)
1312 vpath %.py \$(srcdir)
1313 vpath %.rst \$(srcdir)
1315 # Library versions (used to make SONAME)
1316 # The major version of the library interface. This will control the soname.
1317 # As such, this number must be incremented for any incompatible change to
1318 # the library interface, (such as the deletion of an API or a major
1319 # semantic change that breaks formerly functioning code).
1321 LIBNOTMUCH_VERSION_MAJOR = ${libnotmuch_version_major}
1323 # The minor version of the library interface. This should be incremented at
1324 # the time of release for any additions to the library interface,
1325 # (and when it is incremented, the release version of the library should
1327 LIBNOTMUCH_VERSION_MINOR = ${libnotmuch_version_minor}
1329 # The release version the library interface. This should be incremented at
1330 # the time of release if there have been no changes to the interface, (but
1331 # simply compatible changes to the implementation).
1332 LIBNOTMUCH_VERSION_RELEASE = ${libnotmuch_version_release}
1334 # These are derived from the VERSION macros in lib/notmuch.h so
1335 # if you have to change them, something is wrong.
1337 # The C compiler to use
1340 # The C++ compiler to use
1343 # Command to execute emacs from Makefiles
1344 EMACS = emacs --quick
1346 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
1349 # Default FLAGS for C preprocessor (can be overridden by user such as "make CPPFLAGS=-I/usr/local/include")
1350 CPPFLAGS = ${CPPFLAGS}
1352 # Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
1353 CXXFLAGS = ${CXXFLAGS}
1355 # Default FLAGS for the linker (can be overridden by user such as "make LDFLAGS=-znow")
1356 LDFLAGS = ${LDFLAGS}
1358 # Flags to enable warnings when using the C++ compiler
1359 WARN_CXXFLAGS=${WARN_CXXFLAGS}
1361 # Flags to enable warnings when using the C compiler
1362 WARN_CFLAGS=${WARN_CFLAGS}
1364 # Name of python interpreter
1367 # Name of ruby interpreter
1370 # The prefix to which notmuch should be installed
1371 # Note: If you change this value here, be sure to ensure that the
1372 # LIBDIR_IN_LDCONFIG value below is still set correctly.
1375 # The directory to which libraries should be installed
1376 # Note: If you change this value here, be sure to ensure that the
1377 # LIBDIR_IN_LDCONFIG value below is still set correctly.
1378 libdir = ${LIBDIR:=\$(prefix)/lib}
1380 # Whether libdir is in a path configured into ldconfig
1381 LIBDIR_IN_LDCONFIG = ${libdir_in_ldconfig}
1383 # The directory to which header files should be installed
1384 includedir = ${INCLUDEDIR:=\$(prefix)/include}
1386 # The directory to which man pages should be installed
1387 mandir = ${MANDIR:=\$(prefix)/share/man}
1389 # The directory to which man pages should be installed
1390 infodir = ${INFODIR:=\$(prefix)/share/info}
1392 # The directory to which read-only (configuration) files should be installed
1393 sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc}
1395 # The directory to which emacs lisp files should be installed
1396 emacslispdir=${EMACSLISPDIR}
1398 # The directory to which emacs miscellaneous (machine-independent) files should
1400 emacsetcdir=${EMACSETCDIR}
1402 # Whether bash exists, and if so where
1403 HAVE_BASH = ${have_bash}
1404 BASH_ABSOLUTE = ${bash_absolute}
1406 # Whether perl exists, and if so where
1407 HAVE_PERL = ${have_perl}
1408 PERL_ABSOLUTE = ${perl_absolute}
1410 # Whether there's a sphinx-build binary available for building documentation
1411 HAVE_SPHINX=${have_sphinx}
1413 # Whether there's a makeinfo binary available for building info format documentation
1414 HAVE_MAKEINFO=${have_makeinfo}
1416 # Whether there's an install-info binary available for installing info format documentation
1417 HAVE_INSTALL_INFO=${have_install_info}
1419 # Whether there's a doxygen binary available for building api documentation
1420 HAVE_DOXYGEN=${have_doxygen}
1422 # The directory to which desktop files should be installed
1423 desktop_dir = \$(prefix)/share/applications
1425 # The directory to which bash completions files should be installed
1426 bash_completion_dir = ${BASHCOMPLETIONDIR:=\$(prefix)/share/bash-completion/completions}
1428 # The directory to which zsh completions files should be installed
1429 zsh_completion_dir = ${ZSHCOMLETIONDIR:=\$(prefix)/share/zsh/site-functions}
1431 # Whether the canonicalize_file_name function is available (if not, then notmuch will
1432 # build its own version)
1433 HAVE_CANONICALIZE_FILE_NAME = ${have_canonicalize_file_name}
1435 # Whether the cppcheck static checker is available
1436 HAVE_CPPCHECK = ${have_cppcheck}
1438 # Whether the getline function is available (if not, then notmuch will
1439 # build its own version)
1440 HAVE_GETLINE = ${have_getline}
1442 # Are the ruby development files (and ruby) available? If not skip
1443 # building/testing ruby bindings.
1444 HAVE_RUBY_DEV = ${have_ruby_dev}
1446 # Is the python cffi package available?
1447 HAVE_PYTHON3_CFFI = ${have_python3_cffi}
1449 # Is the python pytest package available?
1450 HAVE_PYTHON3_PYTEST = ${have_python3_pytest}
1452 # Whether the strcasestr function is available (if not, then notmuch will
1453 # build its own version)
1454 HAVE_STRCASESTR = ${have_strcasestr}
1456 # Whether the strsep function is available (if not, then notmuch will
1457 # build its own version)
1458 HAVE_STRSEP = ${have_strsep}
1460 # Whether the timegm function is available (if not, then notmuch will
1461 # build its own version)
1462 HAVE_TIMEGM = ${have_timegm}
1464 # Whether struct dirent has d_type (if not, then notmuch will use stat)
1465 HAVE_D_TYPE = ${have_d_type}
1467 # Whether to have Xapian retry lock
1468 HAVE_XAPIAN_DB_RETRY_LOCK = ${WITH_RETRY_LOCK}
1470 # Whether the getpwuid_r function is standards-compliant
1471 # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS
1472 # to enable the standards-compliant version -- needed for Solaris)
1473 STD_GETPWUID = ${std_getpwuid}
1475 # Whether the asctime_r function is standards-compliant
1476 # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS
1477 # to enable the standards-compliant version -- needed for Solaris)
1478 STD_ASCTIME = ${std_asctime}
1480 # Supported platforms (so far) are: LINUX, MACOSX, SOLARIS, FREEBSD, OPENBSD
1481 PLATFORM = ${platform}
1483 # Whether the linker will automatically resolve the dependency of one
1484 # library on another (if not, then linking a binary requires linking
1485 # directly against both)
1486 LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
1488 # Flags needed to compile and link against Xapian
1489 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
1490 XAPIAN_LDFLAGS = ${xapian_ldflags}
1492 # Flags needed to compile and link against GMime
1493 GMIME_CFLAGS = ${gmime_cflags}
1494 GMIME_LDFLAGS = ${gmime_ldflags}
1496 # Flags needed to compile and link against zlib
1497 ZLIB_CFLAGS = ${zlib_cflags}
1498 ZLIB_LDFLAGS = ${zlib_ldflags}
1500 # Flags needed to compile and link against talloc
1501 TALLOC_CFLAGS = ${talloc_cflags}
1502 TALLOC_LDFLAGS = ${talloc_ldflags}
1504 # Flags needed to have linker set rpath attribute
1505 RPATH_LDFLAGS = ${rpath_ldflags}
1507 # Flags needed to have linker link only to necessary libraries
1508 AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
1510 # Flags to have the linker flag undefined symbols in object files
1511 NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}
1513 # Whether valgrind header files are available
1514 HAVE_VALGRIND = ${have_valgrind}
1516 # And if so, flags needed at compile time for valgrind macros
1517 VALGRIND_CFLAGS = ${valgrind_cflags}
1519 # Whether the sfsexp library is available
1520 HAVE_SFSEXP = ${have_sfsexp}
1522 # And if so, flags needed at compile/link time for sfsexp
1523 SFSEXP_CFLAGS = ${sfsexp_cflags}
1524 SFSEXP_LDFLAGS = ${sfsexp_ldflags}
1527 WITH_EMACS = ${WITH_EMACS}
1529 # Support for desktop file
1530 WITH_DESKTOP = ${WITH_DESKTOP}
1532 # Support for bash completion
1533 WITH_BASH = ${WITH_BASH}
1535 # Support for zsh completion
1536 WITH_ZSH = ${WITH_ZSH}
1538 # Combined flags for compiling and linking against all of the above
1539 COMMON_CONFIGURE_CFLAGS = \\
1540 \$(GMIME_CFLAGS) \$(TALLOC_CFLAGS) \$(ZLIB_CFLAGS) \\
1541 -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \$(VALGRIND_CFLAGS) \\
1542 -DHAVE_SFSEXP=\$(HAVE_SFSEXP) \$(SFSEXP_CFLAGS) \\
1543 -DHAVE_GETLINE=\$(HAVE_GETLINE) \\
1544 -DWITH_EMACS=\$(WITH_EMACS) \\
1545 -DHAVE_CANONICALIZE_FILE_NAME=\$(HAVE_CANONICALIZE_FILE_NAME) \\
1546 -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\
1547 -DHAVE_STRSEP=\$(HAVE_STRSEP) \\
1548 -DHAVE_TIMEGM=\$(HAVE_TIMEGM) \\
1549 -DHAVE_D_TYPE=\$(HAVE_D_TYPE) \\
1550 -DSTD_GETPWUID=\$(STD_GETPWUID) \\
1551 -DSTD_ASCTIME=\$(STD_ASCTIME) \\
1552 -DSILENCE_XAPIAN_DEPRECATION_WARNINGS \\
1553 -DHAVE_XAPIAN_DB_RETRY_LOCK=\$(HAVE_XAPIAN_DB_RETRY_LOCK)
1555 CONFIGURE_CFLAGS = \$(COMMON_CONFIGURE_CFLAGS)
1557 CONFIGURE_CXXFLAGS = \$(COMMON_CONFIGURE_CFLAGS) \$(XAPIAN_CXXFLAGS)
1559 CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS) \$(SFSEXP_LDFLAGS)
1562 # construct the sh.config
1563 cat > sh.config <<EOF
1564 # This sh.config was automatically generated by the ./configure
1565 # script of notmuch.
1567 NOTMUCH_SRCDIR='${NOTMUCH_SRCDIR}'
1569 # Flags needed to compile and link against Xapian
1570 NOTMUCH_XAPIAN_CXXFLAGS="${xapian_cxxflags}"
1571 NOTMUCH_XAPIAN_LDFLAGS="${xapian_ldflags}"
1573 # Whether to have Xapian retry lock
1574 NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${WITH_RETRY_LOCK}
1576 # Flags needed to compile and link against GMime
1577 NOTMUCH_GMIME_CFLAGS="${gmime_cflags}"
1578 NOTMUCH_GMIME_LDFLAGS="${gmime_ldflags}"
1580 # Whether GMime can verify X.509 certificate validity
1581 NOTMUCH_GMIME_X509_CERT_VALIDITY=${gmime_x509_cert_validity}
1583 # Whether GMime emits addresses with angle brackets (with <>)
1584 NOTMUCH_GMIME_EMITS_ANGLE_BRACKETS=${gmime_emits_angle_brackets}
1586 # Whether GMime can verify signatures when decrypting with a session key:
1587 NOTMUCH_GMIME_VERIFY_WITH_SESSION_KEY=${gmime_verify_with_session_key}
1589 # Flags needed to compile and link against zlib
1590 NOTMUCH_ZLIB_CFLAGS="${zlib_cflags}"
1591 NOTMUCH_ZLIB_LDFLAGS="${zlib_ldflags}"
1593 # Does the C compiler support the address sanitizer
1594 NOTMUCH_HAVE_ASAN=${have_asan}
1596 # do we have man pages?
1597 NOTMUCH_HAVE_MAN=$((have_sphinx))
1599 # Whether bash exists, and if so where
1600 NOTMUCH_HAVE_BASH=${have_bash}
1601 NOTMUCH_BASH_ABSOLUTE=${bash_absolute}
1603 # Whether time_t is 64 bits (or more)
1604 NOTMUCH_HAVE_64BIT_TIME_T=${have_64bit_time_t}
1606 # Whether perl exists, and if so where
1607 NOTMUCH_HAVE_PERL=${have_perl}
1608 NOTMUCH_PERL_ABSOLUTE=${perl_absolute}
1610 # Name of python interpreter
1611 NOTMUCH_PYTHON=${python}
1613 # Name of ruby interpreter
1614 NOTMUCH_RUBY=${RUBY}
1616 # Are the ruby development files (and ruby) available? If not skip
1617 # building/testing ruby bindings.
1618 NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
1620 # Is the python cffi package available?
1621 NOTMUCH_HAVE_PYTHON3_CFFI=${have_python3_cffi}
1623 # Is the python pytest package available?
1624 NOTMUCH_HAVE_PYTHON3_PYTEST=${have_python3_pytest}
1626 # Is the sfsexp library available?
1627 NOTMUCH_HAVE_SFSEXP=${have_sfsexp}
1629 # And if so, flags needed at compile/link time for sfsexp
1630 NOTMUCH_SFSEXP_CFLAGS="${sfsexp_cflags}"
1631 NOTMUCH_SFSEXP_LDFLAGS="${sfsexp_ldflags}"
1633 # Platform we are run on
1634 PLATFORM=${platform}
1638 echo "# Generated by configure, run from doc/conf.py"
1639 if [ $WITH_EMACS = "1" ]; then
1640 echo "tags.add('WITH_EMACS')"
1642 if [ $WITH_PYTHON_DOCS = "1" ]; then
1643 echo "tags.add('WITH_PYTHON')"
1645 printf "rsti_dir = '%s'\n" "$(cd emacs && pwd -P)"
1648 cat > bindings/python-cffi/_notmuch_config.py <<EOF
1649 # _notmuch_config.py was automatically generated by the configure
1650 # script in the root of the notmuch source tree.
1651 NOTMUCH_VERSION_FILE='${NOTMUCH_SRCDIR}/version.txt'
1652 NOTMUCH_INCLUDE_DIR='${NOTMUCH_SRCDIR}/lib'
1653 NOTMUCH_LIB_DIR='${NOTMUCH_SRCDIR}/lib'
1656 # Finally, after everything configured, inform the user how to continue.
1659 All required packages were found. You may now run the following
1660 commands to compile and install notmuch: