automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch to support configuration of AR and AR_FLAGS


From: Paul Thomas
Subject: Patch to support configuration of AR and AR_FLAGS
Date: Wed, 19 Mar 2003 18:47:26 -0700

Bug Description:
Automake assumes that a static library is always built using
"ar cru".  This is not always the case.  For example, when
building MySQL for NetWare we cross-compile using the command-line
Metrowerks CodeWarrior linker to build static libraries, for
example, "mwldnlm -type library mylib.lib *.o".  Setting
"AR=mwldnlm" and adding "AC_SUBST(AR)" to configure.in will cause
automake to use "mwldnlm" instead of "ar".  Unfortunately,
however, the "cru" parameters are hardcoded.  Matthias Dietrich
also complained about this
(see http://sources.redhat.com/ml/automake/2002-10/msg00039.html).
He says, "I am quite surprised about the "ar" command. It seems
almost every possible tool involved in a build process can be
defined (CC,LD,CPP,CXX, etc.) but not AR. It is even possible to
redefine AR on a per-library basis using the _AR variables, but
why not having the ability to redefine AR globally with the
appropriate arguments?"  I completely agree.

The following patch fixes this problem by also allowing AR_FLAGS
to be set and configured via configure.in using
"AC_SUBST(AR_FLAGS)".  If not set, AR and AR_FLAGS default to
"ar" and "cru", respectively, so current functionality is
 preserved.

ChangeLog:
2003-03-19  Paul Thomas  <address@hidden>

        * lib/am/libs.am: Stop hardcoding "AR=ar" and instead set
        AR and AR_FLAGS to @AR@ and @AR_FLAGS@, respectively, so
        they can be configured using AC_SUBST(AR) and
        AC_SUBST(AR_FLAGS).
        * m4/init.m4: If AR or AR_FLAGS is not set, set it to "ar"
        or "cru", respectively, to preserve current functionality.
        Also, call AC_SUBST([AR]) and AC_SUBST([AR_FLAGS]) so
        configure will replace @AR@ and @AR_FLAGS@ in lib/am/libs.am.
        * automake.in: Replace the call to '$(AR) cru' with
        '$(AR) $(AR_FLAGS)'.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1438
diff -u -r1.1438 automake.in
--- automake.in 14 Mar 2003 21:46:57 -0000      1.1438
+++ automake.in 20 Mar 2003 00:58:22 -0000
@@ -3355,7 +3355,7 @@
 
       if (! variable_defined ($xlib . '_AR'))
        {
-         &define_variable ($xlib . '_AR', '$(AR) cru', $where);
+         &define_variable ($xlib . '_AR', '$(AR) $(AR_FLAGS)',
$where);
        }
 
       # Generate support for conditional object inclusion in
Index: lib/am/libs.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/libs.am,v
retrieving revision 1.23
diff -u -r1.23 libs.am
--- lib/am/libs.am      8 Jul 2002 19:41:23 -0000       1.23
+++ lib/am/libs.am      20 Mar 2003 00:58:22 -0000
@@ -22,7 +22,8 @@
 ## ----------- ##
 
 if %?FIRST%
-AR = ar
+AR = @AR@
+AR_FLAGS = @AR_FLAGS@
 ## For now this is detected when we see AC_PROG_RANLIB
 ## RANLIB = @RANLIB@
 endif %?FIRST%
Index: m4/init.m4
===================================================================
RCS file: /cvs/automake/automake/m4/init.m4,v
retrieving revision 1.55
diff -u -r1.55 init.m4
--- m4/init.m4  13 Mar 2003 21:43:47 -0000      1.55
+++ m4/init.m4  20 Mar 2003 00:58:22 -0000
@@ -73,6 +73,17 @@
 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of
package])])dnl
 
+# Use AR and AR_FLAGS as defined by configure.
+# By default, set to 'ar' and 'cru', respectively.
+if test -z "$AR"; then
+  AR=ar
+fi
+if test -z "$AR_FLAGS"; then
+  AR_FLAGS=cru
+fi
+AC_SUBST([AR])dnl
+AC_SUBST([AR_FLAGS])dnl
+
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
 AC_REQUIRE([AC_ARG_PROGRAM])dnl





reply via email to

[Prev in Thread] Current Thread [Next in Thread]