1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
#! /bin/bash
#
# Copyright 2011-2012 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--prefix=PREFIX\t\tPrepend PREFIX to program installation paths.\n"
printf "\t\t\t\t[/usr/local]\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
;;
--prefix) if [ ! $value ]
then
abort $1
fi
variables="${variables}PREFIX=$value\n"
;;
--assume-pkgs) variables="${variables}ASSUME_PKGS=1\n"
;;
--build) if [ ! $value ]
then
abort $1
fi
variables="${variables}BUILD_DIR=$value\n"
;;
--debug) variables="${variables}BUILD_RELEASE=\nBUILD_DEBUG=1\n"
;;
--release) variables="${variables}BUILD_DEBUG=\nBUILD_RELEASE=1\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, 'make install' to install.\n"
|