X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=configure;h=5af7852379f494379a320043e9ebacb515c24ef2;hp=ff8baa5e52696686461d82d5cf9728e1c5448a0b;hb=328626d0fd17910eec5d8b5b51dda46f4bbd8189;hpb=943f415f81207ea00bf1efe8c2c1cbf13a094a56 diff --git a/configure b/configure index ff8baa5e..5af78523 100755 --- a/configure +++ b/configure @@ -1,17 +1,140 @@ #! /bin/sh +# Set several defaults (optionally specified by the user in +# environemnt variables) CC=${CC:-gcc} CXX=${CXX:-g++} CFLAGS=${CFLAGS:--O2} CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)} +XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config-1.1 xapian-config} -# defaults +# 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 +# that these names as environment variables have existing uses other +# than the program name that we want. (EMACS is set to 't' when a +# shell is running within emacs and GZIP specifies arguments to pass +# on the gzip command line). + +# Set the defaults for values the user can specify with command-line +# options. PREFIX=/usr/local +LIBDIR= + +usage () +{ + cat <-- Currently ignored + --infodir=DIR Currently ignored + --localstatedir=DIR Currently ignored + --libexecdir=DIR Currently ignored + --disable-maintainer-mode Currently ignored + --disable-dependency-tracking Currently ignored + +EOF +} -# option parsing +# Parse command-line options for option; do - if [ "${option%%=*}" = '--prefix' ] ; then + if [ "${option}" = '--help' ] ; then + usage + exit 0 + elif [ "${option%%=*}" = '--prefix' ] ; then PREFIX="${option#*=}" + elif [ "${option%%=*}" = '--libdir' ] ; then + LIBDIR="${option#*=}" + elif [ "${option%%=*}" = '--includedir' ] ; then + INCLUDEDIR="${option#*=}" + elif [ "${option%%=*}" = '--mandir' ] ; then + MANDIR="${option#*=}" + elif [ "${option%%=*}" = '--sysconfdir' ] ; then + SYSCONFDIR="${option#*=}" + elif [ "${option%%=*}" = '--emacslispdir' ] ; then + EMACSLISPDIR="${option#*=}" + elif [ "${option%%=*}" = '--build' ] ; then + build_option="${option#*=}" + case ${build_option} in + *-*-*) ;; + *) + echo "Unrecognized value for --build option: ${build_option}" + echo "Should be: --" + echo "See:" + echo " $0 --help" + echo "" + exit 1 + esac + build_cpu=${build_option%%-*} + build_option=${build_option#*-} + build_vendor=${build_option%%-*} + build_os=${build_option#*-} + elif [ "${option%%=*}" = '--infodir' ] ; then + true + elif [ "${option%%=*}" = '--localstatedir' ] ; then + true + elif [ "${option%%=*}" = '--libexecdir' ] ; then + true + elif [ "${option}" = '--disable-maintainer-mode' ] ; then + true + elif [ "${option}" = '--disable-dependency-tracking' ] ; then + true + else + echo "Unrecognized option: ${option}" + echo "See:" + echo " $0 --help" + echo "" + exit 1 fi done @@ -44,14 +167,18 @@ else fi printf "Checking for Xapian development files... " -if xapian-config --version > /dev/null 2>&1; then - printf "Yes.\n" - have_xapian=1 - xapian_cxxflags=$(xapian-config --cxxflags) - xapian_ldflags=$(xapian-config --libs) -else +have_xapian=0 +for xapian_config in ${XAPIAN_CONFIG}; do + if ${xapian_config} --version > /dev/null 2>&1; then + printf "Yes.\n" + have_xapian=1 + xapian_cxxflags=$(${xapian_config} --cxxflags) + xapian_ldflags=$(${xapian_config} --libs) + break + fi +done +if [ ${have_xapian} = "0" ]; then printf "No.\n" - have_xapian=0 errors=$((errors + 1)) fi @@ -90,10 +217,21 @@ else have_valgrind=0 fi -if pkg-config --modversion emacs > /dev/null 2>&1; then - emacs_lispdir=$(pkg-config emacs --variable sitepkglispdir) +if [ -z "${EMACSLISPDIR}" ]; then + if pkg-config --modversion emacs > /dev/null 2>&1; then + EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir) + else + EMACSLISPDIR='$(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" + have_emacs=1 else - emacs_lispdir='$(prefix)/share/emacs/site-lisp' + printf "No (so will not byte-compile emacs code)\n" + have_emacs=0 fi if [ $errors -gt 0 ]; then @@ -162,7 +300,7 @@ EOF fi printf "Checking for getline... " -if ${CC} -o config/have_getline config/have_getline.c > /dev/null 2>&1 +if ${CC} -o compat/have_getline compat/have_getline.c > /dev/null 2>&1 then printf "Yes.\n" have_getline=1 @@ -170,7 +308,7 @@ else printf "No (will use our own instead).\n" have_getline=0 fi -rm -f config/have_getline +rm -f compat/have_getline cat <