]> git.notmuchmail.org Git - notmuch/blobdiff - configure
test emacs: Add tests for hiding messages in notmuch-show view
[notmuch] / configure
index c7ec4145afb37518d2d2155911f86ef61effece2..cf525c9f6a0fc6a664d1918d001918c05e12363b 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,12 +1,25 @@
 #! /bin/sh
 
-# Removing space from IFS makes it much easier to support filenames
-# with spaces. See http://www.dwheeler.com/essays/filenames-in-shell.html
-# for gory details.
-IFS="$(printf '\n\t')"
+srcdir=$(dirname "$0")
 
-# Since we don't have space in IFS we use tab to separate things in lists
-tab="$(printf '\t')"
+# For a non-srcdir configure invocation (such as ../configure), create
+# the directory structure and copy Makefiles.
+if [ "$srcdir" != "." ]; then
+
+    for dir in . $(grep "^subdirs *=" "$srcdir"/Makefile | sed -e "s/subdirs *= *//"); do
+       mkdir -p "$dir"
+       cp "$srcdir"/"$dir"/Makefile.local "$dir"
+       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 ideal0.
+    cp -a "$srcdir"/emacs/*.el emacs
+fi
 
 # Set several defaults (optionally specified by the user in
 # environemnt variables)
@@ -342,12 +355,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). 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="
+"
     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
@@ -427,7 +458,7 @@ EOF
 fi
 
 printf "Checking for getline... "
-if ${CC} -o compat/have_getline compat/have_getline.c > /dev/null 2>&1
+if ${CC} -o compat/have_getline "$srcdir"/compat/have_getline.c > /dev/null 2>&1
 then
     printf "Yes.\n"
     have_getline=1
@@ -438,7 +469,7 @@ fi
 rm -f compat/have_getline
 
 printf "Checking for strcasestr... "
-if ${CC} -o compat/have_strcasestr compat/have_strcasestr.c > /dev/null 2>&1
+if ${CC} -o compat/have_strcasestr "$srcdir"/compat/have_strcasestr.c > /dev/null 2>&1
 then
     printf "Yes.\n"
     have_strcasestr=1
@@ -511,6 +542,29 @@ cat > Makefile.config <<EOF
 # changes, (and this could happen by simply calling "make" if the
 # configure script is updated).
 
+# The top-level directory for the source, (the directory containing
+# the configure script). This may be different than the build
+# directory (the current directory at the time configure was run).
+srcdir = ${srcdir}
+
+configure_options = $@
+
+# We use vpath directives (rather than the VPATH variable) since the
+# VPATH variable matches targets as well as prerequisites, (which is
+# not useful since then a target left-over from a srcdir build would
+# cause a target to not be built in the non-srcdir build).
+#
+# Also, we don't use a single "vpath % \$(srcdir)" here because we
+# don't want the vpath to trigger for our emacs lisp compilation,
+# (unless we first find a way to convince emacs to build the .elc
+# target in a directory other than the directory of the .el
+# prerequisite). In the meantime, we're actually copying in the .el
+# files, (which is quite ugly).
+vpath %.c \$(srcdir)
+vpath %.cc \$(srcdir)
+vpath %.1 \$(srcdir)
+vpath Makefile.% \$(srcdir)
+
 # The C compiler to use
 CC = ${CC}