]> git.notmuchmail.org Git - notmuch/blobdiff - configure
Fix configure script to properly detect gmime-2.6 if available.
[notmuch] / configure
index bbf30cd51c92ad0856a1e4eb5692500a973af5b0..dedb7d87ccb1530026fe960e6e6a1dddfa33bf38 100755 (executable)
--- a/configure
+++ b/configure
@@ -22,7 +22,7 @@ if [ "$srcdir" != "." ]; then
 fi
 
 # Set several defaults (optionally specified by the user in
-# environemnt variables)
+# environment variables)
 CC=${CC:-gcc}
 CXX=${CXX:-g++}
 CFLAGS=${CFLAGS:--O2}
@@ -97,6 +97,7 @@ Fine tuning of some installation directories is available:
        --mandir=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]
        --zshcompletiondir=DIR  Zsh completions files [PREFIX/share/zsh/functions/Completion/Unix]
 
@@ -139,6 +140,8 @@ for option; do
        SYSCONFDIR="${option#*=}"
     elif [ "${option%%=*}" = '--emacslispdir' ] ; then
        EMACSLISPDIR="${option#*=}"
+    elif [ "${option%%=*}" = '--emacsetcdir' ] ; then
+       EMACSETCDIR="${option#*=}"
     elif [ "${option%%=*}" = '--bashcompletiondir' ] ; then
        BASHCOMPLETIONDIR="${option#*=}"
     elif [ "${option%%=*}" = '--zshcompletiondir' ] ; then
@@ -278,6 +281,7 @@ for gmimepc in gmime-2.6 gmime-2.4; do
        have_gmime=1
        gmime_cflags=$(pkg-config --cflags $gmimepc)
        gmime_ldflags=$(pkg-config --libs $gmimepc)
+       break
     fi
 done
 if [ "$have_gmime" = "0" ]; then
@@ -286,10 +290,10 @@ if [ "$have_gmime" = "0" ]; then
 fi
 
 # GMime already depends on Glib >= 2.12, but we use at least one Glib
-# function that only exists as of 2.14, (g_hash_table_get_keys)
-printf "Checking for Glib development files (>= 2.14)... "
+# function that only exists as of 2.22, (g_array_unref)
+printf "Checking for Glib development files (>= 2.22)... "
 have_glib=0
-if pkg-config --exists 'glib-2.0 >= 2.14'; then
+if pkg-config --exists 'glib-2.0 >= 2.22'; then
     printf "Yes.\n"
     have_glib=1
     glib_cflags=$(pkg-config --cflags glib-2.0)
@@ -330,6 +334,14 @@ if [ -z "${EMACSLISPDIR}" ]; then
     fi
 fi
 
+if [ -z "${EMACSETCDIR}" ]; then
+    if pkg-config --exists emacs; then
+       EMACSETCDIR=$(pkg-config emacs --variable sitepkglispdir)
+    else
+       EMACSETCDIR='$(prefix)/share/emacs/site-lisp'
+    fi
+fi
+
 printf "Checking if emacs is available... "
 if emacs --quick --batch > /dev/null 2>&1; then
     printf "Yes.\n"
@@ -355,17 +367,30 @@ elif [ $uname = "Linux" ] ; then
     printf "Linux\n"
     platform=LINUX
     linker_resolves_library_dependencies=1
+
+    printf "Checking for $libdir_expanded in ldconfig... "
     ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
     # Separate ldconfig_paths only on newline (not on any potential
-    # embedded space characters in any filenames).
+    # embedded space characters in any filenames). Note, we use a
+    # literal newline in the source here rather than something like:
+    #
+    #  IFS=$(printf '\n')
+    #
+    # because the shell's command substitution deletes any trailing newlines.
     OLD_IFS=$IFS
-    IFS="$(printf '\n')"
+    IFS="
+"
     for path in $ldconfig_paths; do
        if [ "$path" = "$libdir_expanded" ]; then
            libdir_in_ldconfig=1
        fi
     done
     IFS=$OLD_IFS
+    if [ "$libdir_in_ldconfig" = '0' ]; then
+       printf "No (will set RPATH)\n"
+    else
+       printf "Yes\n"
+    fi
 else
     printf "Unknown.\n"
     cat <<EOF
@@ -392,7 +417,7 @@ EOF
        echo "  http://spruce.sourceforge.net/gmime/"
     fi
     if [ $have_glib -eq 0 ]; then
-       echo "  Glib library >= 2.14 (including development files such as headers)"
+       echo "  Glib library >= 2.22 (including development files such as headers)"
        echo "  http://ftp.gnome.org/pub/gnome/sources/glib/"
     fi
     if [ $have_talloc -eq 0 ]; then
@@ -595,12 +620,16 @@ includedir = ${INCLUDEDIR:=\$(prefix)/include}
 # The directory to which man pages should be installed
 mandir = ${MANDIR:=\$(prefix)/share/man}
 
-# The directory to which read-only (configuration) filesshould be installed
+# The directory to which read-only (configuration) files should be installed
 sysconfdir = ${SYSCONFDIR:=\$(prefix)/etc}
 
 # The directory to which emacs lisp files should be installed
 emacslispdir=${EMACSLISPDIR}
 
+# The directory to which emacs miscellaneous (machine-independent) files should
+# be installed
+emacsetcdir=${EMACSETCDIR}
+
 # Whether there's an emacs binary available for byte-compiling
 HAVE_EMACS = ${have_emacs}