diff options
-rw-r--r-- | aclocal.m4 | 67 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | distrib/configure.ac.in | 3 |
3 files changed, 57 insertions, 16 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index f6f1f2bc87..4d65e4eb2b 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -426,8 +426,16 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS], fi # Reduce memory usage when linking. See trac #5240. - $3="$$3 -Wl,--hash-size=31 -Wl,--reduce-memory-overheads" - $4="$$4 --hash-size=31 --reduce-memory-overheads" + if test -n "$LdHashSize31" + then + $3="$$3 -Wl,$LdHashSize31" + $4="$$4 $LdHashSize31" + fi + if test -n "$LdReduceMemoryOverheads" + then + $3="$$3 -Wl,$LdReduceMemoryOverheads" + $4="$$4 $LdReduceMemoryOverheads" + fi rm -f conftest.c conftest.o AC_MSG_RESULT([done]) @@ -774,30 +782,57 @@ AC_SUBST(Alex3) ]) -# FP_PROG_LD_X -# ------------ -# Sets the output variable LdXFlag to -x if ld supports this flag, otherwise the -# variable's value is empty. -AC_DEFUN([FP_PROG_LD_X], +# FP_PROG_LD_FLAG +# --------------- +# Sets the output variable $2 to $1 if ld supports the $1 flag. +# Otherwise the variable's value is empty. +AC_DEFUN([FP_PROG_LD_FLAG], [ -AC_CACHE_CHECK([whether ld understands -x], [fp_cv_ld_x], +AC_CACHE_CHECK([whether ld understands $1], [fp_cv_$2], [echo 'foo() {}' > conftest.c ${CC-cc} -c conftest.c -if ${LdCmd} -r -x -o conftest2.o conftest.o > /dev/null 2>&1; then - fp_cv_ld_x=yes +if ${LdCmd} -r $1 -o conftest2.o conftest.o > /dev/null 2>&1; then + fp_cv_$2=$1 else - fp_cv_ld_x=no + fp_cv_$2= fi rm -rf conftest*]) -if test "$fp_cv_ld_x" = yes; then - LdXFlag=-x -else - LdXFlag= -fi +$2=$fp_cv_$2 +])# FP_PROG_LD_FLAG + + +# FP_PROG_LD_X +# ------------ +# Sets the output variable LdXFlag to -x if ld supports this flag. +# Otherwise the variable's value is empty. +AC_DEFUN([FP_PROG_LD_X], +[ +FP_PROG_LD_FLAG([-x],[LdXFlag]) AC_SUBST([LdXFlag]) ])# FP_PROG_LD_X +# FP_PROG_LD_HashSize31 +# ------------ +# Sets the output variable LdHashSize31 to --hash-size=31 if ld supports +# this flag. Otherwise the variable's value is empty. +AC_DEFUN([FP_PROG_LD_HashSize31], +[ +FP_PROG_LD_FLAG([--hash-size=31],[LdHashSize31]) +])# FP_PROG_LD_HashSize31 + + +# FP_PROG_LD_ReduceMemoryOverheads +# ------------ +# Sets the output variable LdReduceMemoryOverheads to +# --reduce-memory-overheads if ld supports this flag. +# Otherwise the variable's value is empty. +AC_DEFUN([FP_PROG_LD_ReduceMemoryOverheads], +[ +FP_PROG_LD_FLAG([--reduce-memory-overheads],[LdReduceMemoryOverheads]) +])# FP_PROG_LD_ReduceMemoryOverheads + + # FP_PROG_LD_BUILD_ID # ------------ diff --git a/configure.ac b/configure.ac index 34333819a0..475f734aa0 100644 --- a/configure.ac +++ b/configure.ac @@ -424,6 +424,9 @@ dnl ** look to see if we have a C compiler using an llvm back end. dnl FP_CC_LLVM_BACKEND +FP_PROG_LD_HashSize31 +FP_PROG_LD_ReduceMemoryOverheads + FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS]) FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0]) FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1]) diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 8af06d2254..a9fc134021 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -56,6 +56,9 @@ FIND_GCC() FP_GCC_VERSION AC_PROG_CPP +FP_PROG_LD_HashSize31 +FP_PROG_LD_ReduceMemoryOverheads + # dnl ** Check gcc version and flags we need to pass it ** # |