utt/auto/options
Mateusz Hromada 63a5739817 Refactoring of configure scripts.
* Move default values to auto/default
 * Get configuration from environment
 * Add --quiet switch to hide summary
2009-06-06 13:08:46 +02:00

145 lines
6.5 KiB
Bash
Executable File

#!/bin/sh
help=no
quiet=no
if [ -z "$PROJECT_NAME" ]; then PROJECT_NAME=$DEFAULT_PROJECT_NAME; fi
if [ -z "$PROJECT_FULLNAME" ]; then PROJECT_FULLNAME=$DEFAULT_PROJECT_FULLNAME; fi
if [ -z "$PROJECT_COPYRIGHT" ]; then PROJECT_COPYRIGHT=$DEFAULT_PROJECT_COPYRIGHT; fi
if [ -z "$PROJECT_VERSION" ]; then PROJECT_VERSION=$DEFAULT_PROJECT_VERSION; fi
if [ -z "$PROJECT_PAGE" ]; then PROJECT_PAGE=$DEFAULT_PROJECT_PAGE; fi
if [ -z "$PROJECT_MAIL" ]; then PROJECT_MAIL=$DEFAULT_PROJECT_MAIL; fi
if [ -z "$SHELL" ]; then SHELL=$DEFAULT_SHELL; fi
if [ -z "$CC" ]; then CC=$DEFAULT_CC; fi
if [ -z "$BISON" ]; then BISON=$DEFAULT_BISON; fi
if [ -z "$RM" ]; then RM=$DEFAULT_RM; fi
if [ -z "$RMDIR" ]; then RMDIR=$DEFAULT_RMDIR; fi
if [ -z "$TEST" ]; then TEST=$DEFAULT_TEST; fi
if [ -z "$MAKE" ]; then MAKE=$DEFAULT_MAKE; fi
if [ -z "$GREP" ]; then GREP=$DEFAULT_GREP; fi
if [ -z "$CUT" ]; then CUT=$DEFAULT_CUT; fi
if [ -z "$SORT" ]; then SORT=$DEFAULT_SORT; fi
if [ -z "$PR" ]; then PR=$DEFAULT_PR; fi
if [ -z "$CFLAGS" ]; then CFLAGS=$DEFAULT_CFLAGS; fi
if [ -z "$LDFLAGS" ]; then LDFLAGS=$DEFAULT_LDFLAGS; fi
if [ -z "$LDLIBS" ]; then LDLIBS=$DEFAULT_LDLIBS; fi
if [ -z "$BFLAGS" ]; then BFLAGS=$DEFAULT_BFLAGS; fi
if [ -z "$DESTDIR" ]; then DESTDIR=$DEFAULT_DESTDIR; fi
if [ -z "$prefix" ]; then prefix=$DEFAULT_prefix; fi
if [ -z "$exec_prefix" ]; then exec_prefix=$DEFAULT_exec_prefix; fi
if [ -z "$bindir" ]; then bindir=$DEFAULT_bindir; fi
if [ -z "$sbindir" ]; then sbindir=$DEFAULT_sbindir; fi
if [ -z "$datarootdir" ]; then datarootdir=$DEFAULT_datarootdir; fi
if [ -z "$datadir" ]; then datadir=$DEFAULT_datadir; fi
if [ -z "$sysconfdir" ]; then sysconfdir=$DEFAULT_sysconfdir; fi
if [ -z "$sharedstatedir" ]; then sharedstatedir=$DEFAULT_sharedstatedir; fi
if [ -z "$localstatedir" ]; then localstatedir=$DEFAULT_localstatedir; fi
for option
do
case "$option" in
-*=*) value=$(echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//') ;;
*=*) value=$(echo "$option" | sed -e 's/[_A-Z0-9]*=//') ;;
*) value="" ;;
esac
case "$option" in
--help) help=yes ;;
--quiet) quiet=yes ;;
--prefix=*) prefix="$value" ;;
--exec-prefix=*) exec_prefix="$value" ;;
--bindir=*) bindir="$value" ;;
--sbindir=*) sbindir="$value" ;;
--datarootdir=*) datarootdir="$value" ;;
--datadir=*) datadir="$value" ;;
--sysconfdir=*) sysconfdir="$value" ;;
--sharedstatedir=*) sharedstatedir="$value" ;;
--localstatedir=*) localstatedir="$value" ;;
SHELL=*) SHELL="$value" ;;
CC=*) CC="$value" ;;
BISON=*) BISON="$value" ;;
RM=*) RM="$value" ;;
RMDIR=*) RMDIR="$value" ;;
TEST=*) TEST="$value" ;;
MAKE=*) MAKE="$value" ;;
GREP=*) GREP="$value" ;;
CUT=*) CUT="$value" ;;
SORT=*) SORT="$value" ;;
PR=*) PR="$value" ;;
CFLAGS=*) CFLAGS="$value" ;;
LDFLAGS=*) LDFLAGS="$value" ;;
LDLIBS=*) LDLIBS="$value" ;;
BFLAGS=*) BFLAGS="$value" ;;
esac
done
if [ "$help" = "yes" ]; then
cat << HELP_END
Configure script for $PROJECT_NAME $PROJECT_VERSION to adapt to many kinds of systems.
Usage:
./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Options:
--help display this help and exit
Installation directories:
--prefix=PATH install architecture-independent files in PATH
--exec-prefix=PATH install architecture-dependent files in PATH
Fine tuning of the installation directories:
--bindir=PATH user executables
--sbindir=PATH system admin executables
--datarootdir=PATH read-only arch.-independent data root
--datadir=PATH read-only architecture-independent data
--sysconfdir=PATH read-only single-machine data
--sharedstatedir=PATH modifiable architecture-independent data
--localstatedir=PATH modifiable single-machine data
Some influential environment variables:
SHELL shell command
CC C compiler command
BISON Bison compiler command
RM rm command
RMDIR rmdir command
TEST test command
MAKE make command
GREP grep command
CUT cut command
SORT sort command
PR pr command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have
libraries in a nonstandard directory <lib dir>
LDLIBS libraries to pass to the linker, e.g. -l<library>
BFLAGS Bison compiler flags
Use these variables to override default values.
Report bugs to <$PROJECT_MAIL>.
More details at $PROJECT_PAGE.
HELP_END
exit 1
fi