Re: pr401*.test and BSD make: computing LIBOBJDIR

2006-08-04 Thread Alexandre Duret-Lutz
I've checked this in.

2006-08-04  Ralf Wildenhues  [EMAIL PROTECTED]

* automake.in (handle_LIBOBJS_or_ALLOCA): With subdir-objects,
do not prefix `$(top_builddir)/' aka `./' to nonempty LIBOBJDIR,
to help BSD Make find the files also in a VPATH build.
Also return the same path, possibly prefixed, for correct
depdir computation.
* tests/pr401.test: Update to expose wrong depdir computation.
Rewrite to not use the same file name for library object and
main program.
* tests/pr401b.test, tests/pr401c.test: Likewise.

Index: automake.in
===
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1623
diff -u -r1.1623 automake.in
--- automake.in 24 Jun 2006 05:31:54 -  1.1623
+++ automake.in 4 Aug 2006 06:08:09 -
@@ -2175,7 +2175,12 @@
 {
   if (option 'subdir-objects')
{
- define_variable ('LIBOBJDIR', \$(top_builddir)/$dir, INTERNAL);
+ # In the top-level Makefile we do not use $(top_builddir), because
+ # we are already there, and since the targets are built without
+ # a $(top_builddir), it helps BSD Make to match them with
+ # dependencies.
+ $dir = $topsrcdir/$dir if $relative_dir ne '.';
+ define_variable ('LIBOBJDIR', $dir, INTERNAL);
  $clean_files{\$($var)} = MOSTLY_CLEAN;
  # If LTLIBOBJS is used, we must also clear LIBOBJS (which might
  # be created by libtool as a side-effect of creating LTLIBOBJS).
Index: tests/pr401.test
===
RCS file: /cvs/automake/automake/tests/pr401.test,v
retrieving revision 1.3
diff -u -r1.3 pr401.test
--- tests/pr401.test6 Jun 2006 20:42:36 -   1.3
+++ tests/pr401.test4 Aug 2006 06:08:09 -
@@ -36,7 +36,7 @@
 }
 EOF
 
-cat src/feep.c 'EOF'
+cat src/main.c 'EOF'
 #include stdio.h
 
 extern char *feep ();
@@ -76,10 +76,10 @@
 EOF
 
 cat src/Makefile.am 'EOF'
-check_PROGRAMS = feep
-feep_LDADD = ../lib/libfeep.a
+check_PROGRAMS = main
+main_LDADD = ../lib/libfeep.a
 
-TESTS = feep
+TESTS = main
 EOF
 
 $ACLOCAL
@@ -107,16 +107,18 @@
 libfeep_a_SOURCES =
 libfeep_a_LIBADD = $(LIBOBJS)
 
-check_PROGRAMS = feep
-feep_LDADD = libfeep.a
+check_PROGRAMS = main
+main_LDADD = libfeep.a
 
-TESTS = feep
+TESTS = main
 EOF
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 ./configure
+test ! -d src/lib
+test ! -d 'src/$(top_builddir)'
 $MAKE
 $MAKE check
 $MAKE distclean
@@ -136,14 +138,16 @@
 lib_libfeep_a_SOURCES =
 lib_libfeep_a_LIBADD = $(LIBOBJS)
 
-check_PROGRAMS = src/feep
-src_feep_SOURCES = src/feep.c
-src_feep_LDADD = lib/libfeep.a
+check_PROGRAMS = src/main
+src_main_SOURCES = src/main.c
+src_main_LDADD = lib/libfeep.a
 
-TESTS = src/feep
+TESTS = src/main
 
 check-local:
-   test -f src/feep.$(OBJEXT)
+   test -f src/main.$(OBJEXT)
+   test -f lib/feep.$(OBJEXT)
+   test ! -f src/$(DEPDIR)/feep.Po
 EOF
 
 $ACLOCAL
Index: tests/pr401b.test
===
RCS file: /cvs/automake/automake/tests/pr401b.test,v
retrieving revision 1.3
diff -u -r1.3 pr401b.test
--- tests/pr401b.test   6 Jun 2006 20:42:36 -   1.3
+++ tests/pr401b.test   4 Aug 2006 06:08:09 -
@@ -36,7 +36,7 @@
 }
 EOF
 
-cat src/feep.c 'EOF'
+cat src/main.c 'EOF'
 #include stdio.h
 
 extern char *feep ();
@@ -76,10 +76,10 @@
 EOF
 
 cat src/Makefile.am 'EOF'
-check_PROGRAMS = feep
-feep_LDADD = ../lib/libfeep.la
+check_PROGRAMS = main
+main_LDADD = ../lib/libfeep.la
 
-TESTS = feep
+TESTS = main
 EOF
 
 libtoolize
@@ -108,16 +108,18 @@
 libfeep_la_SOURCES =
 libfeep_la_LIBADD = $(LTLIBOBJS)
 
-check_PROGRAMS = feep
-feep_LDADD = libfeep.la
+check_PROGRAMS = main
+main_LDADD = libfeep.la
 
-TESTS = feep
+TESTS = main
 EOF
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 ./configure
+test ! -d src/lib
+test ! -d 'src/$(top_builddir)'
 $MAKE
 $MAKE check
 $MAKE distclean
@@ -137,14 +139,16 @@
 lib_libfeep_la_SOURCES =
 lib_libfeep_la_LIBADD = $(LTLIBOBJS)
 
-check_PROGRAMS = src/feep
-src_feep_SOURCES = src/feep.c
-src_feep_LDADD = lib/libfeep.la
+check_PROGRAMS = src/main
+src_main_SOURCES = src/main.c
+src_main_LDADD = lib/libfeep.la
 
-TESTS = src/feep
+TESTS = src/main
 
 check-local:
-   test -f src/feep.$(OBJEXT)
+   test -f src/main.$(OBJEXT)
+   test -f lib/feep.lo
+   test ! -f src/$(DEPDIR)/feep.Po
 EOF
 
 $ACLOCAL
Index: tests/pr401c.test
===
RCS file: /cvs/automake/automake/tests/pr401c.test,v
retrieving revision 1.3
diff -u -r1.3 pr401c.test
--- tests/pr401c.test   6 Jun 2006 20:42:36 -   1.3
+++ tests/pr401c.test   4 Aug 2006 06:08:09 -
@@ -39,7 +39,7 @@
 }
 EOF
 
-cat src/feep.c 'EOF'
+cat src/main.c 'EOF'
 #include stdio.h
 
 extern char *feep ();
@@ -78,10 +78,10 @@
 EOF
 
 cat src/Makefile.am 'EOF'

Re: automake crash

2006-08-04 Thread Alexandre Duret-Lutz
 BW == Bas Wijnen [EMAIL PROTECTED] writes:

 BW Hi,

 BW automake just crashed on me, and it told me to send a mail
 BW here, so I do. :-)

Hi Bas, thanks for doing so.

 BW This is what it says:
 BW Makefile.am:184: unterminated conditionals: DEBUGGING_TRUE DEPRECATION_TRUE

This means Automake's parser is completely lost. Automake is not
smart enough to handle conditionals inside multi-lines
definitions.

You shouldn't use :

 BW console_cflags = \
 BW if WARNINGS
 BW @EXTRA_WARNING_FLAGS@ \
 BW -Wall \
 BW -W \
 BW -Wpointer-arith \
 BW -Wcast-qual \
 BW -Wwrite-strings \
 BW -Wno-sign-compare \
 BW -Waggregate-return \
 BW -Wstrict-prototypes \
 BW -Wmissing-prototypes \
 BW -Wmissing-declarations \
 BW -Wredundant-decls \
 BW -Wnested-externs \
 BW -O \
 BW endif
 BW if DEBUGGING
 BW -ggdb3 \
 BW endif
 BW if DEPRECATION
 BW -DG_DISABLE_DEPRECATED \
 BW endif
 BW -I$(top_srcdir)/common \
 BW -I$(top_builddir)/common \
 BW -I$(includedir) \
 BW $(GLIB2_CFLAGS)

but rather something like

| if WARNINGS
| warnings_console_cflags = @EXTRA_WARNING_FLAGS@ \
|   -Wall \
|   -W \
|   -Wpointer-arith \
|   -Wcast-qual \
|   -Wwrite-strings \
|   -Wno-sign-compare \
|   -Waggregate-return \
|   -Wstrict-prototypes \
|   -Wmissing-prototypes \
|   -Wmissing-declarations \
|   -Wredundant-decls \
|   -Wnested-externs \
|   -O
| endif
| if DEBUGGING
| debugging_console_cflags = -ggdb3
| endif
| if DEPRECATION
| deprecation_console_cflags = -DG_DISABLE_DEPRECATED 
| endif
| 
| console_cflags = $(warnings_console_cflags) $(debugging_console_cflags) \
|   $(deprecation_console_cflags) \
|   -I$(top_srcdir)/common \
|   -I$(top_builddir)/common \
|   -I$(includedir) \
|   $(aGLIB2_CFLAGS)

or you can build console_cflags bits after bits :

| console_cflags =
| if WARNINGS
| console_cflags += @EXTRA_WARNING_FLAGS@ \
|   -Wall \
|   -W \
|   -Wpointer-arith \
|   -Wcast-qual \
|   -Wwrite-strings \
|   -Wno-sign-compare \
|   -Waggregate-return \
|   -Wstrict-prototypes \
|   -Wmissing-prototypes \
|   -Wmissing-declarations \
|   -Wredundant-decls \
|   -Wnested-externs \
|   -O
| endif
| if DEBUGGING
| console_cflags += -ggdb3
| endif
| if DEPRECATION
| console_cflags += -DG_DISABLE_DEPRECATED 
| endif
| console_cflags += -I$(top_srcdir)/common \
|   -I$(top_builddir)/common \
|   -I$(includedir) \
|   $(aGLIB2_CFLAGS)


Fixing Automake to diagnose this situation would be difficult.
I'll just mention it in the manual.

 BW automake-1.9: 
 BW automake-1.9: ## Internal Error ##
 BW automake-1.9: 
 BW automake-1.9: undefined condition `TRUE' for `AUTOMAKE_OPTIONS'

Automake is so lost it thinks AUTOMAKE_OPTIONS is conditionally defined.
This error message at least is easily improved.

 BW # Pioneers - Implementation of the excellent Settlers of Catan board game.
 BW #   Go buy a copy.

I own one already.  Great game !

I'm checking the following patch in.

2006-08-04  Alexandre Duret-Lutz  [EMAIL PROTECTED]

* doc/automake.texi (Conditionals): Split in two sections, Usage
and Portability, and add a third one, Limits to explain how
conditional definitions inside multi-lines definitions can be
handled.
* automake.in (handle_options): Do not assume that
AUTOMAKE_OPTIONS is defined in TRUE, but diagnose conditional
definitions of AUTOMAKE_OPTIONS.
Report from Bas Wijnen.
* tests/amopt.test: New test.
* tests/Makefile.am (TESTS): Add it.

Index: THANKS
===
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.286
diff -u -r1.286 THANKS
--- THANKS  24 Jun 2006 05:35:43 -  1.286
+++ THANKS  4 Aug 2006 10:21:46 -
@@ -23,6 +23,7 @@
 Art Haas   [EMAIL PROTECTED]
 Assar Westerlund   [EMAIL PROTECTED]
 Axel Belinfante[EMAIL PROTECTED]
+Bas Wijnen [EMAIL PROTECTED]
 Bernard Giroud [EMAIL PROTECTED]
 Bernard Urban  [EMAIL PROTECTED]
 Bernd Jendrissek   [EMAIL PROTECTED]
Index: automake.in
===
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1624
diff -u -r1.1624 automake.in
--- automake.in 4 Aug 2006 06:08:58 -   1.1624
+++ automake.in 4 Aug 2006 10:21:46 -
@@ -1055,12 +1055,16 @@
   my $var = var ('AUTOMAKE_OPTIONS');
   if ($var)
 {
-  # FIXME: We should disallow conditional definitions of AUTOMAKE_OPTIONS.
-  if (process_option_list ($var-rdef (TRUE)-location,
-  $var-value_as_list_recursive (cond_filter =
- TRUE)))
+  if ($var-has_conditional_contents)
{
- return 1;
+ msg_var ('unsupported', $var,
+  `AUTOMAKE_OPTIONS' cannot have conditional contents);
+   }
+  foreach my $locvals ($var-value_as_list_recursive 

Re: Creating subdirs of distdir

2006-08-04 Thread Alexandre Duret-Lutz
Thank you, and sorry for the delay.

I'm installing this as follows, removing another reference to
DISTDIRS in dist.am, fixing distdir.test so it passes, and
fixing the (c) year of pr2.test,

2006-08-04  Stepan Kasal  [EMAIL PROTECTED]

* automake.in (dist_dirs, fill_dist_dirs): Remove.
* lib/am/distdir.am (DISTDIRS): Remove.
* tests/distdir.test, tests/pr2.test: Do not grep, use
`make distdir' instead.

Index: automake.in
===
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1625
diff -u -r1.1625 automake.in
--- automake.in 4 Aug 2006 10:23:14 -   1.1625
+++ automake.in 4 Aug 2006 12:53:16 -
@@ -489,11 +489,6 @@
 # This holds the set of included files.
 my @include_stack;
 
-# This holds a list of directories which we must create at `dist'
-# time.  This is used in some strange scenarios involving weird
-# AC_OUTPUT commands.
-my %dist_dirs;
-
 # List of dependencies for the obvious targets.
 my @all;
 my @check;
@@ -647,8 +642,6 @@
 
 @include_stack = ();
 
-%dist_dirs = ();
-
 @all = ();
 @check = ();
 @check_tests = ();
@@ -3536,24 +3529,6 @@
 return $a cmp $b;
 }
 
-# fill_dist_dirs(@FILES)
-# --
-# Record in %dist_dirs the directory part of any file passed.
-sub fill_dist_dirs (@)
-{
-  my @copy = @_;
-  foreach (@copy)
-{
-  s/\$\(top_srcdir\)/$topsrcdir/;
-  s/\$\(srcdir\)/./;
-  # Strip any leading `./'.
-  s,^(:?\./+)*,,;
-  next unless s,/+[^/]+$,,;
-  $dist_dirs{$_} = 1
-   unless $_ eq '.';
-}
-}
-
 # handle_dist
 # ---
 # Handle 'dist' target.
@@ -3670,26 +3645,10 @@
   # originally, but there were so many requests that I finally
   # relented.
   my $extra_dist = var ('EXTRA_DIST');
-  # FIXME: This should be fixed to work with conditions.  That
-  # will require only making the entries in %dist_dirs under the
-  # appropriate condition.  This is meaningful if the nature of
-  # the distribution should depend upon the configure options
-  # used.
-  fill_dist_dirs ($extra_dist-value_as_list_recursive (skip_ac_subst = 1))
-if $extra_dist;
-
-  # We have to check DIST_COMMON for extra directories in case the
-  # user put a source used in AC_OUTPUT into a subdir.
-  fill_dist_dirs (rvar ('DIST_COMMON')
-  -value_as_list_recursive (skip_ac_subst = 1));
 
   $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook';
   $transform{'GETTEXT'} = $seen_gettext  !$seen_gettext_external;
 
-  # Prepend $(distdir) to each directory given.
-  my %rewritten = map { '$(distdir)/' . $_ = 1 } keys %dist_dirs;
-  $transform{'DISTDIRS'} = join (' ', sort keys %rewritten);
-
   # If the target `dist-hook' exists, make sure it is run.  This
   # allows users to do random weird things to the distribution
   # before it is packaged up.
@@ -4112,14 +4071,6 @@
 
   my $local = basename ($file);
 
-  # Make sure the dist directory for each input file is created.
-  # We only have to do this at the topmost level though.  This
-  # is a bit ugly but it easier than spreading out the logic,
-  # especially in cases like AC_OUTPUT(foo/out:bar/in), where
-  # there is no Makefile in bar/.
-  fill_dist_dirs (@inputs)
-   if $relative_dir eq '.';
-
   # We skip files that aren't in this directory.  However, if
   # the file's directory does not have a Makefile, and we are
   # currently doing `.', then we create a rule to rebuild the
@@ -4191,13 +4142,6 @@
{
  my $fd = dirname ($file);
 
- # Make sure the dist directory for each input file is created.
- # We only have to do this at the topmost level though.
- if ($relative_dir eq '.')
-   {
- $dist_dirs{$fd} = 1;
-   }
-
  # We distribute files that are in this directory.
  # At the top-level (`.') we also distribute files whose
  # directory does not have a Makefile.
Index: lib/am/distdir.am
===
RCS file: /cvs/automake/automake/lib/am/distdir.am,v
retrieving revision 1.66
diff -u -r1.66 distdir.am
--- lib/am/distdir.am   24 Jun 2006 05:35:44 -  1.66
+++ lib/am/distdir.am   4 Aug 2006 12:53:16 -
@@ -55,9 +55,6 @@
 endif %?TOPDIR_P%
 ##
 ##
-?DISTDIRS? $(mkdir_p) %DISTDIRS%
-##
-##
@srcdirstrip=`echo $(srcdir) | sed 's/[].[^$$\\*]//g'`; \
topsrcdirstrip=`echo $(top_srcdir) | sed 's/[].[^$$\\*]//g'`; \
 ##
@@ -108,8 +105,6 @@
 ## (The second `t' command clears the flag for the next round.)
 ##
 ## Make the subdirectories for the files.
-## (The DISTDIRS list can be incomplete, because files in subdirectories can
-## be specified for `dist' conditionally.)
 ##
case $$dist_files in \
  */*) $(mkdir_p) `echo $$dist_files | \
Index: tests/distdir.test

Re: Creating subdirs of distdir

2006-08-04 Thread Stepan Kasal
Hello,

On Fri, Aug 04, 2006 at 02:54:23PM +0200, Alexandre Duret-Lutz wrote:
 I'm installing this as follows, removing another reference to
 DISTDIRS in dist.am, fixing distdir.test so it passes, and
 fixing the (c) year of pr2.test,

thank you very much for the fixes.  (I wonder why I thought that
distdir.test worked for me.)

Stepan




FYI: diagnose old-style AC_INIT with new-style AM_INIT_AUTOMAKE

2006-08-04 Thread Alexandre Duret-Lutz
Found this on an old TODO-list.  If a beginner type

   AC_INIT
   AM_INIT_AUTOMAKE

without further arguments, he gets a confusing error message
about AC_PACKAGE_VERSION:

configure:1943: error: possibly undefined macro: AC_PACKAGE_TARNAME
  If this token and others are legitimate, please use m4_pattern_allow.
  See the Autoconf documentation.

Let's point him to AC_INIT instead.


2006-08-04  Alexandre Duret-Lutz  [EMAIL PROTECTED]

* m4/init.m4: Suggest fixing the call to AC_INIT when
AC_PACKAGE_NAME or AC_PACKAGE_VERSION is undefined.  This is for
newcomers who call AC_INIT and AM_INIT_AUTOMAKE without arguments.
* tests/init.test: New file.
* tests/Makefile.am (TESTS): Add it.

Index: m4/init.m4
===
RCS file: /cvs/automake/automake/m4/init.m4,v
retrieving revision 1.63
diff -u -r1.63 init.m4
--- m4/init.m4  20 Mar 2006 20:31:28 -  1.63
+++ m4/init.m4  4 Aug 2006 14:47:07 -
@@ -1,7 +1,7 @@
 # Do all the work for Automake. -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -53,6 +53,9 @@
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([VERSION], [$2])],
 [_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+   [m4_fatal([AC_INIT should be called with package and version 
arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
 
Index: tests/Makefile.am
===
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.606
diff -u -r1.606 Makefile.am
--- tests/Makefile.am   4 Aug 2006 10:23:14 -   1.606
+++ tests/Makefile.am   4 Aug 2006 14:47:07 -
@@ -270,6 +270,7 @@
 include.test \
 include2.test \
 info.test \
+init.test \
 insh2.test \
 install2.test \
 installdir.test \
Index: tests/init.test
===
RCS file: tests/init.test
diff -N tests/init.test
--- /dev/null   1 Jan 1970 00:00:00 -
+++ tests/init.test 4 Aug 2006 14:47:07 -
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Make sure we give a sensible error message when neither AC_INIT nor
+# AM_INIT_AUTOMAKE are given arguments.
+
+. ./defs || exit 1
+
+set -e
+
+cat configure.in END
+AC_INIT
+AM_INIT_AUTOMAKE
+END
+
+# The error message should mension AC_INIT, not AC_PACKAGE_VERSION.
+($ACLOCAL  $AUTOCONF) 2stderr  exit 1
+cat stderr
+grep AC_PACKAGE_VERSION stderr  exit 1
+grep AC_INIT stderr

-- 
Alexandre Duret-Lutz





FYI: _SCRIPTS doc retake

2006-08-04 Thread Alexandre Duret-Lutz
I'm checking this in.

2006-08-04  Alexandre Duret-Lutz  [EMAIL PROTECTED]

* doc/automake.texi (Scripts): Revamp.  Show an example of script
built from configure.ac.  Discuss CLEANFILES and EXTRA_DIST for
other built scripts.

Index: doc/automake.texi
===
RCS file: /cvs/automake/automake/doc/automake.texi,v
retrieving revision 1.138
diff -u -r1.138 automake.texi
--- doc/automake.texi   4 Aug 2006 10:23:14 -   1.138
+++ doc/automake.texi   4 Aug 2006 16:11:27 -
@@ -5298,22 +5298,47 @@
 @cindex @code{SCRIPTS} primary, defined
 @cindex Primary variable, @code{SCRIPTS}
 @vindex _SCRIPTS
[EMAIL PROTECTED] Installing scripts
 
 It is possible to define and install programs that are scripts.  Such
-programs are listed using the @code{SCRIPTS} primary name.  Automake
-doesn't define any dependencies for scripts; the @file{Makefile.am}
-should include the appropriate rules.
+programs are listed using the @code{SCRIPTS} primary name.  When the
+script is distributed in its final, installable form, the
[EMAIL PROTECTED] usually looks as follows:
 @vindex SCRIPTS
 
-Automake does not assume that scripts are derived objects; such objects
-must be deleted by hand (@pxref{Clean}).
[EMAIL PROTECTED]
+# Install my_script in $(bindir) and distribute it.
+dist_bin_SCRIPTS = my_script
[EMAIL PROTECTED] example
+
+Script are not distributed by default; as we have just seen, those
+that should be distributed can be specified using a @code{dist_}
+prefix as with other primaries.
+
[EMAIL PROTECTED] @code{SCRIPTS}, installation directories
[EMAIL PROTECTED] bin_SCRIPTS
[EMAIL PROTECTED] sbin_SCRIPTS
[EMAIL PROTECTED] libexec_SCRIPTS
[EMAIL PROTECTED] pkgdata_SCRIPTS
[EMAIL PROTECTED] noinst_SCRIPTS
[EMAIL PROTECTED] check_SCRIPTS
+
+Scripts can be installed in @code{bindir}, @code{sbindir},
[EMAIL PROTECTED], or @code{pkgdatadir}.
+
+Scripts that need not being installed can be listed in
[EMAIL PROTECTED], and among them, those which are needed only by
[EMAIL PROTECTED] check} should go in @code{check_SCRIPTS}.
 
-The @command{automake} program itself is a Perl script that is generated
-from @file{automake.in}.  Here is how this is handled:
+When a script needs to be built, the @file{Makefile.am} should include
+the appropriate rules.  For instance the @command{automake} program
+itself is a Perl script that is generated from @file{automake.in}.
+Here is how this is handled:
 
 @example
 bin_SCRIPTS = automake
 CLEANFILES = $(bin_SCRIPTS)
+EXTRA_DIST = automake.in
 
 do_subst = sed -e 's,[@@]datadir[@@],$(datadir),g' \
 -e 's,[@@]PERL[@@],$(PERL),g' \
@@ -5326,34 +5351,38 @@
 chmod +x automake
 @end example
 
-Because---as we have just seen---scripts can be built, they are not
-distributed by default.  Scripts that should be distributed can be
-specified using a @code{dist_} prefix as in other primaries.  For
-instance, the following @file{Makefile.am} declares that
[EMAIL PROTECTED] should be distributed and installed in
[EMAIL PROTECTED](sbindir)}.
+Such scripts for which a build rule has been supplied need to be
+deleted explicitly using @code{CLEANFILES} (@pxref{Clean}), and their
+sources have to be distributed, usually with @code{EXTRA_DIST}
+(@pxref{Dist}).
 
[EMAIL PROTECTED]
-dist_sbin_SCRIPTS = my_script
[EMAIL PROTECTED] example
+Another common way to build scripts is to process them from
[EMAIL PROTECTED] with @code{AC_CONFIG_FILES}.  In this situation
+Automake knows which files should be cleaned and distributed, and what
+the rebuild rules should look like.
 
[EMAIL PROTECTED] @code{SCRIPTS}, installation directories
[EMAIL PROTECTED] Installing scripts
+For instance if @file{configure.ac} contains
 
[EMAIL PROTECTED] bin_SCRIPTS
[EMAIL PROTECTED] sbin_SCRIPTS
[EMAIL PROTECTED] libexec_SCRIPTS
[EMAIL PROTECTED] pkgdata_SCRIPTS
[EMAIL PROTECTED] noinst_SCRIPTS
[EMAIL PROTECTED] check_SCRIPTS
[EMAIL PROTECTED]
+AC_CONFIG_FILES([src/my_script])
[EMAIL PROTECTED] example
 
-Script objects can be installed in @code{bindir}, @code{sbindir},
[EMAIL PROTECTED], or @code{pkgdatadir}.
[EMAIL PROTECTED]
+to build @file{src/my_script} from @file{src/my_script}, then an
[EMAIL PROTECTED]/Makefile.am} to install this script in @code{$(bindir)} can
+be as simple as
 
-Scripts that need not being installed can be listed in
[EMAIL PROTECTED], and among them, those which are needed only by
[EMAIL PROTECTED] check} should go in @code{check_SCRIPTS}.
[EMAIL PROTECTED]
+bin_SCRIPTS = my_script
[EMAIL PROTECTED] example
 
[EMAIL PROTECTED]
+There is no need for @code{EXTRA_DIST}, @code{CLEANFILES}, or any
+build rule: Automake infers them from @code{AC_CONFIG_FILES}
+(@pxref{Requirements}).  This looks simpler, however building scripts
+this way has one drawback: directory variables such as
[EMAIL PROTECTED](datadir)} are not fully expanded and may refer to other
+directory variables.
 
 @node Headers
 @section Header 

Re: FYI: _SCRIPTS doc retake

2006-08-04 Thread Alexandre Duret-Lutz
too fast

2006-08-04  Alexandre Duret-Lutz  [EMAIL PROTECTED]

* doc/automake.texi (Scripts): Fix some errors in previous patch.

Index: doc/automake.texi
===
RCS file: /cvs/automake/automake/doc/automake.texi,v
retrieving revision 1.139
diff -u -r1.139 automake.texi
--- doc/automake.texi   4 Aug 2006 16:14:40 -   1.139
+++ doc/automake.texi   4 Aug 2006 16:27:29 -
@@ -5364,25 +5364,29 @@
 For instance if @file{configure.ac} contains
 
 @example
-AC_CONFIG_FILES([src/my_script])
+AC_CONFIG_FILES([src/my_script], [chmod +x src/my_script])
 @end example
 
 @noindent
-to build @file{src/my_script} from @file{src/my_script}, then an
+to build @file{src/my_script} from @file{src/my_script.in}, then an
 @file{src/Makefile.am} to install this script in @code{$(bindir)} can
 be as simple as
 
 @example
 bin_SCRIPTS = my_script
+CLEANFILES = $(bin_SCRIPTS)
 @end example
 
 @noindent
-There is no need for @code{EXTRA_DIST}, @code{CLEANFILES}, or any
-build rule: Automake infers them from @code{AC_CONFIG_FILES}
-(@pxref{Requirements}).  This looks simpler, however building scripts
-this way has one drawback: directory variables such as
[EMAIL PROTECTED](datadir)} are not fully expanded and may refer to other
-directory variables.
+There is no need for @code{EXTRA_DIST} or any build rule: Automake
+infers them from @code{AC_CONFIG_FILES} (@pxref{Requirements}).
[EMAIL PROTECTED] is still useful, because by default Automake will
+clean targets of @code{AC_CONFIG_FILES} in @code{distclean}, not
[EMAIL PROTECTED]
+
+Although this looks simpler, building scripts this way has one
+drawback: directory variables such as @code{$(datadir)} are not fully
+expanded and may refer to other directory variables.
 
 @node Headers
 @section Header files

-- 
Alexandre Duret-Lutz

Shared books are happy books. http://www.bookcrossing.com/friend/gadl





Re: need to install (but not build or distribute) something to the bin directory...

2006-08-04 Thread Stepan Kasal
Hello,

On Wed, Aug 02, 2006 at 07:30:47PM -0600, Ed Hartnett wrote:
 [...] gcc to produce an extra output file, called libnetcdf.def.
...
 So how do I tell automake that there is a file I would like installed,
 but not specially built nor included in the distribution?
 
 I'm sure there is something very easy I am missing here...

my wild guess is that you need

bin_DATA = libnetcdf.def

Or you can use nodist_bin_DATA, if it makes it more readable for you.
(*_DATA are not distributed by default.)

You might face complaints that there is no rule for the file; in that
case, write one:

libnetcdf.def: libnetcdf.dll
@:

HTH,
Stepan




Re: Disable implicit RCS rule of GNU Make

2006-08-04 Thread Alexandre Duret-Lutz
 RH == Robert Homann [EMAIL PROTECTED] writes:

 RH Hello list!
 RH We have a problem here with GNU Make's built-in rules that I can't seem to
 RH be able to solve. Short version of my question: How can the implicit rule
 RH for RCS defined in GNU Make be disabled in a portable way (Automake 1.9.6,
 RH Autoconf 2.59)? Using GNU Make syntax, this can be done using

 RH % : RCS/%,v
 RH % : %,v

Alway typing make -r, is probably inconvenient.

A portable way to use some GNU Make syntax is to add a
GNUmakefile near your Makefile{,.in,.am}.  This GNUmakefile
would look as follows :
  
include Makefile
% : RCS/%,v
% : %,v

This way GNU Make will uses these rules in addition to the
ordinary Makefile.  But Automake and other Make implementation
never see them.

[...]

 RH CO = \#

BTW, escaping # is not portable.  Here setting 
  CO = :
would be safer.
-- 
Alexandre Duret-Lutz

Shared books are happy books. http://www.bookcrossing.com/friend/gadl





Re: race condition gnulib-tool's mostlyclean-local rule

2006-08-04 Thread Ralf Wildenhues
Hello Jim,

* Jim Meyering wrote on Fri, Aug 04, 2006 at 04:35:30PM CEST:
 
 mostlyclean-local:
   @test -z $(MOSTLYCLEANDIRS) ||\
 for dir in $(MOSTLYCLEANDIRS); do \
   if test -d $$dir; then  \
 echo rmdir $$dir; rmdir $$dir;  \
   fi; \
   done
 
 It works fine when Make rules are run in sequence.
 But I always run make in parallel, e.g., with -j3.
 That causes the rmdir to fail if not all MOSTLYCLEANFILES
 have been removed when the above rmdir runs.

 The problem would be solved if automake were to emit this instead:
 
 mostlyclean-am: mostlyclean-compile mostlyclean-generic
   $(MAKE) mostlyclean-local

IMVHO it's ugly (and resource-wasting) to have a $(MAKE) reinvocation
to paper over limitations in the extensibility of Automake-generated
Makefiles; the right fix would be to add dependency information
  mostlyclean-local: mostlyclean-compile mostlyclean-generic

in this case, except that the latter two targets are not published.

I suggest that for most *-local targets it supports (i.e., where it
makes sense), Automake add a set of hooks
  *-local-before
  *-local-after

for which, if defined in Makefile.am, appropriate such dependency rules
are added.  For example, Automake would generate:

  clean-am: clean-local-before clean-generic clean-whatnotelse ... \
clean-local clean-even-more ... clean-local-after
# ...

  clean-generic clean-whatnotelse ... clean-even-more ...: \
clean-local-before

  clean-local-after: clean-local-before clean-generic \
clean-whatnotelse ... clean-local clean-even-more

This is just a suggestion and comes without a patch, as I clearly
haven't thought through whether this is indeed feasible or simple
to do within Automake, but I believe it would help in a number of
similar situations.  Comments appreciated (including go for it).

Cheers,
Ralf




Re: [bug-gnulib] race condition gnulib-tool's mostlyclean-local rule

2006-08-04 Thread Bruno Haible
Ralf Wildenhues wrote:
 the right fix would be to add dependency information
   mostlyclean-local: mostlyclean-compile mostlyclean-generic

Depending on mostlyclean-compile is not needed, and this rule removes
only files in the current directory. I added this fix to gnulib-tool:


2006-08-04  Bruno Haible  [EMAIL PROTECTED]

* gnulib-tool (func_emit_lib_Makefile_am, func_emit_tests_Makefile_am):
Make the mostlyclean-local rule depend on mostlyclean-generic.
Reported by Jim Meyering. Solution suggested by Ralf Wildenhues.

*** gnulib-tool 31 Jul 2006 11:37:23 -  1.131
--- gnulib-tool 4 Aug 2006 16:03:57 -
***
*** 932,938 
  fi
done
echo
!   echo mostlyclean-local:
echo   @test -z \\$(MOSTLYCLEANDIRS)\ || \\
echo for dir in \$(MOSTLYCLEANDIRS); do \\
echo   if test -d \$\$dir; then \\
--- 932,938 
  fi
done
echo
!   echo mostlyclean-local: mostlyclean-generic
echo   @test -z \\$(MOSTLYCLEANDIRS)\ || \\
echo for dir in \$(MOSTLYCLEANDIRS); do \\
echo   if test -d \$\$dir; then \\
***
*** 1012,1018 
echo clean-local:
echo   rm -rf SunWS_cache
echo
!   echo mostlyclean-local:
echo   @test -z \\$(MOSTLYCLEANDIRS)\ || \\
echo for dir in \$(MOSTLYCLEANDIRS); do \\
echo   if test -d \$\$dir; then \\
--- 1012,1018 
echo clean-local:
echo   rm -rf SunWS_cache
echo
!   echo mostlyclean-local: mostlyclean-generic
echo   @test -z \\$(MOSTLYCLEANDIRS)\ || \\
echo for dir in \$(MOSTLYCLEANDIRS); do \\
echo   if test -d \$\$dir; then \\




race condition gnulib-tool's mostlyclean-local rule

2006-08-04 Thread Jim Meyering
For some modules (e.g., sys_stat), gnulib-tool generates
a mostlyclean-local rule like this:

mostlyclean-local:
@test -z $(MOSTLYCLEANDIRS) ||\
  for dir in $(MOSTLYCLEANDIRS); do \
if test -d $$dir; then  \
  echo rmdir $$dir; rmdir $$dir;  \
fi; \
done

It works fine when Make rules are run in sequence.
But I always run make in parallel, e.g., with -j3.
That causes the rmdir to fail if not all MOSTLYCLEANFILES
have been removed when the above rmdir runs.  But if you look
right afterwards, you find that it is indeed empty.
FYI, this triggered a failure in coreutils make distcheck
with some changes I'm working on.

One way to fix it is by changing automake to generate
a slightly different rule.  Currently it emits this:

mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-local

The problem would be solved if automake were to emit this instead:

mostlyclean-am: mostlyclean-compile mostlyclean-generic
$(MAKE) mostlyclean-local

While I wait for an official automake fix, I'm using the more
aggressive -- i.e., slightly risky -- rule in my Makefile.am:

mostlyclean-local:
@test -z $(MOSTLYCLEANDIRS) || rm -rf $(MOSTLYCLEANDIRS)




Re: race condition gnulib-tool's mostlyclean-local rule

2006-08-04 Thread Jim Meyering
Ralf Wildenhues [EMAIL PROTECTED] wrote:
...
 IMVHO it's ugly (and resource-wasting) to have a $(MAKE) reinvocation
 to paper over limitations in the extensibility of Automake-generated
 Makefiles; the right fix would be to add dependency information
   mostlyclean-local: mostlyclean-compile mostlyclean-generic

 in this case, except that the latter two targets are not published.

 I suggest that for most *-local targets it supports (i.e., where it
 makes sense), Automake add a set of hooks
   *-local-before
   *-local-after

Hi Ralf,

I prefer that approach, too.
Go for it! :)