Initial commit
[fillmore] / configure
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..e440cfd
--- /dev/null
+++ b/configure
@@ -0,0 +1,84 @@
+#! /bin/bash
+#
+# Copyright 2009 Yorba Foundation
+#
+# This software is licensed under the GNU LGPL (version 2.1 or later).
+# See the COPYING file in this distribution. 
+
+CONFIG_IN=configure.mk
+
+configure_help() {
+    printf "\nUsage:\n"
+    printf "\t./configure [OPTIONS]...\n"
+    printf "\n"
+    printf "Options:\n"
+    printf "\t-h, --help\t\tPrint this help and exit.\n"
+    printf "\t--assume-pkgs\t\tTurn off package version checking.\n"
+    printf "\t--build=DIR\t\tBuild secondary files in DIR.\n"
+    printf "\t--debug | --release\tBuild executable for debugging or release.\n"
+    printf "\t\t\t\t[--release]\n"
+    printf "\t--define=SYMBOL\t\tDefine a symbol for the Vala compiler.\n"
+    printf "\n"
+}
+
+abort() {
+    printf "%s: Invalid argument %s\n" $0 $1
+    configure_help
+    exit 1
+}
+
+while [ $# != 0 ]
+do
+    option=`echo $1 | sed 's/=.*//'`
+    if [ `echo $1 | grep '='` ]
+    then
+        value=`echo $1 | sed 's/.*=//'`
+    fi
+
+    case $option in
+        -h | --help)        configure_help
+                            exit 0
+                            ;;
+        
+        --assume-pkgs)      variables="${variables}ASSUME_PKGS=1\n"
+                            ;;
+        
+        --build)            if [ ! $value ]
+                            then
+                                abort $1
+                            fi
+                            
+                            variables="${variables}BUILD_DIR=$value\n"
+                            variables="${variables}MARINA_VAPI=../marina/$value/marina.vapi\n"
+                            ;;
+        
+        --debug)            variables="${variables}BUILD_RELEASE=\nBUILD_DEBUG=1\n"
+                            ;;
+        
+        --release)          variables="${variables}BUILD_DEBUG=\nBUILD_RELEASE=1\n"
+                            ;;
+        
+        --define)           variables="${variables}USER_VALAFLAGS+=--define=$value\n"
+                            ;;
+                            
+
+        *)                  if [ ! $value ]
+                            then
+                                abort $1
+                            fi
+                            
+                            variables="${variables}${option}=${value}\n"
+                            ;;
+    esac
+    
+    shift
+done
+
+rm -f $CONFIG_IN
+if [ $variables ]
+then
+    echo -e -n $variables > $CONFIG_IN
+fi
+echo "CONFIG_IN=../../${CONFIG_IN}" >> $CONFIG_IN
+
+printf "Configured.  Type 'make' to build\n"