X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=configure;h=1e7b9f7a47e1a2efc40e6dc1d8f513bb0a73a672;hp=ab42f9474edcf0e8f368feacc751e0bfe65da2d1;hb=b23902a61158ecdbca2d9d96c6eaf509d6e3d205;hpb=1aa6f90a10794951365626830e8ebf29cf3736c8 diff --git a/configure b/configure index ab42f947..1e7b9f7a 100755 --- a/configure +++ b/configure @@ -19,7 +19,12 @@ To work around this problem you may try to execute: # Store original IFS value so it can be changed (and restored) in many places. readonly DEFAULT_IFS="$IFS" +# The top-level directory for the source. This ./configure and all Makefiles +# are good with ${srcdir} usually being relative. Some components (e.g. tests) +# are executed in subdirectories and for those it is simpler to use +# ${NOTMUCH_SRCDIR} which holds absolute path to the source. srcdir=$(dirname "$0") +NOTMUCH_SRCDIR=$(cd "$srcdir" && pwd) subdirs="util compat lib parse-time-string completion doc emacs" subdirs="${subdirs} performance-test test test/test-databases" @@ -35,17 +40,21 @@ if [ "$srcdir" != "." ]; then cp "$srcdir"/"$dir"/Makefile "$dir" done - # Easiest way to get the test suite to work is to just copy the - # whole thing into the build directory. - cp -a "$srcdir"/test/* test - # Emacs only likes to generate compiled files next to the .el files # by default so copy these as well (which is not ideal). cp -a "$srcdir"/emacs/*.el emacs + + # We were not able to create fully working Makefile using ruby mkmf.rb + # so ruby bindings source files are copied as well (ditto -- not ideal). + mkdir bindings/ruby + cp -a "$srcdir"/bindings/ruby/*.[ch] bindings/ruby + cp -a "$srcdir"/bindings/ruby/extconf.rb bindings/ruby fi # Set several defaults (optionally specified by the user in # environment variables) +BASHCMD=${BASHCMD:-bash} +PERL=${PERL:-perl} CC=${CC:-cc} CXX=${CXX:-c++} CFLAGS=${CFLAGS:--g -O2} @@ -55,6 +64,7 @@ CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)} LDFLAGS=${LDFLAGS:-} XAPIAN_CONFIG=${XAPIAN_CONFIG:-} PYTHON=${PYTHON:-} +RUBY=${RUBY:-ruby} # We don't allow the EMACS or GZIP Makefile variables inherit values # from the environment as we do with CC and CXX above. The reason is @@ -68,10 +78,14 @@ PYTHON=${PYTHON:-} PREFIX=/usr/local LIBDIR= WITH_DOCS=1 +WITH_API_DOCS=1 WITH_EMACS=1 +WITH_DESKTOP=1 WITH_BASH=1 +WITH_RPATH=1 WITH_RUBY=1 WITH_ZSH=1 +WITH_RETRY_LOCK=1 usage () { @@ -108,6 +122,8 @@ Other environment variables can be used to control configure itself, library. [$XAPIAN_CONFIG] PYTHON Name of python command to use in configure and the test suite. + RUBY Name of ruby command to use in + configure and the test suite. Additionally, various options can be specified on the configure command line. @@ -126,27 +142,30 @@ Fine tuning of some installation directories is available: --libdir=DIR Install libraries to DIR [PREFIX/lib] --includedir=DIR Install header files to DIR [PREFIX/include] --mandir=DIR Install man pages to DIR [PREFIX/share/man] + --infodir=DIR Install man pages to DIR [PREFIX/share/man] --sysconfdir=DIR Read-only single-machine data [PREFIX/etc] --emacslispdir=DIR Emacs code [PREFIX/share/emacs/site-lisp] --emacsetcdir=DIR Emacs miscellaneous files [PREFIX/share/emacs/site-lisp] - --bashcompletiondir=DIR Bash completions files [SYSCONFDIR/bash_completion.d] + --bashcompletiondir=DIR Bash completions files [PREFIX/share/bash-completion/completions] --zshcompletiondir=DIR Zsh completions files [PREFIX/share/zsh/functions/Completion/Unix] Some features can be disabled (--with-feature=no is equivalent to --without-feature) : --without-bash-completion Do not install bash completions files - --without-docs Do not install documentation and man pages + --without-docs Do not install documentation + --without-api-docs Do not install API man page --without-emacs Do not install lisp file + --without-desktop Do not install desktop file --without-ruby Do not install ruby bindings --without-zsh-completion Do not install zsh completions files + --without-retry-lock Do not use blocking xapian opens, even if available Additional options are accepted for compatibility with other configure-script calling conventions, but don't do anything yet: --build=-- Currently ignored --host=-- Currently ignored - --infodir=DIR Currently ignored --datadir=DIR Currently ignored --localstatedir=DIR Currently ignored --libexecdir=DIR Currently ignored @@ -169,6 +188,8 @@ for option; do INCLUDEDIR="${option#*=}" elif [ "${option%%=*}" = '--mandir' ] ; then MANDIR="${option#*=}" + elif [ "${option%%=*}" = '--infodir' ] ; then + INFODIR="${option#*=}" elif [ "${option%%=*}" = '--sysconfdir' ] ; then SYSCONFDIR="${option#*=}" elif [ "${option%%=*}" = '--emacslispdir' ] ; then @@ -182,11 +203,21 @@ for option; do elif [ "${option%%=*}" = '--with-docs' ]; then if [ "${option#*=}" = 'no' ]; then WITH_DOCS=0 + WITH_API_DOCS=0 else WITH_DOCS=1 fi elif [ "${option}" = '--without-docs' ] ; then WITH_DOCS=0 + WITH_API_DOCS=0 + elif [ "${option%%=*}" = '--with-api-docs' ]; then + if [ "${option#*=}" = 'no' ]; then + WITH_API_DOCS=0 + else + WITH_API_DOCS=1 + fi + elif [ "${option}" = '--without-api-docs' ] ; then + WITH_API_DOCS=0 elif [ "${option%%=*}" = '--with-emacs' ]; then if [ "${option#*=}" = 'no' ]; then WITH_EMACS=0 @@ -195,6 +226,14 @@ for option; do fi elif [ "${option}" = '--without-emacs' ] ; then WITH_EMACS=0 + elif [ "${option%%=*}" = '--with-desktop' ]; then + if [ "${option#*=}" = 'no' ]; then + WITH_DESKTOP=0 + else + WITH_DESKTOP=1 + fi + elif [ "${option}" = '--without-desktop' ] ; then + WITH_DESKTOP=0 elif [ "${option%%=*}" = '--with-bash-completion' ]; then if [ "${option#*=}" = 'no' ]; then WITH_BASH=0 @@ -203,6 +242,14 @@ for option; do fi elif [ "${option}" = '--without-bash-completion' ] ; then WITH_BASH=0 + elif [ "${option%%=*}" = '--with-rpath' ]; then + if [ "${option#*=}" = 'no' ]; then + WITH_RPATH=0 + else + WITH_RPATH=1 + fi + elif [ "${option}" = '--without-rpath' ] ; then + WITH_RPATH=0 elif [ "${option%%=*}" = '--with-ruby' ]; then if [ "${option#*=}" = 'no' ]; then WITH_RUBY=0 @@ -211,6 +258,14 @@ for option; do fi elif [ "${option}" = '--without-ruby' ] ; then WITH_RUBY=0 + elif [ "${option%%=*}" = '--with-retry-lock' ]; then + if [ "${option#*=}" = 'no' ]; then + WITH_RETRY_LOCK=0 + else + WITH_RETRY_LOCK=1 + fi + elif [ "${option}" = '--without-retry-lock' ] ; then + WITH_RETRY_LOCK=0 elif [ "${option%%=*}" = '--with-zsh-completion' ]; then if [ "${option#*=}" = 'no' ]; then WITH_ZSH=0 @@ -223,8 +278,6 @@ for option; do true elif [ "${option%%=*}" = '--host' ] ; then true - elif [ "${option%%=*}" = '--infodir' ] ; then - true elif [ "${option%%=*}" = '--datadir' ] ; then true elif [ "${option%%=*}" = '--localstatedir' ] ; then @@ -252,7 +305,7 @@ if [ -z "$LIBDIR" ] ; then libdir_expanded="${PREFIX}/lib" else # very non-general variable expansion - libdir_expanded=$(echo "$LIBDIR" | sed "s|\\${prefix}|${PREFIX}|g; s|\\$prefix/|${PREFIX}/|; s|//*|/|g") + libdir_expanded=$(printf %s "$LIBDIR" | sed "s|\${prefix}|${PREFIX}|; s|\$prefix\>|${PREFIX}|; s|//*|/|g") fi cat < minimal.c printf "Sanity checking C compilation environment... " -if ${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1 +test_cmdline="${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal" +if ${test_cmdline} > /dev/null 2>&1 then printf "OK.\n" else printf "Fail.\n" errors=$((errors + 1)) + printf Executed:; printf ' %s' ${test_cmdline}; echo + ${test_cmdline} fi printf "Sanity checking C++ compilation environment... " -if ${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1 +test_cmdline="${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal" +if ${test_cmdline} > /dev/null 2>&1 then printf "OK.\n" else printf "Fail.\n" errors=$((errors + 1)) + printf Executed:; printf ' %s' ${test_cmdline}; echo + ${test_cmdline} fi +unset test_cmdline if [ $errors -gt 0 ]; then cat < /dev/null 2>&1 && \ - ./_libversion > _libversion.sh && . ./_libversion.sh +if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \ + && ./_libversion > _libversion.sh && . ./_libversion.sh then printf "OK.\n" else @@ -372,6 +432,7 @@ EOF printf "Yes.\n" else printf "No.\n" + errors=$((errors + 1)) fi rm -f _compact.o _compact.cc @@ -392,6 +453,24 @@ EOF rm -f _field_processor.o _field_processor.cc default_xapian_backend="" + # DB_RETRY_LOCK is only supported on Xapian > 1.3.2 + have_xapian_db_retry_lock=0 + if [ $WITH_RETRY_LOCK = "1" ]; then + printf "Checking for Xapian lock retry support... " + cat>_retry.cc< +int flag = Xapian::DB_RETRY_LOCK; +EOF + if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _retry.cc -o _retry.o > /dev/null 2>&1 + then + have_xapian_db_retry_lock=1 + printf "Yes.\n" + else + printf "No. (optional)\n" + fi + rm -f _retry.o _retry.cc + fi + printf "Testing default Xapian backend... " cat >_default_backend.cc < @@ -410,16 +489,76 @@ EOF rm -rf test.db _default_backend _default_backend.cc fi -# we need to have a version >= 2.6.5 to avoid a crypto bug. We need -# 2.6.7 for permissive "From " header handling. -GMIME_MINVER=2.6.7 +GMIME_MINVER=3.0.3 printf "Checking for GMime development files... " -if pkg-config --exists "gmime-2.6 >= $GMIME_MINVER"; then +if pkg-config --exists "gmime-3.0 > $GMIME_MINVER"; then printf "Yes.\n" have_gmime=1 - gmime_cflags=$(pkg-config --cflags gmime-2.6) - gmime_ldflags=$(pkg-config --libs gmime-2.6) + gmime_cflags=$(pkg-config --cflags gmime-3.0) + gmime_ldflags=$(pkg-config --libs gmime-3.0) + + printf "Checking for GMime session key extraction support... " + + cat > _check_session_keys.c < +#include + +int main () { + GError *error = NULL; + GMimeParser *parser = NULL; + GMimeMultipartEncrypted *body = NULL; + GMimeDecryptResult *decrypt_result = NULL; + GMimeObject *output = NULL; + + g_mime_init (); + parser = g_mime_parser_new (); + g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("test/corpora/crypto/basic-encrypted.eml", "r", &error)); + if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/crypto/basic-encrypted.eml\n"); + + body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL))); + if (body == NULL) return !! fprintf (stderr, "did not find a multipart encrypted message\n"); + + output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_EXPORT_SESSION_KEY, NULL, &decrypt_result, &error); + if (error || output == NULL) return !! fprintf (stderr, "decryption failed\n"); + + if (decrypt_result == NULL) return !! fprintf (stderr, "no GMimeDecryptResult found\n"); + if (decrypt_result->session_key == NULL) return !! fprintf (stderr, "GMimeDecryptResult has no session key\n"); + + printf ("%s\n", decrypt_result->session_key); + return 0; +} +EOF + if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then + printf 'No.\nCould not make tempdir for testing session-key support.\n' + errors=$((errors + 1)) + elif ${CC} ${CFLAGS} ${gmime_cflags} _check_session_keys.c ${gmime_ldflags} -o _check_session_keys \ + && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < test/gnupg-secret-key.asc \ + && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \ + && [ $SESSION_KEY = 9:0BACD64099D1468AB07C796F0C0AC4851948A658A15B34E803865E9FC635F2F5 ] + then + printf "OK.\n" + else + cat </dev/null; then + printf 'Your current GPGME development version is: %s\n' "$(gpgme-config --version)" + else + printf 'You do not have the GPGME development libraries installed.\n' + fi + errors=$((errors + 1)) + fi + if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then + rm -rf "$TEMP_GPG" + fi else have_gmime=0 printf "No.\n" @@ -442,8 +581,7 @@ else fi if ! pkg-config --exists zlib; then - ${CC} ${zlib_cflags} -o compat/gen_zlib_pc \ - "$srcdir"/compat/gen_zlib_pc.c ${zlib_ldflags} > /dev/null 2>&1 && + ${CC} -o compat/gen_zlib_pc "$srcdir"/compat/gen_zlib_pc.c >/dev/null 2>&1 && compat/gen_zlib_pc > compat/zlib.pc && PKG_CONFIG_PATH="$PKG_CONFIG_PATH":compat && export PKG_CONFIG_PATH @@ -475,10 +613,30 @@ else errors=$((errors + 1)) fi +printf "Checking for bash... " +if command -v ${BASHCMD} > /dev/null; then + have_bash=1 + bash_absolute=$(command -v ${BASHCMD}) + printf "Yes (%s).\n" "$bash_absolute" +else + have_bash=0 + printf "No. (%s not found)\n" "${BASHCMD}" +fi + +printf "Checking for perl... " +if command -v ${PERL} > /dev/null; then + have_perl=1 + perl_absolute=$(command -v ${PERL}) + printf "Yes (%s).\n" "$perl_absolute" +else + have_perl=0 + printf "No. (%s not found)\n" "${PERL}" +fi + printf "Checking for python... " have_python=0 -for name in ${PYTHON} python python2 python3; do +for name in ${PYTHON} python3 python python2; do if command -v $name > /dev/null; then have_python=1 python=$name @@ -519,17 +677,18 @@ if [ -z "${EMACSETCDIR-}" ]; then EMACSETCDIR="\$(prefix)/share/emacs/site-lisp" fi -printf "Checking if emacs is available... " -if emacs --quick --batch > /dev/null 2>&1; then - printf "Yes.\n" - have_emacs=1 -else - printf "No (so will not byte-compile emacs code)\n" - have_emacs=0 +if [ $WITH_EMACS = "1" ]; then + printf "Checking if emacs (>= 24) is available... " + if emacs --quick --batch --eval '(if (< emacs-major-version 24) (kill-emacs 1))' > /dev/null 2>&1; then + printf "Yes.\n" + else + printf "No (disabling emacs related parts of build)\n" + WITH_EMACS=0 + fi fi have_doxygen=0 -if [ $WITH_DOCS = "1" ] ; then +if [ $WITH_API_DOCS = "1" ] ; then printf "Checking if doxygen is available... " if command -v doxygen > /dev/null; then printf "Yes.\n" @@ -542,7 +701,7 @@ fi have_ruby_dev=0 if [ $WITH_RUBY = "1" ] ; then printf "Checking for ruby development files... " - if ruby -e "require 'mkmf'"> /dev/null 2>&1; then + if ${RUBY} -e "require 'mkmf'"> /dev/null 2>&1; then printf "Yes.\n" have_ruby_dev=1 else @@ -551,6 +710,8 @@ if [ $WITH_RUBY = "1" ] ; then fi have_sphinx=0 +have_makeinfo=0 +have_install_info=0 if [ $WITH_DOCS = "1" ] ; then printf "Checking if sphinx is available and supports nroff output... " if command -v sphinx-build > /dev/null && ${python} -m sphinx.writers.manpage > /dev/null 2>&1 ; then @@ -559,6 +720,39 @@ if [ $WITH_DOCS = "1" ] ; then else printf "No (so will not install man pages).\n" fi + printf "Checking if makeinfo is available... " + if command -v makeinfo > /dev/null; then + printf "Yes.\n" + have_makeinfo=1 + else + printf "No (so will not build info pages).\n" + fi + printf "Checking if install-info is available... " + if command -v install-info > /dev/null; then + printf "Yes.\n" + have_install_info=1 + else + printf "No (so will not install info pages).\n" + fi +fi + +if [ $WITH_DESKTOP = "1" ]; then + printf "Checking if desktop-file-install is available... " + if command -v desktop-file-install > /dev/null; then + printf "Yes.\n" + else + printf "No (so will not install .desktop file).\n" + WITH_DESKTOP=0 + fi +fi + +printf "Checking for cppcheck... " +if command -v cppcheck > /dev/null; then + have_cppcheck=1 + printf "Yes.\n" +else + have_cppcheck=0 + printf "No.\n" fi libdir_in_ldconfig=0 @@ -598,7 +792,7 @@ elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then IFS=" " for path in $ldconfig_paths; do - if [ "$path" = "$libdir_expanded" ]; then + if [ "$path" -ef "$libdir_expanded" ]; then libdir_in_ldconfig=1 fi done @@ -610,6 +804,8 @@ elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then fi else printf "Unknown.\n" + platform="$uname" + linker_resolves_library_dependencies=0 cat < _byteorder.c < -#include -uint32_t test = 0x34333231; -int main() { printf("%.4s\n", (const char*)&test); return 0; } -EOF -${CC} ${CFLAGS} _byteorder.c -o _byteorder > /dev/null 2>&1 -util_byte_order=$(./_byteorder) -echo $util_byte_order - -rm -f _byteorder _byteorder.c - if [ $errors -gt 0 ]; then cat <= version 1.2.6, including development files such as headers)" + echo " https://xapian.org/" fi if [ $have_zlib -eq 0 ]; then echo " zlib library (>= version 1.2.5.2, including development files such as headers)" - echo " http://zlib.net/" + echo " https://zlib.net/" echo fi if [ $have_gmime -eq 0 ]; then - echo " GMime 2.6 library >= $GMIME_MINVER" + echo " GMime library >= $GMIME_MINVER" echo " (including development files such as headers)" - echo " http://spruce.sourceforge.net/gmime/" + echo " https://github.com/jstedfast/gmime/" echo fi if [ $have_glib -eq 0 ]; then echo " Glib library >= 2.22 (including development files such as headers)" - echo " http://ftp.gnome.org/pub/gnome/sources/glib/" + echo " https://ftp.gnome.org/pub/gnome/sources/glib/" echo fi if [ $have_talloc -eq 0 ]; then echo " The talloc library (including development files such as headers)" - echo " http://talloc.samba.org/" + echo " https://talloc.samba.org/" echo fi cat </dev/null 2>&1 +if [ $WITH_RPATH = "1" ] && ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1 then printf "Yes.\n" rpath_ldflags="-Wl,--enable-new-dtags -Wl,-rpath,\$(libdir)" @@ -849,7 +1032,7 @@ for flag in -Wmissing-declarations; do done printf "\n\t%s\n" "${WARN_CFLAGS}" -rm -f minimal minimal.c _libversion.c _libversion _libversion.sh +rm -f minimal minimal.c _libversion.c _libversion _libversion.sh _check_session_keys.c _check_session_keys # construct the Makefile.config cat > Makefile.config < Makefile.config < sh.config <