145 lines
4.1 KiB
Text
145 lines
4.1 KiB
Text
# LT_PATH_LD and its dependencies adapted with minor modifications
|
|
# from libtool.m4 for use in libxmp:
|
|
|
|
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
|
|
#
|
|
# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc.
|
|
# Written by Gordon Matzigkeit, 1996
|
|
#
|
|
# This file is free software; the Free Software Foundation gives
|
|
# unlimited permission to copy and/or distribute it, with or without
|
|
# modifications, as long as this notice is preserved.
|
|
|
|
# _LT_PROG_ECHO_BACKSLASH
|
|
# -----------------------
|
|
# Find how we can fake an echo command that does not interpret backslash.
|
|
m4_defun([_LT_PROG_ECHO_BACKSLASH],
|
|
[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
|
|
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
|
|
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
|
|
|
|
AC_MSG_CHECKING([how to print strings])
|
|
# Test print first, because it will be a builtin if present.
|
|
if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
|
|
test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
|
|
ECHO='print -r --'
|
|
elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
|
|
ECHO='printf %s\n'
|
|
else
|
|
# Use this function as a fallback that always works.
|
|
func_fallback_echo ()
|
|
{
|
|
eval 'cat <<_LTECHO_EOF
|
|
$[]1
|
|
_LTECHO_EOF'
|
|
}
|
|
ECHO='func_fallback_echo'
|
|
fi
|
|
|
|
case $ECHO in
|
|
printf*) AC_MSG_RESULT([printf]) ;;
|
|
print*) AC_MSG_RESULT([print -r]) ;;
|
|
*) AC_MSG_RESULT([cat]) ;;
|
|
esac
|
|
])# _LT_PROG_ECHO_BACKSLASH
|
|
|
|
# LT_PATH_LD
|
|
# ----------
|
|
# find the pathname to the GNU or non-GNU linker
|
|
AC_DEFUN([LT_PATH_LD],
|
|
[AC_REQUIRE([AC_PROG_CC])dnl
|
|
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
|
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
|
AC_REQUIRE([AC_PROG_SED])dnl
|
|
AC_REQUIRE([AC_PROG_GREP])dnl
|
|
m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
|
|
|
|
AC_ARG_WITH([gnu-ld],
|
|
[AS_HELP_STRING([--with-gnu-ld],
|
|
[assume the C compiler uses GNU ld @<:@default=no@:>@])],
|
|
[test no = "$withval" || with_gnu_ld=yes],
|
|
[with_gnu_ld=no])dnl
|
|
|
|
ac_prog=ld
|
|
if test yes = "$GCC"; then
|
|
# Check if gcc -print-prog-name=ld gives a path.
|
|
# lose posssible carriage return from output.
|
|
AC_MSG_CHECKING([for ld used by $CC])
|
|
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'`
|
|
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 yes = "$with_gnu_ld"; 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 no != "$with_gnu_ld" && break
|
|
;;
|
|
*)
|
|
test yes != "$with_gnu_ld" && 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)
|
|
AC_MSG_WARN([no acceptable ld found in \$PATH])
|
|
LD=:
|
|
fi
|
|
_LT_PATH_LD_GNU
|
|
AC_SUBST([LD])
|
|
])# LT_PATH_LD
|
|
|
|
# _LT_PATH_LD_GNU
|
|
#- --------------
|
|
m4_defun([_LT_PATH_LD_GNU],
|
|
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
|
|
[# I'd rather use --version here, but apparently some GNU lds only accept -v.
|
|
case `$LD -v 2>&1 </dev/null` in
|
|
*GNU* | *'with BFD'*)
|
|
lt_cv_prog_gnu_ld=yes
|
|
;;
|
|
*)
|
|
lt_cv_prog_gnu_ld=no
|
|
;;
|
|
esac])
|
|
with_gnu_ld=$lt_cv_prog_gnu_ld
|
|
])# _LT_PATH_LD_GNU
|