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 subdirs="util compat lib parse-time-string completion doc emacs"
30 subdirs="${subdirs} performance-test test test/test-databases"
31 subdirs="${subdirs} bindings"
33 # For a non-srcdir configure invocation (such as ../configure), create
34 # the directory structure and copy Makefiles.
35 if [ "$srcdir" != "." ]; then
37 for dir in . ${subdirs}; do
39 cp "$srcdir"/"$dir"/Makefile.local "$dir"
40 cp "$srcdir"/"$dir"/Makefile "$dir"
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
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).
50 cp -a "$srcdir"/bindings/ruby/*.[ch] bindings/ruby
51 cp -a "$srcdir"/bindings/ruby/extconf.rb bindings/ruby
54 # Set several defaults (optionally specified by the user in
55 # environment variables)
56 BASHCMD=${BASHCMD:-bash}
60 CFLAGS=${CFLAGS:--g -O2}
61 CPPFLAGS=${CPPFLAGS:-}
62 CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
63 CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
65 XAPIAN_CONFIG=${XAPIAN_CONFIG:-}
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).
76 # Set the defaults for values the user can specify with command-line
92 Usage: ./configure [options]...
94 This script configures notmuch to build on your system.
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.
101 Finally, it allows you to control various aspects of the build and
102 installation process.
104 First, some common variables can specified via environment variables:
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
113 Each of these values can further be controlled by specifying them
114 later on the "make" command line.
116 Other environment variables can be used to control configure itself,
117 (and for which there is no equivalent build-time control):
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.
127 Additionally, various options can be specified on the configure
130 --prefix=PREFIX Install files in PREFIX [$PREFIX]
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:
137 ./configure --prefix=\$HOME
139 Fine tuning of some installation directories is available:
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]
151 Some features can be disabled (--with-feature=no is equivalent to
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
163 Additional options are accepted for compatibility with other
164 configure-script calling conventions, but don't do anything yet:
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
177 # Parse command-line options
179 if [ "${option}" = '--help' ] ; then
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
209 elif [ "${option}" = '--without-docs' ] ; then
212 elif [ "${option%%=*}" = '--with-api-docs' ]; then
213 if [ "${option#*=}" = 'no' ]; then
218 elif [ "${option}" = '--without-api-docs' ] ; then
220 elif [ "${option%%=*}" = '--with-emacs' ]; then
221 if [ "${option#*=}" = 'no' ]; then
226 elif [ "${option}" = '--without-emacs' ] ; then
228 elif [ "${option%%=*}" = '--with-desktop' ]; then
229 if [ "${option#*=}" = 'no' ]; then
234 elif [ "${option}" = '--without-desktop' ] ; then
236 elif [ "${option%%=*}" = '--with-bash-completion' ]; then
237 if [ "${option#*=}" = 'no' ]; then
242 elif [ "${option}" = '--without-bash-completion' ] ; then
244 elif [ "${option%%=*}" = '--with-ruby' ]; then
245 if [ "${option#*=}" = 'no' ]; then
250 elif [ "${option}" = '--without-ruby' ] ; then
252 elif [ "${option%%=*}" = '--with-retry-lock' ]; then
253 if [ "${option#*=}" = 'no' ]; then
258 elif [ "${option}" = '--without-retry-lock' ] ; then
260 elif [ "${option%%=*}" = '--with-zsh-completion' ]; then
261 if [ "${option#*=}" = 'no' ]; then
266 elif [ "${option}" = '--without-zsh-completion' ] ; then
268 elif [ "${option%%=*}" = '--build' ] ; then
270 elif [ "${option%%=*}" = '--host' ] ; then
272 elif [ "${option%%=*}" = '--datadir' ] ; then
274 elif [ "${option%%=*}" = '--localstatedir' ] ; then
276 elif [ "${option%%=*}" = '--libexecdir' ] ; then
278 elif [ "${option}" = '--disable-maintainer-mode' ] ; then
280 elif [ "${option}" = '--disable-dependency-tracking' ] ; then
283 echo "Unrecognized option: ${option}"
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
295 if [ -z "$LIBDIR" ] ; then
296 libdir_expanded="${PREFIX}/lib"
298 # very non-general variable expansion
299 libdir_expanded=$(printf %s "$LIBDIR" | sed "s|\${prefix}|${PREFIX}|; s|\$prefix\>|${PREFIX}|; s|//*|/|g")
303 Welcome to Notmuch, a system for indexing, searching and tagging your email.
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.
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.
317 We'll now investigate your system to verify that all required
318 dependencies are available:
323 printf "int main(void){return 0;}\n" > minimal.c
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
332 errors=$((errors + 1))
333 printf Executed:; printf ' %s' ${test_cmdline}; echo
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
344 errors=$((errors + 1))
345 printf Executed:; printf ' %s' ${test_cmdline}; echo
350 if [ $errors -gt 0 ]; then
352 *** Error: Initial sanity checking of environment failed. Please try
353 running configure in a clean environment, and if the problem persists,
356 rm -f minimal minimal.c
360 printf "Reading libnotmuch version from source... "
361 cat > _libversion.c <<EOF
363 #include "lib/notmuch.h"
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);
374 if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
375 && ./_libversion > _libversion.sh && . ./_libversion.sh
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.
385 rm -f _libversion _libversion.c _libversion.sh
389 if pkg-config --version > /dev/null 2>&1; then
395 printf "Checking for Xapian development files... "
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}
402 xapian_cxxflags=$(${xapian_config} --cxxflags)
403 xapian_ldflags=$(${xapian_config} --libs)
407 if [ ${have_xapian} = "0" ]; then
409 errors=$((errors + 1))
412 have_xapian_compact=0
413 have_xapian_field_processor=0
414 if [ ${have_xapian} = "1" ]; then
415 printf "Checking for Xapian compaction support... "
418 class TestCompactor : public Xapian::Compactor { };
420 if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _compact.cc -o _compact.o > /dev/null 2>&1
422 have_xapian_compact=1
426 errors=$((errors + 1))
429 rm -f _compact.o _compact.cc
431 printf "Checking for Xapian FieldProcessor API... "
432 cat>_field_processor.cc<<EOF
434 class TitleFieldProcessor : public Xapian::FieldProcessor { };
436 if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _field_processor.cc -o _field_processor.o > /dev/null 2>&1
438 have_xapian_field_processor=1
441 printf "No. (optional)\n"
444 rm -f _field_processor.o _field_processor.cc
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... "
453 int flag = Xapian::DB_RETRY_LOCK;
455 if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _retry.cc -o _retry.o > /dev/null 2>&1
457 have_xapian_db_retry_lock=1
460 printf "No. (optional)\n"
462 rm -f _retry.o _retry.cc
465 printf "Testing default Xapian backend... "
466 cat >_default_backend.cc <<EOF
468 int main(int argc, char** argv) {
469 Xapian::WritableDatabase db("test.db",Xapian::DB_CREATE_OR_OPEN);
472 ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} _default_backend.cc -o _default_backend ${xapian_ldflags}
474 if [ -f test.db/iamglass ]; then
475 default_xapian_backend=glass
477 default_xapian_backend=chert
479 printf "%s\n" "${default_xapian_backend}";
480 rm -rf test.db _default_backend _default_backend.cc
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.
488 printf "Checking for GMime development files... "
489 if pkg-config --exists "gmime-3.0 > $GMIME3_MINVER"; then
490 printf "Yes (3.0).\n"
492 gmime_cflags=$(pkg-config --cflags gmime-3.0)
493 gmime_ldflags=$(pkg-config --libs gmime-3.0)
495 have_gmime_session_keys=1
496 elif pkg-config --exists "gmime-2.6 >= $GMIME_MINVER"; then
497 printf "Yes (2.6).\n"
499 gmime_cflags=$(pkg-config --cflags gmime-2.6)
500 gmime_ldflags=$(pkg-config --libs gmime-2.6)
502 if pkg-config --exists "gmime-2.6 >= 2.6.21"; then
503 have_gmime_session_keys=1
505 have_gmime_session_keys=0
509 have_gmime_session_keys=0
511 errors=$((errors + 1))
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)... "
518 if pkg-config --exists 'glib-2.0 >= 2.22'; then
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)
526 errors=$((errors + 1))
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
537 printf "Checking for zlib (>= 1.2.5.2)... "
539 if pkg-config --atleast-version=1.2.5.2 zlib; then
542 zlib_cflags=$(pkg-config --cflags zlib)
543 zlib_ldflags=$(pkg-config --libs zlib)
546 errors=$((errors + 1))
549 printf "Checking for talloc development files... "
550 if pkg-config --exists talloc; then
553 talloc_cflags=$(pkg-config --cflags talloc)
554 talloc_ldflags=$(pkg-config --libs talloc)
559 errors=$((errors + 1))
562 printf "Checking for bash... "
563 if command -v ${BASHCMD} > /dev/null; then
565 bash_absolute=$(command -v ${BASHCMD})
566 printf "Yes (%s).\n" "$bash_absolute"
569 printf "No. (%s not found)\n" "${BASHCMD}"
572 printf "Checking for perl... "
573 if command -v ${PERL} > /dev/null; then
575 perl_absolute=$(command -v ${PERL})
576 printf "Yes (%s).\n" "$perl_absolute"
579 printf "No. (%s not found)\n" "${PERL}"
582 printf "Checking for python... "
585 for name in ${PYTHON} python3 python python2; do
586 if command -v $name > /dev/null; then
589 printf "Yes (%s).\n" "$name"
594 if [ $have_python -eq 0 ]; then
596 errors=$((errors + 1))
599 printf "Checking for valgrind development files... "
600 if pkg-config --exists valgrind; then
603 valgrind_cflags=$(pkg-config --cflags valgrind)
605 printf "No (but that's fine).\n"
610 printf "Checking for bash-completion (>= 1.90)... "
611 if pkg-config --atleast-version=1.90 bash-completion; then
614 printf "No (will not install bash completion).\n"
618 if [ -z "${EMACSLISPDIR-}" ]; then
619 EMACSLISPDIR="\$(prefix)/share/emacs/site-lisp"
622 if [ -z "${EMACSETCDIR-}" ]; then
623 EMACSETCDIR="\$(prefix)/share/emacs/site-lisp"
626 printf "Checking if emacs is available... "
627 if emacs --quick --batch > /dev/null 2>&1; then
631 printf "No (so will not byte-compile emacs code)\n"
636 if [ $WITH_API_DOCS = "1" ] ; then
637 printf "Checking if doxygen is available... "
638 if command -v doxygen > /dev/null; then
642 printf "No (so will not install api docs)\n"
647 if [ $WITH_RUBY = "1" ] ; then
648 printf "Checking for ruby development files... "
649 if ${RUBY} -e "require 'mkmf'"> /dev/null 2>&1; then
653 printf "No (skipping ruby bindings)\n"
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
666 printf "No (so will not install man pages).\n"
668 printf "Checking if makeinfo is available... "
669 if command -v makeinfo > /dev/null; then
673 printf "No (so will not build info pages).\n"
675 printf "Checking if install-info is available... "
676 if command -v install-info > /dev/null; then
680 printf "No (so will not install info pages).\n"
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
689 printf "No (so will not install .desktop file).\n"
694 printf "Checking for cppcheck... "
695 if command -v cppcheck > /dev/null; then
705 printf "Checking which platform we are on... "
707 if [ $uname = "Darwin" ] ; then
710 linker_resolves_library_dependencies=0
711 elif [ $uname = "SunOS" ] ; then
714 linker_resolves_library_dependencies=0
715 elif [ $uname = "FreeBSD" ] ; then
718 linker_resolves_library_dependencies=0
719 elif [ $uname = "OpenBSD" ] ; then
722 linker_resolves_library_dependencies=0
723 elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
724 printf "%s\n" "$uname"
726 linker_resolves_library_dependencies=1
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:
736 # because the shell's command substitution deletes any trailing newlines.
739 for path in $ldconfig_paths; do
740 if [ "$path" -ef "$libdir_expanded" ]; then
745 if [ "$libdir_in_ldconfig" = '0' ]; then
746 printf "No (will set RPATH)\n"
753 linker_resolves_library_dependencies=0
756 *** Warning: Unknown platform. Notmuch might or might not build correctly.
761 if [ $errors -gt 0 ]; then
764 *** Error: The dependencies of notmuch could not be satisfied. You will
765 need to install the following packages before being able to compile
769 if [ $have_python -eq 0 ]; then
770 echo " python interpreter"
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/"
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/"
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/"
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/"
792 if [ $have_talloc -eq 0 ]; then
793 echo " The talloc library (including development files such as headers)"
794 echo " https://talloc.samba.org/"
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:
802 On Debian and similar systems:
804 sudo apt-get install libxapian-dev libgmime-2.6-dev libtalloc-dev zlib1g-dev
806 Or on Fedora and similar systems:
808 sudo yum install xapian-core-devel gmime-devel libtalloc-devel zlib-devel
810 On other systems, similar commands can be used, but the details of the
811 package names may be different.
814 if [ $have_pkg_config -eq 0 ]; then
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:
821 sudo apt-get install pkg-config
823 sudo yum install pkgconfig
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.
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.
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
845 have_canonicalize_file_name=1
847 printf "No (will use our own instead).\n"
848 have_canonicalize_file_name=0
850 rm -f compat/have_canonicalize_file_name
853 printf "Checking for getline... "
854 if ${CC} -o compat/have_getline "$srcdir"/compat/have_getline.c > /dev/null 2>&1
859 printf "No (will use our own instead).\n"
862 rm -f compat/have_getline
864 printf "Checking for strcasestr... "
865 if ${CC} -o compat/have_strcasestr "$srcdir"/compat/have_strcasestr.c > /dev/null 2>&1
870 printf "No (will use our own instead).\n"
873 rm -f compat/have_strcasestr
875 printf "Checking for strsep... "
876 if ${CC} -o compat/have_strsep "$srcdir"/compat/have_strsep.c > /dev/null 2>&1
881 printf "No (will use our own instead).\n"
884 rm -f compat/have_strsep
886 printf "Checking for timegm... "
887 if ${CC} -o compat/have_timegm "$srcdir"/compat/have_timegm.c > /dev/null 2>&1
892 printf "No (will use our own instead).\n"
895 rm -f compat/have_timegm
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
903 printf "No (will use stat instead).\n"
906 rm -f compat/have_d_type
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
914 printf "No (will define _POSIX_PTHREAD_SEMANTICS to get it).\n"
917 rm -f compat/check_getpwuid
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
925 printf "No (will define _POSIX_PTHREAD_SEMANTICS to get it).\n"
928 rm -f compat/check_asctime
930 printf "Checking for rpath support... "
931 if ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1
934 rpath_ldflags="-Wl,--enable-new-dtags -Wl,-rpath,\$(libdir)"
936 printf "No (nothing to worry about).\n"
940 printf "Checking for -Wl,--as-needed... "
941 if ${CC} -Wl,--as-needed -o minimal minimal.c >/dev/null 2>&1
944 as_needed_ldflags="-Wl,--as-needed"
946 printf "No (nothing to worry about).\n"
950 printf "Checking for -Wl,--no-undefined... "
951 if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1
954 no_undefined_ldflags="-Wl,--no-undefined"
956 printf "No (nothing to worry about).\n"
957 no_undefined_ldflags=""
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
965 WARN_CXXFLAGS="${WARN_CXXFLAGS}${WARN_CXXFLAGS:+ }${flag}"
968 printf "\n\t%s\n" "${WARN_CXXFLAGS}"
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
975 WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}"
978 printf "\n\t%s\n" "${WARN_CFLAGS}"
980 rm -f minimal minimal.c _libversion.c _libversion _libversion.sh
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).
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).
995 NOTMUCH_SRCDIR = ${NOTMUCH_SRCDIR}
997 # subdirectories to build
1000 configure_options = $@
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).
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)
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).
1025 LIBNOTMUCH_VERSION_MAJOR = ${libnotmuch_version_major}
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
1031 LIBNOTMUCH_VERSION_MINOR = ${libnotmuch_version_minor}
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}
1038 # These are derived from the VERSION macros in lib/notmuch.h so
1039 # if you have to change them, something is wrong.
1041 # The C compiler to use
1044 # The C++ compiler to use
1047 # Command to execute emacs from Makefiles
1048 EMACS = emacs --quick
1050 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
1053 # Default FLAGS for C preprocessor (can be overridden by user such as "make CPPFLAGS=-I/usr/local/include")
1054 CPPFLAGS = ${CPPFLAGS}
1056 # Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
1057 CXXFLAGS = ${CXXFLAGS}
1059 # Default FLAGS for the linker (can be overridden by user such as "make LDFLAGS=-znow")
1060 LDFLAGS = ${LDFLAGS}
1062 # Flags to enable warnings when using the C++ compiler
1063 WARN_CXXFLAGS=${WARN_CXXFLAGS}
1065 # Flags to enable warnings when using the C compiler
1066 WARN_CFLAGS=${WARN_CFLAGS}
1068 # Name of python interpreter
1071 # Name of ruby interpreter
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.
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}
1084 # Whether libdir is in a path configured into ldconfig
1085 LIBDIR_IN_LDCONFIG = ${libdir_in_ldconfig}
1087 # The directory to which header files should be installed
1088 includedir = ${INCLUDEDIR:=\$(prefix)/include}
1090 # The directory to which man pages should be installed
1091 mandir = ${MANDIR:=\$(prefix)/share/man}
1093 # The directory to which man pages should be installed
1094 infodir = ${INFODIR:=\$(prefix)/share/info}
1096 # The directory to which read-only (configuration) files should be installed
1097 sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc}
1099 # The directory to which emacs lisp files should be installed
1100 emacslispdir=${EMACSLISPDIR}
1102 # The directory to which emacs miscellaneous (machine-independent) files should
1104 emacsetcdir=${EMACSETCDIR}
1106 # Whether bash exists, and if so where
1107 HAVE_BASH = ${have_bash}
1108 BASH_ABSOLUTE = ${bash_absolute}
1110 # Whether perl exists, and if so where
1111 HAVE_PERL = ${have_perl}
1112 PERL_ABSOLUTE = ${perl_absolute}
1114 # Whether there's an emacs binary available for byte-compiling
1115 HAVE_EMACS = ${have_emacs}
1117 # Whether there's a sphinx-build binary available for building documentation
1118 HAVE_SPHINX=${have_sphinx}
1120 # Whether there's a makeinfo binary available for building info format documentation
1121 HAVE_MAKEINFO=${have_makeinfo}
1123 # Whether there's an install-info binary available for installing info format documentation
1124 HAVE_INSTALL_INFO=${have_install_info}
1126 # Whether there's a doxygen binary available for building api documentation
1127 HAVE_DOXYGEN=${have_doxygen}
1129 # The directory to which desktop files should be installed
1130 desktop_dir = \$(prefix)/share/applications
1132 # The directory to which bash completions files should be installed
1133 bash_completion_dir = ${BASHCOMPLETIONDIR:=\$(prefix)/share/bash-completion/completions}
1135 # The directory to which zsh completions files should be installed
1136 zsh_completion_dir = ${ZSHCOMLETIONDIR:=\$(prefix)/share/zsh/functions/Completion/Unix}
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}
1142 # Whether the cppcheck static checker is available
1143 HAVE_CPPCHECK = ${have_cppcheck}
1145 # Whether the getline function is available (if not, then notmuch will
1146 # build its own version)
1147 HAVE_GETLINE = ${have_getline}
1149 # Are the ruby development files (and ruby) available? If not skip
1150 # building/testing ruby bindings.
1151 HAVE_RUBY_DEV = ${have_ruby_dev}
1153 # Whether the strcasestr function is available (if not, then notmuch will
1154 # build its own version)
1155 HAVE_STRCASESTR = ${have_strcasestr}
1157 # Whether the strsep function is available (if not, then notmuch will
1158 # build its own version)
1159 HAVE_STRSEP = ${have_strsep}
1161 # Whether the timegm function is available (if not, then notmuch will
1162 # build its own version)
1163 HAVE_TIMEGM = ${have_timegm}
1165 # Whether struct dirent has d_type (if not, then notmuch will use stat)
1166 HAVE_D_TYPE = ${have_d_type}
1168 # Whether the GMime version can handle extraction and reuse of session keys
1169 HAVE_GMIME_SESSION_KEYS = ${have_gmime_session_keys}
1171 # Whether the Xapian version in use supports compaction
1172 HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
1174 # Whether the Xapian version in use supports field processors
1175 HAVE_XAPIAN_FIELD_PROCESSOR = ${have_xapian_field_processor}
1177 # Whether the Xapian version in use supports DB_RETRY_LOCK
1178 HAVE_XAPIAN_DB_RETRY_LOCK = ${have_xapian_db_retry_lock}
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}
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}
1190 # Supported platforms (so far) are: LINUX, MACOSX, SOLARIS, FREEBSD, OPENBSD
1191 PLATFORM = ${platform}
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}
1198 # Flags needed to compile and link against Xapian
1199 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
1200 XAPIAN_LDFLAGS = ${xapian_ldflags}
1202 # Which backend will Xapian use by default?
1203 DEFAULT_XAPIAN_BACKEND = ${default_xapian_backend}
1205 # Flags needed to compile and link against GMime
1206 GMIME_CFLAGS = ${gmime_cflags}
1207 GMIME_LDFLAGS = ${gmime_ldflags}
1209 # Flags needed to compile and link against zlib
1210 ZLIB_CFLAGS = ${zlib_cflags}
1211 ZLIB_LDFLAGS = ${zlib_ldflags}
1213 # Flags needed to compile and link against talloc
1214 TALLOC_CFLAGS = ${talloc_cflags}
1215 TALLOC_LDFLAGS = ${talloc_ldflags}
1217 # Flags needed to have linker set rpath attribute
1218 RPATH_LDFLAGS = ${rpath_ldflags}
1220 # Flags needed to have linker link only to necessary libraries
1221 AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
1223 # Flags to have the linker flag undefined symbols in object files
1224 NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}
1226 # Whether valgrind header files are available
1227 HAVE_VALGRIND = ${have_valgrind}
1229 # And if so, flags needed at compile time for valgrind macros
1230 VALGRIND_CFLAGS = ${valgrind_cflags}
1233 WITH_EMACS = ${WITH_EMACS}
1235 # Support for desktop file
1236 WITH_DESKTOP = ${WITH_DESKTOP}
1238 # Support for bash completion
1239 WITH_BASH = ${WITH_BASH}
1241 # Support for zsh completion
1242 WITH_ZSH = ${WITH_ZSH}
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)
1263 CONFIGURE_CFLAGS = \$(COMMON_CONFIGURE_CFLAGS)
1265 CONFIGURE_CXXFLAGS = \$(COMMON_CONFIGURE_CFLAGS) \$(XAPIAN_CXXFLAGS)
1267 CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)
1270 # construct the sh.config
1271 cat > sh.config <<EOF
1272 # This sh.config was automatically generated by the ./configure
1273 # script of notmuch.
1275 NOTMUCH_SRCDIR='${NOTMUCH_SRCDIR}'
1277 # Whether the Xapian version in use supports compaction
1278 NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
1280 # Whether the Xapian version in use supports field processors
1281 NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR=${have_xapian_field_processor}
1283 # Whether the Xapian version in use supports lock retry
1284 NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${have_xapian_db_retry_lock}
1286 # Whether the GMime version can handle extraction and reuse of session keys
1287 NOTMUCH_HAVE_GMIME_SESSION_KEYS=${have_gmime_session_keys}
1289 # Which backend will Xapian use by default?
1290 NOTMUCH_DEFAULT_XAPIAN_BACKEND=${default_xapian_backend}
1292 # do we have man pages?
1293 NOTMUCH_HAVE_MAN=$((have_sphinx))
1295 # Whether bash exists, and if so where
1296 NOTMUCH_HAVE_BASH=${have_bash}
1297 NOTMUCH_BASH_ABSOLUTE=${bash_absolute}
1299 # Whether perl exists, and if so where
1300 NOTMUCH_HAVE_PERL=${have_perl}
1301 NOTMUCH_PERL_ABSOLUTE=${perl_absolute}
1303 # Name of python interpreter
1304 NOTMUCH_PYTHON=${python}
1306 # Name of ruby interpreter
1307 NOTMUCH_RUBY=${RUBY}
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}
1313 # Major version of gmime
1314 NOTMUCH_GMIME_MAJOR=${gmime_major}
1316 # Platform we are run on
1317 PLATFORM=${platform}
1320 # Finally, after everything configured, inform the user how to continue.
1323 All required packages were found. You may now run the following
1324 commands to compile and install notmuch: