From e7d87238d45e53449b74cebcc519a6f3057ba592 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 9 Aug 1996 15:45:13 +0000 Subject: [PATCH] Canoncalize library names --- ChangeLog | 6 ++++++ automake.in | 27 ++++++++++++++++++++++----- lib/am/library.am | 4 ++-- library.am | 4 ++-- tests/ChangeLog | 4 ++++ tests/Makefile.am | 2 +- tests/Makefile.in | 2 +- tests/canon4.test | 19 +++++++++++++++++++ 8 files changed, 57 insertions(+), 11 deletions(-) create mode 100755 tests/canon4.test diff --git a/ChangeLog b/ChangeLog index adc0ab22..2016d84d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Aug 9 09:18:46 1996 Tom Tromey + + * automake.in (handle_libraries): Canonicalize library name. Test + canon4.test. + * library.am (lib@LIBRARY@.a): Use @XLIBRARY@ where appropriate. + Thu Aug 8 10:57:21 1996 Tom Tromey * automake.in (handle_scripts): Correctly compute diff --git a/automake.in b/automake.in index 6571a2c9..237db7de 100755 --- a/automake.in +++ b/automake.in @@ -832,23 +832,40 @@ sub handle_libraries local ($obj) = &get_object_extension; local ($munge); + local ($xlib); foreach $onelib (@liblist) { - if (&variable_defined ($onelib . '_LIBADD')) + # Canonicalize names. + ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c; + if ($xlib ne $one_file) + { + local ($xt); + foreach $xt ('_LIBADD', '_SOURCES', '_OBJECTS', '_DEPENDENCIES') + { + &am_line_error ($one_file . $xt, + "invalid variable \`" . $onelib . $xt + . "'; should be \`" . $xlib . $xt . "'") + if &variable_defined ($onelib . $xt); + } + } + + if (&variable_defined ($xlib . '_LIBADD')) { - &handle_lib_objects ($onelib . '_LIBADD'); + &handle_lib_objects ($xlib . '_LIBADD'); } else { # Generate support for conditional object inclusion in # libraries. - $output_vars .= $onelib . "_LIBADD =\n"; + $output_vars .= $xlib . "_LIBADD =\n"; } - &handle_source_transform ($onelib, $onelib, $obj); + &handle_source_transform ($xlib, $onelib, $obj); $output_rules .= - &file_contents_with_transform ('s/\@LIBRARY\@/' . $onelib . '/go', + &file_contents_with_transform ('s/\@LIBRARY\@/' . $onelib . '/go;' + . 's/\@XLIBRARY\@/' + . $xlib . '/go;', 'library'); } diff --git a/lib/am/library.am b/lib/am/library.am index a8126b07..41993982 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: $(@LIBRARY@_OBJECTS) $(@LIBRARY@_LIBADD) +lib@LIBRARY@.a: $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_LIBADD) rm -f lib@LIBRARY@.a - $(AR) cru lib@LIBRARY@.a $(@LIBRARY@_OBJECTS) $(@LIBRARY@_LIBADD) + $(AR) cru lib@LIBRARY@.a $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_LIBADD) $(RANLIB) lib@LIBRARY@.a diff --git a/library.am b/library.am index a8126b07..41993982 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: $(@LIBRARY@_OBJECTS) $(@LIBRARY@_LIBADD) +lib@LIBRARY@.a: $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_LIBADD) rm -f lib@LIBRARY@.a - $(AR) cru lib@LIBRARY@.a $(@LIBRARY@_OBJECTS) $(@LIBRARY@_LIBADD) + $(AR) cru lib@LIBRARY@.a $(@XLIBRARY@_OBJECTS) $(@XLIBRARY@_LIBADD) $(RANLIB) lib@LIBRARY@.a diff --git a/tests/ChangeLog b/tests/ChangeLog index 2a8ed8bd..fa6bd1e5 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +Fri Aug 9 09:18:07 1996 Tom Tromey + + * canon4.test: New file. + Thu Aug 8 10:47:45 1996 Tom Tromey * exsource.test: New file. diff --git a/tests/Makefile.am b/tests/Makefile.am index fae6f995..cccbc9d5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -12,6 +12,6 @@ insh2.test outdir.test fpinstall.test fpinst2.test texinfo.test dejagnu.test \ yacc.test mkinstall2.test texinfo2.test ansi.test depacl.test depacl2.test \ error.test colon.test vtexi2.test tags.test comment.test libfiles.test \ man.test info.test obsolete.test lex.test scripts.test subdir2.test \ -exsource.test +exsource.test canon4.test EXTRA_DIST = defs $(TESTS) diff --git a/tests/Makefile.in b/tests/Makefile.in index 79f21996..9db317bf 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -50,7 +50,7 @@ insh2.test outdir.test fpinstall.test fpinst2.test texinfo.test dejagnu.test \ yacc.test mkinstall2.test texinfo2.test ansi.test depacl.test depacl2.test \ error.test colon.test vtexi2.test tags.test comment.test libfiles.test \ man.test info.test obsolete.test lex.test scripts.test subdir2.test \ -exsource.test +exsource.test canon4.test EXTRA_DIST = defs $(TESTS) mkinstalldirs = $(top_srcdir)/mkinstalldirs diff --git a/tests/canon4.test b/tests/canon4.test new file mode 100755 index 00000000..11e83bfe --- /dev/null +++ b/tests/canon4.test @@ -0,0 +1,19 @@ +#! /bin/sh + +# Test to make sure name canonicalization happens for libraries. + +. $srcdir/defs || exit 1 + +cat >> configure.in << 'END' +AC_PROG_RANLIB +END + +cat > Makefile.am << 'END' +noinst_LIBRARIES = x-y +x_y_SOURCES = xy.c +END + +$AUTOMAKE || exit 1 + +grep '^x-y' Makefile.in && exit 1 +exit 0 -- 2.43.5