Blame m4/lib-ld.m4

Packit Service 50ad14
# lib-ld.m4 serial 3 (gettext-0.13)
Packit Service 50ad14
dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
Packit Service 50ad14
dnl This file is free software, distributed under the terms of the GNU
Packit Service 50ad14
dnl General Public License.  As a special exception to the GNU General
Packit Service 50ad14
dnl Public License, this file may be distributed as part of a program
Packit Service 50ad14
dnl that contains a configuration script generated by Autoconf, under
Packit Service 50ad14
dnl the same distribution terms as the rest of that program.
Packit Service 50ad14
Packit Service 50ad14
dnl Subroutines of libtool.m4,
Packit Service 50ad14
dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
Packit Service 50ad14
dnl with libtool.m4.
Packit Service 50ad14
Packit Service 50ad14
dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
Packit Service 50ad14
AC_DEFUN([AC_LIB_PROG_LD_GNU],
Packit Service 50ad14
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
Packit Service 50ad14
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
Packit Service 50ad14
case `$LD -v 2>&1 
Packit Service 50ad14
*GNU* | *'with BFD'*)
Packit Service 50ad14
  acl_cv_prog_gnu_ld=yes ;;
Packit Service 50ad14
*)
Packit Service 50ad14
  acl_cv_prog_gnu_ld=no ;;
Packit Service 50ad14
esac])
Packit Service 50ad14
with_gnu_ld=$acl_cv_prog_gnu_ld
Packit Service 50ad14
])
Packit Service 50ad14
Packit Service 50ad14
dnl From libtool-1.4. Sets the variable LD.
Packit Service 50ad14
AC_DEFUN([AC_LIB_PROG_LD],
Packit Service 50ad14
[AC_ARG_WITH(gnu-ld,
Packit Service 50ad14
[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
Packit Service 50ad14
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
Packit Service 50ad14
AC_REQUIRE([AC_PROG_CC])dnl
Packit Service 50ad14
AC_REQUIRE([AC_CANONICAL_HOST])dnl
Packit Service 50ad14
# Prepare PATH_SEPARATOR.
Packit Service 50ad14
# The user is always right.
Packit Service 50ad14
if test "${PATH_SEPARATOR+set}" != set; then
Packit Service 50ad14
  echo "#! /bin/sh" >conf$$.sh
Packit Service 50ad14
  echo  "exit 0"   >>conf$$.sh
Packit Service 50ad14
  chmod +x conf$$.sh
Packit Service 50ad14
  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
Packit Service 50ad14
    PATH_SEPARATOR=';'
Packit Service 50ad14
  else
Packit Service 50ad14
    PATH_SEPARATOR=:
Packit Service 50ad14
  fi
Packit Service 50ad14
  rm -f conf$$.sh
Packit Service 50ad14
fi
Packit Service 50ad14
ac_prog=ld
Packit Service 50ad14
if test "$GCC" = yes; then
Packit Service 50ad14
  # Check if gcc -print-prog-name=ld gives a path.
Packit Service 50ad14
  AC_MSG_CHECKING([for ld used by GCC])
Packit Service 50ad14
  case $host in
Packit Service 50ad14
  *-*-mingw*)
Packit Service 50ad14
    # gcc leaves a trailing carriage return which upsets mingw
Packit Service 50ad14
    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
Packit Service 50ad14
  *)
Packit Service 50ad14
    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
Packit Service 50ad14
  esac
Packit Service 50ad14
  case $ac_prog in
Packit Service 50ad14
    # Accept absolute paths.
Packit Service 50ad14
    [[\\/]* | [A-Za-z]:[\\/]*)]
Packit Service 50ad14
      [re_direlt='/[^/][^/]*/\.\./']
Packit Service 50ad14
      # Canonicalize the path of ld
Packit Service 50ad14
      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
Packit Service 50ad14
      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
Packit Service 50ad14
	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
Packit Service 50ad14
      done
Packit Service 50ad14
      test -z "$LD" && LD="$ac_prog"
Packit Service 50ad14
      ;;
Packit Service 50ad14
  "")
Packit Service 50ad14
    # If it fails, then pretend we aren't using GCC.
Packit Service 50ad14
    ac_prog=ld
Packit Service 50ad14
    ;;
Packit Service 50ad14
  *)
Packit Service 50ad14
    # If it is relative, then search for the first ld in PATH.
Packit Service 50ad14
    with_gnu_ld=unknown
Packit Service 50ad14
    ;;
Packit Service 50ad14
  esac
Packit Service 50ad14
elif test "$with_gnu_ld" = yes; then
Packit Service 50ad14
  AC_MSG_CHECKING([for GNU ld])
Packit Service 50ad14
else
Packit Service 50ad14
  AC_MSG_CHECKING([for non-GNU ld])
Packit Service 50ad14
fi
Packit Service 50ad14
AC_CACHE_VAL(acl_cv_path_LD,
Packit Service 50ad14
[if test -z "$LD"; then
Packit Service 50ad14
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
Packit Service 50ad14
  for ac_dir in $PATH; do
Packit Service 50ad14
    test -z "$ac_dir" && ac_dir=.
Packit Service 50ad14
    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
Packit Service 50ad14
      acl_cv_path_LD="$ac_dir/$ac_prog"
Packit Service 50ad14
      # Check to see if the program is GNU ld.  I'd rather use --version,
Packit Service 50ad14
      # but apparently some GNU ld's only accept -v.
Packit Service 50ad14
      # Break only if it was the GNU/non-GNU ld that we prefer.
Packit Service 50ad14
      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
Packit Service 50ad14
      *GNU* | *'with BFD'*)
Packit Service 50ad14
	test "$with_gnu_ld" != no && break ;;
Packit Service 50ad14
      *)
Packit Service 50ad14
	test "$with_gnu_ld" != yes && break ;;
Packit Service 50ad14
      esac
Packit Service 50ad14
    fi
Packit Service 50ad14
  done
Packit Service 50ad14
  IFS="$ac_save_ifs"
Packit Service 50ad14
else
Packit Service 50ad14
  acl_cv_path_LD="$LD" # Let the user override the test with a path.
Packit Service 50ad14
fi])
Packit Service 50ad14
LD="$acl_cv_path_LD"
Packit Service 50ad14
if test -n "$LD"; then
Packit Service 50ad14
  AC_MSG_RESULT($LD)
Packit Service 50ad14
else
Packit Service 50ad14
  AC_MSG_RESULT(no)
Packit Service 50ad14
fi
Packit Service 50ad14
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
Packit Service 50ad14
AC_LIB_PROG_LD_GNU
Packit Service 50ad14
])