Detect and use gld/gnm/gar as alternatives to ld/nm/ar, especially for winegcc.
Francois Gouget
fgouget at codeweavers.com
Thu Jun 26 07:05:57 CDT 2008
---
On Solaris it is customary to prefix the names of the GNU tools with 'g'
to avoid conflicts with their 'native' counterparts. However Wine
hardcodes the name of these tools to ld/nm/ar and thus won't compile on
a Solaris system that only has the GNU tools.
We're already looking for gas as an alternative to as so we should look
for gld, gnm and gar too.
I think that, except for configure, this patch should apply
independently from the previous libXxf86vm patch.
Make.rules.in | 1 +
configure | 172 +++++++++++++++++++++++++++++++++++++++------
configure.ac | 5 +-
tools/winegcc/Makefile.in | 1 +
tools/winegcc/winegcc.c | 2 +
5 files changed, 157 insertions(+), 24 deletions(-)
diff --git a/Make.rules.in b/Make.rules.in
index 1d03841..b46a573 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -46,6 +46,7 @@ LN_S = @LN_S@
TOOLSDIR = @TOOLSDIR@
AS = @AS@
LD = @LD@
+NM = @NM@
LDFLAGS = @LDFLAGS@
PRELINK = @PRELINK@
RM = rm -f
diff --git a/configure b/configure
index c47b723..5e5b8d0 100755
--- a/configure
+++ b/configure
@@ -687,7 +687,11 @@ BISON
AS
ac_ct_AS
LD
+ac_ct_LD
+NM
+ac_ct_NM
AR
+ac_ct_AR
ARFLAGS
RANLIB
STRIP
@@ -5437,8 +5441,10 @@ esac
fi
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
+ for ac_prog in ld gld
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_LD+set}" = set; then
@@ -5454,7 +5460,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_LD="${ac_tool_prefix}ld"
+ ac_cv_prog_LD="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -5474,11 +5480,15 @@ echo "${ECHO_T}no" >&6; }
fi
+ test -n "$LD" && break
+ done
fi
-if test -z "$ac_cv_prog_LD"; then
+if test -z "$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
+ for ac_prog in ld gld
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_LD+set}" = set; then
@@ -5494,7 +5504,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_LD="ld"
+ ac_cv_prog_ac_ct_LD="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -5513,6 +5523,10 @@ else
echo "${ECHO_T}no" >&6; }
fi
+
+ test -n "$ac_ct_LD" && break
+done
+
if test "x$ac_ct_LD" = x; then
LD="ld"
else
@@ -5528,13 +5542,117 @@ ac_tool_warned=yes ;;
esac
LD=$ac_ct_LD
fi
+fi
+
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in nm gnm
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_NM+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$NM"; then
+ ac_cv_prog_NM="$NM" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_NM="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+NM=$ac_cv_prog_NM
+if test -n "$NM"; then
+ { echo "$as_me:$LINENO: result: $NM" >&5
+echo "${ECHO_T}$NM" >&6; }
else
- LD="$ac_cv_prog_LD"
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$NM" && break
+ done
+fi
+if test -z "$NM"; then
+ ac_ct_NM=$NM
+ for ac_prog in nm gnm
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_NM+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_NM"; then
+ ac_cv_prog_ac_ct_NM="$ac_ct_NM" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_NM="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NM=$ac_cv_prog_ac_ct_NM
+if test -n "$ac_ct_NM"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_NM" >&5
+echo "${ECHO_T}$ac_ct_NM" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$ac_ct_NM" && break
+done
+
+ if test "x$ac_ct_NM" = x; then
+ NM="nm"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ NM=$ac_ct_NM
+ fi
fi
if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
+ for ac_prog in ar gar
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_AR+set}" = set; then
@@ -5550,7 +5668,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_AR="${ac_tool_prefix}ar"
+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -5570,11 +5688,15 @@ echo "${ECHO_T}no" >&6; }
fi
+ test -n "$AR" && break
+ done
fi
-if test -z "$ac_cv_prog_AR"; then
+if test -z "$AR"; then
ac_ct_AR=$AR
- # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
+ for ac_prog in ar gar
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
@@ -5590,7 +5712,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_AR="ar"
+ ac_cv_prog_ac_ct_AR="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -5609,6 +5731,10 @@ else
echo "${ECHO_T}no" >&6; }
fi
+
+ test -n "$ac_ct_AR" && break
+done
+
if test "x$ac_ct_AR" = x; then
AR="ar"
else
@@ -5624,8 +5750,6 @@ ac_tool_warned=yes ;;
esac
AR=$ac_ct_AR
fi
-else
- AR="$ac_cv_prog_AR"
fi
ARFLAGS=rc
@@ -23545,16 +23669,16 @@ BISON!$BISON$ac_delim
AS!$AS$ac_delim
ac_ct_AS!$ac_ct_AS$ac_delim
LD!$LD$ac_delim
+ac_ct_LD!$ac_ct_LD$ac_delim
+NM!$NM$ac_delim
+ac_ct_NM!$ac_ct_NM$ac_delim
AR!$AR$ac_delim
+ac_ct_AR!$ac_ct_AR$ac_delim
ARFLAGS!$ARFLAGS$ac_delim
RANLIB!$RANLIB$ac_delim
STRIP!$STRIP$ac_delim
WINDRES!$WINDRES$ac_delim
LN_S!$LN_S$ac_delim
-LN!$LN$ac_delim
-GREP!$GREP$ac_delim
-EGREP!$EGREP$ac_delim
-LDCONFIG!$LDCONFIG$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 82; then
@@ -23616,6 +23740,10 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+LN!$LN$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+LDCONFIG!$LDCONFIG$ac_delim
INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
INSTALL_DATA!$INSTALL_DATA$ac_delim
@@ -23694,7 +23822,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 80; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/configure.ac b/configure.ac
index 2d2f892..4e9e381 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,8 +161,9 @@ then
fi
AC_CHECK_TOOLS(AS,[gas as],as)
-AC_CHECK_TOOL(LD,ld,ld)
-AC_CHECK_TOOL(AR,ar,ar)
+AC_CHECK_TOOLS(LD,[ld gld],ld)
+AC_CHECK_TOOLS(NM,[nm gnm],nm)
+AC_CHECK_TOOLS(AR,[ar gar],ar)
AC_SUBST(ARFLAGS,rc)
AC_PROG_RANLIB
AC_CHECK_TOOL(STRIP,strip,strip)
diff --git a/tools/winegcc/Makefile.in b/tools/winegcc/Makefile.in
index 31c3a5b..fd7691d 100644
--- a/tools/winegcc/Makefile.in
+++ b/tools/winegcc/Makefile.in
@@ -9,6 +9,7 @@ DEFS = \
-DCPP="\"@CPPBIN@\"" \
-DCXX="\"@CXX@\"" \
-DLD="\"$(LD)\"" \
+ -DNM="\"$(NM)\"" \
-DPRELINK="\"$(PRELINK)\""
TOPSRCDIR = @top_srcdir@
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 2c63ae5..b4a314d 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -572,6 +572,8 @@ static void build(struct options* opts)
strarray_add(spec_args, AS);
strarray_add(spec_args, "--ld-cmd");
strarray_add(spec_args, LD);
+ strarray_add(spec_args, "--nm-cmd");
+ strarray_add(spec_args, NM);
strarray_addall(spec_args, strarray_fromstring(DLLFLAGS, " "));
strarray_add(spec_args, opts->shared ? "--dll" : "--exe");
strarray_add(spec_args, "-o");
--
1.5.5.3
More information about the wine-patches
mailing list