configure: Add detection of the linker version string.

- Review appreciated, as long as you understand that I understand that this is
   a horrible hack.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110883 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2010-08-11 23:53:59 +00:00
parent 7def14f40f
commit ee0f32d723
4 changed files with 53 additions and 1 deletions

View File

@ -1041,6 +1041,9 @@ AC_PATH_PROGS(OCAMLDEP, [ocamldep])
AC_PATH_PROGS(OCAMLDOC, [ocamldoc])
AC_PATH_PROGS(GAS, [gas as])
dnl Get the version of the linker in use.
AC_LINK_GET_VERSION
dnl Determine whether the linker supports the -R option.
AC_LINK_USE_R

View File

@ -1,3 +1,24 @@
#
# Get the linker version string.
#
# This macro is specific to LLVM.
#
AC_DEFUN([AC_LINK_GET_VERSION],
[AC_CACHE_CHECK([for linker version],[llvm_cv_link_version],
[
version_string="$(ld -v 2>&1 | head -1)"
# Check for ld64.
if (echo "$version_string" | grep -q "ld64"); then
llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)#\1#")
else
llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#")
fi
])
AC_DEFINE_UNQUOTED([HOST_LINK_VERSION],"$llvm_cv_link_version",
[Linker version detected at compile time.])
])
#
# Determine if the system can handle the -R option being passed to the linker.
#

27
configure vendored
View File

@ -8729,6 +8729,31 @@ fi
done
{ echo "$as_me:$LINENO: checking for linker version" >&5
echo $ECHO_N "checking for linker version... $ECHO_C" >&6; }
if test "${llvm_cv_link_version+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
version_string="$(ld -v 2>&1 | head -1)"
# Check for ld64.
if (echo "$version_string" | grep -q "ld64"); then
llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)#\1#")
else
llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#")
fi
fi
{ echo "$as_me:$LINENO: result: $llvm_cv_link_version" >&5
echo "${ECHO_T}$llvm_cv_link_version" >&6; }
cat >>confdefs.h <<_ACEOF
#define HOST_LINK_VERSION "$llvm_cv_link_version"
_ACEOF
{ echo "$as_me:$LINENO: checking for compiler -Wl,-R<path> option" >&5
echo $ECHO_N "checking for compiler -Wl,-R<path> option... $ECHO_C" >&6; }
if test "${llvm_cv_link_use_r+set}" = set; then
@ -11395,7 +11420,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 11398 "configure"
#line 11423 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H

View File

@ -467,6 +467,9 @@
/* Define to 1 if you have the `__dso_handle' function. */
#undef HAVE___DSO_HANDLE
/* Linker version detected at compile time. */
#undef HOST_LINK_VERSION
/* Installation directory for binary executables */
#undef LLVM_BINDIR