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.
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'");
'_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');
#! /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.
#
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
#! /bin/sh
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
$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'
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