automake-patches
[Top][All Lists]
Advanced

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

FYI: RANLIB and LIBTOOL (Was: Re: FYI: better diagnostics about undefine


From: Alexandre Duret-Lutz
Subject: FYI: RANLIB and LIBTOOL (Was: Re: FYI: better diagnostics about undefined variables + simplifications)
Date: Wed, 03 Jul 2002 20:50:27 +0200
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386-debian-linux-gnu)

In the continuation of these patches, we can use
require_variables for RANLIB and LIBTOOL.
I'm checking in this.

(BTW, this adds the 399th and 400th test cases.)

2002-07-03  Alexandre Duret-Lutz  <address@hidden>

        * 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.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1316
diff -u -r1.1316 automake.in
--- automake.in 2 Jul 2002 09:27:00 -0000       1.1316
+++ automake.in 3 Jul 2002 18:42:24 -0000
@@ -227,6 +227,8 @@
 
 # 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 @@
    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 @@
    U => 'AM_C_PROTOTYPES',
    );
 
+# Macros shipped with Autoconf.
 my %ac_macro_for_var =
   (
    CC => 'AC_PROG_CC',
@@ -252,6 +256,7 @@
    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 $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 @@
        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 @@
 # 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 @@
 
     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 @@
     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 @@
                  AC_CONFIG_HEADERS
                  AC_INIT
                  AC_LIBSOURCE
-                 AC_PROG_LIBTOOL AM_PROG_LIBTOOL
                  AC_SUBST
                  AM_AUTOMAKE_VERSION
                  AM_CONDITIONAL
@@ -4739,10 +4728,6 @@
        {
          $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 @@
                              . " || 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 @@
     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 @@
     &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 @@
                     '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';
 
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.412
diff -u -r1.412 Makefile.am
--- tests/Makefile.am   1 Jul 2002 16:10:35 -0000       1.412
+++ tests/Makefile.am   3 Jul 2002 18:42:24 -0000
@@ -213,9 +213,11 @@
 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 \
Index: tests/library2.test
===================================================================
RCS file: tests/library2.test
diff -N tests/library2.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/library2.test 3 Jul 2002 18:42:24 -0000
@@ -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
Index: tests/libtool4.test
===================================================================
RCS file: tests/libtool4.test
diff -N tests/libtool4.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/libtool4.test 3 Jul 2002 18:42:24 -0000
@@ -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
-- 
Alexandre Duret-Lutz




reply via email to

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