From: simonmar Date: Wed, 24 Oct 2001 09:43:48 +0000 (+0000) Subject: [project @ 2001-10-24 09:43:47 by simonmar] X-Git-Tag: Approximately_9120_patches~724 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=4d6959b1a60cc8b03c76346c9a7bddfd77f4f80a [project @ 2001-10-24 09:43:47 by simonmar] Detect whether the local 'ld' command supports -x, and only use the flag if it does. --- diff --git a/aclocal.m4 b/aclocal.m4 index f8435bf..eb7b0ca 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -dnl $Id: aclocal.m4,v 1.85 2001/10/13 20:26:13 sof Exp $ +dnl $Id: aclocal.m4,v 1.86 2001/10/24 09:43:47 simonmar Exp $ dnl dnl Extra autoconf macros for the Glasgow fptools dnl @@ -245,6 +245,29 @@ AC_SUBST(ContextDiffCmd) ]) dnl +dnl Check whether ld supports -x +dnl +AC_DEFUN(FPTOOLS_LD_X, +[AC_CACHE_CHECK([whether ld understands -x], fptools_cv_ld_x, +[ +echo 'foo() {}' > conftest.c +${CC-cc} -c conftest.c +if ${LdCmd} -r -x -o foo.o conftest.o; then + fptools_cv_ld_x=yes +else + fptools_cv_ld_x=no +fi +rm -rf conftest.c conftest.o foo.o +]) +if test "$fptools_cv_ld_x" = yes; then + LdXFlag=-x +else + LdXFlag= +fi +AC_SUBST(LdXFlag) +]) + +dnl dnl Finding the Right Yacc dnl AC_DEFUN(FPTOOLS_PROG_YACCY, diff --git a/configure.in b/configure.in index ed227ce..b7e9464 100644 --- a/configure.in +++ b/configure.in @@ -973,5 +973,8 @@ FPTOOLS_END_DATA_SECTION dnl ** code before data? FPTOOLS_CODE_BEFORE_DATA +dnl ** check for ld, and whether ld has -x option +AC_PATH_PROG(LdCmd, ld) +FPTOOLS_LD_X AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h ) diff --git a/mk/config.mk.in b/mk/config.mk.in index 1268da3..2f52bad 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -700,7 +700,6 @@ INSTALL := $(subst .././install-sh,$(FPTOOLS_TOP_ABS)/install-sh,$(INSTALL)) LATEX = latex HEVEA = hevea HACHA = hacha -LD = ld LN_S = @LN_S@ MANMACROS = -man MSMACROS = -ms @@ -714,6 +713,13 @@ RANLIB = @RANLIB@ RM = rm -f SED = @SedCmd@ SHELL = /bin/sh + +# Some ld's support the -x flag and some don't, so the configure +# script detects which we have and sets LdXFlag to "-x" or "" +# respectively. +LD = @LdCmd@ +LD_X = @LdXFlag@ + # # In emergency situations, REAL_SHELL is used to perform shell commands # from within the ghc driver script, by scribbling the command line to diff --git a/mk/target.mk b/mk/target.mk index b7ec45b..17de1d3 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -461,7 +461,7 @@ HC_SPLIT_PRE = \ $(RM) $@; if [ ! -d $(basename $@) ]; then mkdir $(basename $@); else \ $(FIND) $(basename $@) -name '*.$(way_)o' | xargs $(RM) __rm_food; fi ifeq "$(GhcWithInterpreter)" "YES" -HC_SPLIT_POST = $(LD) -r -x -o $@ $(basename $@)/*.$(way_)o +HC_SPLIT_POST = $(LD) -r $(LD_X) -o $@ $(basename $@)/*.$(way_)o else HC_SPLIT_POST = touch $@ endif # GhcWithInterpreter == YES @@ -491,12 +491,12 @@ ifeq "$(StripLibraries)" "YES" ifeq "$(SplitObjs)" "YES" SRC_HC_POST_OPTS += \ for i in $(basename $@)/*; do \ - $(LD) -r -x -o $$i.tmp $$i; \ + $(LD) -r $(LD_X) -o $$i.tmp $$i; \ $(MV) $$i.tmp $$i; \ done else SRC_HC_POST_OPTS += \ - $(LD) -r -x -o $@.tmp $@; $(MV) $@.tmp $@ + $(LD) -r $(LD_X) -o $@.tmp $@; $(MV) $@.tmp $@ endif # SplitObjs endif # StripLibraries @@ -538,7 +538,7 @@ ifneq "$(DONT_WANT_STD_GHCI_LIB_RULE)" "YES" # hslibs/Win32 uses this 'feature'. # $(GHCI_LIBRARY) :: $(LIBOBJS) - $(LD) -r -x -o $@ $(LIBOBJS) $(STUBOBJS) + $(LD) -r $(LD_X) -o $@ $(LIBOBJS) $(STUBOBJS) endif # DONT_WANT_STD_GHCI_LIB_RULE endif # GhcWithInterpreter