diff --git a/configure b/configure index 8120ee23..51867f2c 100755 --- a/configure +++ b/configure @@ -32,7 +32,7 @@ baseos=`$full_pathname/scripts/getbaseos`; installdir=/usr/local/cad -if [ $# -eq 1 ] +if [ $# -gt 0 ] then installdir=$1 fi @@ -92,6 +92,16 @@ then mkdir $installdir/act fi +# get additional CFLAGS and pass them through +if [ $# -gt 1 ] +then + case $2 in + "CFLAGS="*) addon_cflags=${2#CFLAGS=} + addon_cflags=${addon_cflags#\"} + addon_cflags=${addon_cflags#\'} + echo "CFLAGS: $addon_cflags" + esac +fi # # shared linking on macos @@ -101,6 +111,13 @@ then sh_build=-fPIC sh_link=-dynamiclib sh_exe_options= +elif [ "x$baseos" = "xlinux" ] || [ "x$baseos" = "xsolaris" ] +then + sh_build="\"-shared -DPIC -fPIC\"" + # the RUNPATH shared object search parameter are relative the location of the binary during runtime, and as backup the compile time $ACT_HOME path is used + # libraries and executables are parsed differently by the build system hand have therefor different escape patterns + sh_link="\"-shared -Wl,-x,-rpath=\\\$ORIGIN/../lib,-rpath=$ACT_HOME/lib\"" + sh_exe_options="\"-Wl,-rpath=\\$\$ORIGIN/../lib,-rpath=$ACT_HOME/lib\"" else sh_build="\"-shared -DPIC -fPIC\"" sh_link="\"-shared -Wl,-x,-rpath=$ACT_HOME/lib\"" @@ -110,7 +127,8 @@ fi c_compiler_name=gcc cxx_compiler_name=g++ -c_compiler_flags=-O2 +# the double parentesis are needed beause of double parcing in the check script and are removed in the makefile to have the intended behaviour +c_compiler_flags="\"-O2 ${addon_cflags}\"" make_program=gmake myranlib=ranlib diff --git a/scripts/Makefile.std b/scripts/Makefile.std index 4dba46f1..7f6434f3 100644 --- a/scripts/Makefile.std +++ b/scripts/Makefile.std @@ -74,7 +74,7 @@ DFLAGS=-DARCH_$(ARCH) -DOS_$(OS) -DBASEOS_$(BASEOS) -I$(INSTALLINC) # -D_FORTIFY ifndef DEPEND_FLAGS DEPEND_FLAGS=-I. endif -CFLAGS=$(C_COMPILER_FLAGS) +CFLAGS=$(subst ",,$(C_COMPILER_FLAGS)) all: installincsub dependsub allsub move-in $(TARGETLIBS) install_lib install_inc $(TARGETS) $(EXTRA) move-out postsub diff --git a/scripts/check b/scripts/check index 8764ea7e..392f97c5 100755 --- a/scripts/check +++ b/scripts/check @@ -66,9 +66,9 @@ int main (void) EOM - +# the $C_COMPILER_FLAGS enable to load so files form a custom path echo " ... looking for editline" -if ! $C_COMPILER_NAME -c __tst1.c >/dev/null 2>&1 +if ! $C_COMPILER_NAME $C_COMPILER_FLAGS -c __tst1.c >/dev/null 2>&1 then rm -f __tst1.c echo "Did not find libeditline on the system" @@ -76,7 +76,7 @@ then fi echo " ... looking for zlib" -if ! $C_COMPILER_NAME __tst1.o -lz >/dev/null 2>&1 +if ! $C_COMPILER_NAME $C_COMPILER_FLAGS __tst1.o -lz >/dev/null 2>&1 then rm -f __tst1.c echo "Did not find zlib on the system" diff --git a/simulation/prsim/Makefile b/simulation/prsim/Makefile index 017d3bc2..7887cd9a 100644 --- a/simulation/prsim/Makefile +++ b/simulation/prsim/Makefile @@ -32,7 +32,7 @@ SRCS=$(OBJS:.o=.c) include $(VLSI_TOOLS_SRC)/scripts/Makefile.std $(BIN1): $(LIB) $(OBJS1) $(LIBDEPEND) $(SCMCLIDEPEND) - $(CXX) $(CFLAGS) $(OBJS1) -o $(BIN1) $(LIBCOMMON) $(LIBACTSCMCLI) -ledit -ldl + $(CXX) $(CFLAGS) $(OBJS1) -o $(BIN1) $(LIBCOMMON) $(LIBACTSCMCLI) -ledit $(SH_EXE_OPTIONS) -ldl $(BIN2): $(LIB) $(OBJS2) $(LIBDEPEND) $(CXX) $(CFLAGS) $(OBJS2) -o $(BIN2) $(LIBCOMMON)