[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: update standard library name diagnostics
From: |
Alexandre Duret-Lutz |
Subject: |
FYI: update standard library name diagnostics |
Date: |
Sat, 22 May 2004 16:23:36 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
I wanted to disable the warning for noinst_ library, but that's
too much work and I'm more interested in getting 1.9 out...
I'm installing this little improvement on HEAD.
2004-05-22 Alexandre Duret-Lutz <address@hidden>
* 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.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1561
diff -u -r1.1561 automake.in
--- automake.in 22 May 2004 07:19:34 -0000 1.1561
+++ automake.in 22 May 2004 14:20:14 -0000
@@ -2357,9 +2357,15 @@
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 @@
'_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: tests/stdlib.test
===================================================================
RCS file: /cvs/automake/automake/tests/stdlib.test,v
retrieving revision 1.5
diff -u -r1.5 stdlib.test
--- tests/stdlib.test 3 Jul 2003 18:58:50 -0000 1.5
+++ tests/stdlib.test 22 May 2004 14:20:17 -0000
@@ -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 @@
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: tests/stdlib2.test
===================================================================
RCS file: /cvs/automake/automake/tests/stdlib2.test,v
retrieving revision 1.3
diff -u -r1.3 stdlib2.test
--- tests/stdlib2.test 14 Nov 2003 21:26:01 -0000 1.3
+++ tests/stdlib2.test 22 May 2004 14:20:17 -0000
@@ -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 @@
$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 @@
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
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: update standard library name diagnostics,
Alexandre Duret-Lutz <=