2N/A# lib-ld.m4 serial 5 (gettext-0.18.2)
2N/Adnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc.
2N/Adnl This file is free software; the Free Software Foundation
2N/Adnl gives unlimited permission to copy and/or distribute it,
2N/Adnl with or without modifications, as long as this notice is preserved.
2N/A
2N/Adnl Subroutines of libtool.m4,
2N/Adnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
2N/Adnl with libtool.m4.
2N/A
2N/Adnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
2N/AAC_DEFUN([AC_LIB_PROG_LD_GNU],
2N/A[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
2N/A[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
2N/Acase `$LD -v 2>&1 </dev/null` in
2N/A*GNU* | *'with BFD'*)
2N/A acl_cv_prog_gnu_ld=yes ;;
2N/A*)
2N/A acl_cv_prog_gnu_ld=no ;;
2N/Aesac])
2N/Awith_gnu_ld=$acl_cv_prog_gnu_ld
2N/A])
2N/A
2N/Adnl From libtool-1.4. Sets the variable LD.
2N/AAC_DEFUN([AC_LIB_PROG_LD],
2N/A[AC_ARG_WITH([gnu-ld],
2N/A[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
2N/Atest "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
2N/AAC_REQUIRE([AC_PROG_CC])dnl
2N/AAC_REQUIRE([AC_CANONICAL_HOST])dnl
2N/A# Prepare PATH_SEPARATOR.
2N/A# The user is always right.
2N/Aif test "${PATH_SEPARATOR+set}" != set; then
2N/A # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
2N/A # contains only /bin. Note that ksh looks also at the FPATH variable,
2N/A # so we have to set that as well for the test.
2N/A PATH_SEPARATOR=:
2N/A (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
2N/A && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
2N/A || PATH_SEPARATOR=';'
2N/A }
2N/Afi
2N/Aac_prog=ld
2N/Aif test "$GCC" = yes; then
2N/A # Check if gcc -print-prog-name=ld gives a path.
2N/A AC_MSG_CHECKING([for ld used by GCC])
2N/A case $host in
2N/A *-*-mingw*)
2N/A # gcc leaves a trailing carriage return which upsets mingw
2N/A ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
2N/A *)
2N/A ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
2N/A esac
2N/A case $ac_prog in
2N/A # Accept absolute paths.
2N/A [[\\/]* | [A-Za-z]:[\\/]*)]
2N/A [re_direlt='/[^/][^/]*/\.\./']
2N/A # Canonicalize the path of ld
2N/A ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
2N/A while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
2N/A ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
2N/A done
2N/A test -z "$LD" && LD="$ac_prog"
2N/A ;;
2N/A "")
2N/A # If it fails, then pretend we aren't using GCC.
2N/A ac_prog=ld
2N/A ;;
2N/A *)
2N/A # If it is relative, then search for the first ld in PATH.
2N/A with_gnu_ld=unknown
2N/A ;;
2N/A esac
2N/Aelif test "$with_gnu_ld" = yes; then
2N/A AC_MSG_CHECKING([for GNU ld])
2N/Aelse
2N/A AC_MSG_CHECKING([for non-GNU ld])
2N/Afi
2N/AAC_CACHE_VAL([acl_cv_path_LD],
2N/A[if test -z "$LD"; then
2N/A IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
2N/A for ac_dir in $PATH; do
2N/A test -z "$ac_dir" && ac_dir=.
2N/A if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
2N/A acl_cv_path_LD="$ac_dir/$ac_prog"
2N/A # Check to see if the program is GNU ld. I'd rather use --version,
2N/A # but apparently some GNU ld's only accept -v.
2N/A # Break only if it was the GNU/non-GNU ld that we prefer.
2N/A case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
2N/A *GNU* | *'with BFD'*)
2N/A test "$with_gnu_ld" != no && break ;;
2N/A *)
2N/A test "$with_gnu_ld" != yes && break ;;
2N/A esac
2N/A fi
2N/A done
2N/A IFS="$ac_save_ifs"
2N/Aelse
2N/A acl_cv_path_LD="$LD" # Let the user override the test with a path.
2N/Afi])
2N/ALD="$acl_cv_path_LD"
2N/Aif test -n "$LD"; then
2N/A AC_MSG_RESULT([$LD])
2N/Aelse
2N/A AC_MSG_RESULT([no])
2N/Afi
2N/Atest -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
2N/AAC_LIB_PROG_LD_GNU
2N/A])