autogen.sh, cleanup

This commit is contained in:
rlar 2010-09-19 18:27:16 +00:00
parent 8f8071aceb
commit f025c7a602
2 changed files with 114 additions and 120 deletions

View File

@ -1,3 +1,7 @@
2010-09-19 Robert Larice
* autogen.sh :
cleanup
2010-09-19 Robert Larice 2010-09-19 Robert Larice
* src/frontend/plotting/graf.c , * src/frontend/plotting/graf.c ,
* src/frontend/plotting/grid.c : * src/frontend/plotting/grid.c :

View File

@ -12,8 +12,6 @@
# configure.ac stays untouched # configure.ac stays untouched
PROJECT=ngspice PROJECT=ngspice
TEST_TYPE=-f
FILE=DEVICES
# ADMS variables # ADMS variables
@ -28,202 +26,194 @@ DIE=0
help() help()
{ {
echo echo
echo "$PROJECT autogen.sh help" echo "$PROJECT autogen.sh help"
echo echo
echo "--adms -a: enables adms feature" echo "--adms -a: enables adms feature"
echo "--help -h: print this file" echo "--help -h: print this file"
echo "--version -v: print version" echo "--version -v: print version"
echo echo
} }
version() version()
{ {
echo echo
echo "$PROJECT autogen.sh 1.0" echo "$PROJECT autogen.sh 1.0"
echo echo
} }
end_on_error() error_and_exit()
{ {
if test "$ADMS" -eq 1; then echo "Error: $1"
# cp -p temp-adms.ac configure.err if [ "$ADMS" -eq 1 ]; then
rm -f temp-adms.ac rm -f temp-adms.ac
fi fi
exit 1
exit 1
} }
check_awk() check_awk()
{ {
(awk --version) < /dev/null > /dev/null 2>&1 || { (awk --version) < /dev/null > /dev/null 2>&1 || {
echo echo
echo "You must have awk installed to compile $PROJECT with --adms." echo "You must have awk installed to compile $PROJECT with --adms."
exit 1 exit 1
} }
} }
check_autoconf() check_autoconf()
{ {
(autoconf --version) < /dev/null > /dev/null 2>&1 || { (autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo echo
echo "You must have autoconf installed to compile $PROJECT." echo "You must have autoconf installed to compile $PROJECT."
echo "See http://www.gnu.org/software/automake/" echo "See http://www.gnu.org/software/automake/"
echo "(newest stable release is recommended)" echo "(newest stable release is recommended)"
DIE=1 DIE=1
} }
(libtoolize --version) < /dev/null > /dev/null 2>&1 || { (libtoolize --version) < /dev/null > /dev/null 2>&1 || {
echo echo
echo "You must have libtool installed to compile $PROJECT." echo "You must have libtool installed to compile $PROJECT."
echo "See http://www.gnu.org/software/libtool/" echo "See http://www.gnu.org/software/libtool/"
echo "(newest stable release is recommended)" echo "(newest stable release is recommended)"
DIE=1 DIE=1
} }
(automake --version) < /dev/null > /dev/null 2>&1 || { (automake --version) < /dev/null > /dev/null 2>&1 || {
echo echo
echo "You must have automake installed to compile $PROJECT." echo "You must have automake installed to compile $PROJECT."
echo "See http://www.gnu.org/software/automake/" echo "See http://www.gnu.org/software/automake/"
echo "(newest stable release is recommended)" echo "(newest stable release is recommended)"
DIE=1 DIE=1
} }
} }
check_adms() check_adms()
{ {
(admsXml --version) < /dev/null > /dev/null 2>&1 || { (admsXml --version) < /dev/null > /dev/null 2>&1 || {
echo echo
echo "You must have admsXml installed to compile adms models." echo "You must have admsXml installed to compile adms models."
echo "See http://mot-adms.sourceforge.net" echo "See http://mot-adms.sourceforge.net"
echo "(newest stable release is recommended)" echo "(newest stable release is recommended)"
DIE=1 DIE=1
} }
} }
case "$1" in case "$1" in
"--adms" | "-a") "--adms" | "-a")
check_adms check_adms
ADMS=1 ADMS=1
;; ;;
"--help" | "-h") "--help" | "-h")
help help
exit 0 exit 0
;; ;;
"--version" | "-v") "--version" | "-v")
version version
exit 0 exit 0
;; ;;
*) *)
;; ;;
esac esac
check_autoconf check_autoconf
if test "$DIE" -eq 1; then if [ "$DIE" -eq 1 ]; then
exit 1 exit 1
fi fi
test $TEST_TYPE $FILE || { [ -f "DEVICES" ] || {
echo "You must run this script in the top-level $PROJECT directory" echo "You must run this script in the top-level $PROJECT directory"
exit 1 exit 1
} }
# only for --adms: # only for --adms:
if test "$ADMS" -eq 1; then if [ "$ADMS" -eq 1 ]; then
check_awk check_awk
# sed 's/tests\/vbic\/Makefile/tests\/vbic\/Makefile\ # add adms related Makefile entries to a configure.ac style file for
# src\/spicelib\/devices\/adms\/ekv\/Makefile\ # autoconf and automake
# src\/spicelib\/devices\/adms\/hicum0\/Makefile\
# src\/spicelib\/devices\/adms\/hicum2\/Makefile\
# src\/spicelib\/devices\/adms\/mextram\/Makefile\
# src\/spicelib\/devices\/adms\/psp102\/Makefile/g' configure.temp >configure.ac
# automake and autoconf need these entries in configure.ac for adms enabled # Find all lines with "#VLAMKF" and put the second token of each line
z="" # into a shell variable
znew="" adms_Makefiles=`awk '$1 ~ /#VLAMKF/ { print "./" $2 }' < configure.ac`
# Find all lines with "#VLAMKF" and put the second token of each line into shell variable z
# as input to additional automake call for the adms directories
z=`cat configure.ac | awk -v z=${z} '$1 ~ /#VLAMKF/{ z=$2; print "./"z }' `
# same as above, sed requires \ at line endings, to be added to temp-adms.ac used by autoconf
znew=`cat configure.ac | awk -v z=${znew} '$1 ~ /#VLAMKF/{ znew=$2; print " "znew"\\\" }' `
# Find "tests/vbic/Makefile" and replace by tests/vbic/Makefile plus contents of variable z # just the same, but escape newlines with '\' for the following sed expression
sed -e " znew=`awk '$1 ~ /#VLAMKF/ { print " " $2 "\\\\" }' < configure.ac`
s,tests\\/vbic\\/Makefile,tests\\/vbic\\/Makefile\\
$znew ," configure.ac >temp-adms.ac
currentdir=`pwd` # Find "tests/vbic/Makefile" and insert the list of Makefiles
sed \
-e "s,tests\\/vbic\\/Makefile,&\\n $znew ," \
configure.ac > temp-adms.ac
for adms_dir in `ls $ADMSDIR` for adms_dir in `ls $ADMSDIR` ; do
do if [ -d "$ADMSDIR/$adms_dir" ]; then
if [ -d "$ADMSDIR/$adms_dir" ]; then
case "$adms_dir" in case "$adms_dir" in
"CVS") "CVS")
echo "Skipping CVS" ;; echo "Skipping CVS"
;;
"admst") "admst")
echo "Skipping scripts dir" ;; echo "Skipping scripts dir"
;;
*) *)
echo "Entering into directory: $adms_dir" echo "Entering into directory: $adms_dir"
echo "-->"$ADMSDIR/$adms_dir echo "-->"$ADMSDIR/$adms_dir
cd $ADMSDIR/$adms_dir (
file=`ls admsva/*.va` cd $ADMSDIR/$adms_dir
$ADMSXML $file -Iadmsva -xv -e ../admst/ngspiceVersion.xml \ $ADMSXML `ls admsva/*.va` -Iadmsva -xv \
-e ../admst/ngspiceMakefile.am.xml -e ../admst/ngspiceVersion.xml \
-e ../admst/ngspiceMakefile.am.xml
cd $currentdir )
;; ;;
esac esac
fi fi
done done
fi fi
echo "Running aclocal $ACLOCAL_FLAGS" echo "Running aclocal $ACLOCAL_FLAGS"
aclocal $ACLOCAL_FLAGS aclocal $ACLOCAL_FLAGS \
if [ $? -ne 0 ]; then echo "aclocal failed"; end_on_error ; fi || error_and_exit "aclocal failed"
echo "Running libtoolize" echo "Running libtoolize"
libtoolize --copy --force libtoolize --copy --force \
if [ $? -ne 0 ];then echo "libtoolize failed"; end_on_error ; fi || error_and_exit "libtoolize failed"
# optional feature: autoheader # optional feature: autoheader
(autoheader --version) < /dev/null > /dev/null 2>&1 (autoheader --version) < /dev/null > /dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Running autoheader" echo "Running autoheader"
autoheader autoheader \
if [ $? -ne 0 ]; then echo "autoheader failed"; end_on_error ; fi || error_and_exit "autoheader failed"
fi fi
echo "Running automake -Wall --copy --add-missing" echo "Running automake -Wall --copy --add-missing"
automake -Wall --copy --add-missing automake -Wall --copy --add-missing \
if [ $? -ne 0 ]; then echo "automake failed"; end_on_error ; fi || error_and_exit "automake failed"
if test "$ADMS" -eq 1; then if [ "$ADMS" -eq 1 ]; then
echo "Running automake for adms" echo "Running automake for adms"
automake -Wall --copy --add-missing $z automake -Wall --copy --add-missing $adms_Makefiles \
if [ $? -ne 0 ]; then echo "automake failed"; end_on_error ; fi || error_and_exit "automake failed"
fi fi
echo "Running autoconf" echo "Running autoconf"
if test "$ADMS" -eq 1; then if [ "$ADMS" -eq 1 ]; then
autoconf temp-adms.ac > configure autoconf temp-adms.ac > configure \
rm -f temp-adms.ac || error_and_exit "autoconf failed, with adms"
rm -f temp-adms.ac
else else
autoconf autoconf \
|| error_and_exit "autoconf failed"
fi fi
if [ $? -ne 0 ]; then echo "autoconf failed"; end_on_error ; fi
echo "Success." echo "Success."
exit 0 exit 0