aboutsummaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2014-11-08 07:13:08 +0100
committerTristan Gingold <tgingold@free.fr>2014-11-08 07:13:08 +0100
commit4ef1adc1294c586f683a20a488120e6e42b4e6e2 (patch)
tree32b030d71e312ae6e81c419df4c27f4eabf17964 /configure
parent59ddac0209695d4f54c88f77e7a954feb5ab1aec (diff)
downloadghdl-4ef1adc1294c586f683a20a488120e6e42b4e6e2.tar.gz
ghdl-4ef1adc1294c586f683a20a488120e6e42b4e6e2.tar.bz2
ghdl-4ef1adc1294c586f683a20a488120e6e42b4e6e2.zip
configure/Makefile: support build for gcc.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure32
1 files changed, 27 insertions, 5 deletions
diff --git a/configure b/configure
index fb3babb30..e869495e5 100755
--- a/configure
+++ b/configure
@@ -10,12 +10,14 @@ GNATMAKE=${GNATMAKE:-gnatmake}
prefix=/usr/local
libdirsuffix=lib/ghdl
libdirreverse=../..
+gcc_src_dir=
+gcc_version=unknown
build=
show_help=no
progname=$0
-subst_vars="CC GNATMAKE CFLAGS build srcdir prefix backend libdirsuffix libdirreverse"
+subst_vars="CC GNATMAKE CFLAGS build srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir"
# Find srcdir
srcdir=`dirname $progname`
@@ -25,13 +27,17 @@ fi
# Check echo -n / echo \c
if test x`echo -n` = x"-n" ; then
- echon=""
+ echon=
echoc="\c"
else
echon="-n"
- echoc=""
+ echoc=
fi
+# Read gcc version from README file
+gcc_version=`grep '^gcc version' $srcdir/README |
+ sed -e 's/gcc version \([0-9.]*\) \[.*\]\.$/\1/'`
+
# Decode options
for opt do
optarg=`expr x$opt : 'x[^=]*=\(.*\)'`
@@ -42,6 +48,7 @@ for opt do
;;
--prefix=*) prefix="$optarg";;
--srcdir=*) srcdir="$optarg";;
+ --with-gcc=*) gcc_src_dir="$optarg"; backend=gcc;;
-h|-help|--help) show_help=yes;;
*) echo "$0: unknown option $opt; try $0 --help"
exit 1
@@ -57,6 +64,7 @@ Usage: configure [options]
Options [defaults in brackets]:
--prefix=PREFIX install in PREFIX [$prefix]
--srcdir=SRCDIR source code path [$srcdir]
+ --with-gcc=DIR use gcc backend from DIR (needs gcc $gcc_version)
EOF
exit 0
fi
@@ -83,6 +91,20 @@ if test $backend = mcode; then
fi
fi
+# For gcc backend, check version
+if test $backend = gcc; then
+ if ! test -f $gcc_src_dir/gcc/BASE-VER; then
+ echo "cannot found gcc/BASE-VER in $gcc_src_dir"
+ exit 1
+ fi
+ base_ver=`cat $gcc_src_dir/gcc/BASE-VER`
+ if test x$base_ver != x$gcc_version; then
+ echo "Mismatch gcc version from $gcc_src_dir"
+ echo "Need gcc version $gcc_version"
+ exit 1
+ fi
+fi
+
# Compute build machine
if test x$build = x; then
build=`$CC $CFLAGS -dumpmachine`
@@ -97,9 +119,9 @@ echo "# Generated by configure."
echo "# Run this file to recreate the current configuration."
echo
echo "# Generated by:"
-echo $echon "# $progname" $echoc
+echo $echon "# $progname"$echoc
for opt do
- echo $echon " " $opt $echoc
+ echo $echon " $opt"$echoc
done
echo
echo