summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@slbdata.se>2009-06-11 22:20:28 +0200
committerSamuel Lidén Borell <samuel@slbdata.se>2010-01-02 22:30:05 +0100
commitd22b3daf633d89b6ac9c09b472839c3a53c6dd70 (patch)
treeaf899cc6ac842917094455d9c87edcc8e30fe9d9 /configure
parent9df1a155ac38ba629fc46de4086e3a7033ce64f7 (diff)
downloadfribid-d22b3daf633d89b6ac9c09b472839c3a53c6dd70.tar.gz
fribid-d22b3daf633d89b6ac9c09b472839c3a53c6dd70.tar.bz2
fribid-d22b3daf633d89b6ac9c09b472839c3a53c6dd70.zip
Added a "configure" script
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure81
1 files changed, 81 insertions, 0 deletions
diff --git a/configure b/configure
new file mode 100755
index 0000000..0fab087
--- /dev/null
+++ b/configure
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+prefix="/usr/local"
+execprefix=""
+
+error=""
+
+while [ "$#" != "0" ]; do
+ flag="$1"
+ shift
+ case "$flag" in
+ --help)
+ # TODO
+ exit 0
+ ;;
+ --prefix=*)
+ prefix=${flag#--prefix=}
+ ;;
+ --exec-prefix=*)
+ execprefix=${flag#--exec-prefix=}
+ ;;
+ *)
+ echo "Invalid option: $flag"
+ error=1
+ ;;
+ esac
+done
+
+if [ ! -r "common/defines.h" ]; then
+ echo "You must be in the root directory of the source code to compile."
+ error=1
+fi
+
+if [ -n "$error" ]; then
+ exit 2
+fi
+
+prefixPath="$prefix"
+
+if [ -z "$execprefix" ]; then
+ execPath="$prefix"
+else
+ execPath="$execprefix"
+fi
+
+echo "Prefix: $prefixPath"
+if [ -n "$execprefix" ]; then
+ echo "Executable/library prefix: $execPath"
+fi
+
+CONFFILE=common/config.h
+
+echo "
+/* This file is automatically generated.
+ Run the configure script to change the configuration. */
+
+#define PREFIX \"$prefixPath\"
+#define EPREFIX \"$execPath\"
+" > $CONFFILE
+
+
+cancreate() {
+ if [ -w "$1" ]; then
+ return 0
+ elif [ ! -e "$1" ]; then
+ cancreate `dirname "$1"`
+ return $?
+ else
+ return 1
+ fi
+}
+
+if cancreate "$prefixPath" && cancreate "$execPath"; then
+ INSTALLCMD="make install"
+else
+ INSTALLCMD="sudo make install"
+fi
+
+echo "Wrote $CONFFILE."
+echo "Type \`\`make'' to compile, and then \`\`$INSTALLCMD'' to install."
+