From ee0f32d723431cdae943e8a8d45ecdb856a0e76c Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 11 Aug 2010 23:53:59 +0000 Subject: 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 --- autoconf/m4/link_options.m4 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'autoconf/m4') diff --git a/autoconf/m4/link_options.m4 b/autoconf/m4/link_options.m4 index b48710c094..4c5f2f435d 100644 --- a/autoconf/m4/link_options.m4 +++ b/autoconf/m4/link_options.m4 @@ -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. # -- cgit v1.2.3