From 189ffc2e7313e901822caa7f76d1fe3961e922e0 Mon Sep 17 00:00:00 2001 From: Gerald Pfeifer Date: Wed, 14 Jan 2015 10:52:48 +0100 Subject: [PATCH] makefiles: Support building with non-default LD. --- Make.vars.in | 1 + configure | 93 +++++++++++++++++++++++++++++++++++++++ configure.ac | 1 + tools/winegcc/Makefile.in | 1 + tools/winegcc/winegcc.c | 2 + 5 files changed, 98 insertions(+) diff --git a/Make.vars.in b/Make.vars.in index ee8ee39e584..e825f4bc4a0 100644 --- a/Make.vars.in +++ b/Make.vars.in @@ -40,6 +40,7 @@ RANLIB = @RANLIB@ STRIP = @STRIP@ LN_S = @LN_S@ TOOLSDIR = @TOOLSDIR@ +LD = @LD@ LDFLAGS = @LDFLAGS@ DLLFLAGS = @DLLFLAGS@ PRELINK = @PRELINK@ diff --git a/configure b/configure index 817ddd77b33..c0aa93ebba6 100755 --- a/configure +++ b/configure @@ -732,6 +732,7 @@ BISON FLEX TOOLSDIR TARGETFLAGS +LD CPPBIN ac_ct_CXX CXXFLAGS @@ -4737,6 +4738,98 @@ cat >>confdefs.h <<_ACEOF #define EXEEXT "$ac_exeext" _ACEOF +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. +set dummy ${ac_tool_prefix}ld; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="${ac_tool_prefix}ld" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LD"; then + ac_ct_LD=$LD + # Extract the first word of "ld", so it can be a program name with args. +set dummy ld; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LD"; then + ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LD="ld" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LD=$ac_cv_prog_ac_ct_LD +if test -n "$ac_ct_LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5 +$as_echo "$ac_ct_LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LD" = x; then + LD="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LD=$ac_ct_LD + fi +else + LD="$ac_cv_prog_LD" +fi + case $host in *-darwin*) diff --git a/configure.ac b/configure.ac index df3c37b256e..ab8945a26ab 100644 --- a/configure.ac +++ b/configure.ac @@ -122,6 +122,7 @@ AC_PROG_CXX dnl We can't use AC_PROG_CPP for winegcc, it uses by default $(CC) -E AC_CHECK_TOOL(CPPBIN,cpp,cpp) AC_DEFINE_UNQUOTED(EXEEXT,["$ac_exeext"],[Define to the file extension for executables.]) +AC_CHECK_TOOL(LD,ld) case $host in *-darwin*) diff --git a/tools/winegcc/Makefile.in b/tools/winegcc/Makefile.in index 3975ca55d10..370a2e4b56e 100644 --- a/tools/winegcc/Makefile.in +++ b/tools/winegcc/Makefile.in @@ -16,6 +16,7 @@ winegcc_EXTRADEFS = \ -DCC="\"$(CC)\"" \ -DCPP="\"$(CPPBIN)\"" \ -DCXX="\"$(CXX)\"" \ + -DLD="\"$(LD)\"" \ -DPRELINK="\"$(PRELINK)\"" winegcc$(EXEEXT): winegcc.o utils.o diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index a2f09d21e51..3b2794e8c0c 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -1034,6 +1034,8 @@ static void build(struct options* opts) /* run winebuild to generate the .spec.o file */ spec_args = get_winebuild_args( opts ); strarray_add( spec_args, strmake( "--cc-cmd=%s", build_tool_name( opts, "gcc", CC ))); + strarray_add( spec_args, strmake( "--ld-cmd=%s", build_tool_name( opts, "ld", LD ))); + spec_o_name = get_temp_file(output_name, ".spec.o"); if (opts->force_pointer_size) strarray_add(spec_args, strmake("-m%u", 8 * opts->force_pointer_size ));