51
if test "$GCC" = yes; then
52
# Check if gcc -print-prog-name=ld gives a path.
50
if test -n "$LD"; then
51
AC_MSG_CHECKING([for ld])
52
elif test "$GCC" = yes; then
53
53
AC_MSG_CHECKING([for ld used by $CC])
56
# gcc leaves a trailing carriage return which upsets mingw
57
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
59
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
62
# Accept absolute paths.
63
[[\\/]]* | ?:[[\\/]]*)
64
re_direlt='/[[^/]][[^/]]*/\.\./'
65
# Canonicalize the pathname of ld
66
ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
67
while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
68
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
70
test -z "$LD" && LD="$ac_prog"
73
# If it fails, then pretend we aren't using GCC.
77
# If it is relative, then search for the first ld in PATH.
81
54
elif test "$with_gnu_ld" = yes; then
82
55
AC_MSG_CHECKING([for GNU ld])
84
57
AC_MSG_CHECKING([for non-GNU ld])
86
AC_CACHE_VAL([acl_cv_path_LD],
87
[if test -z "$LD"; then
88
acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
89
for ac_dir in $PATH; do
91
test -z "$ac_dir" && ac_dir=.
92
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
93
acl_cv_path_LD="$ac_dir/$ac_prog"
94
# Check to see if the program is GNU ld. I'd rather use --version,
95
# but apparently some variants of GNU ld only accept -v.
96
# Break only if it was the GNU/non-GNU ld that we prefer.
97
case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
99
test "$with_gnu_ld" != no && break
102
test "$with_gnu_ld" != yes && break
59
if test -n "$LD"; then
60
# Let the user override the test with a path.
109
acl_cv_path_LD="$LD" # Let the user override the test with a path.
63
AC_CACHE_VAL([acl_cv_path_LD],
65
acl_cv_path_LD= # Final result of this test
66
ac_prog=ld # Program to search in $PATH
67
if test "$GCC" = yes; then
68
# Check if gcc -print-prog-name=ld gives a path.
71
# gcc leaves a trailing carriage return which upsets mingw
72
acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
74
acl_output=`($CC -print-prog-name=ld) 2>&5` ;;
77
# Accept absolute paths.
78
[[\\/]]* | ?:[[\\/]]*)
79
re_direlt='/[[^/]][[^/]]*/\.\./'
80
# Canonicalize the pathname of ld
81
acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'`
82
while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do
83
acl_output=`echo $acl_output | sed "s%$re_direlt%/%"`
85
# Got the pathname. No search in PATH is needed.
86
acl_cv_path_LD="$acl_output"
90
# If it fails, then pretend we aren't using GCC.
93
# If it is relative, then search for the first ld in PATH.
98
if test -n "$ac_prog"; then
99
# Search for $ac_prog in $PATH.
100
acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
101
for ac_dir in $PATH; do
103
test -z "$ac_dir" && ac_dir=.
104
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
105
acl_cv_path_LD="$ac_dir/$ac_prog"
106
# Check to see if the program is GNU ld. I'd rather use --version,
107
# but apparently some variants of GNU ld only accept -v.
108
# Break only if it was the GNU/non-GNU ld that we prefer.
109
case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
110
*GNU* | *'with BFD'*)
111
test "$with_gnu_ld" != no && break
114
test "$with_gnu_ld" != yes && break
125
[[#if defined __powerpc64__ || defined _ARCH_PPC64
131
[# The compiler produces 64-bit code. Add option '-b64' so that the
132
# linker groks 64-bit object files.
133
case "$acl_cv_path_LD " in
135
*) acl_cv_path_LD="$acl_cv_path_LD -b64" ;;
142
[[#if defined __sparcv9 || defined __arch64__
149
[# The compiler produces 32-bit code. Add option '-m elf32_sparc'
150
# so that the linker groks 32-bit object files.
151
case "$acl_cv_path_LD " in
152
*" -m elf32_sparc "*) ;;
153
*) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;;
112
161
if test -n "$LD"; then
113
162
AC_MSG_RESULT([$LD])
115
164
AC_MSG_RESULT([no])
165
AC_MSG_ERROR([no acceptable ld found in \$PATH])
117
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
118
167
AC_LIB_PROG_LD_GNU