Let the configure script recognize the AR variable, such that the name of the archiver can be specified at configure time. Changed test for TLS-support from AC_RUN_IFELSE to AC_LINK_IFELSE. Both changes are necessary to make cross-compilation possible.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8123 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/configure.in b/configure.in
index 8bb4f46..5cbae44 100644
--- a/configure.in
+++ b/configure.in
@@ -60,6 +60,13 @@
 AC_PROG_CXX
 AC_PROG_RANLIB
 
+# If no AR variable was specified, look up the name of the archiver. Otherwise
+# do not touch the AR variable.
+if test "x$AR" = "x"; then
+  AC_PATH_PROGS([AR], ["${LD%ld}ar" "ar"], [ar])
+fi
+AC_ARG_VAR([AR],[Archiver command])
+
 # Check for the compiler support
 if test "${GCC}" != "yes" ; then
    AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
@@ -1145,7 +1152,7 @@
 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
 	       [AC_ARG_ENABLE(tls, [  --enable-tls            platform supports TLS],
 		[vg_cv_tls=$enableval],
-               	[AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
+               	[AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
                                                 [[return foo;]])],
                                [vg_cv_tls=yes],
                                [vg_cv_tls=no])])])