From de3595192bb0c192c66380b92977ea17c49fd792 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 19 Apr 2017 20:43:06 +0200 Subject: configure: set abs_srcdir --- Makefile.in | 3 ++- configure | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index f68ff33a4..4403478c6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -19,6 +19,7 @@ CC=@CC@ CXX=@CXX@ build=@build@ srcdir=@srcdir@ +abs_srcdir=@abs_srcdir@ GNATMAKE=@GNATMAKE@ prefix=@prefix@ backend=@backend@ @@ -107,7 +108,7 @@ Makefile: $(srcdir)/Makefile.in GHDL_COMMON_INCFLAGS=-aI$(srcdir)/src -aI$(srcdir)/src/vhdl -aI$(srcdir)/src/grt -aI$(srcdir)/src/psl -aI$(srcdir)/src/vhdl/translate -GRTSRCDIR=$(srcdir)/src/grt +GRTSRCDIR=$(abs_srcdir)/src/grt include $(GRTSRCDIR)/Makefile.inc version.tmp: $(srcdir)/src/version.in force diff --git a/configure b/configure index ff35d7441..2bb5ce7c1 100755 --- a/configure +++ b/configure @@ -25,7 +25,7 @@ PIC_FLAGS=-fPIC show_help=no progname=$0 -subst_vars="CC CXX GNATMAKE CFLAGS LDFLAGS build srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir llvm_config llvm_be backtrace_lib build_mode EXEEXT SOEXT PIC_FLAGS default_pie" +subst_vars="CC CXX GNATMAKE CFLAGS LDFLAGS build srcdir abs_srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir llvm_config llvm_be backtrace_lib build_mode EXEEXT SOEXT PIC_FLAGS default_pie" # Find srcdir srcdir=`dirname $progname` @@ -94,7 +94,27 @@ EOF exit 0 fi +# Set abs_srcdir (absolute srcdir) +case $srcdir in + /*) abs_srcdir=$srcdir;; + *) abs_srcdir=`pwd`/$srcdir ;; +esac + # Sanity checks +# Check srcdir +pat="2019802090ed76fc5c54cec58f22a2c1" +if ! grep $pat $srcdir/configure > /dev/null 2>&1; then + echo "Incorrect srcdir; try with --srcdir=xx" + echo "srcdir=$srcdir" + exit 1 +fi + +if ! cmp $srcdir/configure $abs_srcdir/configure > /dev/null 2>&1; then + echo "Cannot compute absolute source dir (or incorrect srcdir)" + echo "srcdir=$srcdir" + echo "abs_srcdir=$abs_srcdir" + exit 1 +fi # Check that gnatmake exists if ! $GNATMAKE --version >/dev/null 2>&1; then echo "Sorry, you need GNAT to build GHDL. See the README" -- cgit v1.2.3