diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/scan-tools.sh | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/scripts/scan-tools.sh b/scripts/scan-tools.sh index 1afdb6c64..7c0e89cea 100644 --- a/scripts/scan-tools.sh +++ b/scripts/scan-tools.sh @@ -5,7 +5,6 @@ shopt -s extglob topdir=$(pwd) opath=$PATH out=0 -clang=0 if [[ $NO_ERROR != @(0|1) ]]; then echo Please do not invoke this script directly! @@ -61,7 +60,6 @@ OpenBSD) fi ;; Darwin*) - clang=1 ;; *) # unsupported @@ -79,16 +77,12 @@ else makecmd=$(which gmake 2>/dev/null ) fi -if [ $clang -ne 1 ];then -HCFLAGS=-static-libgcc -fi - cat >Makefile <<'EOF' include ${ADK_TOPDIR}/prereq.mk all: run-test test: test.c - ${HOST_CC} $(HCFLAGS) -o $@ $^ ${LDADD} + ${HOST_CC} ${HOST_CFLAGS} -o $@ $^ ${LDADD} run-test: test ./test @@ -102,7 +96,18 @@ cat >test.c <<-'EOF' return (0); } EOF -X=$($makecmd ADK_TOPDIR=$topdir 2>&1) +X=$($makecmd ADK_TOPDIR=$topdir LDADD=-lgcc 2>&1) +if [[ $X != *@(Native compiler works)* ]]; then + echo Cannot compile with shared libgcc use static one. + HOST_CFLAGS=-static-libgcc + echo "HOST_CFLAGS:=-O0 -g0 -static-libgcc" >> $topdir/prereq.mk + echo "HOST_CXXFLAGS:=-O0 -g0 -static-libgcc" >> $topdir/prereq.mk +else + echo "HOST_CFLAGS:=-O0 -g0" >> $topdir/prereq.mk + echo "HOST_CXXFLAGS:=-O0 -g0" >> $topdir/prereq.mk +fi + +X=$($makecmd ADK_TOPDIR=$topdir HOST_CFLAGS=${HOST_CFLAGS} 2>&1) if [[ $X != *@(Native compiler works)* ]]; then echo "$X" | sed 's/^/| /' echo Cannot compile a simple test programme. @@ -154,7 +159,7 @@ cat >test.c <<-'EOF' } EOF X=$(echo 'Yay! Native compiler works.' | gzip | \ - $makecmd ADK_TOPDIR=$topdir LDADD=-lz 2>&1) + $makecmd ADK_TOPDIR=$topdir LDADD=-lz HOST_CFLAGS=${HOST_CFLAGS} 2>&1) if [[ $X != *@(Native compiler works)* ]]; then echo "$X" | sed 's/^/| /' echo Cannot compile a libz test programm. |