diff --git a/build-aux/check.sh.in b/build-aux/check.sh.in index e692bc53..d3285f5e 100644 --- a/build-aux/check.sh.in +++ b/build-aux/check.sh.in @@ -79,6 +79,8 @@ if test $compiler = gcc; then cd gcc-lib srcdest=$srcdir/../ srcdir=../$srcdir + MES_CHECKING_BUILTIN_LIBS="-l gcc" + export MES_CHECKING_BUILTIN_LIBS ../pre-inst-env ${SHELL} ${srcdest}build-aux/check-mescc.sh ) fi @@ -97,7 +99,8 @@ fi LDFLAGS=" -nostdlib " - LIBS="-lc -lmescc" + MES_CHECKING_BUILTIN_LIBS="-l mescc" + export MES_CHECKING_BUILTIN_LIBS AR="${srcdest}pre-inst-env mesar" CC="${srcdest}pre-inst-env mescc" ../pre-inst-env ${SHELL} ${srcdest}build-aux/check-mescc.sh diff --git a/build-aux/test-c.sh b/build-aux/test-c.sh index eb3b356a..5d7875f7 100755 --- a/build-aux/test-c.sh +++ b/build-aux/test-c.sh @@ -40,16 +40,25 @@ rm -f "$o" CC=${CC-gcc} i=$(basename "$t" .c) + +if [ -z "${MES_CHECKING_BUILTIN_LIBS}" ] +then + MES_CHECKING_BUILTIN_LIBS="`${CC} --print-libgcc-file-name`" +fi + if [ -z "${i/[012][0-9]-*/}" ]; then - LIBS='-l mescc' + LIBS="${MES_CHECKING_BUILTIN_LIBS}" elif [ -z "${i/[34][0-9]-*/}" ]; then - LIBS='-l c-mini -l mescc' + LIBS="-l c-mini ${MES_CHECKING_BUILTIN_LIBS} -l c-mini" elif [ -z "${i/[78][0-9a-z]-*/}" ]; then - LIBS='-l c+tcc -l mescc' + LIBS="-l c+tcc ${MES_CHECKING_BUILTIN_LIBS} -l c+tcc" elif [ -z "${i/9[0-9a-z]-*/}" ]; then - LIBS='-l c+gnu -l mescc' + LIBS="-l c+gnu ${MES_CHECKING_BUILTIN_LIBS} -l c+gnu" else - LIBS='-l c -l mescc' + # Make it possible to resolve raise(), required by libgcc.a, provided + # in libc.a. The final command line has to have "-lc -lgcc -lc". + # See . + LIBS="-l c ${MES_CHECKING_BUILTIN_LIBS} -l c" fi if test $mes_kernel = gnu\