summaryrefslogtreecommitdiff
path: root/autoconf/m4/link_options.m4
diff options
context:
space:
mode:
Diffstat (limited to 'autoconf/m4/link_options.m4')
-rw-r--r--autoconf/m4/link_options.m421
1 files changed, 21 insertions, 0 deletions
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,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.