Files

228 lines
4.9 KiB
Bash
Raw Permalink Normal View History

2000-04-27 20:03:57 +00:00
#!/bin/sh
2010-09-19 18:27:16 +00:00
# Configuration script for ngspice.
2006-02-08 09:23:32 +00:00
#
2010-09-19 18:27:16 +00:00
# This script performs initial configuration of ngspice source
2006-02-08 09:23:32 +00:00
# package.
#
#
2010-09-08 17:14:44 +00:00
# temp-adms.ac: modified configure.ac if --adms is selected
2010-08-18 17:13:26 +00:00
# for temporary use by autoconf, will be deleted automatically
2010-09-08 17:14:44 +00:00
# configure.ac stays untouched
2000-04-27 20:03:57 +00:00
2006-02-08 09:23:32 +00:00
PROJECT=ngspice
2000-04-27 20:03:57 +00:00
2006-02-08 09:23:32 +00:00
# ADMS variables
ADMSDIR=src/spicelib/devices/adms
XMLPATH=src/spicelib/devices/adms/admst
2017-03-12 19:12:53 +01:00
ADMSXML=${ADMSXML:-admsXml}
2006-02-08 09:23:32 +00:00
ADMS=0
# Exit variable
2000-04-27 20:03:57 +00:00
DIE=0
2006-02-08 09:23:32 +00:00
2012-10-29 23:47:02 +01:00
# Check for Mac OS X
uname -a | grep -q "Darwin"
if [ $? -eq 0 ]; then
LIBTOOLIZE=glibtoolize
else
LIBTOOLIZE=libtoolize
fi
2006-02-08 09:23:32 +00:00
help()
{
2010-09-19 18:27:16 +00:00
echo
echo "$PROJECT autogen.sh help"
echo
echo "--adms -a: enables adms feature"
echo "--help -h: print this file"
echo "--version -v: print version"
echo
2006-02-08 09:23:32 +00:00
}
version()
{
2010-09-19 18:27:16 +00:00
echo
echo "$PROJECT autogen.sh 1.0"
echo
2006-02-08 09:23:32 +00:00
}
2010-09-19 18:27:16 +00:00
error_and_exit()
2010-08-01 19:02:23 +00:00
{
2010-09-19 18:27:16 +00:00
echo "Error: $1"
if [ "$ADMS" -eq 1 ]; then
rm -f temp-adms.ac
fi
exit 1
2010-08-01 19:02:23 +00:00
}
2006-02-08 09:23:32 +00:00
2010-08-18 18:08:11 +00:00
check_awk()
{
2010-09-19 18:27:16 +00:00
(awk --version) < /dev/null > /dev/null 2>&1 || {
2010-08-18 18:08:11 +00:00
echo
echo "You must have awk installed to compile $PROJECT with --adms."
exit 1
2010-09-19 18:27:16 +00:00
}
}
2006-02-08 09:23:32 +00:00
check_autoconf()
{
2010-09-19 18:27:16 +00:00
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
2000-04-27 20:03:57 +00:00
echo
echo "You must have autoconf installed to compile $PROJECT."
echo "See http://www.gnu.org/software/automake/"
echo "(newest stable release is recommended)"
2000-04-27 20:03:57 +00:00
DIE=1
2010-09-19 18:27:16 +00:00
}
2000-04-27 20:03:57 +00:00
2012-10-29 23:47:02 +01:00
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
2000-04-27 20:03:57 +00:00
echo
echo "You must have libtool installed to compile $PROJECT."
echo "See http://www.gnu.org/software/libtool/"
echo "(newest stable release is recommended)"
2000-04-27 20:03:57 +00:00
DIE=1
2010-09-19 18:27:16 +00:00
}
2000-04-27 20:03:57 +00:00
2010-09-19 18:27:16 +00:00
(automake --version) < /dev/null > /dev/null 2>&1 || {
2000-04-27 20:03:57 +00:00
echo
echo "You must have automake installed to compile $PROJECT."
echo "See http://www.gnu.org/software/automake/"
echo "(newest stable release is recommended)"
2000-04-27 20:03:57 +00:00
DIE=1
2010-09-19 18:27:16 +00:00
}
2000-04-27 20:03:57 +00:00
}
2006-02-08 09:23:32 +00:00
check_adms()
{
2017-03-12 19:12:53 +01:00
($ADMSXML --version) < /dev/null > /dev/null 2>&1 || {
2006-02-08 09:23:32 +00:00
echo
echo "You must have admsXml installed to compile adms models."
echo "See http://mot-adms.sourceforge.net"
echo "(newest stable release is recommended)"
DIE=1
2010-09-19 18:27:16 +00:00
}
2006-02-08 09:23:32 +00:00
}
case "$1" in
"--adms" | "-a")
2010-09-19 18:27:16 +00:00
check_adms
ADMS=1
;;
2006-02-08 09:23:32 +00:00
"--help" | "-h")
2010-09-19 18:27:16 +00:00
help
exit 0
;;
2006-02-08 09:23:32 +00:00
"--version" | "-v")
2010-09-19 18:27:16 +00:00
version
exit 0
;;
2006-02-08 09:23:32 +00:00
*)
2010-09-19 18:27:16 +00:00
;;
esac
2006-02-08 09:23:32 +00:00
check_autoconf
2010-09-19 18:27:16 +00:00
if [ "$DIE" -eq 1 ]; then
exit 1
2000-04-27 20:03:57 +00:00
fi
2010-09-19 18:27:16 +00:00
[ -f "DEVICES" ] || {
echo "You must run this script in the top-level $PROJECT directory"
exit 1
2000-04-27 20:03:57 +00:00
}
2010-08-18 17:13:26 +00:00
# only for --adms:
2011-05-19 17:47:40 +00:00
if [ "$ADMS" -gt 0 ]; then
2010-09-19 18:27:16 +00:00
check_awk
# add adms related Makefile entries to a configure.ac style file for
# autoconf and automake
# Find all lines with "#VLAMKF" and put the second token of each line
# into a shell variable
adms_Makefiles=`awk '$1 ~ /#VLAMKF/ { print "./" $2 }' < configure.ac`
# just the same, but escape newlines with '\' for the following sed expression
znew=`awk '$1 ~ /#VLAMKF/ { print " " $2 "\\\\" }' < configure.ac`
# Find "tests/vbic/Makefile" and insert the list of Makefiles
# some sed's fail to process the '\n' escape on the RHS,
# thus use an escaped plain newline
2010-09-19 18:27:16 +00:00
sed \
-e "s,tests\\/vbic\\/Makefile,&\\
$znew
," \
2010-09-19 18:27:16 +00:00
configure.ac > temp-adms.ac
for adms_dir in `ls $ADMSDIR` ; do
if [ -d "$ADMSDIR/$adms_dir" ]; then
case "$adms_dir" in
"admst")
echo "Skipping scripts dir"
;;
*)
echo "Entering into directory: $adms_dir"
echo "-->"$ADMSDIR/$adms_dir
(
cd $ADMSDIR/$adms_dir
2012-10-25 18:53:18 +02:00
$ADMSXML `ls admsva/*.va` -Iadmsva -xv \
-e ../admst/ngspiceVersion.xml \
-e ../admst/ngspiceMakefile.am.xml
2010-09-19 18:27:16 +00:00
)
;;
esac
fi
done
2008-12-28 17:29:30 +00:00
2006-02-08 09:23:32 +00:00
fi
2012-10-29 23:47:02 +01:00
echo "Running $LIBTOOLIZE"
$LIBTOOLIZE --copy --force \
|| error_and_exit "$LIBTOOLIZE failed"
2010-09-17 16:26:06 +00:00
2012-06-21 19:17:01 +02:00
echo "Running aclocal $ACLOCAL_FLAGS"
aclocal $ACLOCAL_FLAGS --force -I m4 \
2012-06-21 19:17:01 +02:00
|| error_and_exit "aclocal failed"
2006-02-08 09:23:32 +00:00
# optional feature: autoheader
2010-09-19 18:27:16 +00:00
(autoheader --version) < /dev/null > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Running autoheader"
autoheader --force \
2010-09-19 18:27:16 +00:00
|| error_and_exit "autoheader failed"
fi
2006-02-08 09:23:32 +00:00
echo "Running automake -Wall --copy --add-missing"
2010-09-19 18:27:16 +00:00
automake -Wall --copy --add-missing \
|| error_and_exit "automake failed"
2006-02-08 09:23:32 +00:00
2011-05-19 17:47:40 +00:00
if [ "$ADMS" -gt 0 ]; then
2010-09-19 18:27:16 +00:00
echo "Running automake for adms"
automake -Wall --copy --add-missing $adms_Makefiles \
|| error_and_exit "automake failed"
2010-08-18 17:13:26 +00:00
fi
2006-02-08 09:23:32 +00:00
2010-08-18 17:13:26 +00:00
echo "Running autoconf"
2011-05-19 17:47:40 +00:00
if [ "$ADMS" -gt 0 ]; then
autoconf --force temp-adms.ac > configure \
2010-09-19 18:27:16 +00:00
|| error_and_exit "autoconf failed, with adms"
rm -f temp-adms.ac
chmod +x configure
2010-08-18 17:13:26 +00:00
else
autoconf --force \
2010-09-19 18:27:16 +00:00
|| error_and_exit "autoconf failed"
2010-08-01 10:28:18 +00:00
fi
2008-12-28 17:29:30 +00:00
echo "Success."
2010-08-01 10:28:18 +00:00
exit 0