automake-patches
[Top][All Lists]
Advanced

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

Automake::Config


From: Alexandre Duret-Lutz
Subject: Automake::Config
Date: Tue, 05 Aug 2003 22:11:42 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

I'm (slowly) working on getting the %target_* machinery in its
own packages, Automake::Rule/Automake::RuleDef, like
Automake::Variable/Automake::VarDef.  (both share a few
functions via Automake::Item/Automake::ItemDef base classes,
suggestion for better names are welcome).

Doing this, I've discovered that the current implementation of
&rule_define (which should become Automake::Rule::define) checks
for $options{'no-exeext'}.  Ooops, %options need to be available
to packages.

In second tree I'm therefore working on getting all the %options
machinery in its own Automake::Options package.  This includes
functions such as process_option_list.  However
process_option_list uses the $VERSION variable, which is only
defined in automake.in.  Ooops 2.

In the future we'll have similar issues with other AC_SUBST'ed
variables that we want to access from packages.

So here we are.  This patch introduces a config.h equivalent:
Automake::Config, so that these variables are substituted in one
accessible place.

2003-08-05  Alexandre Duret-Lutz  <address@hidden>

        * lib/Automake/Config.in: New file.
        * lib/Automake/Makefile.am (nodist_perllib_DATA, do_subst): New
        variables.
        (Config.pm): New rule.
        * Makefile.am (maintainer-check): Adjust expected differences
        between automake.in and automake.
        (lib/Automake/Config.pm): New rule.
        (aclocal, automake): Depend on lib/Automake/Config.pm.
        * aclocal.in, automake.in: Use Automake::Config.

Index: Makefile.am
===================================================================
RCS file: /cvs/automake/automake/Makefile.am,v
retrieving revision 1.216
diff -u -r1.216 Makefile.am
--- Makefile.am 29 Jul 2003 20:32:31 -0000      1.216
+++ Makefile.am 5 Aug 2003 19:56:25 -0000
@@ -71,14 +71,18 @@
            -e 's,address@hidden@],$(APIVERSION),g' \
            -e 's,address@hidden@],$(SHELL),g'
 
-automake: automake.in Makefile
+automake: automake.in Makefile lib/Automake/Config.pm
        $(do_subst) < $(srcdir)/automake.in > automake
        chmod +x automake
 
-aclocal: aclocal.in Makefile
+aclocal: aclocal.in Makefile lib/Automake/Config.pm
        $(do_subst) < $(srcdir)/aclocal.in > aclocal
        chmod +x aclocal
 
+lib/Automake/Config.pm: lib/Automake/Config.in
+       $(do_subst) <$(srcdir)/lib/Automake/Config.in >$@
+
+
 ## The master location for INSTALL is lib/INSTALL.
 ## This is where `make fetch' will install new versions.
 ## Make sure we also update this copy.
@@ -97,7 +101,7 @@
 ## This check avoids accidental configure substitutions in the source.
 ## There are exactly 8 lines that should be modified.  This works out
 ## to 28 lines of diffs.
-       @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 28; then \
+       @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 20; then \
          echo "found too many diffs between automake.in and automake"; 1>&2; \
          diff -c $(srcdir)/automake.in automake; \
          exit 1; \
Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.82
diff -u -r1.82 aclocal.in
--- aclocal.in  9 Jul 2003 22:09:27 -0000       1.82
+++ aclocal.in  5 Aug 2003 19:56:26 -0000
@@ -33,16 +33,13 @@
   unshift @INC, $perllibdir;
 }
 
+use Automake::Config;
 use Automake::General;
 use Automake::Configure_ac;
 use Automake::XFile;
 use Automake::FileUtils;
 use File::stat;
 
-# Some constants.
-$VERSION = '@VERSION@';
-$APIVERSION = '@APIVERSION@';
-$PACKAGE = '@PACKAGE@';
 # Note that this isn't pkgdatadir, but a separate directory.
 # Note also that the versioned directory is handled later.
 $acdir = '@datadir@/aclocal';
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1493
diff -u -r1.1493 automake.in
--- automake.in 5 Aug 2003 09:25:16 -0000       1.1493
+++ automake.in 5 Aug 2003 19:56:29 -0000
@@ -121,6 +121,7 @@
 package Automake;
 
 use strict;
+use Automake::Config;
 use Automake::General;
 use Automake::XFile;
 use Automake::Channels;
@@ -141,12 +142,6 @@
 ## ----------- ##
 ## Constants.  ##
 ## ----------- ##
-
-# Parameters set by configure.  Not to be changed.  NOTE: assign
-# VERSION as string so that e.g. version 0.30 will print correctly.
-my $VERSION = '@VERSION@';
-my $PACKAGE = '@PACKAGE@';
-my $libdir = '@datadir@/@address@hidden@APIVERSION@';
 
 # Some regular expressions.  One reason to put them here is that it
 # makes indentation work better in Emacs.
Index: bootstrap
===================================================================
RCS file: /cvs/automake/automake/bootstrap,v
retrieving revision 1.11
diff -u -r1.11 bootstrap
--- bootstrap   2 Jun 2003 21:59:14 -0000       1.11
+++ bootstrap   5 Aug 2003 19:56:29 -0000
@@ -90,28 +90,28 @@
 mkdir automake-$APIVERSION
 cp -rf lib/* automake-$APIVERSION
 
+dosubst ()
+{
+  sed -e "address@hidden@%$PERL%g" \
+      -e "address@hidden@%$VERSION%g" \
+      -e "address@hidden@%$APIVERSION%g" \
+      -e "address@hidden@%$PACKAGE%g" \
+      -e "address@hidden@%$datadir%g" \
+      -e "address@hidden@%$BOOTSTRAP_SHELL%g" $1 > $2
+}
+
+
+# Create temporary replacement for lib/Automake/Config.pm
+dosubst lib/Automake/Config.in lib/Automake/Config.pm
+
 # Create temporary replacement for aclocal
-sed -e "address@hidden@%$PERL%g" \
-    -e "address@hidden@%$VERSION%g" \
-    -e "address@hidden@%$APIVERSION%g" \
-    -e "address@hidden@%$PACKAGE%g" \
-    -e "address@hidden@%$datadir%g" \
-    -e "address@hidden@%$BOOTSTRAP_SHELL%g" \
-    aclocal.in >aclocal.tmp
+dosubst aclocal.in aclocal.tmp
 
 # Overwrite amversion.m4
-sed -e "address@hidden@%$VERSION%g" \
-    -e "address@hidden@%$APIVERSION%g" \
-    m4/amversion.in >m4/amversion.m4
+dosubst m4/amversion.in m4/amversion.m4
 
 # Create temporary replacement for automake
-sed -e "address@hidden@%$PERL%g" \
-    -e "address@hidden@%$VERSION%g" \
-    -e "address@hidden@%$APIVERSION%g" \
-    -e "address@hidden@%$PACKAGE%g" \
-    -e "address@hidden@%$datadir%g" \
-    -e "address@hidden@%$BOOTSTRAP_SHELL%g" \
-    automake.in >automake.tmp
+dosubst automake.in automake.tmp
 
 # Run the autotools.
 $PERL ./aclocal.tmp -I m4
@@ -121,3 +121,4 @@
 # Remove temporary files and directories
 rm -rf aclocal-$APIVERSION automake-$APIVERSION
 rm -f aclocal.tmp automake.tmp
+rm -f lib/Automake/Config.pm
Index: lib/Automake/Config.in
===================================================================
RCS file: lib/Automake/Config.in
diff -N lib/Automake/Config.in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lib/Automake/Config.in      5 Aug 2003 19:56:31 -0000
@@ -0,0 +1,52 @@
+# Copyright (C) 2003  Free Software Foundation, Inc.      -*- Perl -*-
+
+# 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.
+
+package Automake::Config;
+use strict;
+
+use vars qw (@ISA @EXPORT);
+
address@hidden = qw (Exporter);
address@hidden = qw ($APIVERSION $PACKAGE $VERSION $libdir);
+
+use vars qw ($APIVERSION $PACKAGE $VERSION $libdir);
+
+# Parameters set by configure.  Not to be changed.  NOTE: assign
+# VERSION as string so that e.g. version 0.30 will print correctly.
+$APIVERSION = '@APIVERSION@';
+$PACKAGE = '@PACKAGE@';
+$VERSION = '@VERSION@';
+$libdir = '@datadir@/@address@hidden@APIVERSION@';
+
+1;;
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
Index: lib/Automake/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/Makefile.am,v
retrieving revision 1.15
diff -u -r1.15 Makefile.am
--- lib/Automake/Makefile.am    9 Jul 2003 22:09:28 -0000       1.15
+++ lib/Automake/Makefile.am    5 Aug 2003 19:56:31 -0000
@@ -35,3 +35,19 @@
   Version.pm \
   XFile.pm \
   Wrap.pm
+
+nodist_perllib_DATA = \
+  Config.pm
+
+## We can't use configure to do the substitution here; we must do it
+## by hand.  We use a funny notation here to avoid configure
+## substitutions in our text.
+do_subst = sed -e 's,address@hidden@],$(datadir),g' -e 
's,address@hidden@],$(PERL),g' \
+           -e 's,address@hidden@],@configure_input@,g' \
+           -e 's,address@hidden@],$(PACKAGE),g' \
+           -e 's,address@hidden@],$(VERSION),g' \
+           -e 's,address@hidden@],$(APIVERSION),g' \
+           -e 's,address@hidden@],$(SHELL),g'
+
+Config.pm: Config.in
+       $(do_subst) <$(srcdir)/Config.in >$@
-- 
Alexandre Duret-Lutz





reply via email to

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