[llvm-commits] [llvm] r110883 - in /llvm/trunk: autoconf/configure.ac autoconf/m4/link_options.m4 configure include/llvm/Config/config.h.in

Daniel Dunbar daniel at zuster.org
Wed Aug 11 16:54:00 PDT 2010


Author: ddunbar
Date: Wed Aug 11 18:53:59 2010
New Revision: 110883

URL: http://llvm.org/viewvc/llvm-project?rev=110883&view=rev
Log:
configure: Add detection of the linker version string.
 - Review appreciated, as long as you understand that I understand that this is
   a horrible hack.

Modified:
    llvm/trunk/autoconf/configure.ac
    llvm/trunk/autoconf/m4/link_options.m4
    llvm/trunk/configure
    llvm/trunk/include/llvm/Config/config.h.in

Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=110883&r1=110882&r2=110883&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Wed Aug 11 18:53:59 2010
@@ -1041,6 +1041,9 @@
 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
 

Modified: llvm/trunk/autoconf/m4/link_options.m4
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/m4/link_options.m4?rev=110883&r1=110882&r2=110883&view=diff
==============================================================================
--- llvm/trunk/autoconf/m4/link_options.m4 (original)
+++ llvm/trunk/autoconf/m4/link_options.m4 Wed Aug 11 18:53:59 2010
@@ -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.

Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=110883&r1=110882&r2=110883&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Wed Aug 11 18:53:59 2010
@@ -8729,6 +8729,31 @@
 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 @@
   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

Modified: llvm/trunk/include/llvm/Config/config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=110883&r1=110882&r2=110883&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.in (original)
+++ llvm/trunk/include/llvm/Config/config.h.in Wed Aug 11 18:53:59 2010
@@ -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
 





More information about the llvm-commits mailing list