automake-patches
[Top][All Lists]
Advanced

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

Patch: FYI: PR 215 fix


From: Tom Tromey
Subject: Patch: FYI: PR 215 fix
Date: 30 Dec 2001 17:26:57 -0700

I'm checking this in.
We've long wanted a way to specify options at the top-level.
For a while I had planned to change the meaning of the 3rd argument to
AM_INIT_AUTOMAKE.  Unfortunately that would not be backwards
compatible.  So I've elected for a new macro instead.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>
        For PR automake/215:
        * configure.in: Use AM_AUTOMAKE_OPTIONS.
        * Makefile.am (AUTOMAKE_OPTIONS): Removed.
        * automake.texi (Macros): Document AM_AUTOMAKE_OPTIONS.
        (Options): Mention AM_AUTOMAKE_OPTIONS.
        * automake.in (global_options): New global.
        (global_options_line): Likewise.
        (scan_autoconf_traces): Trace AM_AUTOMAKE_OPTIONS.
        (scan_one_autoconf_file): Likewise.
        (process_option_list): New function.
        (handle_options): Use it.  Also, handle global options.
        * m4/Makefile.am (m4data_DATA): Added options.m4.
        * m4/options.m4: New file.

Index: Makefile.am
===================================================================
RCS file: /cvs/automake/automake/Makefile.am,v
retrieving revision 1.178
diff -u -r1.178 Makefile.am
--- Makefile.am 2001/10/28 14:01:40 1.178
+++ Makefile.am 2001/12/31 00:14:45
@@ -19,8 +19,6 @@
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
 
-AUTOMAKE_OPTIONS = 1.4 dist-bzip2
-
 ## We need `.' in SUBDIRS because we want `check' to build `.' before
 ## tests.
 SUBDIRS = . m4 lib tests
Index: Makefile.in
===================================================================
RCS file: /cvs/automake/automake/Makefile.in,v
retrieving revision 1.343
diff -u -r1.343 Makefile.in
--- Makefile.in 2001/12/26 08:22:05 1.343
+++ Makefile.in 2001/12/31 00:14:45
@@ -73,8 +73,6 @@
 am__quote = @am__quote@
 install_sh = @install_sh@
 
-AUTOMAKE_OPTIONS = 1.4 dist-bzip2
-
 SUBDIRS = . m4 lib tests
 
 bin_SCRIPTS = automake aclocal
@@ -350,7 +348,7 @@
          && rm -fr $(distdir); }; }
 
 GZIP_ENV = --best
-distcleancheck_listfiles = "find . -type f -print"
+distcleancheck_listfiles = find . -type f -print
 
 distdir: $(DISTFILES)
        $(am__remove_distdir)
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.163
diff -u -r1.163 NEWS
--- NEWS 2001/12/14 16:25:37 1.163
+++ NEWS 2001/12/31 00:14:45
@@ -19,6 +19,7 @@
 * Fixed handling of nobase_ targets.
 * Fixed support of implicit rules leading to .lo objects.
 * Fixed late inclusion of --add-missing files (e.g. depcomp) in DIST_COMMON
+* Added new AM_AUTOMAKE_OPTIONS macro
 
 New in 1.5:
 * Support for `configure.ac'.
Index: aclocal.m4
===================================================================
RCS file: /cvs/automake/automake/aclocal.m4,v
retrieving revision 1.69
diff -u -r1.69 aclocal.m4
--- aclocal.m4 2001/12/26 08:22:05 1.69
+++ aclocal.m4 2001/12/31 00:14:46
@@ -1,4 +1,4 @@
-# aclocal.m4 generated automatically by aclocal 1.5b -*- Autoconf -*-
+# aclocal.m4 generated automatically by aclocal 1.5c -*- Autoconf -*-
 
 # Copyright 1996, 1997, 1998, 1999, 2000, 2001
 # Free Software Foundation, Inc.
@@ -494,11 +494,13 @@
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 [for mf in $CONFIG_FILES; do
-  case $mf in
-  Makefile) dirpart=.;;
-  */Makefile) dirpart=`AS_DIRNAME("$mf")`;;
-  *) continue;;
-  esac
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  if (head -1 $mf | fgrep 'generated by automake') > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    dirpart=
+  fi
   grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
   # Extract the definition of DEP_FILES from the Makefile without
   # running `make'.
@@ -642,7 +644,40 @@
 else
   $1_TRUE='#'
   $1_FALSE=
-fi])
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([conditional \"$1\" was never defined.
+Usually this means the macro was only invoked conditionally.])
+fi])])
+
+# Do all the work for Automake.                            -*- Autoconf -*-
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+# AM_AUTOMAKE_OPTIONS([OPTIONS])
+# ------------------------------
+# Set some automake options globally.
+AC_DEFUN([AM_AUTOMAKE_OPTIONS],
+[dnl nothing
+])
 
 # Copyright 2001 Free Software Foundation, Inc.             -*- Autoconf -*-
 
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1248
diff -u -r1.1248 automake.in
--- automake.in 2001/12/30 23:46:26 1.1248
+++ automake.in 2001/12/31 00:14:52
@@ -448,6 +448,12 @@
 # depcomp is added after the toplevel Makefile.in -- which
 # should distribute depcomp -- has been generated.)
 my $automake_needs_to_reprocess_all_files = 0;
+
+# Options set via AM_AUTOMAKE_OPTIONS.
+my $global_options = '';
+# Line number for AM_AUTOMAKE_OPTIONS.
+my $global_options_line;
+
 
 
 ################################################################
@@ -1390,57 +1396,87 @@
     return 0;
 }
 
-# Handle AUTOMAKE_OPTIONS variable.  Return 1 on error, 0 otherwise.
-sub handle_options
+# $BOOL
+# process_option_list ($CONFIG, @OPTIONS)
+# ------------------------------
+# Process a list of options.  Return 1 on error, 0 otherwise.
+# This is a helper for handle_options.  CONFIG is true if we're
+# handling global options.
+sub process_option_list
 {
-    if (variable_defined ('AUTOMAKE_OPTIONS'))
+    my ($config, @list) = @_;
+    foreach (@list)
     {
-       foreach (&variable_value_as_list_recursive ('AUTOMAKE_OPTIONS', ''))
+       $options{$_} = 1;
+       if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign')
        {
-           $options{$_} = 1;
-           if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign')
-           {
-               &set_strictness ($_);
-           }
-           elsif ($_ eq 'cygnus')
-           {
-               $cygnus_mode = 1;
-           }
-           elsif (/^(.*\/)?ansi2knr$/)
-           {
-               # An option like "../lib/ansi2knr" is allowed.  With
-               # no path prefix, we assume the required programs are
-               # in this directory.  We save the actual option for
-               # later.
-               $options{'ansi2knr'} = $_;
-           }
-           elsif ($_ eq 'no-installman' || $_ eq 'no-installinfo'
-                  || $_ eq 'dist-shar' || $_ eq 'dist-zip'
-                  || $_ eq 'dist-tarZ' || $_ eq 'dist-bzip2'
-                  || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex'
-                  || $_ eq 'readme-alpha' || $_ eq 'check-news'
-                  || $_ eq 'subdir-objects' || $_ eq 'nostdinc'
-                  || $_ eq 'no-exeext')
-           {
-               # Explicitly recognize these.
-           }
-           elsif ($_ eq 'no-dependencies')
+           &set_strictness ($_);
+       }
+       elsif ($_ eq 'cygnus')
+       {
+           $cygnus_mode = 1;
+       }
+       elsif (/^(.*\/)?ansi2knr$/)
+       {
+           # An option like "../lib/ansi2knr" is allowed.  With no
+           # path prefix, we assume the required programs are in this
+           # directory.  We save the actual option for later.
+           $options{'ansi2knr'} = $_;
+       }
+       elsif ($_ eq 'no-installman' || $_ eq 'no-installinfo'
+              || $_ eq 'dist-shar' || $_ eq 'dist-zip'
+              || $_ eq 'dist-tarZ' || $_ eq 'dist-bzip2'
+              || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex'
+              || $_ eq 'readme-alpha' || $_ eq 'check-news'
+              || $_ eq 'subdir-objects' || $_ eq 'nostdinc'
+              || $_ eq 'no-exeext')
+       {
+           # Explicitly recognize these.
+       }
+       elsif ($_ eq 'no-dependencies')
+       {
+           $use_dependencies = 0;
+       }
+       elsif (/(\d+)\.(\d+)([a-z]?)(-[A-Za-z0-9]+)?/)
+       {
+           # Got a version number.
+           if (version_check ($1, $2, $3, $4))
            {
-               $use_dependencies = 0;
+               return 1;
            }
-           elsif (/(\d+)\.(\d+)([a-z]?)(-[A-Za-z0-9]+)?/)
+       }
+       else
+       {
+           if ($config)
            {
-               # Got a version number.
-               if (version_check ($1, $2, $3, $4))
-               {
-                   return 1;
-               }
+               file_error ($global_options_line,
+                           "option `" . $_ . "\' not recognized");
            }
            else
            {
                macro_error ('AUTOMAKE_OPTIONS',
                             "option `" . $_ . "\' not recognized");
            }
+           return 1;
+       }
+    }
+}
+
+# Handle AUTOMAKE_OPTIONS variable.  Return 1 on error, 0 otherwise.
+sub handle_options
+{
+    # Process global options first so that more specific options can
+    # override.
+    if (&process_option_list (1, split (' ', $global_options)))
+    {
+       return 1;
+    }
+
+    if (variable_defined ('AUTOMAKE_OPTIONS'))
+    {
+       if (&process_option_list (0, &variable_value_as_list_recursive 
('AUTOMAKE_OPTIONS', '')))
+       {
+           return 1;
        }
     }
 
@@ -4436,6 +4472,7 @@
                  AM_C_PROTOTYPES
                  AM_GNU_GETTEXT
                  AM_INIT_AUTOMAKE
+                 AM_AUTOMAKE_OPTIONS
                  AM_MAINTAINER_MODE
                  AM_PATH_LISPDIR
                  AM_PATH_PYTHON
@@ -4525,6 +4562,11 @@
          $package_version_location = $here;
          $seen_init_automake = 1;
        }
+      elsif ($macro eq 'AM_AUTOMAKE_OPTIONS')
+        {
+         $global_options = $args[1];
+         $global_options_line = $here;
+       }
       elsif ($macro eq 'AM_MAINTAINER_MODE')
        {
          $seen_maint_mode = $here;
@@ -4759,6 +4801,12 @@
            ($package_version = $1) =~ s/$AM_PACKAGE_VERSION_PATTERN/$1/o;
            $package_version_location = $here;
            $seen_init_automake = $here;
+       }
+
+       if (/AM_AUTOMAKE_OPTIONS\(([^)]+)\)/)
+       {
+            $global_options = &unquote_m4_arg ($1);
+            $global_options_line = $here;
        }
 
        if (/AM_PROG_LEX/)
Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.253
diff -u -r1.253 automake.texi
--- automake.texi 2001/12/30 23:46:26 1.253
+++ automake.texi 2001/12/31 00:14:57
@@ -1329,6 +1329,11 @@
 @c consider generating this node automatically from m4 files.
 
 @table @code
address@hidden AM_AUTOMAKE_OPTIONS
+This takes a single argument which is a list of options which should be
+applied to every @file{Makefile.am} in the tree.  The effect is as if
+each option were listed in @code{AUTOMAKE_OPTIONS}.
+
 @item AM_CONFIG_HEADER
 Automake will generate rules to automatically regenerate the config
 header.
@@ -3972,6 +3977,10 @@
 @end table
 
 Unrecognized options are diagnosed by @code{automake}.
+
+If you want an option to apply to all the files in the tree, you can use
+the @code{AM_AUTOMAKE_OPTIONS} macro in @file{configure.in}.
address@hidden
 
 
 @node Miscellaneous, Include, Options, Top
Index: configure.in
===================================================================
RCS file: /cvs/automake/automake/configure.in,v
retrieving revision 1.93
diff -u -r1.93 configure.in
--- configure.in 2001/12/26 08:22:05 1.93
+++ configure.in 2001/12/31 00:14:59
@@ -25,6 +25,7 @@
 AC_CONFIG_AUX_DIR(lib)
 
 AM_INIT_AUTOMAKE(automake, 1.5c)
+AM_AUTOMAKE_OPTIONS([1.5 dist-bzip2])
 
 ACLOCAL="`pwd`/aclocal --acdir=m4"
 # $AUTOMAKE is always run after a `cd $top_srcdir', hence `.' is really
Index: m4/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/m4/Makefile.am,v
retrieving revision 1.38
diff -u -r1.38 Makefile.am
--- m4/Makefile.am 2001/12/12 11:11:39 1.38
+++ m4/Makefile.am 2001/12/31 00:14:59
@@ -22,9 +22,9 @@
 m4datadir = $(datadir)/aclocal
 
 m4data_DATA = as.m4 auxdir.m4 ccstdc.m4 cond.m4 depend.m4 depout.m4 \
-dmalloc.m4 gcj.m4 header.m4 init.m4 install-sh.m4 lex.m4 \
-lispdir.m4 make.m4 maintainer.m4 minuso.m4 missing.m4 multi.m4 \
-protos.m4 python.m4 regex.m4 runlog.m4 sanity.m4 strip.m4 \
-termios.m4 winsz.m4
+dmalloc.m4 gcj.m4 header.m4 init.m4 install-sh.m4 lex.m4 lispdir.m4 \
+make.m4 maintainer.m4 minuso.m4 missing.m4 multi.m4 options.m4 \
+protos.m4 python.m4 regex.m4 runlog.m4 sanity.m4 strip.m4 termios.m4 \
+winsz.m4
 
 EXTRA_DIST = $(m4data_DATA)
Index: m4/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/m4/Makefile.in,v
retrieving revision 1.166
diff -u -r1.166 Makefile.in
--- m4/Makefile.in 2001/12/14 16:32:13 1.166
+++ m4/Makefile.in 2001/12/31 00:15:00
@@ -76,10 +76,10 @@
 m4datadir = $(datadir)/aclocal
 
 m4data_DATA = as.m4 auxdir.m4 ccstdc.m4 cond.m4 depend.m4 depout.m4 \
-dmalloc.m4 gcj.m4 header.m4 init.m4 install-sh.m4 lex.m4 \
-lispdir.m4 make.m4 maintainer.m4 minuso.m4 missing.m4 multi.m4 \
-protos.m4 python.m4 regex.m4 runlog.m4 sanity.m4 strip.m4 \
-termios.m4 winsz.m4
+dmalloc.m4 gcj.m4 header.m4 init.m4 install-sh.m4 lex.m4 lispdir.m4 \
+make.m4 maintainer.m4 minuso.m4 missing.m4 multi.m4 options.m4 \
+protos.m4 python.m4 regex.m4 runlog.m4 sanity.m4 strip.m4 termios.m4 \
+winsz.m4
 
 
 EXTRA_DIST = $(m4data_DATA)
Index: m4/options.m4
===================================================================
RCS file: options.m4
diff -N options.m4
--- /dev/null   Tue May  5 13:32:27 1998
+++ m4/options.m4 Sun Dec 30 16:15:00 2001
@@ -0,0 +1,27 @@
+# Do all the work for Automake.                            -*- Autoconf -*-
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+# AM_AUTOMAKE_OPTIONS([OPTIONS])
+# ------------------------------
+# Set some automake options globally.
+AC_DEFUN([AM_AUTOMAKE_OPTIONS],
+[dnl nothing
+])



reply via email to

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