aboutsummaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2015-11-11 13:43:14 -0500
committerMike Frysinger <vapier@chromium.org>2015-11-11 13:43:14 -0500
commitf217ae431f2c63969c6ada406ddbcc589e2edd32 (patch)
tree32610fcfd6a5c761045dddaf86881bb62cf7d27c /aclocal.m4
parentgitignore: add mac/dump_syms (diff)
downloadbreakpad-f217ae431f2c63969c6ada406ddbcc589e2edd32.tar.xz
build: detect the right `ar` tool
Use automake's AM_PROG_AR helper instead of the default of hardcoding `ar` all the time. When cross-compiling, this can often be the wrong one to use. BUG=google-breakpad:519 R=ted.mielczarek@gmail.com Review URL: https://codereview.chromium.org/1435813002 .
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m460
1 files changed, 60 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index e657517b..10010c22 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -56,6 +56,66 @@ m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+# Copyright (C) 2011-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_AR([ACT-IF-FAIL])
+# -------------------------
+# Try to determine the archiver interface, and trigger the ar-lib wrapper
+# if it is needed. If the detection of archiver interface fails, run
+# ACT-IF-FAIL (default is to abort configure with a proper error message).
+AC_DEFUN([AM_PROG_AR],
+[AC_BEFORE([$0], [LT_INIT])dnl
+AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([ar-lib])dnl
+AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false])
+: ${AR=ar}
+
+AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
+ [AC_LANG_PUSH([C])
+ am_cv_ar_interface=ar
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])],
+ [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
+ AC_TRY_EVAL([am_ar_try])
+ if test "$ac_status" -eq 0; then
+ am_cv_ar_interface=ar
+ else
+ am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
+ AC_TRY_EVAL([am_ar_try])
+ if test "$ac_status" -eq 0; then
+ am_cv_ar_interface=lib
+ else
+ am_cv_ar_interface=unknown
+ fi
+ fi
+ rm -f conftest.lib libconftest.a
+ ])
+ AC_LANG_POP([C])])
+
+case $am_cv_ar_interface in
+ar)
+ ;;
+lib)
+ # Microsoft lib, so override with the ar-lib wrapper script.
+ # FIXME: It is wrong to rewrite AR.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__AR in this case,
+ # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something
+ # similar.
+ AR="$am_aux_dir/ar-lib $AR"
+ ;;
+unknown)
+ m4_default([$1],
+ [AC_MSG_ERROR([could not determine $AR interface])])
+ ;;
+esac
+AC_SUBST([AR])dnl
+])
+
# Figure out how to run the assembler. -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc.