]> git.notmuchmail.org Git - notmuch/blobdiff - configure
wrap-and-sort -ast
[notmuch] / configure
index 6e73b22ef68d044f63074bbd7b9a1775a23e12af..fad2655c39ad4d2b6fbb0c85042f70059b15d418 100755 (executable)
--- a/configure
+++ b/configure
@@ -26,6 +26,27 @@ readonly DEFAULT_IFS="$IFS"
 srcdir=$(dirname "$0")
 NOTMUCH_SRCDIR=$(cd "$srcdir" && pwd)
 
+case $NOTMUCH_SRCDIR in ( *\'* | *['\"`$']* )
+       echo "Definitely unsafe characters in source path '$NOTMUCH_SRCDIR'".
+       exit 1
+esac
+
+case $PWD in ( *\'* | *['\"`$']* )
+       echo "Definitely unsafe characters in current directory '$PWD'".
+       exit 1
+esac
+
+# In case of whitespace, builds may work, tests definitely will not.
+case $NOTMUCH_SRCDIR in ( *["$IFS"]* )
+       echo "Whitespace in source path '$NOTMUCH_SRCDIR' not supported".
+       exit 1
+esac
+
+case $PWD in ( *["$IFS"]* )
+       echo "Whitespace in current directory '$PWD' not supported".
+       exit 1
+esac
+
 subdirs="util compat lib parse-time-string completion doc emacs"
 subdirs="${subdirs} performance-test test test/test-databases"
 subdirs="${subdirs} bindings"
@@ -147,7 +168,7 @@ Fine tuning of some installation directories is available:
        --emacslispdir=DIR      Emacs code [PREFIX/share/emacs/site-lisp]
        --emacsetcdir=DIR       Emacs miscellaneous files [PREFIX/share/emacs/site-lisp]
        --bashcompletiondir=DIR Bash completions files [PREFIX/share/bash-completion/completions]
-       --zshcompletiondir=DIR  Zsh completions files [PREFIX/share/zsh/functions/Completion/Unix]
+       --zshcompletiondir=DIR  Zsh completions files [PREFIX/share/zsh/site-functions]
 
 Some features can be disabled (--with-feature=no is equivalent to
 --without-feature) :
@@ -513,7 +534,7 @@ int main () {
 
     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));
+    g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/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)));
@@ -533,7 +554,7 @@ EOF
         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 \
+           && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < "$srcdir"/test/gnupg-secret-key.asc \
            && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \
            && [ $SESSION_KEY = 9:0BACD64099D1468AB07C796F0C0AC4851948A658A15B34E803865E9FC635F2F5 ]
     then
@@ -650,6 +671,40 @@ if [ $have_python -eq 0 ]; then
     errors=$((errors + 1))
 fi
 
+have_python3=0
+if [ $have_python -eq 1 ]; then
+    printf "Checking for python3..."
+    if "$python" -c 'import sys; assert sys.version_info >= (3,0)' > /dev/null 2>&1; then
+        printf "Yes.\n"
+        have_python3=1
+    else
+        printf "No.\n"
+    fi
+fi
+
+have_python3_cffi=0
+have_python3_pytest=0
+if [ $have_python3 -eq 1 ]; then
+    printf "Checking for python3 cffi... "
+    if "$python" -c 'import cffi' >/dev/null 2>&1; then
+        printf "Yes.\n"
+        have_python3_cffi=1
+    else
+        printf "No.\n"
+    fi
+
+    printf "Checking for python3 pytest (>= 3.0)... "
+    conf=$(mktemp)
+    printf "[pytest]\nminversion=3.0\n" > $conf
+    if pytest-3 -c $conf --version >/dev/null 2>&1; then
+        printf "Yes.\n"
+        have_python3_pytest=1
+    else
+        printf "No.\n"
+    fi
+    rm -f $conf
+fi
+
 printf "Checking for valgrind development files... "
 if pkg-config --exists valgrind; then
     printf "Yes.\n"
@@ -677,13 +732,14 @@ if [ -z "${EMACSETCDIR-}" ]; then
     EMACSETCDIR="\$(prefix)/share/emacs/site-lisp"
 fi
 
-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"
-    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
@@ -1165,9 +1221,6 @@ BASH_ABSOLUTE = ${bash_absolute}
 HAVE_PERL = ${have_perl}
 PERL_ABSOLUTE = ${perl_absolute}
 
-# Whether there's an emacs binary available for byte-compiling
-HAVE_EMACS = ${have_emacs}
-
 # Whether there's a sphinx-build binary available for building documentation
 HAVE_SPHINX=${have_sphinx}
 
@@ -1187,7 +1240,7 @@ desktop_dir = \$(prefix)/share/applications
 bash_completion_dir = ${BASHCOMPLETIONDIR:=\$(prefix)/share/bash-completion/completions}
 
 # The directory to which zsh completions files should be installed
-zsh_completion_dir = ${ZSHCOMLETIONDIR:=\$(prefix)/share/zsh/functions/Completion/Unix}
+zsh_completion_dir = ${ZSHCOMLETIONDIR:=\$(prefix)/share/zsh/site-functions}
 
 # Whether the canonicalize_file_name function is available (if not, then notmuch will
 # build its own version)
@@ -1204,6 +1257,12 @@ HAVE_GETLINE = ${have_getline}
 # building/testing ruby bindings.
 HAVE_RUBY_DEV = ${have_ruby_dev}
 
+# Is the python cffi package available?
+HAVE_PYTHON3_CFFI = ${have_python3_cffi}
+
+# Is the python pytest package available?
+HAVE_PYTHON3_PYTEST = ${have_python3_pytest}
+
 # Whether the strcasestr function is available (if not, then notmuch will
 # build its own version)
 HAVE_STRCASESTR = ${have_strcasestr}
@@ -1357,6 +1416,12 @@ NOTMUCH_RUBY=${RUBY}
 # building/testing ruby bindings.
 NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
 
+# Is the python cffi package available?
+NOTMUCH_HAVE_PYTHON3_CFFI=${have_python3_cffi}
+
+# Is the python pytest package available?
+NOTMUCH_HAVE_PYTHON3_PYTEST=${have_python3_pytest}
+
 # Platform we are run on
 PLATFORM=${platform}
 EOF