]> git.cworth.org Git - notmuch/blob - configure
Merge tag '0.28.1'
[notmuch] / configure
1 #! /bin/sh
2
3 set -u
4
5 # Test whether this shell is capable of parameter substring processing.
6 ( option='a/b'; : ${option#*/} ) 2>/dev/null || {
7     echo "
8 The shell interpreting '$0' is lacking some required features.
9
10 To work around this problem you may try to execute:
11
12     ksh $0 $*
13  or
14     bash $0 $*
15 "
16     exit 1
17 }
18
19 # Store original IFS value so it can be changed (and restored) in many places.
20 readonly DEFAULT_IFS="$IFS"
21
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)
28
29 subdirs="util compat lib parse-time-string completion doc emacs"
30 subdirs="${subdirs} performance-test test test/test-databases"
31 subdirs="${subdirs} bindings"
32
33 # For a non-srcdir configure invocation (such as ../configure), create
34 # the directory structure and copy Makefiles.
35 if [ "$srcdir" != "." ]; then
36
37     for dir in . ${subdirs}; do
38         mkdir -p "$dir"
39         cp "$srcdir"/"$dir"/Makefile.local "$dir"
40         cp "$srcdir"/"$dir"/Makefile "$dir"
41     done
42
43     # Emacs only likes to generate compiled files next to the .el files
44     # by default so copy these as well (which is not ideal).
45     cp -a "$srcdir"/emacs/*.el emacs
46
47     # We were not able to create fully working Makefile using ruby mkmf.rb
48     # so ruby bindings source files are copied as well (ditto -- not ideal).
49     mkdir bindings/ruby
50     cp -a "$srcdir"/bindings/ruby/*.[ch] bindings/ruby
51     cp -a "$srcdir"/bindings/ruby/extconf.rb bindings/ruby
52 fi
53
54 # Set several defaults (optionally specified by the user in
55 # environment variables)
56 BASHCMD=${BASHCMD:-bash}
57 PERL=${PERL:-perl}
58 CC=${CC:-cc}
59 CXX=${CXX:-c++}
60 CFLAGS=${CFLAGS:--g -O2}
61 CPPFLAGS=${CPPFLAGS:-}
62 CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
63 CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
64 LDFLAGS=${LDFLAGS:-}
65 XAPIAN_CONFIG=${XAPIAN_CONFIG:-}
66 PYTHON=${PYTHON:-}
67 RUBY=${RUBY:-ruby}
68
69 # We don't allow the EMACS or GZIP Makefile variables inherit values
70 # from the environment as we do with CC and CXX above. The reason is
71 # that these names as environment variables have existing uses other
72 # than the program name that we want. (EMACS is set to 't' when a
73 # shell is running within emacs and GZIP specifies arguments to pass
74 # on the gzip command line).
75
76 # Set the defaults for values the user can specify with command-line
77 # options.
78 PREFIX=/usr/local
79 LIBDIR=
80 WITH_DOCS=1
81 WITH_API_DOCS=1
82 WITH_EMACS=1
83 WITH_DESKTOP=1
84 WITH_BASH=1
85 WITH_RUBY=1
86 WITH_ZSH=1
87 WITH_RETRY_LOCK=1
88
89 usage ()
90 {
91     cat <<EOF
92 Usage: ./configure [options]...
93
94 This script configures notmuch to build on your system.
95
96 It verifies that dependencies are available, determines flags needed
97 to compile and link against various required libraries, and identifies
98 whether various system functions can be used or if locally-provided
99 replacements will be built instead.
100
101 Finally, it allows you to control various aspects of the build and
102 installation process.
103
104 First, some common variables can specified via environment variables:
105
106         CC              The C compiler to use
107         CFLAGS          Flags to pass to the C compiler
108         CPPFLAGS        Flags to pass to the C preprocessor
109         CXX             The C++ compiler to use
110         CXXFLAGS        Flags to pass to the C compiler
111         LDFLAGS         Flags to pass when linking
112
113 Each of these values can further be controlled by specifying them
114 later on the "make" command line.
115
116 Other environment variables can be used to control configure itself,
117 (and for which there is no equivalent build-time control):
118
119         XAPIAN_CONFIG   The program to use to determine flags for
120                         compiling and linking against the Xapian
121                         library. [$XAPIAN_CONFIG]
122         PYTHON          Name of python command to use in
123                         configure and the test suite.
124         RUBY            Name of ruby command to use in
125                         configure and the test suite.
126
127 Additionally, various options can be specified on the configure
128 command line.
129
130         --prefix=PREFIX Install files in PREFIX [$PREFIX]
131
132 By default, "make install" will install the resulting program to
133 $PREFIX/bin, documentation to $PREFIX/man, etc. You can
134 specify an installation prefix other than $PREFIX using
135 --prefix, for instance:
136
137         ./configure --prefix=\$HOME
138
139 Fine tuning of some installation directories is available:
140
141         --libdir=DIR            Install libraries to DIR [PREFIX/lib]
142         --includedir=DIR        Install header files to DIR [PREFIX/include]
143         --mandir=DIR            Install man pages to DIR [PREFIX/share/man]
144         --infodir=DIR           Install man pages to DIR [PREFIX/share/man]
145         --sysconfdir=DIR        Read-only single-machine data [PREFIX/etc]
146         --emacslispdir=DIR      Emacs code [PREFIX/share/emacs/site-lisp]
147         --emacsetcdir=DIR       Emacs miscellaneous files [PREFIX/share/emacs/site-lisp]
148         --bashcompletiondir=DIR Bash completions files [PREFIX/share/bash-completion/completions]
149         --zshcompletiondir=DIR  Zsh completions files [PREFIX/share/zsh/functions/Completion/Unix]
150
151 Some features can be disabled (--with-feature=no is equivalent to
152 --without-feature) :
153
154         --without-bash-completion       Do not install bash completions files
155         --without-docs                  Do not install documentation
156         --without-api-docs              Do not install API man page
157         --without-emacs                 Do not install lisp file
158         --without-desktop               Do not install desktop file
159         --without-ruby                  Do not install ruby bindings
160         --without-zsh-completion        Do not install zsh completions files
161         --without-retry-lock            Do not use blocking xapian opens, even if available
162
163 Additional options are accepted for compatibility with other
164 configure-script calling conventions, but don't do anything yet:
165
166         --build=<cpu>-<vendor>-<os>     Currently ignored
167         --host=<cpu>-<vendor>-<os>      Currently ignored
168         --datadir=DIR                   Currently ignored
169         --localstatedir=DIR             Currently ignored
170         --libexecdir=DIR                Currently ignored
171         --disable-maintainer-mode       Currently ignored
172         --disable-dependency-tracking   Currently ignored
173
174 EOF
175 }
176
177 # Parse command-line options
178 for option; do
179     if [ "${option}" = '--help' ] ; then
180         usage
181         exit 0
182     elif [ "${option%%=*}" = '--prefix' ] ; then
183         PREFIX="${option#*=}"
184     elif [ "${option%%=*}" = '--libdir' ] ; then
185         LIBDIR="${option#*=}"
186     elif [ "${option%%=*}" = '--includedir' ] ; then
187         INCLUDEDIR="${option#*=}"
188     elif [ "${option%%=*}" = '--mandir' ] ; then
189         MANDIR="${option#*=}"
190     elif [ "${option%%=*}" = '--infodir' ] ; then
191         INFODIR="${option#*=}"
192     elif [ "${option%%=*}" = '--sysconfdir' ] ; then
193         SYSCONFDIR="${option#*=}"
194     elif [ "${option%%=*}" = '--emacslispdir' ] ; then
195         EMACSLISPDIR="${option#*=}"
196     elif [ "${option%%=*}" = '--emacsetcdir' ] ; then
197         EMACSETCDIR="${option#*=}"
198     elif [ "${option%%=*}" = '--bashcompletiondir' ] ; then
199         BASHCOMPLETIONDIR="${option#*=}"
200     elif [ "${option%%=*}" = '--zshcompletiondir' ] ; then
201         ZSHCOMLETIONDIR="${option#*=}"
202     elif [ "${option%%=*}" = '--with-docs' ]; then
203         if [ "${option#*=}" = 'no' ]; then
204             WITH_DOCS=0
205             WITH_API_DOCS=0
206         else
207             WITH_DOCS=1
208         fi
209     elif [ "${option}" = '--without-docs' ] ; then
210         WITH_DOCS=0
211         WITH_API_DOCS=0
212     elif [ "${option%%=*}" = '--with-api-docs' ]; then
213         if [ "${option#*=}" = 'no' ]; then
214             WITH_API_DOCS=0
215         else
216             WITH_API_DOCS=1
217         fi
218     elif [ "${option}" = '--without-api-docs' ] ; then
219         WITH_API_DOCS=0
220     elif [ "${option%%=*}" = '--with-emacs' ]; then
221         if [ "${option#*=}" = 'no' ]; then
222             WITH_EMACS=0
223         else
224             WITH_EMACS=1
225         fi
226     elif [ "${option}" = '--without-emacs' ] ; then
227         WITH_EMACS=0
228     elif [ "${option%%=*}" = '--with-desktop' ]; then
229         if [ "${option#*=}" = 'no' ]; then
230             WITH_DESKTOP=0
231         else
232             WITH_DESKTOP=1
233         fi
234     elif [ "${option}" = '--without-desktop' ] ; then
235         WITH_DESKTOP=0
236     elif [ "${option%%=*}" = '--with-bash-completion' ]; then
237         if [ "${option#*=}" = 'no' ]; then
238             WITH_BASH=0
239         else
240             WITH_BASH=1
241         fi
242     elif [ "${option}" = '--without-bash-completion' ] ; then
243         WITH_BASH=0
244     elif [ "${option%%=*}" = '--with-ruby' ]; then
245         if [ "${option#*=}" = 'no' ]; then
246             WITH_RUBY=0
247         else
248             WITH_RUBY=1
249         fi
250     elif [ "${option}" = '--without-ruby' ] ; then
251         WITH_RUBY=0
252     elif [ "${option%%=*}" = '--with-retry-lock' ]; then
253         if [ "${option#*=}" = 'no' ]; then
254             WITH_RETRY_LOCK=0
255         else
256             WITH_RETRY_LOCK=1
257         fi
258     elif [ "${option}" = '--without-retry-lock' ] ; then
259         WITH_RETRY_LOCK=0
260     elif [ "${option%%=*}" = '--with-zsh-completion' ]; then
261         if [ "${option#*=}" = 'no' ]; then
262             WITH_ZSH=0
263         else
264             WITH_ZSH=1
265         fi
266     elif [ "${option}" = '--without-zsh-completion' ] ; then
267         WITH_ZSH=0
268     elif [ "${option%%=*}" = '--build' ] ; then
269         true
270     elif [ "${option%%=*}" = '--host' ] ; then
271         true
272     elif [ "${option%%=*}" = '--datadir' ] ; then
273         true
274     elif [ "${option%%=*}" = '--localstatedir' ] ; then
275         true
276     elif [ "${option%%=*}" = '--libexecdir' ] ; then
277         true
278     elif [ "${option}" = '--disable-maintainer-mode' ] ; then
279         true
280     elif [ "${option}" = '--disable-dependency-tracking' ] ; then
281         true
282     else
283         echo "Unrecognized option: ${option}"
284         echo "See:"
285         echo "  $0 --help"
286         echo ""
287         exit 1
288     fi
289 done
290
291 # We set this value early, (rather than just while printing the
292 # Makefile.config file later like most values), because we need to
293 # actually investigate this value compared to the ldconfig_paths value
294 # below.
295 if [ -z "$LIBDIR" ] ; then
296     libdir_expanded="${PREFIX}/lib"
297 else
298     # very non-general variable expansion
299     libdir_expanded=$(printf %s "$LIBDIR" | sed "s|\${prefix}|${PREFIX}|; s|\$prefix\>|${PREFIX}|; s|//*|/|g")
300 fi
301
302 cat <<EOF
303 Welcome to Notmuch, a system for indexing, searching and tagging your email.
304
305 We hope that the process of building and installing notmuch is quick
306 and smooth so that you can soon be reading and processing your email
307 more efficiently than ever.
308
309 If anything goes wrong in the configure process, you can override any
310 decisions it makes by manually editing the Makefile.config file that
311 it creates. Also please do as much as you can to figure out what could
312 be different on your machine compared to those of the notmuch
313 developers. Then, please email those details to the Notmuch list
314 (notmuch@notmuchmail.org) so that we can hopefully make future
315 versions of notmuch easier for you to use.
316
317 We'll now investigate your system to verify that all required
318 dependencies are available:
319
320 EOF
321
322 errors=0
323 printf "int main(void){return 0;}\n" > minimal.c
324
325 printf "Sanity checking C compilation environment... "
326 test_cmdline="${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal"
327 if  ${test_cmdline} > /dev/null 2>&1
328 then
329     printf "OK.\n"
330 else
331     printf "Fail.\n"
332     errors=$((errors + 1))
333     printf Executed:; printf ' %s' ${test_cmdline}; echo
334     ${test_cmdline}
335 fi
336
337 printf "Sanity checking C++ compilation environment... "
338 test_cmdline="${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal"
339 if ${test_cmdline} > /dev/null 2>&1
340 then
341     printf "OK.\n"
342 else
343     printf "Fail.\n"
344     errors=$((errors + 1))
345     printf Executed:; printf ' %s' ${test_cmdline}; echo
346     ${test_cmdline}
347 fi
348 unset test_cmdline
349
350 if [ $errors -gt 0 ]; then
351     cat <<EOF
352 *** Error: Initial sanity checking of environment failed.  Please try
353 running configure in a clean environment, and if the problem persists,
354 report a bug.
355 EOF
356     rm -f minimal minimal.c
357     exit 1
358 fi
359
360 printf "Reading libnotmuch version from source... "
361 cat > _libversion.c <<EOF
362 #include <stdio.h>
363 #include "lib/notmuch.h"
364 int main(void) {
365     printf("libnotmuch_version_major=%d\n",
366                 LIBNOTMUCH_MAJOR_VERSION);
367     printf("libnotmuch_version_minor=%d\n",
368                 LIBNOTMUCH_MINOR_VERSION);
369     printf("libnotmuch_version_release=%d\n",
370                 LIBNOTMUCH_MICRO_VERSION);
371     return 0;
372 }
373 EOF
374 if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
375        && ./_libversion > _libversion.sh && . ./_libversion.sh
376 then
377     printf "OK.\n"
378 else
379     cat <<EOF
380
381 *** Error: Reading lib/notmuch.h failed.
382 Please try running configure again in a clean environment, and if the
383 problem persists, report a bug.
384 EOF
385     rm -f _libversion _libversion.c _libversion.sh
386     exit 1
387 fi
388
389 if pkg-config --version > /dev/null 2>&1; then
390     have_pkg_config=1
391 else
392     have_pkg_config=0
393 fi
394
395 printf "Checking for Xapian development files... "
396 have_xapian=0
397 for xapian_config in ${XAPIAN_CONFIG} xapian-config xapian-config-1.3; do
398     if ${xapian_config} --version > /dev/null 2>&1; then
399         xapian_version=$(${xapian_config} --version | sed -e 's/.* //')
400         printf "Yes (%s).\n" ${xapian_version}
401         have_xapian=1
402         xapian_cxxflags=$(${xapian_config} --cxxflags)
403         xapian_ldflags=$(${xapian_config} --libs)
404         break
405     fi
406 done
407 if [ ${have_xapian} = "0" ]; then
408     printf "No.\n"
409     errors=$((errors + 1))
410 fi
411
412 have_xapian_compact=0
413 have_xapian_field_processor=0
414 if [ ${have_xapian} = "1" ]; then
415     printf "Checking for Xapian compaction support... "
416     cat>_compact.cc<<EOF
417 #include <xapian.h>
418 class TestCompactor : public Xapian::Compactor { };
419 EOF
420     if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _compact.cc -o _compact.o > /dev/null 2>&1
421     then
422         have_xapian_compact=1
423         printf "Yes.\n"
424     else
425         printf "No.\n"
426         errors=$((errors + 1))
427     fi
428
429     rm -f _compact.o _compact.cc
430
431     printf "Checking for Xapian FieldProcessor API... "
432     cat>_field_processor.cc<<EOF
433 #include <xapian.h>
434 class TitleFieldProcessor : public Xapian::FieldProcessor { };
435 EOF
436     if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _field_processor.cc -o _field_processor.o > /dev/null 2>&1
437     then
438         have_xapian_field_processor=1
439         printf "Yes.\n"
440     else
441         printf "No. (optional)\n"
442     fi
443
444     rm -f _field_processor.o _field_processor.cc
445
446     default_xapian_backend=""
447     # DB_RETRY_LOCK is only supported on Xapian > 1.3.2
448     have_xapian_db_retry_lock=0
449     if [ $WITH_RETRY_LOCK = "1" ]; then
450         printf "Checking for Xapian lock retry support... "
451         cat>_retry.cc<<EOF
452 #include <xapian.h>
453 int flag = Xapian::DB_RETRY_LOCK;
454 EOF
455         if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _retry.cc -o _retry.o > /dev/null 2>&1
456         then
457             have_xapian_db_retry_lock=1
458             printf "Yes.\n"
459         else
460             printf "No. (optional)\n"
461         fi
462         rm -f _retry.o _retry.cc
463     fi
464
465     printf "Testing default Xapian backend... "
466     cat >_default_backend.cc <<EOF
467 #include <xapian.h>
468 int main(int argc, char** argv) {
469    Xapian::WritableDatabase db("test.db",Xapian::DB_CREATE_OR_OPEN);
470 }
471 EOF
472     ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} _default_backend.cc -o _default_backend ${xapian_ldflags}
473     ./_default_backend
474     if [ -f test.db/iamglass ]; then
475         default_xapian_backend=glass
476     else
477         default_xapian_backend=chert
478     fi
479     printf "%s\n" "${default_xapian_backend}";
480     rm -rf test.db _default_backend _default_backend.cc
481 fi
482
483 # we need to have a version >= 2.6.5 to avoid a crypto bug. We need
484 # 2.6.7 for permissive "From " header handling.
485 GMIME_MINVER=2.6.7
486 GMIME3_MINVER=3.0.3
487
488 printf "Checking for GMime development files... "
489 if pkg-config --exists "gmime-3.0 > $GMIME3_MINVER"; then
490     printf "Yes (3.0).\n"
491     have_gmime=1
492     gmime_cflags=$(pkg-config --cflags gmime-3.0)
493     gmime_ldflags=$(pkg-config --libs gmime-3.0)
494     gmime_major=3
495     have_gmime_session_keys=1
496 elif pkg-config --exists "gmime-2.6 >= $GMIME_MINVER"; then
497     printf "Yes (2.6).\n"
498     have_gmime=1
499     gmime_cflags=$(pkg-config --cflags gmime-2.6)
500     gmime_ldflags=$(pkg-config --libs gmime-2.6)
501     gmime_major=2
502     if pkg-config --exists "gmime-2.6 >= 2.6.21"; then
503         have_gmime_session_keys=1
504     else
505         have_gmime_session_keys=0
506     fi
507 else
508     have_gmime=0
509     have_gmime_session_keys=0
510     printf "No.\n"
511     errors=$((errors + 1))
512 fi
513
514 # GMime already depends on Glib >= 2.12, but we use at least one Glib
515 # function that only exists as of 2.22, (g_array_unref)
516 printf "Checking for Glib development files (>= 2.22)... "
517 have_glib=0
518 if pkg-config --exists 'glib-2.0 >= 2.22'; then
519     printf "Yes.\n"
520     have_glib=1
521     # these are included in gmime cflags and ldflags
522     # glib_cflags=$(pkg-config --cflags glib-2.0)
523     # glib_ldflags=$(pkg-config --libs glib-2.0)
524 else
525     printf "No.\n"
526     errors=$((errors + 1))
527 fi
528
529 if ! pkg-config --exists zlib; then
530   ${CC} -o compat/gen_zlib_pc "$srcdir"/compat/gen_zlib_pc.c >/dev/null 2>&1 &&
531   compat/gen_zlib_pc > compat/zlib.pc &&
532   PKG_CONFIG_PATH="$PKG_CONFIG_PATH":compat &&
533   export PKG_CONFIG_PATH
534   rm -f compat/gen_zlib_pc
535 fi
536
537 printf "Checking for zlib (>= 1.2.5.2)... "
538 have_zlib=0
539 if pkg-config --atleast-version=1.2.5.2 zlib; then
540     printf "Yes.\n"
541     have_zlib=1
542     zlib_cflags=$(pkg-config --cflags zlib)
543     zlib_ldflags=$(pkg-config --libs zlib)
544 else
545     printf "No.\n"
546     errors=$((errors + 1))
547 fi
548
549 printf "Checking for talloc development files... "
550 if pkg-config --exists talloc; then
551     printf "Yes.\n"
552     have_talloc=1
553     talloc_cflags=$(pkg-config --cflags talloc)
554     talloc_ldflags=$(pkg-config --libs talloc)
555 else
556     printf "No.\n"
557     have_talloc=0
558     talloc_cflags=
559     errors=$((errors + 1))
560 fi
561
562 printf "Checking for bash... "
563 if command -v ${BASHCMD} > /dev/null; then
564     have_bash=1
565     bash_absolute=$(command -v ${BASHCMD})
566     printf "Yes (%s).\n" "$bash_absolute"
567 else
568     have_bash=0
569     printf "No. (%s not found)\n" "${BASHCMD}"
570 fi
571
572 printf "Checking for perl... "
573 if command -v ${PERL} > /dev/null; then
574     have_perl=1
575     perl_absolute=$(command -v ${PERL})
576     printf "Yes (%s).\n" "$perl_absolute"
577 else
578     have_perl=0
579     printf "No. (%s not found)\n" "${PERL}"
580 fi
581
582 printf "Checking for python... "
583 have_python=0
584
585 for name in ${PYTHON} python3 python python2; do
586     if command -v $name > /dev/null; then
587         have_python=1
588         python=$name
589         printf "Yes (%s).\n" "$name"
590         break
591     fi
592 done
593
594 if [ $have_python -eq 0 ]; then
595     printf "No.\n"
596     errors=$((errors + 1))
597 fi
598
599 printf "Checking for valgrind development files... "
600 if pkg-config --exists valgrind; then
601     printf "Yes.\n"
602     have_valgrind=1
603     valgrind_cflags=$(pkg-config --cflags valgrind)
604 else
605     printf "No (but that's fine).\n"
606     have_valgrind=0
607     valgrind_cflags=
608 fi
609
610 printf "Checking for bash-completion (>= 1.90)... "
611 if pkg-config --atleast-version=1.90 bash-completion; then
612     printf "Yes.\n"
613 else
614     printf "No (will not install bash completion).\n"
615     WITH_BASH=0
616 fi
617
618 if [ -z "${EMACSLISPDIR-}" ]; then
619     EMACSLISPDIR="\$(prefix)/share/emacs/site-lisp"
620 fi
621
622 if [ -z "${EMACSETCDIR-}" ]; then
623     EMACSETCDIR="\$(prefix)/share/emacs/site-lisp"
624 fi
625
626 printf "Checking if emacs (>= 24) is available... "
627 if emacs --quick --batch --eval '(if (< emacs-major-version 24) (kill-emacs 1))' > /dev/null 2>&1; then
628     printf "Yes.\n"
629     have_emacs=1
630 else
631     printf "No (so will not byte-compile emacs code)\n"
632     have_emacs=0
633 fi
634
635 have_doxygen=0
636 if [ $WITH_API_DOCS = "1" ] ; then
637     printf "Checking if doxygen is available... "
638     if command -v doxygen > /dev/null; then
639         printf "Yes.\n"
640         have_doxygen=1
641     else
642         printf "No (so will not install api docs)\n"
643     fi
644 fi
645
646 have_ruby_dev=0
647 if [ $WITH_RUBY = "1" ] ; then
648     printf "Checking for ruby development files... "
649     if ${RUBY} -e "require 'mkmf'"> /dev/null 2>&1; then
650         printf "Yes.\n"
651         have_ruby_dev=1
652     else
653         printf "No (skipping ruby bindings)\n"
654     fi
655 fi
656
657 have_sphinx=0
658 have_makeinfo=0
659 have_install_info=0
660 if [ $WITH_DOCS = "1" ] ; then
661     printf "Checking if sphinx is available and supports nroff output... "
662     if command -v sphinx-build > /dev/null && ${python} -m sphinx.writers.manpage > /dev/null 2>&1 ; then
663         printf "Yes.\n"
664         have_sphinx=1
665     else
666         printf "No (so will not install man pages).\n"
667     fi
668     printf "Checking if makeinfo is available... "
669     if command -v makeinfo > /dev/null; then
670         printf "Yes.\n"
671         have_makeinfo=1
672     else
673         printf "No (so will not build info pages).\n"
674     fi
675     printf "Checking if install-info is available... "
676     if command -v install-info > /dev/null; then
677         printf "Yes.\n"
678         have_install_info=1
679     else
680         printf "No (so will not install info pages).\n"
681     fi
682 fi
683
684 if [ $WITH_DESKTOP = "1" ]; then
685     printf "Checking if desktop-file-install is available... "
686     if command -v desktop-file-install > /dev/null; then
687         printf "Yes.\n"
688     else
689         printf "No (so will not install .desktop file).\n"
690         WITH_DESKTOP=0
691     fi
692 fi
693
694 printf "Checking for cppcheck... "
695 if command -v cppcheck > /dev/null; then
696     have_cppcheck=1
697     printf "Yes.\n"
698 else
699     have_cppcheck=0
700     printf "No.\n"
701 fi
702
703 libdir_in_ldconfig=0
704
705 printf "Checking which platform we are on... "
706 uname=$(uname)
707 if [ $uname = "Darwin" ] ; then
708     printf "Mac OS X.\n"
709     platform=MACOSX
710     linker_resolves_library_dependencies=0
711 elif [ $uname = "SunOS" ] ; then
712     printf "Solaris.\n"
713     platform=SOLARIS
714     linker_resolves_library_dependencies=0
715 elif [ $uname = "FreeBSD" ] ; then
716     printf "FreeBSD.\n"
717     platform=FREEBSD
718     linker_resolves_library_dependencies=0
719 elif [ $uname = "OpenBSD" ] ; then
720     printf "OpenBSD.\n"
721     platform=OPENBSD
722     linker_resolves_library_dependencies=0
723 elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
724     printf "%s\n" "$uname"
725     platform="$uname"
726     linker_resolves_library_dependencies=1
727
728     printf "Checking for %s in ldconfig... " "$libdir_expanded"
729     ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
730     # Separate ldconfig_paths only on newline (not on any potential
731     # embedded space characters in any filenames). Note, we use a
732     # literal newline in the source here rather than something like:
733     #
734     #   IFS=$(printf '\n')
735     #
736     # because the shell's command substitution deletes any trailing newlines.
737     IFS="
738 "
739     for path in $ldconfig_paths; do
740         if [ "$path" -ef "$libdir_expanded" ]; then
741             libdir_in_ldconfig=1
742         fi
743     done
744     IFS=$DEFAULT_IFS
745     if [ "$libdir_in_ldconfig" = '0' ]; then
746         printf "No (will set RPATH)\n"
747     else
748         printf "Yes\n"
749     fi
750 else
751     printf "Unknown.\n"
752     platform="$uname"
753     linker_resolves_library_dependencies=0
754     cat <<EOF
755
756 *** Warning: Unknown platform. Notmuch might or might not build correctly.
757
758 EOF
759 fi
760
761 if [ $errors -gt 0 ]; then
762     cat <<EOF
763
764 *** Error: The dependencies of notmuch could not be satisfied. You will
765 need to install the following packages before being able to compile
766 notmuch:
767
768 EOF
769     if [ $have_python -eq 0 ]; then
770         echo "  python interpreter"
771     fi
772     if [ $have_xapian -eq 0 -o $have_xapian_compact -eq 0 ]; then
773         echo "  Xapian library (>= version 1.2.6, including development files such as headers)"
774         echo "  https://xapian.org/"
775     fi
776     if [ $have_zlib -eq 0 ]; then
777         echo "  zlib library (>= version 1.2.5.2, including development files such as headers)"
778         echo "  https://zlib.net/"
779         echo
780     fi
781     if [ $have_gmime -eq 0 ]; then
782         echo "  GMime 2.6 library >= $GMIME_MINVER"
783         echo "  (including development files such as headers)"
784         echo "  https://github.com/jstedfast/gmime/"
785         echo
786     fi
787     if [ $have_glib -eq 0 ]; then
788         echo "  Glib library >= 2.22 (including development files such as headers)"
789         echo "  https://ftp.gnome.org/pub/gnome/sources/glib/"
790         echo
791     fi
792     if [ $have_talloc -eq 0 ]; then
793         echo "  The talloc library (including development files such as headers)"
794         echo "  https://talloc.samba.org/"
795         echo
796     fi
797     cat <<EOF
798 With any luck, you're using a modern, package-based operating system
799 that has all of these packages available in the distribution. In that
800 case a simple command will install everything you need. For example:
801
802 On Debian and similar systems:
803
804         sudo apt-get install libxapian-dev libgmime-2.6-dev libtalloc-dev zlib1g-dev
805
806 Or on Fedora and similar systems:
807
808         sudo yum install xapian-core-devel gmime-devel libtalloc-devel zlib-devel
809
810 On other systems, similar commands can be used, but the details of the
811 package names may be different.
812
813 EOF
814     if [ $have_pkg_config -eq 0 ]; then
815 cat <<EOF
816 Note: the pkg-config program is not available. This configure script
817 uses pkg-config to find the compilation flags required to link against
818 the various libraries needed by notmuch. It's possible you simply need
819 to install pkg-config with a command such as:
820
821         sudo apt-get install pkg-config
822 Or:
823         sudo yum install pkgconfig
824
825 But if pkg-config is not available for your system, then you will need
826 to modify the configure script to manually set the cflags and ldflags
827 variables to the correct values to link against each library in each
828 case that pkg-config could not be used to determine those values.
829
830 EOF
831     fi
832 cat <<EOF
833 When you have installed the necessary dependencies, you can run
834 configure again to ensure the packages can be found, or simply run
835 "make" to compile notmuch.
836
837 EOF
838     exit 1
839 fi
840
841 printf "Checking for canonicalize_file_name... "
842 if ${CC} -o compat/have_canonicalize_file_name "$srcdir"/compat/have_canonicalize_file_name.c > /dev/null 2>&1
843 then
844     printf "Yes.\n"
845     have_canonicalize_file_name=1
846 else
847     printf "No (will use our own instead).\n"
848     have_canonicalize_file_name=0
849 fi
850 rm -f compat/have_canonicalize_file_name
851
852
853 printf "Checking for getline... "
854 if ${CC} -o compat/have_getline "$srcdir"/compat/have_getline.c > /dev/null 2>&1
855 then
856     printf "Yes.\n"
857     have_getline=1
858 else
859     printf "No (will use our own instead).\n"
860     have_getline=0
861 fi
862 rm -f compat/have_getline
863
864 printf "Checking for strcasestr... "
865 if ${CC} -o compat/have_strcasestr "$srcdir"/compat/have_strcasestr.c > /dev/null 2>&1
866 then
867     printf "Yes.\n"
868     have_strcasestr=1
869 else
870     printf "No (will use our own instead).\n"
871     have_strcasestr=0
872 fi
873 rm -f compat/have_strcasestr
874
875 printf "Checking for strsep... "
876 if ${CC} -o compat/have_strsep "$srcdir"/compat/have_strsep.c > /dev/null 2>&1
877 then
878     printf "Yes.\n"
879     have_strsep="1"
880 else
881     printf "No (will use our own instead).\n"
882     have_strsep="0"
883 fi
884 rm -f compat/have_strsep
885
886 printf "Checking for timegm... "
887 if ${CC} -o compat/have_timegm "$srcdir"/compat/have_timegm.c > /dev/null 2>&1
888 then
889     printf "Yes.\n"
890     have_timegm="1"
891 else
892     printf "No (will use our own instead).\n"
893     have_timegm="0"
894 fi
895 rm -f compat/have_timegm
896
897 printf "Checking for dirent.d_type... "
898 if ${CC} -o compat/have_d_type "$srcdir"/compat/have_d_type.c > /dev/null 2>&1
899 then
900     printf "Yes.\n"
901     have_d_type="1"
902 else
903     printf "No (will use stat instead).\n"
904     have_d_type="0"
905 fi
906 rm -f compat/have_d_type
907
908 printf "Checking for standard version of getpwuid_r... "
909 if ${CC} -o compat/check_getpwuid "$srcdir"/compat/check_getpwuid.c > /dev/null 2>&1
910 then
911     printf "Yes.\n"
912     std_getpwuid=1
913 else
914     printf "No (will define _POSIX_PTHREAD_SEMANTICS to get it).\n"
915     std_getpwuid=0
916 fi
917 rm -f compat/check_getpwuid
918
919 printf "Checking for standard version of asctime_r... "
920 if ${CC} -o compat/check_asctime "$srcdir"/compat/check_asctime.c > /dev/null 2>&1
921 then
922     printf "Yes.\n"
923     std_asctime=1
924 else
925     printf "No (will define _POSIX_PTHREAD_SEMANTICS to get it).\n"
926     std_asctime=0
927 fi
928 rm -f compat/check_asctime
929
930 printf "Checking for rpath support... "
931 if ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1
932 then
933     printf "Yes.\n"
934     rpath_ldflags="-Wl,--enable-new-dtags -Wl,-rpath,\$(libdir)"
935 else
936     printf "No (nothing to worry about).\n"
937     rpath_ldflags=""
938 fi
939
940 printf "Checking for -Wl,--as-needed... "
941 if ${CC} -Wl,--as-needed -o minimal minimal.c >/dev/null 2>&1
942 then
943     printf "Yes.\n"
944     as_needed_ldflags="-Wl,--as-needed"
945 else
946     printf "No (nothing to worry about).\n"
947     as_needed_ldflags=""
948 fi
949
950 printf "Checking for -Wl,--no-undefined... "
951 if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1
952 then
953     printf "Yes.\n"
954     no_undefined_ldflags="-Wl,--no-undefined"
955 else
956     printf "No (nothing to worry about).\n"
957     no_undefined_ldflags=""
958 fi
959
960 WARN_CXXFLAGS=""
961 printf "Checking for available C++ compiler warning flags... "
962 for flag in -Wall -Wextra -Wwrite-strings; do
963     if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1
964     then
965         WARN_CXXFLAGS="${WARN_CXXFLAGS}${WARN_CXXFLAGS:+ }${flag}"
966     fi
967 done
968 printf "\n\t%s\n" "${WARN_CXXFLAGS}"
969
970 WARN_CFLAGS="${WARN_CXXFLAGS}"
971 printf "Checking for available C compiler warning flags... "
972 for flag in -Wmissing-declarations; do
973     if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1
974     then
975         WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}"
976     fi
977 done
978 printf "\n\t%s\n" "${WARN_CFLAGS}"
979
980 rm -f minimal minimal.c _libversion.c _libversion _libversion.sh
981
982 # construct the Makefile.config
983 cat > Makefile.config <<EOF
984 # This Makefile.config was automatically generated by the ./configure
985 # script of notmuch. If the configure script identified anything
986 # incorrectly, then you can edit this file to try to correct things,
987 # but be warned that if configure is run again it will destroy your
988 # changes, (and this could happen by simply calling "make" if the
989 # configure script is updated).
990
991 # The top-level directory for the source, (the directory containing
992 # the configure script). This may be different than the build
993 # directory (the current directory at the time configure was run).
994 srcdir = ${srcdir}
995 NOTMUCH_SRCDIR = ${NOTMUCH_SRCDIR}
996
997 # subdirectories to build
998 subdirs = ${subdirs}
999
1000 configure_options = $@
1001
1002 # We use vpath directives (rather than the VPATH variable) since the
1003 # VPATH variable matches targets as well as prerequisites, (which is
1004 # not useful since then a target left-over from a srcdir build would
1005 # cause a target to not be built in the non-srcdir build).
1006 #
1007 # Also, we don't use a single "vpath % \$(srcdir)" here because we
1008 # don't want the vpath to trigger for our emacs lisp compilation,
1009 # (unless we first find a way to convince emacs to build the .elc
1010 # target in a directory other than the directory of the .el
1011 # prerequisite). In the meantime, we're actually copying in the .el
1012 # files, (which is quite ugly).
1013 vpath %.c \$(srcdir)
1014 vpath %.cc \$(srcdir)
1015 vpath Makefile.% \$(srcdir)
1016 vpath %.py \$(srcdir)
1017 vpath %.rst \$(srcdir)
1018
1019 # Library versions (used to make SONAME)
1020 # The major version of the library interface. This will control the soname.
1021 # As such, this number must be incremented for any incompatible change to
1022 # the library interface, (such as the deletion of an API or a major
1023 # semantic change that breaks formerly functioning code).
1024 #
1025 LIBNOTMUCH_VERSION_MAJOR = ${libnotmuch_version_major}
1026
1027 # The minor version of the library interface. This should be incremented at
1028 # the time of release for any additions to the library interface,
1029 # (and when it is incremented, the release version of the library should
1030 #  be reset to 0).
1031 LIBNOTMUCH_VERSION_MINOR = ${libnotmuch_version_minor}
1032
1033 # The release version the library interface. This should be incremented at
1034 # the time of release if there have been no changes to the interface, (but
1035 # simply compatible changes to the implementation).
1036 LIBNOTMUCH_VERSION_RELEASE = ${libnotmuch_version_release}
1037
1038 # These are derived from the VERSION macros in lib/notmuch.h so
1039 # if you have to change them, something is wrong.
1040
1041 # The C compiler to use
1042 CC = ${CC}
1043
1044 # The C++ compiler to use
1045 CXX = ${CXX}
1046
1047 # Command to execute emacs from Makefiles
1048 EMACS = emacs --quick
1049
1050 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
1051 CFLAGS = ${CFLAGS}
1052
1053 # Default FLAGS for C preprocessor (can be overridden by user such as "make CPPFLAGS=-I/usr/local/include")
1054 CPPFLAGS = ${CPPFLAGS}
1055
1056 # Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
1057 CXXFLAGS = ${CXXFLAGS}
1058
1059 # Default FLAGS for the linker (can be overridden by user such as "make LDFLAGS=-znow")
1060 LDFLAGS = ${LDFLAGS}
1061
1062 # Flags to enable warnings when using the C++ compiler
1063 WARN_CXXFLAGS=${WARN_CXXFLAGS}
1064
1065 # Flags to enable warnings when using the C compiler
1066 WARN_CFLAGS=${WARN_CFLAGS}
1067
1068 # Name of python interpreter
1069 PYTHON = ${python}
1070
1071 # Name of ruby interpreter
1072 RUBY = ${RUBY}
1073
1074 # The prefix to which notmuch should be installed
1075 # Note: If you change this value here, be sure to ensure that the
1076 # LIBDIR_IN_LDCONFIG value below is still set correctly.
1077 prefix = ${PREFIX}
1078
1079 # The directory to which libraries should be installed
1080 # Note: If you change this value here, be sure to ensure that the
1081 # LIBDIR_IN_LDCONFIG value below is still set correctly.
1082 libdir = ${LIBDIR:=\$(prefix)/lib}
1083
1084 # Whether libdir is in a path configured into ldconfig
1085 LIBDIR_IN_LDCONFIG = ${libdir_in_ldconfig}
1086
1087 # The directory to which header files should be installed
1088 includedir = ${INCLUDEDIR:=\$(prefix)/include}
1089
1090 # The directory to which man pages should be installed
1091 mandir = ${MANDIR:=\$(prefix)/share/man}
1092
1093 # The directory to which man pages should be installed
1094 infodir = ${INFODIR:=\$(prefix)/share/info}
1095
1096 # The directory to which read-only (configuration) files should be installed
1097 sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc}
1098
1099 # The directory to which emacs lisp files should be installed
1100 emacslispdir=${EMACSLISPDIR}
1101
1102 # The directory to which emacs miscellaneous (machine-independent) files should
1103 # be installed
1104 emacsetcdir=${EMACSETCDIR}
1105
1106 # Whether bash exists, and if so where
1107 HAVE_BASH = ${have_bash}
1108 BASH_ABSOLUTE = ${bash_absolute}
1109
1110 # Whether perl exists, and if so where
1111 HAVE_PERL = ${have_perl}
1112 PERL_ABSOLUTE = ${perl_absolute}
1113
1114 # Whether there's an emacs binary available for byte-compiling
1115 HAVE_EMACS = ${have_emacs}
1116
1117 # Whether there's a sphinx-build binary available for building documentation
1118 HAVE_SPHINX=${have_sphinx}
1119
1120 # Whether there's a makeinfo binary available for building info format documentation
1121 HAVE_MAKEINFO=${have_makeinfo}
1122
1123 # Whether there's an install-info binary available for installing info format documentation
1124 HAVE_INSTALL_INFO=${have_install_info}
1125
1126 # Whether there's a doxygen binary available for building api documentation
1127 HAVE_DOXYGEN=${have_doxygen}
1128
1129 # The directory to which desktop files should be installed
1130 desktop_dir = \$(prefix)/share/applications
1131
1132 # The directory to which bash completions files should be installed
1133 bash_completion_dir = ${BASHCOMPLETIONDIR:=\$(prefix)/share/bash-completion/completions}
1134
1135 # The directory to which zsh completions files should be installed
1136 zsh_completion_dir = ${ZSHCOMLETIONDIR:=\$(prefix)/share/zsh/functions/Completion/Unix}
1137
1138 # Whether the canonicalize_file_name function is available (if not, then notmuch will
1139 # build its own version)
1140 HAVE_CANONICALIZE_FILE_NAME = ${have_canonicalize_file_name}
1141
1142 # Whether the cppcheck static checker is available
1143 HAVE_CPPCHECK = ${have_cppcheck}
1144
1145 # Whether the getline function is available (if not, then notmuch will
1146 # build its own version)
1147 HAVE_GETLINE = ${have_getline}
1148
1149 # Are the ruby development files (and ruby) available? If not skip
1150 # building/testing ruby bindings.
1151 HAVE_RUBY_DEV = ${have_ruby_dev}
1152
1153 # Whether the strcasestr function is available (if not, then notmuch will
1154 # build its own version)
1155 HAVE_STRCASESTR = ${have_strcasestr}
1156
1157 # Whether the strsep function is available (if not, then notmuch will
1158 # build its own version)
1159 HAVE_STRSEP = ${have_strsep}
1160
1161 # Whether the timegm function is available (if not, then notmuch will
1162 # build its own version)
1163 HAVE_TIMEGM = ${have_timegm}
1164
1165 # Whether struct dirent has d_type (if not, then notmuch will use stat)
1166 HAVE_D_TYPE = ${have_d_type}
1167
1168 # Whether the GMime version can handle extraction and reuse of session keys
1169 HAVE_GMIME_SESSION_KEYS = ${have_gmime_session_keys}
1170
1171 # Whether the Xapian version in use supports compaction
1172 HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
1173
1174 # Whether the Xapian version in use supports field processors
1175 HAVE_XAPIAN_FIELD_PROCESSOR = ${have_xapian_field_processor}
1176
1177 # Whether the Xapian version in use supports DB_RETRY_LOCK
1178 HAVE_XAPIAN_DB_RETRY_LOCK = ${have_xapian_db_retry_lock}
1179
1180 # Whether the getpwuid_r function is standards-compliant
1181 # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS
1182 # to enable the standards-compliant version -- needed for Solaris)
1183 STD_GETPWUID = ${std_getpwuid}
1184
1185 # Whether the asctime_r function is standards-compliant
1186 # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS
1187 # to enable the standards-compliant version -- needed for Solaris)
1188 STD_ASCTIME = ${std_asctime}
1189
1190 # Supported platforms (so far) are: LINUX, MACOSX, SOLARIS, FREEBSD, OPENBSD
1191 PLATFORM = ${platform}
1192
1193 # Whether the linker will automatically resolve the dependency of one
1194 # library on another (if not, then linking a binary requires linking
1195 # directly against both)
1196 LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
1197
1198 # Flags needed to compile and link against Xapian
1199 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
1200 XAPIAN_LDFLAGS = ${xapian_ldflags}
1201
1202 # Which backend will Xapian use by default?
1203 DEFAULT_XAPIAN_BACKEND = ${default_xapian_backend}
1204
1205 # Flags needed to compile and link against GMime
1206 GMIME_CFLAGS = ${gmime_cflags}
1207 GMIME_LDFLAGS = ${gmime_ldflags}
1208
1209 # Flags needed to compile and link against zlib
1210 ZLIB_CFLAGS = ${zlib_cflags}
1211 ZLIB_LDFLAGS = ${zlib_ldflags}
1212
1213 # Flags needed to compile and link against talloc
1214 TALLOC_CFLAGS = ${talloc_cflags}
1215 TALLOC_LDFLAGS = ${talloc_ldflags}
1216
1217 # Flags needed to have linker set rpath attribute
1218 RPATH_LDFLAGS = ${rpath_ldflags}
1219
1220 # Flags needed to have linker link only to necessary libraries
1221 AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
1222
1223 # Flags to have the linker flag undefined symbols in object files
1224 NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}
1225
1226 # Whether valgrind header files are available
1227 HAVE_VALGRIND = ${have_valgrind}
1228
1229 # And if so, flags needed at compile time for valgrind macros
1230 VALGRIND_CFLAGS = ${valgrind_cflags}
1231
1232 # Support for emacs
1233 WITH_EMACS = ${WITH_EMACS}
1234
1235 # Support for desktop file
1236 WITH_DESKTOP = ${WITH_DESKTOP}
1237
1238 # Support for bash completion
1239 WITH_BASH = ${WITH_BASH}
1240
1241 # Support for zsh completion
1242 WITH_ZSH = ${WITH_ZSH}
1243
1244 # Combined flags for compiling and linking against all of the above
1245 COMMON_CONFIGURE_CFLAGS = \\
1246         \$(GMIME_CFLAGS) \$(TALLOC_CFLAGS) \$(ZLIB_CFLAGS)      \\
1247         -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \$(VALGRIND_CFLAGS)   \\
1248         -DHAVE_GETLINE=\$(HAVE_GETLINE)                         \\
1249         -DWITH_EMACS=\$(WITH_EMACS)                             \\
1250         -DHAVE_CANONICALIZE_FILE_NAME=\$(HAVE_CANONICALIZE_FILE_NAME) \\
1251         -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)                   \\
1252         -DHAVE_STRSEP=\$(HAVE_STRSEP)                           \\
1253         -DHAVE_TIMEGM=\$(HAVE_TIMEGM)                           \\
1254         -DHAVE_D_TYPE=\$(HAVE_D_TYPE)                           \\
1255         -DSTD_GETPWUID=\$(STD_GETPWUID)                         \\
1256         -DSTD_ASCTIME=\$(STD_ASCTIME)                           \\
1257         -DHAVE_GMIME_SESSION_KEYS=\$(HAVE_GMIME_SESSION_KEYS)   \\
1258         -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)           \\
1259         -DSILENCE_XAPIAN_DEPRECATION_WARNINGS                   \\
1260         -DHAVE_XAPIAN_FIELD_PROCESSOR=\$(HAVE_XAPIAN_FIELD_PROCESSOR) \\
1261         -DHAVE_XAPIAN_DB_RETRY_LOCK=\$(HAVE_XAPIAN_DB_RETRY_LOCK)
1262
1263 CONFIGURE_CFLAGS = \$(COMMON_CONFIGURE_CFLAGS)
1264
1265 CONFIGURE_CXXFLAGS = \$(COMMON_CONFIGURE_CFLAGS) \$(XAPIAN_CXXFLAGS)
1266
1267 CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)
1268 EOF
1269
1270 # construct the sh.config
1271 cat > sh.config <<EOF
1272 # This sh.config was automatically generated by the ./configure
1273 # script of notmuch.
1274
1275 NOTMUCH_SRCDIR='${NOTMUCH_SRCDIR}'
1276
1277 # Whether the Xapian version in use supports compaction
1278 NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
1279
1280 # Whether the Xapian version in use supports field processors
1281 NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR=${have_xapian_field_processor}
1282
1283 # Whether the Xapian version in use supports lock retry
1284 NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${have_xapian_db_retry_lock}
1285
1286 # Whether the GMime version can handle extraction and reuse of session keys
1287 NOTMUCH_HAVE_GMIME_SESSION_KEYS=${have_gmime_session_keys}
1288
1289 # Which backend will Xapian use by default?
1290 NOTMUCH_DEFAULT_XAPIAN_BACKEND=${default_xapian_backend}
1291
1292 # do we have man pages?
1293 NOTMUCH_HAVE_MAN=$((have_sphinx))
1294
1295 # Whether bash exists, and if so where
1296 NOTMUCH_HAVE_BASH=${have_bash}
1297 NOTMUCH_BASH_ABSOLUTE=${bash_absolute}
1298
1299 # Whether perl exists, and if so where
1300 NOTMUCH_HAVE_PERL=${have_perl}
1301 NOTMUCH_PERL_ABSOLUTE=${perl_absolute}
1302
1303 # Name of python interpreter
1304 NOTMUCH_PYTHON=${python}
1305
1306 # Name of ruby interpreter
1307 NOTMUCH_RUBY=${RUBY}
1308
1309 # Are the ruby development files (and ruby) available? If not skip
1310 # building/testing ruby bindings.
1311 NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
1312
1313 # Major version of gmime
1314 NOTMUCH_GMIME_MAJOR=${gmime_major}
1315
1316 # Platform we are run on
1317 PLATFORM=${platform}
1318 EOF
1319
1320 # Finally, after everything configured, inform the user how to continue.
1321 cat <<EOF
1322
1323 All required packages were found. You may now run the following
1324 commands to compile and install notmuch:
1325
1326         make
1327         sudo make install
1328
1329 EOF