Refactoring of configure scripts.

* Move default values to auto/default
 * Get configuration from environment
 * Add --quiet switch to hide summary
This commit is contained in:
Mateusz Hromada 2009-06-06 13:08:46 +02:00
parent f7b30b9fc6
commit 63a5739817
4 changed files with 107 additions and 56 deletions

38
auto/defaults Executable file
View File

@ -0,0 +1,38 @@
#!/bin/sh
DEFAULT_PROJECT_NAME='utt'
DEFAULT_PROJECT_FULLNAME='UAM Text Tools'
DEFAULT_PROJECT_COPYRIGHT='Copyright (C) UTT Team'
DEFAULT_PROJECT_VERSION='0.9.3'
DEFAULT_PROJECT_PAGE='http://utt.wmi.amu.edu.pl'
DEFAULT_PROJECT_MAIL='utt@wmid.amu.edu.pl'
DEFAULT_SHELL='/bin/sh'
DEFAULT_CC='/usr/bin/gcc'
DEFAULT_BISON='/usr/bin/bison'
DEFAULT_RM='/bin/rm -f'
DEFAULT_RMDIR='/bin/rm -rf'
DEFAULT_TEST='/usr/bin/test'
DEFAULT_MAKE='/usr/bin/make'
DEFAULT_GREP='/bin/grep'
DEFAULT_CUT='/usr/bin/cut'
DEFAULT_SORT='/usr/bin/sort'
DEFAULT_PR='/usr/bin/pr'
DEFAULT_CFLAGS='-g -O2 -Wall'
DEFAULT_LDFLAGS=''
DEFAULT_LDLIBS=''
DEFAULT_BFLAGS=''
DEFAULT_DESTDIR=
DEFAULT_prefix='/usr/local'
DEFAULT_exec_prefix='$(prefix)'
DEFAULT_bindir='$(exec_prefix)/bin'
DEFAULT_sbindir='$(exec_prefix)/sbin'
DEFAULT_datarootdir='$(prefix)/share'
DEFAULT_datadir='$(datarootdir)'
DEFAULT_sysconfdir='$(prefix)/etc'
DEFAULT_sharedstatedir='$(prefix)/com'
DEFAULT_localstatedir='$(prefix)/var'

View File

@ -1,42 +1,43 @@
#!/bin/sh
help=no
quiet=no
PROJECT_NAME='utt'
PROJECT_FULLNAME='UAM Text Tools'
PROJECT_COPYRIGHT='Copyright (C) UTT Team'
PROJECT_VERSION='0.9.3'
PROJECT_PAGE='http://utt.wmi.amu.edu.pl'
PROJECT_MAIL='utt@wmid.amu.edu.pl'
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
SHELL='/bin/sh'
CC='/usr/bin/gcc'
BISON='/usr/bin/bison'
RM='/bin/rm -f'
RMDIR='/bin/rm -rf'
TEST='/usr/bin/test'
MAKE='/usr/bin/make'
GREP='/bin/grep'
CUT='/usr/bin/cut'
SORT='/usr/bin/sort'
PR='/usr/bin/pr'
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
CFLAGS='-g -O2 -Wall'
LDFLAGS=''
LDLIBS=''
BFLAGS=''
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
DESTDIR=
if [ -z "$DESTDIR" ]; then DESTDIR=$DEFAULT_DESTDIR; fi
prefix='/usr/local'
exec_prefix='$(prefix)'
bindir='$(exec_prefix)/bin'
sbindir='$(exec_prefix)/sbin'
datarootdir='$(prefix)/share'
datadir='$(datarootdir)'
sysconfdir='$(prefix)/etc'
sharedstatedir='$(prefix)/com'
localstatedir='$(prefix)/var'
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
@ -48,6 +49,7 @@ do
case "$option" in
--help) help=yes ;;
--quiet) quiet=yes ;;
--prefix=*) prefix="$value" ;;
--exec-prefix=*) exec_prefix="$value" ;;

View File

@ -1,11 +1,22 @@
#!/bin/sh
if [ "$quiet" = "yes" ]; then return; fi
cat << SUMMARY_END
Project name : $PROJECT_NAME
Project fullname : $PROJECT_FULLNAME
Project copyright : $PROJECT_COPYRIGHT
Project version : $PROJECT_VERSION
Project page : $PROJECT_PAGE
Project mail : $PROJECT_MAIL
Configuration summary
DESTDIR : $DESTDIR
prefix : $prefix
exec-prefix : $exec_prefix
exec_prefix : $exec_prefix
bindir : $bindir
sbindir : $sbindir
datarootdir : $datarootdir
@ -32,4 +43,3 @@ Configuration summary
BFLAGS : $BFLAGS
SUMMARY_END

1
configure vendored
View File

@ -1,5 +1,6 @@
#!/bin/sh
. ./auto/defaults
. ./auto/options
if [ -f ./src/config.h ]; then