This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: Allow toplevel LDFLAGS to be set from the environment


Hi Guys,

  I am seeking permission to apply the following patch, originally
  suggested by Michael Deutschmann several years ago.  It is quite
  simple - it allows the top level Makefile to inherit the value of
  LDLFAGS if it is set in the environment.  This is currently
  permitted for other, similar flags (CFLAGS, CXXFLAGS), but not for
  LDFLAGS.

  DJ has expressed some concern that this might trip up cross-host
  builds if the user is unaware that their LDFLAGS setting is being
  inherited, but I doubt if this will be a real problem in practise
  because a) most users will not have LDFLAGS set and b) most linker
  flags will either be harmless or generate errors if used
  inappropriately for a cross-host build.

  Tested by building and installing an i686-pc-linux-gnu native
  toolchain and an x86 hosted and built, arm-elf targeted toolchain.

Cheers
  Nick

<toplevel>/ChangeLog
2004-10-18  Nick Clifton  <nickc@redhat.com>

	* Makefile.tpl (LDFLAGS): Allow this to be set from the
	configure script.
        * Makefile.in: Regenerate.
	* configure.in: Allow LDFLAGS to be set from the environment.
        * configure: Regenerate.

Index: Makefile.tpl
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.tpl,v
retrieving revision 1.116
diff -c -3 -p -r1.116 Makefile.tpl
*** Makefile.tpl	6 Oct 2004 10:09:29 -0000	1.116
--- Makefile.tpl	18 Oct 2004 13:19:34 -0000
*************** DLLTOOL = @DLLTOOL@
*** 339,345 ****
  NM = @NM@
  
  LD = @LD@
! LDFLAGS = 
  
  RANLIB = @RANLIB@
  
--- 339,345 ----
  NM = @NM@
  
  LD = @LD@
! LDFLAGS = @LDFLAGS@
  
  RANLIB = @RANLIB@
  
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.324
diff -c -3 -p -r1.324 configure.in
*** configure.in	12 Oct 2004 22:49:33 -0000	1.324
--- configure.in	18 Oct 2004 13:19:35 -0000
*************** if test "${build}" != "${host}" ; then
*** 971,976 ****
--- 971,977 ----
    CFLAGS=${CFLAGS-"-g -O2"}
    CXX=${CXX-${host_alias}-c++}
    CXXFLAGS=${CXXFLAGS-"-g -O2"}
+   LDFLAGS=${LDFLAGS-""}
    CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
    CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
    CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
*************** else
*** 1017,1022 ****
--- 1018,1024 ----
    CXX=${CXX-"c++"}
    CFLAGS=${CFLAGS-"-g"}
    CXXFLAGS=${CXXFLAGS-"-g -O2"}
+   LDFLAGS=${LDFLAGS-""}
  fi
  
  ACX_PROG_GNAT
*************** AC_SUBST(CXX)
*** 2156,2161 ****
--- 2158,2164 ----
  AC_SUBST(CFLAGS)
  AC_SUBST(CFLAGS_FOR_BUILD)
  AC_SUBST(CXXFLAGS)
+ AC_SUBST(LDFLAGS)
  
  # Target tools.
  NCN_STRICT_CHECK_TARGET_TOOL(CONFIGURED_AR_FOR_TARGET, ar)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]