aboutsummaryrefslogtreecommitdiffstats
path: root/autoconf/ast_prog_ld.m4
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-20 05:06:29 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-20 05:06:29 +0000
commit0e959dc59a7808321582ab926df8677b81f2ef8c (patch)
treec9ed67c0ffe74cb16322c96d459e5e826b912524 /autoconf/ast_prog_ld.m4
parentf2eeaf54c03ab0dfb007c29fc8b2e2654fbe6428 (diff)
Merged revisions 151242-151243 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r151242 | kpfleming | 2008-10-20 07:59:04 +0300 (Mon, 20 Oct 2008) | 9 lines Merged revisions 151240 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r151240 | kpfleming | 2008-10-20 07:45:56 +0300 (Mon, 20 Oct 2008) | 3 lines break up acinclude.m4 into individual files, which will make it easier to maintain, easier to add new macros (less patching) and will ease maintenance of these macros across Asterisk branches ........ ................ r151243 | kpfleming | 2008-10-20 08:00:56 +0300 (Mon, 20 Oct 2008) | 9 lines Merged revisions 151241 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r151241 | kpfleming | 2008-10-20 07:57:33 +0300 (Mon, 20 Oct 2008) | 2 lines rename this macro to properly reflect what it does ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@151245 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'autoconf/ast_prog_ld.m4')
-rw-r--r--autoconf/ast_prog_ld.m483
1 files changed, 83 insertions, 0 deletions
diff --git a/autoconf/ast_prog_ld.m4 b/autoconf/ast_prog_ld.m4
new file mode 100644
index 000000000..9177fedb3
--- /dev/null
+++ b/autoconf/ast_prog_ld.m4
@@ -0,0 +1,83 @@
+# AST_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AST_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+ [AC_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])
+AC_REQUIRE([AST_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by $CC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AST_PROG_LD_GNU
+])# AST_PROG_LD