Fix configure script to handle --prefix=
authorJameson Graef Rollins <jrollins@finestructure.net>
Sat, 28 Nov 2009 23:57:35 +0000 (18:57 -0500)
committerCarl Worth <cworth@cworth.org>
Fri, 4 Dec 2009 22:48:38 +0000 (14:48 -0800)
Reviewed-by: Carl Worth <cworth@cworth.org>:
This is really the fundamental thing that people expect a configure
script to do, so it's important to support it.

configure

index fd194ab039609ca7c999ad39389bf230735d14ce..70a3c3d881da5c5c9b0244fd63f3a70adbec6b48 100755 (executable)
--- a/configure
+++ b/configure
@@ -3,6 +3,16 @@
 CC=${CC:-gcc}
 CXX=${CXX:-g++}
 
+# 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.
 
@@ -186,7 +196,7 @@ CC = ${CC}
 CXX = ${CXX}
 
 # 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}