2000-04-27 22:03:57 +02:00
|
|
|
#!/bin/sh
|
2010-09-19 20:27:16 +02:00
|
|
|
# Configuration script for ngspice.
|
2006-02-08 10:23:32 +01:00
|
|
|
#
|
2010-09-19 20:27:16 +02:00
|
|
|
# This script performs initial configuration of ngspice source
|
2006-02-08 10:23:32 +01:00
|
|
|
# package.
|
|
|
|
|
#
|
|
|
|
|
#
|
2010-09-08 19:14:44 +02:00
|
|
|
# temp-adms.ac: modified configure.ac if --adms is selected
|
2010-08-18 19:13:26 +02:00
|
|
|
# for temporary use by autoconf, will be deleted automatically
|
2010-09-08 19:14:44 +02:00
|
|
|
# configure.ac stays untouched
|
2000-04-27 22:03:57 +02:00
|
|
|
|
2006-02-08 10:23:32 +01:00
|
|
|
PROJECT=ngspice
|
2000-04-27 22:03:57 +02:00
|
|
|
|
2006-02-08 10:23:32 +01:00
|
|
|
# ADMS variables
|
|
|
|
|
|
|
|
|
|
ADMSDIR=src/spicelib/devices/adms
|
|
|
|
|
XMLPATH=src/spicelib/devices/adms/admst
|
|
|
|
|
ADMSXML=admsXml
|
|
|
|
|
ADMS=0
|
|
|
|
|
|
|
|
|
|
# Exit variable
|
2000-04-27 22:03:57 +02:00
|
|
|
DIE=0
|
|
|
|
|
|
2006-02-08 10:23:32 +01: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 10:23:32 +01:00
|
|
|
help()
|
|
|
|
|
{
|
2010-09-19 20:27:16 +02: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 10:23:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
version()
|
|
|
|
|
{
|
2010-09-19 20:27:16 +02:00
|
|
|
echo
|
|
|
|
|
echo "$PROJECT autogen.sh 1.0"
|
|
|
|
|
echo
|
2006-02-08 10:23:32 +01:00
|
|
|
}
|
|
|
|
|
|
2010-09-19 20:27:16 +02:00
|
|
|
error_and_exit()
|
2010-08-01 21:02:23 +02:00
|
|
|
{
|
2010-09-19 20:27:16 +02:00
|
|
|
echo "Error: $1"
|
|
|
|
|
if [ "$ADMS" -eq 1 ]; then
|
|
|
|
|
rm -f temp-adms.ac
|
|
|
|
|
fi
|
|
|
|
|
exit 1
|
2010-08-01 21:02:23 +02:00
|
|
|
}
|
2006-02-08 10:23:32 +01:00
|
|
|
|
2010-08-18 20:08:11 +02:00
|
|
|
check_awk()
|
|
|
|
|
{
|
2010-09-19 20:27:16 +02:00
|
|
|
(awk --version) < /dev/null > /dev/null 2>&1 || {
|
2010-08-18 20:08:11 +02:00
|
|
|
echo
|
|
|
|
|
echo "You must have awk installed to compile $PROJECT with --adms."
|
|
|
|
|
exit 1
|
2010-09-19 20:27:16 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-08 10:23:32 +01:00
|
|
|
check_autoconf()
|
|
|
|
|
{
|
2010-09-19 20:27:16 +02:00
|
|
|
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
2000-04-27 22:03:57 +02:00
|
|
|
echo
|
|
|
|
|
echo "You must have autoconf installed to compile $PROJECT."
|
2005-09-06 22:28:26 +02:00
|
|
|
echo "See http://www.gnu.org/software/automake/"
|
|
|
|
|
echo "(newest stable release is recommended)"
|
2000-04-27 22:03:57 +02:00
|
|
|
DIE=1
|
2010-09-19 20:27:16 +02:00
|
|
|
}
|
2000-04-27 22:03:57 +02:00
|
|
|
|
2012-10-29 23:47:02 +01:00
|
|
|
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
|
2000-04-27 22:03:57 +02:00
|
|
|
echo
|
|
|
|
|
echo "You must have libtool installed to compile $PROJECT."
|
2005-09-06 22:28:26 +02:00
|
|
|
echo "See http://www.gnu.org/software/libtool/"
|
|
|
|
|
echo "(newest stable release is recommended)"
|
2000-04-27 22:03:57 +02:00
|
|
|
DIE=1
|
2010-09-19 20:27:16 +02:00
|
|
|
}
|
2000-04-27 22:03:57 +02:00
|
|
|
|
2010-09-19 20:27:16 +02:00
|
|
|
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
2000-04-27 22:03:57 +02:00
|
|
|
echo
|
|
|
|
|
echo "You must have automake installed to compile $PROJECT."
|
2005-09-06 22:28:26 +02:00
|
|
|
echo "See http://www.gnu.org/software/automake/"
|
|
|
|
|
echo "(newest stable release is recommended)"
|
2000-04-27 22:03:57 +02:00
|
|
|
DIE=1
|
2010-09-19 20:27:16 +02:00
|
|
|
}
|
2000-04-27 22:03:57 +02:00
|
|
|
}
|
|
|
|
|
|
2006-02-08 10:23:32 +01:00
|
|
|
|
|
|
|
|
check_adms()
|
|
|
|
|
{
|
2010-09-19 20:27:16 +02:00
|
|
|
(admsXml --version) < /dev/null > /dev/null 2>&1 || {
|
2006-02-08 10:23:32 +01: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 20:27:16 +02:00
|
|
|
}
|
2006-02-08 10:23:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
|
"--adms" | "-a")
|
2010-09-19 20:27:16 +02:00
|
|
|
check_adms
|
|
|
|
|
ADMS=1
|
|
|
|
|
;;
|
|
|
|
|
|
2006-02-08 10:23:32 +01:00
|
|
|
"--help" | "-h")
|
2010-09-19 20:27:16 +02:00
|
|
|
help
|
|
|
|
|
exit 0
|
|
|
|
|
;;
|
|
|
|
|
|
2006-02-08 10:23:32 +01:00
|
|
|
"--version" | "-v")
|
2010-09-19 20:27:16 +02:00
|
|
|
version
|
|
|
|
|
exit 0
|
|
|
|
|
;;
|
|
|
|
|
|
2006-02-08 10:23:32 +01:00
|
|
|
*)
|
2010-09-19 20:27:16 +02:00
|
|
|
;;
|
|
|
|
|
esac
|
2006-02-08 10:23:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
check_autoconf
|
|
|
|
|
|
2010-09-19 20:27:16 +02:00
|
|
|
if [ "$DIE" -eq 1 ]; then
|
|
|
|
|
exit 1
|
2000-04-27 22:03:57 +02:00
|
|
|
fi
|
|
|
|
|
|
2010-09-19 20:27:16 +02:00
|
|
|
[ -f "DEVICES" ] || {
|
|
|
|
|
echo "You must run this script in the top-level $PROJECT directory"
|
|
|
|
|
exit 1
|
2000-04-27 22:03:57 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 19:13:26 +02:00
|
|
|
# only for --adms:
|
2011-05-19 19:47:40 +02:00
|
|
|
if [ "$ADMS" -gt 0 ]; then
|
2010-09-19 20:27:16 +02: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
|
2010-09-21 19:40:57 +02:00
|
|
|
# some sed's fail to process the '\n' escape on the RHS,
|
|
|
|
|
# thus use an escaped plain newline
|
2010-09-19 20:27:16 +02:00
|
|
|
sed \
|
2010-09-21 19:40:57 +02:00
|
|
|
-e "s,tests\\/vbic\\/Makefile,&\\
|
|
|
|
|
$znew
|
|
|
|
|
," \
|
2010-09-19 20:27:16 +02: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 20:27:16 +02:00
|
|
|
)
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
fi
|
|
|
|
|
done
|
2008-12-28 18:29:30 +01:00
|
|
|
|
2006-02-08 10:23:32 +01:00
|
|
|
fi
|
|
|
|
|
|
2012-10-29 23:47:02 +01:00
|
|
|
echo "Running $LIBTOOLIZE"
|
|
|
|
|
$LIBTOOLIZE --copy --force \
|
|
|
|
|
|| error_and_exit "$LIBTOOLIZE failed"
|
2010-09-17 18:26:06 +02:00
|
|
|
|
2012-06-21 19:17:01 +02:00
|
|
|
echo "Running aclocal $ACLOCAL_FLAGS"
|
|
|
|
|
aclocal $ACLOCAL_FLAGS \
|
|
|
|
|
|| error_and_exit "aclocal failed"
|
|
|
|
|
|
2006-02-08 10:23:32 +01:00
|
|
|
# optional feature: autoheader
|
2010-09-19 20:27:16 +02:00
|
|
|
(autoheader --version) < /dev/null > /dev/null 2>&1
|
2007-12-15 14:41:48 +01:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
|
echo "Running autoheader"
|
2010-09-19 20:27:16 +02:00
|
|
|
autoheader \
|
|
|
|
|
|| error_and_exit "autoheader failed"
|
2007-12-15 14:41:48 +01:00
|
|
|
fi
|
2006-02-08 10:23:32 +01:00
|
|
|
|
2007-12-15 14:41:48 +01:00
|
|
|
echo "Running automake -Wall --copy --add-missing"
|
2010-09-19 20:27:16 +02:00
|
|
|
automake -Wall --copy --add-missing \
|
|
|
|
|
|| error_and_exit "automake failed"
|
2006-02-08 10:23:32 +01:00
|
|
|
|
2011-05-19 19:47:40 +02:00
|
|
|
if [ "$ADMS" -gt 0 ]; then
|
2010-09-19 20:27:16 +02:00
|
|
|
echo "Running automake for adms"
|
|
|
|
|
automake -Wall --copy --add-missing $adms_Makefiles \
|
|
|
|
|
|| error_and_exit "automake failed"
|
2010-08-18 19:13:26 +02:00
|
|
|
fi
|
2006-02-08 10:23:32 +01:00
|
|
|
|
2010-08-18 19:13:26 +02:00
|
|
|
echo "Running autoconf"
|
2011-05-19 19:47:40 +02:00
|
|
|
if [ "$ADMS" -gt 0 ]; then
|
2010-09-19 20:27:16 +02:00
|
|
|
autoconf temp-adms.ac > configure \
|
|
|
|
|
|| error_and_exit "autoconf failed, with adms"
|
|
|
|
|
rm -f temp-adms.ac
|
2010-08-18 19:13:26 +02:00
|
|
|
else
|
2010-09-19 20:27:16 +02:00
|
|
|
autoconf \
|
|
|
|
|
|| error_and_exit "autoconf failed"
|
2010-08-01 12:28:18 +02:00
|
|
|
fi
|
2008-12-28 18:29:30 +01:00
|
|
|
|
2007-12-15 14:41:48 +01:00
|
|
|
echo "Success."
|
2010-08-01 12:28:18 +02:00
|
|
|
exit 0
|