From 6aefd4354b566215a93943320f5914710eef1096 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 3 Jul 2002 18:50:03 +0000 Subject: [PATCH] * automake.in (am_macro_for_var): Add LIBTOOL. (ac_macro_for_var): Add RANLIB. (seen_libtool): Remove. (handle_libtool, lang_c_finish, define_compiler_variable, make_paragraphs): Use variable_defined ('LIBTOOL') instead of $seen_libtool. (handle_languages) <%transform>: Don't set 'LIBTOOL', it is already done in make_paragraphs. (handle_libraries): Simplify by requiring RANLIB with &require_variables_for_macro. (handle_ltlibraries): Simplify by requiring LIBTOOL with &require_variables_for_macro. (scan_autoconf_traces): Don't trace for AC_PROG_LIBTOOL and AM_PROG_LIBTOOL. * tests/libtool4.test, tests/library2.test: New files. * tests/Makefile.in (TESTS): Add libtool4.test and library2.test. --- ChangeLog | 19 ++++++++++++ automake.in | 74 ++++++++++++++++++--------------------------- tests/Makefile.am | 2 ++ tests/Makefile.in | 2 ++ tests/library2.test | 16 ++++++++++ tests/libtool4.test | 16 ++++++++++ 6 files changed, 85 insertions(+), 44 deletions(-) create mode 100755 tests/library2.test create mode 100755 tests/libtool4.test diff --git a/ChangeLog b/ChangeLog index 04b57e00..f207a593 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2002-07-03 Alexandre Duret-Lutz + + * automake.in (am_macro_for_var): Add LIBTOOL. + (ac_macro_for_var): Add RANLIB. + (seen_libtool): Remove. + (handle_libtool, lang_c_finish, define_compiler_variable, + make_paragraphs): Use + variable_defined ('LIBTOOL') instead of $seen_libtool. + (handle_languages) <%transform>: Don't set 'LIBTOOL', it is + already done in make_paragraphs. + (handle_libraries): Simplify by requiring RANLIB with + &require_variables_for_macro. + (handle_ltlibraries): Simplify by requiring LIBTOOL with + &require_variables_for_macro. + (scan_autoconf_traces): Don't trace for AC_PROG_LIBTOOL and + AM_PROG_LIBTOOL. + * tests/libtool4.test, tests/library2.test: New files. + * tests/Makefile.in (TESTS): Add libtool4.test and library2.test. + 2002-07-02 Alexandre Duret-Lutz * automake.in (create, keyed_aclocal_warning): Delete, unused. diff --git a/automake.in b/automake.in index 5a82e7f0..5759ff3c 100755 --- a/automake.in +++ b/automake.in @@ -227,6 +227,8 @@ my %standard_prefix = # Declare the macros that define known variables, so we can # hint the user if she try to use one of these variables. + +# Macros accessible via aclocal. my %am_macro_for_var = ( ANSI2KNR => 'AM_C_PROTOTYPES', @@ -235,6 +237,7 @@ my %am_macro_for_var = EMACS => 'AM_PATH_LISPDIR', GCJ => 'AM_PROG_GCJ', LEX => 'AM_PROG_LEX', + LIBTOOL => 'AC_PROG_LIBTOOL', lispdir => 'AM_PATH_LISPDIR', pkgpyexecdir => 'AM_PATH_PYTHON', pkgpythondir => 'AM_PATH_PYTHON', @@ -244,6 +247,7 @@ my %am_macro_for_var = U => 'AM_C_PROTOTYPES', ); +# Macros shipped with Autoconf. my %ac_macro_for_var = ( CC => 'AC_PROG_CC', @@ -252,6 +256,7 @@ my %ac_macro_for_var = CXXFLAGS => 'AC_PROG_CXX', F77 => 'AC_PROG_F77', F77FLAGS => 'AC_PROG_F77', + RANLIB => 'AC_PROG_RANLIB', YACC => 'AC_PROG_YACC', ); @@ -365,9 +370,6 @@ my $ac_gettext_location; my $seen_canonical = 0; my $canonical_location; -# Where AC_PROG_LIBTOOL appears. -my $seen_libtool; - # Where AM_MAINTAINER_MODE appears. my $seen_maint_mode; @@ -1719,7 +1721,6 @@ sub handle_languages my %transform = ('EXT' => $ext, 'PFX' => $pfx, 'FPFX' => $fpfx, - 'LIBTOOL' => defined $seen_libtool, 'AMDEP' => $AMDEP, '-c' => $lang->compile_flag || '', 'MORE-THAN-ONE' @@ -2741,23 +2742,23 @@ sub handle_compile () # Handle libtool rules. sub handle_libtool { - return unless $seen_libtool; + return unless variable_defined ('LIBTOOL'); - # Libtool requires some files, but only at top level. - require_conf_file ($seen_libtool, FOREIGN, @libtool_files) - if $relative_dir eq '.'; + # Libtool requires some files, but only at top level. + require_conf_file_with_macro ('LIBTOOL', FOREIGN, @libtool_files) + if $relative_dir eq '.'; - my @libtool_rms; - foreach my $item (sort keys %libtool_clean_directories) + my @libtool_rms; + foreach my $item (sort keys %libtool_clean_directories) { - my $dir = ($item eq '.') ? '' : "$item/"; - # .libs is for Unix, _libs for DOS. - push (@libtool_rms, "\t-rm -rf ${dir}.libs ${dir}_libs"); + my $dir = ($item eq '.') ? '' : "$item/"; + # .libs is for Unix, _libs for DOS. + push (@libtool_rms, "\t-rm -rf ${dir}.libs ${dir}_libs"); } - # Output the libtool compilation rules. - $output_rules .= &file_contents ('libtool', - ('LTRMS' => join ("\n", @libtool_rms))); + # Output the libtool compilation rules. + $output_rules .= &file_contents ('libtool', + ('LTRMS' => join ("\n", @libtool_rms))); } # handle_programs () @@ -2888,15 +2889,10 @@ sub handle_libraries my @prefix = am_primary_prefixes ('LIBRARIES', 0, 'lib', 'pkglib', 'noinst', 'check'); - if (! defined $configure_vars{'RANLIB'} - && @prefix) - { - macro_error ($prefix[0] . '_LIBRARIES', - "library used but `RANLIB' not defined in `$configure_ac'"); - # Only get this error once. If this is ever printed, we have - # a bug. - $configure_vars{'RANLIB'} = 'BUG'; - } + + require_variables_for_macro ($prefix[0] . '_LIBRARIES', + 'library used', 'RANLIB') + if (@prefix); my $seen_libobjs = 0; foreach my $onelib (@liblist) @@ -2984,18 +2980,12 @@ sub handle_ltlibraries my @prefix = am_primary_prefixes ('LTLIBRARIES', 0, 'lib', 'pkglib', 'noinst', 'check'); + require_variables_for_macro ($prefix[0] . '_KTLIBRARIES', + 'Libtool library used', 'LIBTOOL') + if (@prefix); + foreach my $key (@prefix) { - if (!$seen_libtool) - { - macro_error ($key . '_LTLIBRARIES', - "library used but `LIBTOOL' not defined in `$configure_ac'"); - # Only get this error once. If this is ever printed, - # we have a bug. - $configure_vars{'LIBTOOL'} = 'BUG'; - $seen_libtool = $var_location{$key . '_LTLIBRARIES'}; - } - # Get the installation directory of each library. (my $dir = $key) =~ s/^nobase_//; for (variable_value_as_list_recursive ($key . '_LTLIBRARIES', 'all')) @@ -4672,7 +4662,6 @@ sub scan_autoconf_traces ($) AC_CONFIG_HEADERS AC_INIT AC_LIBSOURCE - AC_PROG_LIBTOOL AM_PROG_LIBTOOL AC_SUBST AM_AUTOMAKE_VERSION AM_CONDITIONAL @@ -4739,10 +4728,6 @@ sub scan_autoconf_traces ($) { $libsources{$args[1]} = $here; } - elsif ($macro =~ /^A(C|M)_PROG_LIBTOOL$/) - { - $seen_libtool = $here; - } elsif ($macro eq 'AC_SUBST') { # Just check for alphanumeric in AC_SUBST. If you do @@ -5116,7 +5101,7 @@ sub lang_c_finish . " || rm -f ${base}_.c\n"); push (@objects, $base . '_.$(OBJEXT)'); push (@objects, $base . '_.lo') - if $seen_libtool; + if variable_defined ('LIBTOOL'); } # Make all _.o (and _.lo) files depend on ansi2knr. @@ -6778,7 +6763,7 @@ sub define_compiler_variable ($) my ($var, $value) = ($lang->compiler, $lang->compile); &define_variable ($var, $value); &define_variable ("LT$var", "\$(LIBTOOL) --mode=compile $value") - if $seen_libtool; + if variable_defined ('LIBTOOL'); } @@ -6794,7 +6779,8 @@ sub define_linker_variable ($) &define_variable ($lang->lder, $lang->ld); # CCLINK = $(CCLD) blah blah... &define_variable ($lang->linker, - (($seen_libtool ? '$(LIBTOOL) --mode=link ' : '') + ((variable_defined ('LIBTOOL') + ? '$(LIBTOOL) --mode=link ' : '') . $lang->link)); } @@ -7329,7 +7315,7 @@ sub make_paragraphs ($%) 'HOST' => $seen_canonical, 'TARGET' => $seen_canonical == AC_CANONICAL_SYSTEM, - 'LIBTOOL' => defined $configure_vars{'LIBTOOL'}) + 'LIBTOOL' => variable_defined ('LIBTOOL')) # We don't need more than two consecutive new-lines. . 's/\n{3,}/\n\n/g'; diff --git a/tests/Makefile.am b/tests/Makefile.am index d9d67c80..b4700009 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -213,9 +213,11 @@ libobj8.test \ libobj10.test \ libobj11.test \ library.test \ +library2.test \ libtool.test \ libtool2.test \ libtool3.test \ +libtool4.test \ link_c_cxx.test \ link_dist.test \ link_f_c.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 7e8381c0..33e5e8f3 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -300,9 +300,11 @@ libobj8.test \ libobj10.test \ libobj11.test \ library.test \ +library2.test \ libtool.test \ libtool2.test \ libtool3.test \ +libtool4.test \ link_c_cxx.test \ link_dist.test \ link_f_c.test \ diff --git a/tests/library2.test b/tests/library2.test new file mode 100755 index 00000000..6915c31a --- /dev/null +++ b/tests/library2.test @@ -0,0 +1,16 @@ +#! /bin/sh + +# Make sure Automake suggest using AC_PROG_RANLIB when *_LIBRARIES is used. + +. $srcdir/defs || exit 1 + +set -e + +cat > Makefile.am << 'END' +EXTRA_LIBRARIES = libfoo.a +END + +$ACLOCAL +$AUTOMAKE 2>stderr && exit 1 +cat stderr +grep AC_PROG_RANLIB stderr diff --git a/tests/libtool4.test b/tests/libtool4.test new file mode 100755 index 00000000..71534ec4 --- /dev/null +++ b/tests/libtool4.test @@ -0,0 +1,16 @@ +#!/bin/sh + +# Make sure Automake suggests AC_PROG_LIBTOOL when *_LTLIBRARIES is used. + +. $srcdir/defs || exit 1 + +set -e + +cat > Makefile.am << 'END' +EXTRA_LTLIBRARIES = liblib.la +END + +$ACLOCAL +$AUTOMAKE 2>stderr && exit 1 +cat stderr +grep AC_PROG_LIBTOOL stderr -- 2.43.5