automake-patches
[Top][All Lists]
Advanced

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

Re: Patch to support configuration of AR and AR_FLAGS


From: Alexandre Duret-Lutz
Subject: Re: Patch to support configuration of AR and AR_FLAGS
Date: Sun, 06 Apr 2003 20:30:20 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux)

>>> "Paul" == Paul Thomas <address@hidden> writes:

 Paul> Bug Description:
 Paul> Automake assumes that a static library is always built using
 Paul> "ar cru".  This is not always the case.  For example, when
 Paul> building MySQL for NetWare we cross-compile using the command-line
 Paul> Metrowerks CodeWarrior linker to build static libraries, for
 Paul> example, "mwldnlm -type library mylib.lib *.o".  Setting
 Paul> "AR=mwldnlm" and adding "AC_SUBST(AR)" to configure.in will cause
 Paul> automake to use "mwldnlm" instead of "ar".  Unfortunately,
 Paul> however, the "cru" parameters are hardcoded.  

Thanks for the patch and sorry for the delay.  I'm installing the
following change instead.  It will be in Automake 1.8.

2003-04-06  Alexandre Duret-Lutz  <address@hidden>

        * lib/am/libs.am (ARFLAGS): Define.
        * automake.in (handle_libraries): Use `$(ARFLAGS)' instead of
        hard-coding `cru'.
        * automake.texi (A Library): Explain how AR, ARFLAGS and RANLIB
        are used, and how they can be overridden.
        (Program and Library Variables): Adjust to show `$(ARFLAGS)'
        instead of `cru'
        * tests/ar.test: Rewrite to test for AR, ARFLAGS, and RANLIB.
        * tests/ranlib.test: Delete, obsoleted by ar.test.
        * tests/Makefile.am (TESTS): Remove ranlib.test.
        Report from Paul Thomas.

Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.206
diff -u -r1.206 NEWS
--- NEWS        13 Mar 2003 21:33:59 -0000      1.206
+++ NEWS        6 Apr 2003 18:27:00 -0000
@@ -59,6 +59,11 @@
 
 * Texinfo rules back up and restore info files when makeinfo fails.
 
+* AR's `cru' flags are now set in a global ARFLAGS variable instead
+  of being hard-coded in each $(AR) invocation, so they can be
+  substituted from configure.ac.  This has been requested by people
+  dealing with non-POSIX ar implementations.
+
 
 New in 1.7:
 * Autoconf 2.54 is required.
Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.213
diff -u -r1.213 THANKS
--- THANKS      20 Mar 2003 22:44:34 -0000      1.213
+++ THANKS      6 Apr 2003 18:27:00 -0000
@@ -163,6 +163,7 @@
 Paul Eggert            address@hidden
 Paul Jarc              address@hidden
 Paul Martinolich       address@hidden
+Paul Thomas            address@hidden
 Pavel Roskin           address@hidden
 Per Bothner            address@hidden
 Per Cederqvist         address@hidden
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1439
diff -u -r1.1439 automake.in
--- automake.in 3 Apr 2003 21:38:38 -0000       1.1439
+++ automake.in 6 Apr 2003 18:27:07 -0000
@@ -3355,7 +3355,7 @@
 
       if (! variable_defined ($xlib . '_AR'))
        {
-         &define_variable ($xlib . '_AR', '$(AR) cru', $where);
+         &define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
        }
 
       # Generate support for conditional object inclusion in
Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.328
diff -u -r1.328 automake.texi
--- automake.texi       20 Mar 2003 22:44:34 -0000      1.328
+++ automake.texi       6 Apr 2003 18:27:13 -0000
@@ -2366,6 +2366,17 @@
 configure-time must be added to the @code{BUILT_SOURCES} variable
 (@pxref{Sources}).
 
+Building a static library is done by compiling all object files, then
+by invoking @code{$(AR) $(ARFLAGS)} followed by the name of the
+library and the list of objects, and finally by calling
address@hidden(RANLIB)} on that library.  You should call
address@hidden from your @file{configure.in} to define
address@hidden (Automake will complain otherwise).  @code{AR} and
address@hidden default to @code{ar} and @code{cru} respectively; you
+can override these two variables my setting them in your
address@hidden, by @code{AC_SUBST}ing them from your
address@hidden, or by defining a per-library @code{maude_AR}
+variable (@pxref{Program and Library Variables}).
 
 @node A Shared Library, Program and Library Variables, A Library, Programs
 @section Building a Shared Library
@@ -2510,13 +2521,13 @@
 e.g., @samp{nodist_EXTRA_maude_SOURCES}.
 
 @item maude_AR
-A static library is created by default by invoking @code{$(AR) cru}
-followed by the name of the library and then the objects being put into
-the library.  You can override this by setting the @samp{_AR} variable.
-This is usually used with C++; some C++ compilers require a special
-invocation in order to instantiate all the templates which should go
-into a library.  For instance, the SGI C++ compiler likes this variable set
-like so:
+A static library is created by default by invoking @code{$(AR)
+$(ARFLAGS)} followed by the name of the library and then the objects
+being put into the library.  You can override this by setting the
address@hidden variable.  This is usually used with C++; some C++
+compilers require a special invocation in order to instantiate all the
+templates which should go into a library.  For instance, the SGI C++
+compiler likes this variable set like so:
 @example
 libmaude_a_AR = $(CXX) -ar -o
 @end example
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      6 Apr 2003 18:27:13 -0000
@@ -1,5 +1,6 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright 1994, 1995, 1996, 1998, 1999, 2001 Free Software Foundation, Inc.
+## Copyright (C) 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003
+## Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -23,6 +24,7 @@
 
 if %?FIRST%
 AR = ar
+ARFLAGS = cru
 ## For now this is detected when we see AC_PROG_RANLIB
 ## RANLIB = @RANLIB@
 endif %?FIRST%
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.477
diff -u -r1.477 Makefile.am
--- tests/Makefile.am   3 Apr 2003 21:38:39 -0000       1.477
+++ tests/Makefile.am   6 Apr 2003 18:27:13 -0000
@@ -339,7 +339,6 @@
 python.test \
 python2.test \
 python3.test \
-ranlib.test \
 recurs.test \
 recurs2.test \
 remake.test \
Index: tests/ar.test
===================================================================
RCS file: /cvs/automake/automake/tests/ar.test,v
retrieving revision 1.2
diff -u -r1.2 ar.test
--- tests/ar.test       8 Sep 2002 13:07:55 -0000       1.2
+++ tests/ar.test       6 Apr 2003 18:27:14 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -18,26 +18,28 @@
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-# Test for setting AR in configure.in.
+# Make sure that AR, ARFLAGS, and RANLIB can be substituted from configure.in.
 
 . ./defs || exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE($me, 1.0)
-AC_PROG_CC
-AC_PROG_RANLIB
-AC_PATH_PROG(AR, arppc)
-AC_CONFIG_FILES(Makefile)
+set -e
+
+cat >> configure.in << 'END'
+AC_SUBST([AR], ['echo it works'])
+AC_SUBST([ARFLAGS], ['>'])
+AC_SUBST([RANLIB], ['echo really works >>'])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 lib_LIBRARIES = libfoo.a
-libfoo_a_SOURCES = maude.c
+libfoo_a_SOURCES =
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
-
-grep 'AR = ar' Makefile.in && exit 1
-exit 0
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE
+grep 'it works' libfoo.a
+grep 'really works' libfoo.a
Index: tests/ranlib.test
===================================================================
RCS file: tests/ranlib.test
diff -N tests/ranlib.test
--- tests/ranlib.test   8 Sep 2002 13:07:55 -0000       1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,39 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
-#
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# GNU Automake is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with autoconf; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# Test to make sure AC_PROG_RANLIB can be overridden.  Idea from Tatu
-# Ylonen.
-
-. ./defs || exit 1
-
-cat >> configure.in << 'END'
-AC_PROG_CC
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-END
-
-cat > Makefile.am << 'END'
-noinst_LIBRARIES = libjoe.a
-END
-
-: > config.guess
-: > config.sub
-
-$ACLOCAL || exit 1
-$AUTOMAKE
-- 
Alexandre Duret-Lutz





reply via email to

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