aboutsummaryrefslogtreecommitdiffstats
path: root/autoconf
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-08-11 23:53:59 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-08-11 23:53:59 +0000
commitee0f32d723431cdae943e8a8d45ecdb856a0e76c (patch)
treea87f1f927894d4596886dd8c3642f3a7ef66bf2a /autoconf
parent7def14f40f0b47551e2d66ec2f140a18b5bbbea4 (diff)
downloadexternal_llvm-ee0f32d723431cdae943e8a8d45ecdb856a0e76c.zip
external_llvm-ee0f32d723431cdae943e8a8d45ecdb856a0e76c.tar.gz
external_llvm-ee0f32d723431cdae943e8a8d45ecdb856a0e76c.tar.bz2
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
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/configure.ac3
-rw-r--r--autoconf/m4/link_options.m421
2 files changed, 24 insertions, 0 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 29a57b8..7211fe1 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -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
diff --git a/autoconf/m4/link_options.m4 b/autoconf/m4/link_options.m4
index b48710c..4c5f2f4 100644
--- a/autoconf/m4/link_options.m4
+++ b/autoconf/m4/link_options.m4
@@ -1,4 +1,25 @@
#
+# 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.
#
# This macro is specific to LLVM.