aboutsummaryrefslogtreecommitdiff
path: root/m4/lib-ld.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/lib-ld.m4')
-rw-r--r--m4/lib-ld.m487
1 files changed, 48 insertions, 39 deletions
diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4
index 96c4e2c33..ddc569f73 100644
--- a/m4/lib-ld.m4
+++ b/m4/lib-ld.m4
@@ -1,50 +1,56 @@
1# lib-ld.m4 serial 3 (gettext-0.13) 1# lib-ld.m4 serial 6
2dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. 2dnl Copyright (C) 1996-2003, 2009-2014 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7dnl Subroutines of libtool.m4, 7dnl Subroutines of libtool.m4,
8dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision 8dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
9dnl with libtool.m4. 9dnl collision with libtool.m4.
10 10
11dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. 11dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
12AC_DEFUN([AC_LIB_PROG_LD_GNU], 12AC_DEFUN([AC_LIB_PROG_LD_GNU],
13[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, 13[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
14[# I'd rather use --version here, but apparently some GNU ld's only accept -v. 14[# I'd rather use --version here, but apparently some GNU lds only accept -v.
15case `$LD -v 2>&1 </dev/null` in 15case `$LD -v 2>&1 </dev/null` in
16*GNU* | *'with BFD'*) 16*GNU* | *'with BFD'*)
17 acl_cv_prog_gnu_ld=yes ;; 17 acl_cv_prog_gnu_ld=yes
18 ;;
18*) 19*)
19 acl_cv_prog_gnu_ld=no ;; 20 acl_cv_prog_gnu_ld=no
21 ;;
20esac]) 22esac])
21with_gnu_ld=$acl_cv_prog_gnu_ld 23with_gnu_ld=$acl_cv_prog_gnu_ld
22]) 24])
23 25
24dnl From libtool-1.4. Sets the variable LD. 26dnl From libtool-2.4. Sets the variable LD.
25AC_DEFUN([AC_LIB_PROG_LD], 27AC_DEFUN([AC_LIB_PROG_LD],
26[AC_ARG_WITH(gnu-ld, 28[AC_REQUIRE([AC_PROG_CC])dnl
27[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
28test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
29AC_REQUIRE([AC_PROG_CC])dnl
30AC_REQUIRE([AC_CANONICAL_HOST])dnl 29AC_REQUIRE([AC_CANONICAL_HOST])dnl
30
31AC_ARG_WITH([gnu-ld],
32 [AS_HELP_STRING([--with-gnu-ld],
33 [assume the C compiler uses GNU ld [default=no]])],
34 [test "$withval" = no || with_gnu_ld=yes],
35 [with_gnu_ld=no])dnl
36
31# Prepare PATH_SEPARATOR. 37# Prepare PATH_SEPARATOR.
32# The user is always right. 38# The user is always right.
33if test "${PATH_SEPARATOR+set}" != set; then 39if test "${PATH_SEPARATOR+set}" != set; then
34 echo "#! /bin/sh" >conf$$.sh 40 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
35 echo "exit 0" >>conf$$.sh 41 # contains only /bin. Note that ksh looks also at the FPATH variable,
36 chmod +x conf$$.sh 42 # so we have to set that as well for the test.
37 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then 43 PATH_SEPARATOR=:
38 PATH_SEPARATOR=';' 44 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
39 else 45 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
40 PATH_SEPARATOR=: 46 || PATH_SEPARATOR=';'
41 fi 47 }
42 rm -f conf$$.sh
43fi 48fi
49
44ac_prog=ld 50ac_prog=ld
45if test "$GCC" = yes; then 51if test "$GCC" = yes; then
46 # Check if gcc -print-prog-name=ld gives a path. 52 # Check if gcc -print-prog-name=ld gives a path.
47 AC_MSG_CHECKING([for ld used by GCC]) 53 AC_MSG_CHECKING([for ld used by $CC])
48 case $host in 54 case $host in
49 *-*-mingw*) 55 *-*-mingw*)
50 # gcc leaves a trailing carriage return which upsets mingw 56 # gcc leaves a trailing carriage return which upsets mingw
@@ -54,12 +60,12 @@ if test "$GCC" = yes; then
54 esac 60 esac
55 case $ac_prog in 61 case $ac_prog in
56 # Accept absolute paths. 62 # Accept absolute paths.
57 [[\\/]* | [A-Za-z]:[\\/]*)] 63 [[\\/]]* | ?:[[\\/]]*)
58 [re_direlt='/[^/][^/]*/\.\./'] 64 re_direlt='/[[^/]][[^/]]*/\.\./'
59 # Canonicalize the path of ld 65 # Canonicalize the pathname of ld
60 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` 66 ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
61 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do 67 while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
62 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` 68 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
63 done 69 done
64 test -z "$LD" && LD="$ac_prog" 70 test -z "$LD" && LD="$ac_prog"
65 ;; 71 ;;
@@ -77,33 +83,36 @@ elif test "$with_gnu_ld" = yes; then
77else 83else
78 AC_MSG_CHECKING([for non-GNU ld]) 84 AC_MSG_CHECKING([for non-GNU ld])
79fi 85fi
80AC_CACHE_VAL(acl_cv_path_LD, 86AC_CACHE_VAL([acl_cv_path_LD],
81[if test -z "$LD"; then 87[if test -z "$LD"; then
82 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" 88 acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
83 for ac_dir in $PATH; do 89 for ac_dir in $PATH; do
90 IFS="$acl_save_ifs"
84 test -z "$ac_dir" && ac_dir=. 91 test -z "$ac_dir" && ac_dir=.
85 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then 92 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
86 acl_cv_path_LD="$ac_dir/$ac_prog" 93 acl_cv_path_LD="$ac_dir/$ac_prog"
87 # Check to see if the program is GNU ld. I'd rather use --version, 94 # Check to see if the program is GNU ld. I'd rather use --version,
88 # but apparently some GNU ld's only accept -v. 95 # but apparently some variants of GNU ld only accept -v.
89 # Break only if it was the GNU/non-GNU ld that we prefer. 96 # Break only if it was the GNU/non-GNU ld that we prefer.
90 case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in 97 case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
91 *GNU* | *'with BFD'*) 98 *GNU* | *'with BFD'*)
92 test "$with_gnu_ld" != no && break ;; 99 test "$with_gnu_ld" != no && break
100 ;;
93 *) 101 *)
94 test "$with_gnu_ld" != yes && break ;; 102 test "$with_gnu_ld" != yes && break
103 ;;
95 esac 104 esac
96 fi 105 fi
97 done 106 done
98 IFS="$ac_save_ifs" 107 IFS="$acl_save_ifs"
99else 108else
100 acl_cv_path_LD="$LD" # Let the user override the test with a path. 109 acl_cv_path_LD="$LD" # Let the user override the test with a path.
101fi]) 110fi])
102LD="$acl_cv_path_LD" 111LD="$acl_cv_path_LD"
103if test -n "$LD"; then 112if test -n "$LD"; then
104 AC_MSG_RESULT($LD) 113 AC_MSG_RESULT([$LD])
105else 114else
106 AC_MSG_RESULT(no) 115 AC_MSG_RESULT([no])
107fi 116fi
108test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) 117test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
109AC_LIB_PROG_LD_GNU 118AC_LIB_PROG_LD_GNU