summaryrefslogtreecommitdiffstats
path: root/m4/lib-ld.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/lib-ld.m4')
-rw-r--r--m4/lib-ld.m497
1 files changed, 97 insertions, 0 deletions
diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4
new file mode 100644
index 0000000..ddb5732
--- /dev/null
+++ b/m4/lib-ld.m4
@@ -0,0 +1,97 @@
1# lib-ld.m4 serial 1 (gettext-0.11)
2dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
3dnl This file is free software, distributed under the terms of the GNU
4dnl General Public License. As a special exception to the GNU General
5dnl Public License, this file may be distributed as part of a program
6dnl that contains a configuration script generated by Autoconf, under
7dnl the same distribution terms as the rest of that program.
8
9dnl Subroutines of libtool.m4,
10dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
11dnl with libtool.m4.
12
13dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
14AC_DEFUN([AC_LIB_PROG_LD_GNU],
15[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
16[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
17if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
18 acl_cv_prog_gnu_ld=yes
19else
20 acl_cv_prog_gnu_ld=no
21fi])
22with_gnu_ld=$acl_cv_prog_gnu_ld
23])
24
25dnl From libtool-1.4. Sets the variable LD.
26AC_DEFUN([AC_LIB_PROG_LD],
27[AC_ARG_WITH(gnu-ld,
28[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
29test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
30AC_REQUIRE([AC_PROG_CC])dnl
31AC_REQUIRE([AC_CANONICAL_HOST])dnl
32ac_prog=ld
33if test "$GCC" = yes; then
34 # Check if gcc -print-prog-name=ld gives a path.
35 AC_MSG_CHECKING([for ld used by GCC])
36 case $host in
37 *-*-mingw*)
38 # gcc leaves a trailing carriage return which upsets mingw
39 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
40 *)
41 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
42 esac
43 case $ac_prog in
44 # Accept absolute paths.
45 [[\\/]* | [A-Za-z]:[\\/]*)]
46 [re_direlt='/[^/][^/]*/\.\./']
47 # Canonicalize the path of ld
48 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
49 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
50 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
51 done
52 test -z "$LD" && LD="$ac_prog"
53 ;;
54 "")
55 # If it fails, then pretend we aren't using GCC.
56 ac_prog=ld
57 ;;
58 *)
59 # If it is relative, then search for the first ld in PATH.
60 with_gnu_ld=unknown
61 ;;
62 esac
63elif test "$with_gnu_ld" = yes; then
64 AC_MSG_CHECKING([for GNU ld])
65else
66 AC_MSG_CHECKING([for non-GNU ld])
67fi
68AC_CACHE_VAL(acl_cv_path_LD,
69[if test -z "$LD"; then
70 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
71 for ac_dir in $PATH; do
72 test -z "$ac_dir" && ac_dir=.
73 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
74 acl_cv_path_LD="$ac_dir/$ac_prog"
75 # Check to see if the program is GNU ld. I'd rather use --version,
76 # but apparently some GNU ld's only accept -v.
77 # Break only if it was the GNU/non-GNU ld that we prefer.
78 if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
79 test "$with_gnu_ld" != no && break
80 else
81 test "$with_gnu_ld" != yes && break
82 fi
83 fi
84 done
85 IFS="$ac_save_ifs"
86else
87 acl_cv_path_LD="$LD" # Let the user override the test with a path.
88fi])
89LD="$acl_cv_path_LD"
90if test -n "$LD"; then
91 AC_MSG_RESULT($LD)
92else
93 AC_MSG_RESULT(no)
94fi
95test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
96AC_LIB_PROG_LD_GNU
97])