diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2022-08-23 19:42:51 +0200 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2022-09-14 11:08:55 +0200 |
commit | 868beb15ae02c352005a2df8857f4ebb9bd758fd (patch) | |
tree | 0dc6e6a91c4ef0f131ca82a777e6ac2ad193c399 /gl/m4/lib-ld.m4 | |
parent | b89aee56964f7d933f2da5f371e32b4d7db9410b (diff) | |
download | monitoring-plugins-868beb1.tar.gz |
Sync with the latest Gnulib code (d27c820595)
Diffstat (limited to 'gl/m4/lib-ld.m4')
-rw-r--r-- | gl/m4/lib-ld.m4 | 163 |
1 files changed, 106 insertions, 57 deletions
diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4 index c145e478..934207a7 100644 --- a/gl/m4/lib-ld.m4 +++ b/gl/m4/lib-ld.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # lib-ld.m4 serial 6 | 1 | # lib-ld.m4 serial 10 |
2 | dnl Copyright (C) 1996-2003, 2009-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1996-2003, 2009-2022 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -47,73 +47,122 @@ if test "${PATH_SEPARATOR+set}" != set; then | |||
47 | } | 47 | } |
48 | fi | 48 | fi |
49 | 49 | ||
50 | ac_prog=ld | 50 | if test -n "$LD"; then |
51 | if test "$GCC" = yes; then | 51 | AC_MSG_CHECKING([for ld]) |
52 | # Check if gcc -print-prog-name=ld gives a path. | 52 | elif test "$GCC" = yes; then |
53 | AC_MSG_CHECKING([for ld used by $CC]) | 53 | AC_MSG_CHECKING([for ld used by $CC]) |
54 | case $host in | ||
55 | *-*-mingw*) | ||
56 | # gcc leaves a trailing carriage return which upsets mingw | ||
57 | ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; | ||
58 | *) | ||
59 | ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; | ||
60 | esac | ||
61 | case $ac_prog in | ||
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%/%"` | ||
69 | done | ||
70 | test -z "$LD" && LD="$ac_prog" | ||
71 | ;; | ||
72 | "") | ||
73 | # If it fails, then pretend we aren't using GCC. | ||
74 | ac_prog=ld | ||
75 | ;; | ||
76 | *) | ||
77 | # If it is relative, then search for the first ld in PATH. | ||
78 | with_gnu_ld=unknown | ||
79 | ;; | ||
80 | esac | ||
81 | elif test "$with_gnu_ld" = yes; then | 54 | elif test "$with_gnu_ld" = yes; then |
82 | AC_MSG_CHECKING([for GNU ld]) | 55 | AC_MSG_CHECKING([for GNU ld]) |
83 | else | 56 | else |
84 | AC_MSG_CHECKING([for non-GNU ld]) | 57 | AC_MSG_CHECKING([for non-GNU ld]) |
85 | fi | 58 | fi |
86 | AC_CACHE_VAL([acl_cv_path_LD], | 59 | if test -n "$LD"; then |
87 | [if test -z "$LD"; then | 60 | # Let the user override the test with a path. |
88 | acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR | 61 | : |
89 | for ac_dir in $PATH; do | 62 | else |
90 | IFS="$acl_save_ifs" | 63 | AC_CACHE_VAL([acl_cv_path_LD], |
91 | test -z "$ac_dir" && ac_dir=. | 64 | [ |
92 | if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then | 65 | acl_cv_path_LD= # Final result of this test |
93 | acl_cv_path_LD="$ac_dir/$ac_prog" | 66 | ac_prog=ld # Program to search in $PATH |
94 | # Check to see if the program is GNU ld. I'd rather use --version, | 67 | if test "$GCC" = yes; then |
95 | # but apparently some variants of GNU ld only accept -v. | 68 | # Check if gcc -print-prog-name=ld gives a path. |
96 | # Break only if it was the GNU/non-GNU ld that we prefer. | 69 | case $host in |
97 | case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in | 70 | *-*-mingw*) |
98 | *GNU* | *'with BFD'*) | 71 | # gcc leaves a trailing carriage return which upsets mingw |
99 | test "$with_gnu_ld" != no && break | 72 | acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; |
100 | ;; | 73 | *) |
101 | *) | 74 | acl_output=`($CC -print-prog-name=ld) 2>&5` ;; |
102 | test "$with_gnu_ld" != yes && break | 75 | esac |
103 | ;; | 76 | case $acl_output in |
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%/%"` | ||
84 | done | ||
85 | # Got the pathname. No search in PATH is needed. | ||
86 | acl_cv_path_LD="$acl_output" | ||
87 | ac_prog= | ||
88 | ;; | ||
89 | "") | ||
90 | # If it fails, then pretend we aren't using GCC. | ||
91 | ;; | ||
92 | *) | ||
93 | # If it is relative, then search for the first ld in PATH. | ||
94 | with_gnu_ld=unknown | ||
95 | ;; | ||
104 | esac | 96 | esac |
105 | fi | 97 | fi |
106 | done | 98 | if test -n "$ac_prog"; then |
107 | IFS="$acl_save_ifs" | 99 | # Search for $ac_prog in $PATH. |
108 | else | 100 | acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR |
109 | acl_cv_path_LD="$LD" # Let the user override the test with a path. | 101 | for ac_dir in $PATH; do |
110 | fi]) | 102 | IFS="$acl_save_ifs" |
111 | LD="$acl_cv_path_LD" | 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 | ||
112 | ;; | ||
113 | *) | ||
114 | test "$with_gnu_ld" != yes && break | ||
115 | ;; | ||
116 | esac | ||
117 | fi | ||
118 | done | ||
119 | IFS="$acl_save_ifs" | ||
120 | fi | ||
121 | case $host in | ||
122 | *-*-aix*) | ||
123 | AC_COMPILE_IFELSE( | ||
124 | [AC_LANG_SOURCE( | ||
125 | [[#if defined __powerpc64__ || defined __LP64__ | ||
126 | int ok; | ||
127 | #else | ||
128 | error fail | ||
129 | #endif | ||
130 | ]])], | ||
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 | ||
134 | *" -b64 "*) ;; | ||
135 | *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; | ||
136 | esac | ||
137 | ], []) | ||
138 | ;; | ||
139 | sparc64-*-netbsd*) | ||
140 | AC_COMPILE_IFELSE( | ||
141 | [AC_LANG_SOURCE( | ||
142 | [[#if defined __sparcv9 || defined __arch64__ | ||
143 | int ok; | ||
144 | #else | ||
145 | error fail | ||
146 | #endif | ||
147 | ]])], | ||
148 | [], | ||
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" ;; | ||
154 | esac | ||
155 | ]) | ||
156 | ;; | ||
157 | esac | ||
158 | ]) | ||
159 | LD="$acl_cv_path_LD" | ||
160 | fi | ||
112 | if test -n "$LD"; then | 161 | if test -n "$LD"; then |
113 | AC_MSG_RESULT([$LD]) | 162 | AC_MSG_RESULT([$LD]) |
114 | else | 163 | else |
115 | AC_MSG_RESULT([no]) | 164 | AC_MSG_RESULT([no]) |
165 | AC_MSG_ERROR([no acceptable ld found in \$PATH]) | ||
116 | fi | 166 | fi |
117 | test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) | ||
118 | AC_LIB_PROG_LD_GNU | 167 | AC_LIB_PROG_LD_GNU |
119 | ]) | 168 | ]) |