From 2a4fc173032edbf5826e60842e24d57990bdf1fa Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 16 Nov 1996 01:43:23 +0000 Subject: [PATCH] Installed Gord's library changes --- ChangeLog | 16 ++++++++++++++ NEWS | 1 + automake.in | 64 +++++++++++++---------------------------------------- automake.texi | 17 +++++++------- lib/am/library.am | 8 +++---- lib/am/libs.am | 8 +++---- library.am | 8 +++---- libs-clean.am | 2 +- libs.am | 8 +++---- tests/ChangeLog | 5 +++++ tests/Makefile.am | 2 +- tests/alllib.test | 4 ++-- tests/canon4.test | 4 ++-- tests/libfiles.test | 21 ------------------ tests/libobj.test | 6 ++--- tests/libobj2.test | 6 ++--- tests/ranlib.test | 2 +- version.texi | 2 +- 18 files changed, 76 insertions(+), 108 deletions(-) delete mode 100755 tests/libfiles.test diff --git a/ChangeLog b/ChangeLog index 85486d5..32ab1ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,22 @@ +Fri Nov 15 16:22:15 1996 Gordon Matzigkeit + + * library.am: Fixed references to LIBRARY according to new scheme. + + * libs.am, libs-clean.am: Removed references to LIBFILES. + + * automake.texi (A Library): doc fix + + * automake.in (handle_libraries): Deleted references to *LIBFILES, + since we now have the full library name in the *LIBRARIES + variable. + (am_install_var): Removed `-no-all' option, which was only required + for the LIBFILES hack. + Fri Nov 15 16:39:29 1996 Tom Tromey * automake.in: Applied libtool-related patches from Gord. + (scan_configure): Set CC configure var if AM_PROG_LIBTOOL seen. + Also indicate that AC_CANONICAL_HOST was run. * Makefile.am (pkgdata_DATA): Removed aclocal.m4. diff --git a/NEWS b/NEWS index f362eb4..9d7143f 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,7 @@ New in 1.1h: * Special --cygnus mode * OMIT_DEPENDENCIES can now hold list of dependencies to be omitted when making distribution. Some dependencies are auto-ignored. +* Changed how libraries are specified in _LIBRARIES variable New in 1.0: * Bug fixes diff --git a/automake.in b/automake.in index d4e0da0..c43d0d7 100755 --- a/automake.in +++ b/automake.in @@ -1201,7 +1201,7 @@ sub handle_programs # Handle libraries. sub handle_libraries { - local (@liblist) = &am_install_var ('-no-all', '-clean', + local (@liblist) = &am_install_var ('-clean', 'libs', 'LIBRARIES', 'lib', 'pkglib', 'noinst', 'check'); return if ! @liblist; @@ -1223,47 +1223,21 @@ sub handle_libraries } } - # Generate _LIBFILES variables. Too bad we can't do this in - # am_install_var. - local ($onedir, $onelib); - local (@outlist); - local (@libfiles_list); - foreach $onedir (keys %valid) - { - if (&variable_defined ($onedir . '_LIBRARIES')) - { - @outlist = (); - foreach $onelib (&variable_value_as_list ($onedir . '_LIBRARIES')) - { - # FIXME: configure substitutions are just preserved. - # So your configure.in must say MYLIB=libfoo.a instead - # of MYLIB=foo. Otherwise, you end up with an entry - # like lib@MYLIB@.a in LIBFILES, which can turn into - # "lib.a" -- major lossage. Something better must be - # done here. - if (/^\@.*\@$/) - { - push (@outlist, $onelib); - } - else - { - push (@outlist, 'lib' . $onelib . '.a'); - } - } - &define_pretty_variable ($onedir . '_LIBFILES', @outlist); - } - - push (@libfiles_list, '$(' . $onedir . '_LIBFILES)') - unless $onedir eq 'EXTRA'; - } - push (@all, '$(LIBFILES)'); - + local ($onelib); local ($obj) = &get_object_extension; local ($munge); local ($xlib); local ($seen_libobjs) = 0; foreach $onelib (@liblist) { + # Check that the library fits the standard naming convention. + if ($onelib !~ /^lib.*\.a$/) + { + # FIXME this should only be a warning for foreign packages + &am_line_error ($onelib . $xt, + "\`$onelib' is not a standard library name"); + } + # Canonicalize names. ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c; if ($xlib ne $onelib) @@ -1271,7 +1245,7 @@ sub handle_libraries local ($xt); foreach $xt ('_LIBADD', '_SOURCES', '_OBJECTS', '_DEPENDENCIES') { - &am_line_error ($one_file . $xt, + &am_line_error ($onelib . $xt, "invalid variable \`" . $onelib . $xt . "'; should be \`" . $xlib . $xt . "'") if &variable_defined ($onelib . $xt); @@ -1314,14 +1288,6 @@ sub handle_libraries } } - # Turn "foo" into "libfoo.a" and include macro definition. - grep (($_ = 'lib' . $_ . '.a') && 0, @liblist); - - if (! &variable_defined ('LIBFILES')) - { - &define_pretty_variable ('LIBFILES ', @libfiles_list); - } - &define_variable ('AR', 'ar'); &define_configure_variable ('RANLIB'); } @@ -3191,6 +3157,10 @@ sub scan_configure $seen_libtool = 1; $libtool_line = $.; $configure_vars{'RANLIB'} = 1; + $configure_vars{'CC'} = 1; + # AM_PROG_LIBTOOL runs AC_CANONICAL_HOST. Make sure we + # never downgrade (if we've seen AC_CANONICAL_SYSTEM). + $seen_canonical = $AC_CANONICAL_HOST if ! $seen_canonical; } } @@ -4030,10 +4000,6 @@ sub am_install_var { $do_clean = 1; } - elsif ($args[0] eq '-no-all') - { - $do_all = 0; - } elsif ($args[0] !~ /^-/) { last; diff --git a/automake.texi b/automake.texi index 501864e..5c6f898 100644 --- a/automake.texi +++ b/automake.texi @@ -938,18 +938,19 @@ Building a library is much like building a program. In this case, the name of the primary is @samp{LIBRARIES}. Libraries can be installed in @code{libdir} or @code{pkglibdir}. -Each @samp{_LIBRARIES} variable is a list of the base names of -libraries to be built. For instance to create a library named -@file{libcpio.a}, but not install it, you would write: +Each @samp{_LIBRARIES} variable is a list of the libraries to be built. +For instance to create a library named @file{libcpio.a}, but not install +it, you would write: @example -noinst_LIBRARIES = cpio +noinst_LIBRARIES = libcpio.a @end example The sources that go into a library are determined exactly as they are -for programs, via the @samp{_SOURCES} variables. Note that programs and -libraries share a namespace, so one cannot have a program (@file{lob}) and -a library (@file{liblob.a}) with the same name in one directory. +for programs, via the @samp{_SOURCES} variables. Note that the library +name is canonicalized (@pxref{Canonicalization}), so the @samp{_SOURCES} +variable corresponding to @file{liblob.a} is @samp{liblob_a_SOURCES}, +not @samp{liblob.a_SOURCES}. Extra objects can be added to a library using the @samp{library_LIBADD} variable. This should be used for objects determined by @@ -958,7 +959,7 @@ variable. This should be used for objects determined by @vindex LIBADD @example -cpio_LIBADD = @@LIBOBJS@@ @@ALLOCA@@ +libcpio_a_LIBADD = @@LIBOBJS@@ @@ALLOCA@@ @end example diff --git a/lib/am/library.am b/lib/am/library.am index 00e0970..a247448 100644 --- a/lib/am/library.am +++ b/lib/am/library.am @@ -15,7 +15,7 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. -lib@LIBRARY@.a: $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_DEPENDENCIES) - rm -f lib@LIBRARY@.a - $(AR) cru lib@LIBRARY@.a $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_LIBADD) - $(RANLIB) lib@LIBRARY@.a +@LIBRARY@: $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_DEPENDENCIES) + rm -f @LIBRARY@ + $(AR) cru @LIBRARY@ $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_LIBADD) + $(RANLIB) @LIBRARY@ diff --git a/lib/am/libs.am b/lib/am/libs.am index 324128d..a5a449a 100644 --- a/lib/am/libs.am +++ b/lib/am/libs.am @@ -15,12 +15,12 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. -install-@DIR@LIBRARIES: $(@DIR@_LIBFILES) +install-@DIR@LIBRARIES: $(@DIR@_LIBRARIES) $(NORMAL_INSTALL) $(mkinstalldirs) $(@DIR@dir) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. - list="$(@DIR@_LIBFILES)"; for p in $$list; do \ + list="$(@DIR@_LIBRARIES)"; for p in $$list; do \ if test -f $$p; then \ $(INSTALL_DATA) $$p $(@DIR@dir)/$$p; \ else :; fi; \ @@ -31,7 +31,7 @@ install-@DIR@LIBRARIES: $(@DIR@_LIBFILES) ## useless; sh never actually executes this command. Read the GNU ## Standards for a little enlightenment on this. $(POST_INSTALL) - list="$(@DIR@_LIBFILES)"; for p in $$list; do \ + list="$(@DIR@_LIBRARIES)"; for p in $$list; do \ if test -f $$p; then \ ## Must ranlib after installing because mod time changes. $(RANLIB) $(@DIR@dir)/$$p; \ @@ -39,6 +39,6 @@ install-@DIR@LIBRARIES: $(@DIR@_LIBFILES) done uninstall-@DIR@LIBRARIES: - list="$(@DIR@_LIBFILES)"; for p in $$list; do \ + list="$(@DIR@_LIBRARIES)"; for p in $$list; do \ rm -f $(@DIR@dir)/$$p; \ done diff --git a/library.am b/library.am index 00e0970..a247448 100644 --- a/library.am +++ b/library.am @@ -15,7 +15,7 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. -lib@LIBRARY@.a: $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_DEPENDENCIES) - rm -f lib@LIBRARY@.a - $(AR) cru lib@LIBRARY@.a $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_LIBADD) - $(RANLIB) lib@LIBRARY@.a +@LIBRARY@: $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_DEPENDENCIES) + rm -f @LIBRARY@ + $(AR) cru @LIBRARY@ $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_LIBADD) + $(RANLIB) @LIBRARY@ diff --git a/libs-clean.am b/libs-clean.am index aadfac6..0f7f0fa 100644 --- a/libs-clean.am +++ b/libs-clean.am @@ -18,7 +18,7 @@ mostlyclean-@DIR@LIBRARIES: clean-@DIR@LIBRARIES: - test -z "$(@DIR@_LIBFILES)" || rm -f $(@DIR@_LIBFILES) + test -z "$(@DIR@_LIBRARIES)" || rm -f $(@DIR@_LIBRARIES) distclean-@DIR@LIBRARIES: diff --git a/libs.am b/libs.am index 324128d..a5a449a 100644 --- a/libs.am +++ b/libs.am @@ -15,12 +15,12 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. -install-@DIR@LIBRARIES: $(@DIR@_LIBFILES) +install-@DIR@LIBRARIES: $(@DIR@_LIBRARIES) $(NORMAL_INSTALL) $(mkinstalldirs) $(@DIR@dir) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. - list="$(@DIR@_LIBFILES)"; for p in $$list; do \ + list="$(@DIR@_LIBRARIES)"; for p in $$list; do \ if test -f $$p; then \ $(INSTALL_DATA) $$p $(@DIR@dir)/$$p; \ else :; fi; \ @@ -31,7 +31,7 @@ install-@DIR@LIBRARIES: $(@DIR@_LIBFILES) ## useless; sh never actually executes this command. Read the GNU ## Standards for a little enlightenment on this. $(POST_INSTALL) - list="$(@DIR@_LIBFILES)"; for p in $$list; do \ + list="$(@DIR@_LIBRARIES)"; for p in $$list; do \ if test -f $$p; then \ ## Must ranlib after installing because mod time changes. $(RANLIB) $(@DIR@dir)/$$p; \ @@ -39,6 +39,6 @@ install-@DIR@LIBRARIES: $(@DIR@_LIBFILES) done uninstall-@DIR@LIBRARIES: - list="$(@DIR@_LIBFILES)"; for p in $$list; do \ + list="$(@DIR@_LIBRARIES)"; for p in $$list; do \ rm -f $(@DIR@dir)/$$p; \ done diff --git a/tests/ChangeLog b/tests/ChangeLog index 54a140c..7b6527a 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,10 @@ Fri Nov 15 00:09:18 1996 Tom Tromey + * libfiles.test: Removed (obsolete). + + * libobj.test, canon4.test, libobj2.test, alllib.test, + ranlib.test: Fixed for Gord's changes to library handling. + * Many files: Use AC_PROG_CC to avoid error. Thu Oct 24 15:22:53 1996 Tom Tromey diff --git a/tests/Makefile.am b/tests/Makefile.am index 031acc8..4263d4d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -10,7 +10,7 @@ target.test extra.test noinst.test instman.test mkinstall.test auxdir.test \ canon3.test mdate2.test subdir.test backsl.test package.test number.test \ insh2.test outdir.test fpinstall.test fpinst2.test texinfo.test dejagnu.test \ yacc.test mkinst2.test texinfo2.test ansi.test depacl.test depacl2.test \ -error.test colon.test vtexi2.test tags.test comment.test libfiles.test \ +error.test colon.test vtexi2.test tags.test comment.test \ man.test info.test obsolete.test lex.test scripts.test subdir2.test \ exsource.test canon4.test dup.test defun.test cxxlink.test cxxnoc.test \ order.test libobj2.test interp.test alllib.test block.test libobj3.test \ diff --git a/tests/alllib.test b/tests/alllib.test index 8b63aeb..2f6425e 100755 --- a/tests/alllib.test +++ b/tests/alllib.test @@ -11,8 +11,8 @@ AC_PROG_RANLIB END cat > Makefile.am << 'END' -lib_LIBRARIES = V -EXTRA_LIBRARIES = Vm +lib_LIBRARIES = libV.a +EXTRA_LIBRARIES = libVm.a END $AUTOMAKE || exit 1 diff --git a/tests/canon4.test b/tests/canon4.test index 7207fd1..6c87424 100755 --- a/tests/canon4.test +++ b/tests/canon4.test @@ -10,8 +10,8 @@ AC_PROG_RANLIB END cat > Makefile.am << 'END' -noinst_LIBRARIES = x-y -x_y_SOURCES = xy.c +noinst_LIBRARIES = libx-y.a +libx_y_a_SOURCES = xy.c END $AUTOMAKE || exit 1 diff --git a/tests/libfiles.test b/tests/libfiles.test deleted file mode 100755 index 429282c..0000000 --- a/tests/libfiles.test +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Test for bug reported by Gord Matzigkeit. If user-defined prefix is -# used with library, _LIBFILES is never generated. - -. $srcdir/defs || exit 1 - -cat >> configure.in << 'END' -AC_PROG_CC -AC_PROG_RANLIB -END - -cat > Makefile.am << 'END' -blibdir = $(top_builddir)/lib -blib_LIBRARIES = foo -foo_SOURCES = foo.c -END - -$AUTOMAKE || exit 1 - -grep '^blib_LIBFILES' Makefile.in diff --git a/tests/libobj.test b/tests/libobj.test index 9fe17b7..f946531 100755 --- a/tests/libobj.test +++ b/tests/libobj.test @@ -17,9 +17,9 @@ AC_OUTPUT(Makefile) END cat > Makefile.am << 'END' -noinst_LIBRARIES = tu -tu_SOURCES = -tu_LIBADD = @LIBOBJS@ +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = +libtu_a_LIBADD = @LIBOBJS@ END : > fsusage.c diff --git a/tests/libobj2.test b/tests/libobj2.test index 85f8d89..ad745c3 100755 --- a/tests/libobj2.test +++ b/tests/libobj2.test @@ -18,9 +18,9 @@ END mkdir subdir cat > subdir/Makefile.am << 'END' -noinst_LIBRARIES = tu -tu_SOURCES = -tu_LIBADD = @LIBOBJS@ +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = +libtu_a_LIBADD = @LIBOBJS@ END : > subdir/fsusage.c diff --git a/tests/ranlib.test b/tests/ranlib.test index c18a21f..d977a39 100755 --- a/tests/ranlib.test +++ b/tests/ranlib.test @@ -11,7 +11,7 @@ AC_CHECK_TOOL(RANLIB, ranlib, :) END cat > Makefile.am << 'END' -noinst_LIBRARIES = joe +noinst_LIBRARIES = libjoe.a END : > config.guess diff --git a/version.texi b/version.texi index b9c052e..4b0b234 100644 --- a/version.texi +++ b/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 14 November 1996 +@set UPDATED 15 November 1996 @set EDITION 1.1h @set VERSION 1.1h -- 2.7.4