]> git.notmuchmail.org Git - notmuch/blobdiff - configure
configure: Support the capturing of CFLAGS and CXXFLAGS at configure time.
[notmuch] / configure
index fd194ab039609ca7c999ad39389bf230735d14ce..ff8baa5e52696686461d82d5cf9728e1c5448a0b 100755 (executable)
--- a/configure
+++ b/configure
@@ -2,6 +2,18 @@
 
 CC=${CC:-gcc}
 CXX=${CXX:-g++}
+CFLAGS=${CFLAGS:--O2}
+CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
+
+# defaults
+PREFIX=/usr/local
+
+# option parsing
+for option; do
+    if [ "${option%%=*}" = '--prefix' ] ; then
+       PREFIX="${option#*=}"
+    fi
+done
 
 cat <<EOF
 Welcome to Notmuch, a system for indexing, searching and tagging your email.
@@ -185,8 +197,14 @@ CC = ${CC}
 # The C++ compiler to use
 CXX = ${CXX}
 
+# Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
+CFLAGS = ${CFLAGS}
+
+# Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
+CXXFLAGS = ${CXXFLAGS}
+
 # The prefix to which notmuch should be installed
-prefix = /usr/local
+prefix = ${PREFIX}
 
 # The directory to which emacs lisp files should be installed
 emacs_lispdir=${emacs_lispdir}
@@ -214,11 +232,11 @@ HAVE_VALGRIND = ${have_valgrind}
 VALGRIND_CFLAGS = ${valgrind_cflags}
 
 # Combined flags for compiling and linking against all of the above
-override CFLAGS += -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)      \\
+CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)      \\
                   \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND)   \\
                   \$(VALGRIND_CFLAGS)
-override CXXFLAGS += -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\
+CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\
                     \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
                     \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS)
-override LDFLAGS += \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)
+CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)
 EOF