]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* automake.in (handle_libraries): Make the diagnostic about
authorAlexandre Duret-Lutz <adl@gnu.org>
Sat, 22 May 2004 14:23:54 +0000 (14:23 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sat, 22 May 2004 14:23:54 +0000 (14:23 +0000)
non standard libraries a warning in foreign packages.  This
is already the case in handle_ltlibraries.
(handle_libraries, handle_ltlibraries): Suggest a standard
library name in the diagnostic, to help newcomers.
* tests/stdlib.test, tests/stdlib2.test: Check for these
suggestions.

ChangeLog
automake.in
tests/stdlib.test
tests/stdlib2.test

index a85b043941760a92ba973ab2ce8e2e42b407f258..852170f8952a12e1b0fa7796a25c6197528caac6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2004-05-22  Alexandre Duret-Lutz  <adl@gnu.org>
 
+       * automake.in (handle_libraries): Make the diagnostic about
+       non standard libraries a warning in foreign packages.  This
+       is already the case in handle_ltlibraries.
+       (handle_libraries, handle_ltlibraries): Suggest a standard
+       library name in the diagnostic, to help newcomers.
+       * tests/stdlib.test, tests/stdlib2.test: Check for these
+       suggestions.
+
        Check directory names for unportable names.  Shaking the code
        to check this also led to the removal of the no-"/"-in-SUBDIRS
        restriction, and a fix to _do_recursive_traversal.
index afd4b93e89d78b917c88ad98f2bd4f1d78f82a80..7914b9d53e4c32f0e415793835bb0435de1d192c 100755 (executable)
@@ -2357,9 +2357,15 @@ sub handle_libraries
 
       my $seen_libobjs = 0;
       # Check that the library fits the standard naming convention.
-      if (basename ($onelib) !~ /^lib.*\.a/)
+      my $bn = basename ($onelib);
+      if ($bn !~ /^lib.*\.a$/)
        {
-         error $where, "`$onelib' is not a standard library name";
+         $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.a/;
+         my $suggestion = dirname ($onelib) . "/$bn";
+         $suggestion =~ s|^\./||g;
+         msg ('error-gnu/warn', $where,
+              "`$onelib' is not a standard library name\n"
+              . "did you mean `$suggestion'?")
        }
 
       $where->push_context ("while processing library `$onelib'");
@@ -2523,25 +2529,40 @@ sub handle_ltlibraries
                                            '_DEPENDENCIES');
 
       # Check that the library fits the standard naming convention.
-      my $libname_rx = "^lib.*\.la";
+      my $libname_rx = '^lib.*\.la';
       my $ldvar = var ("${xlib}_LDFLAGS") || var ('AM_LDFLAGS');
       my $ldvar2 = var ('LDFLAGS');
       if (($ldvar && grep (/-module/, $ldvar->value_as_list_recursive))
          || ($ldvar2 && grep (/-module/, $ldvar2->value_as_list_recursive)))
        {
          # Relax name checking for libtool modules.
-         $libname_rx = "\.la";
+         $libname_rx = '\.la';
        }
-      if (basename ($onelib) !~ /$libname_rx$/)
+
+      my $bn = basename ($onelib);
+      if ($bn !~ /$libname_rx$/)
        {
+          my $type = 'library';
+          if ($libname_rx eq '\.la')
+           {
+             $bn =~ s/^(lib|)(.*?)(?:\.[^.]*)?$/$1$2.la/;
+              $type = 'module';
+           }
+          else
+           {
+             $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.la/;
+           }
+         my $suggestion = dirname ($onelib) . "/$bn";
+         $suggestion =~ s|^\./||g;
          msg ('error-gnu/warn', $where,
-              "`$onelib' is not a standard libtool library name");
+              "`$onelib' is not a standard libtool $type name\n"
+              . "did you mean `$suggestion'?")
        }
 
       $where->push_context ("while processing Libtool library `$onelib'");
       $where->set (INTERNAL->get);
 
-      # Make sure we at look at these.
+      # Make sure we look at these.
       set_seen ($xlib . '_LDFLAGS');
       set_seen ($xlib . '_DEPENDENCIES');
 
index 1f4bdad4fced3d1c1fa5532fd4d0e32ea441efd7..9c0282d65f228194c140cb82a0da9279f6e7bf2c 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -30,10 +30,11 @@ AC_PROG_RANLIB
 END
 
 cat > Makefile.am << 'END'
-noinst_LIBRARIES = foo
+noinst_LIBRARIES = sub/foo
 END
 
 $ACLOCAL
 AUTOMAKE_fails
 # We're specifically testing for line-number information.
-grep 'Makefile.am:1:.*foo.*standard library name' stderr
+grep 'Makefile.am:1:.*sub/foo.*standard library name' stderr
+grep 'Makefile.am:1:.*sub/libfoo.a.*' stderr
index eee1c5134740d734c5b5d152dcbb169d070ce1a0..37102f748cd15b8be381ca91a84a37bd6c65436a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -51,12 +51,14 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails --add-missing --gnu
-grep 'nonstandard.la.*not a standard libtool library name' stderr
+grep 'Makefile.am:2:.*nonstandard.la.*standard libtool library name' stderr
+grep 'Makefile.am:2:.*libnonstandard.la' stderr
 
-# We will use -Wno-gnu to disable the warning about setting LDFLAGS.
+# We will use -Wno-gnu to disable the warning about setting LDFLAGS (below)
 # Make sure nonstandard names are diagnosed anyway.
 AUTOMAKE_fails --add-missing --gnu -Wno-gnu
-grep 'nonstandard.la.*not a standard libtool library name' stderr
+grep 'Makefile.am:2:.*nonstandard.la.*standard libtool library name' stderr
+grep 'Makefile.am:2:.*libnonstandard.la' stderr
 
 # Make sure nonstandard_la_LDFLAGS is read even if LDFLAGS is used.
 cat >Makefile.inc <<'EOF'
@@ -78,6 +80,20 @@ nonstandard_la_LDFLAGS = -lfoo
 AM_LDFLAGS = -module
 EOF
 AUTOMAKE_fails
+grep 'Makefile.am:2:.*nonstandard.la.*standard libtool library name' stderr
+grep 'Makefile.am:2:.*libnonstandard.la' stderr
 
 echo 'AM_LDFLAGS = -module' > Makefile.inc
 $AUTOMAKE
+
+# For module, Automake should not suggest the lib prefix.
+cat > Makefile.am << 'END'
+include Makefile.inc
+lib_LTLIBRARIES = nonstandard
+nonstandard_SOURCES = foo.c
+FOO = -module
+END
+
+AUTOMAKE_fails
+grep "Makefile.am:2:.*nonstandard'.*standard libtool module name" stderr
+grep 'Makefile.am:2:.*`nonstandard.la' stderr