From: Alexandre Duret-Lutz Date: Sun, 6 Apr 2003 18:31:12 +0000 (+0000) Subject: * lib/am/libs.am (ARFLAGS): Define. X-Git-Tag: Release-1-7-3b~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a71b3490639831ca5028a7f3e69323022b36a2d7;p=thirdparty%2Fautomake.git * 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. --- diff --git a/ChangeLog b/ChangeLog index be2bb66a0..948eb8603 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2003-04-06 Alexandre Duret-Lutz + + * 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. + 2003-04-03 Alexandre Duret-Lutz * automake.in (check_trailing_slash): New function (variation on diff --git a/NEWS b/NEWS index ec13ece9c..1b422a54d 100644 --- a/NEWS +++ b/NEWS @@ -59,6 +59,11 @@ New in 1.7a: * 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. diff --git a/THANKS b/THANKS index 441eee16f..4b92c8300 100644 --- a/THANKS +++ b/THANKS @@ -163,6 +163,7 @@ Paul D. Smith psmith@BayNetworks.COM Paul Eggert eggert@twinsun.com Paul Jarc prj@po.cwru.edu Paul Martinolich martinol@datasync.com +Paul Thomas PTHOMAS@novell.com Pavel Roskin pavel_roskin@geocities.com Per Bothner bothner@cygnus.com Per Cederqvist ceder@lysator.liu.se diff --git a/automake.in b/automake.in index 5983ce903..1df692850 100755 --- a/automake.in +++ b/automake.in @@ -3355,7 +3355,7 @@ sub handle_libraries 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 diff --git a/automake.texi b/automake.texi index e7559861f..870347005 100644 --- a/automake.texi +++ b/automake.texi @@ -2366,6 +2366,17 @@ In addition, sources for extra objects that will not exist until 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 +@code{$(RANLIB)} on that library. You should call +@code{AC_PROG_RANLIB} from your @file{configure.in} to define +@code{RANLIB} (Automake will complain otherwise). @code{AR} and +@code{ARFLAGS} default to @code{ar} and @code{cru} respectively; you +can override these two variables my setting them in your +@file{Makefile.am}, by @code{AC_SUBST}ing them from your +@file{configure.in}, 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 @@ This variable also supports @samp{dist_} and @samp{nodist_} prefixes, 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 +@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: @example libmaude_a_AR = $(CXX) -ar -o @end example diff --git a/lib/am/libs.am b/lib/am/libs.am index ba7fd53cb..92193e855 100644 --- a/lib/am/libs.am +++ b/lib/am/libs.am @@ -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% diff --git a/stamp-vti b/stamp-vti index 7013658ea..24a373866 100644 --- a/stamp-vti +++ b/stamp-vti @@ -1,4 +1,4 @@ -@set UPDATED 20 March 2003 -@set UPDATED-MONTH March 2003 +@set UPDATED 6 April 2003 +@set UPDATED-MONTH April 2003 @set EDITION 1.7a @set VERSION 1.7a diff --git a/tests/Makefile.am b/tests/Makefile.am index 864dc612b..3f70ff58f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -339,7 +339,6 @@ proginst.test \ python.test \ python2.test \ python3.test \ -ranlib.test \ recurs.test \ recurs2.test \ remake.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 69cafd729..809143119 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -433,7 +433,6 @@ proginst.test \ python.test \ python2.test \ python3.test \ -ranlib.test \ recurs.test \ recurs2.test \ remake.test \ diff --git a/tests/ar.test b/tests/ar.test index 84f29398f..e3ed86938 100755 --- a/tests/ar.test +++ b/tests/ar.test @@ -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 diff --git a/tests/ranlib.test b/tests/ranlib.test deleted file mode 100755 index bd7ca9d9a..000000000 --- a/tests/ranlib.test +++ /dev/null @@ -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 diff --git a/version.texi b/version.texi index 7013658ea..24a373866 100644 --- a/version.texi +++ b/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 20 March 2003 -@set UPDATED-MONTH March 2003 +@set UPDATED 6 April 2003 +@set UPDATED-MONTH April 2003 @set EDITION 1.7a @set VERSION 1.7a