From dda80c75274a57dbbb71b16ad51cc0716741da4a Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Fri, 11 Sep 2020 09:37:50 -0400 Subject: attempt to sync ChannelDefs.pm *and* Config.pm from automake needs changes to how wrapper.as works, postponed --- Makefile.am | 4 ++++ build-aux/fetch.sh | 6 +++++- lib/Autom4te/ChannelDefs.pm | 16 +++++++++++---- lib/Autom4te/Config.in | 47 +++++++++++++++++++++++++++++++++++++++++++++ lib/local.mk | 21 ++++++++++++++++---- 5 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 lib/Autom4te/Config.in diff --git a/Makefile.am b/Makefile.am index ecc9cb35..45760ac2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,6 +42,7 @@ edit = sed \ -e 's|@PERL[@]|$(PERL)|g' \ -e 's|@PERL_FLOCK[@]|$(PERL_FLOCK)|g' \ -e 's|@bindir[@]|$(bindir)|g' \ + -e 's|@datadir[@]|$(datadir)|g' \ -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \ -e 's|@prefix[@]|$(prefix)|g' \ -e 's|@autoconf-name[@]|'`echo autoconf | sed '$(transform)'`'|g' \ @@ -53,7 +54,10 @@ edit = sed \ -e 's|@AWK[@]|$(AWK)|g' \ -e 's|@RELEASE_YEAR[@]|$(RELEASE_YEAR)|g' \ -e 's|@VERSION[@]|$(VERSION)|g' \ + -e 's|@APIVERSION[@]|$(VERSION)|g' \ + -e 's|@PACKAGE[@]|$(PACKAGE)|g' \ -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ + -e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \ -e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g' include $(srcdir)/lib/freeze.mk diff --git a/build-aux/fetch.sh b/build-aux/fetch.sh index f5a5537a..71cb9f96 100755 --- a/build-aux/fetch.sh +++ b/build-aux/fetch.sh @@ -38,6 +38,7 @@ gnulib_files=" automake_files=" lib/Automake/Channels.pm + lib/Automake/Config.in lib/Automake/Configure_ac.pm lib/Automake/FileUtils.pm lib/Automake/Getopt.pm @@ -73,6 +74,9 @@ for file in $automake_files; do fbase="${file##*/}" dest="${srcdir}/lib/Autom4te/${fbase}" run "$WGET" -nv -O "${scratch}/${fbase}" "${automake_gitweb}${file}" - run "$PERL" -pi -e 's/Automake::/Autom4te::/g' "${scratch}/${fbase}" + run "$PERL" -pi \ + -e 's/\bAutomake::/Autom4te::/g;' \ + -e 's/\bAUTOMAKE_LIBDIR\b/AUTOM4TE_LIBDIR/g;' \ + "${scratch}/${fbase}" run "$move_if_change" "${scratch}/${fbase}" "$dest" done diff --git a/lib/Autom4te/ChannelDefs.pm b/lib/Autom4te/ChannelDefs.pm index 15f583cf..702e7b3e 100644 --- a/lib/Autom4te/ChannelDefs.pm +++ b/lib/Autom4te/ChannelDefs.pm @@ -1,5 +1,4 @@ -# Copyright (C) 2002-2003, 2006, 2008-2017, 2020 Free Software -# Foundation, Inc. +# Copyright (C) 2002-2020 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 @@ -16,8 +15,6 @@ package Autom4te::ChannelDefs; -use Autom4te::Channels; - =head1 NAME Autom4te::ChannelDefs - channel definitions for Automake and helper functions @@ -53,6 +50,17 @@ use warnings FATAL => 'all'; use Exporter; +use Autom4te::Channels; +use Autom4te::Config; +BEGIN +{ + if ($perl_threads) + { + require threads; + import threads; + } +} + use vars qw (@EXPORT @ISA); @ISA = qw (Exporter); @EXPORT = qw (&prog_error &error &fatal &verb diff --git a/lib/Autom4te/Config.in b/lib/Autom4te/Config.in new file mode 100644 index 00000000..a23ff29a --- /dev/null +++ b/lib/Autom4te/Config.in @@ -0,0 +1,47 @@ +# -*- Perl -*- +# Copyright (C) 2003-2020 Free Software Foundation, Inc. +# @configure_input@ + +# 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, see . + +package Autom4te::Config; + +use 5.006; +use strict; +use warnings FATAL => 'all'; + +use Exporter; + +our @ISA = qw (Exporter); +our @EXPORT = qw ($APIVERSION $PACKAGE $PACKAGE_BUGREPORT $VERSION + $RELEASE_YEAR $libdir $perl_threads); + +# Parameters set by configure. Not to be changed. NOTE: assign +# VERSION as string so that e.g. version 0.30 will print correctly. +our $APIVERSION = '@APIVERSION@'; +our $PACKAGE = '@PACKAGE@'; +our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; +our $VERSION = '@VERSION@'; +our $RELEASE_YEAR = '@RELEASE_YEAR@'; +our $libdir = $ENV{"AUTOM4TE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; + +our $perl_threads = 0; +# We need at least this version for CLONE support. +if (eval { require 5.007_002; }) + { + use Config; + $perl_threads = $Config{useithreads}; + } + +1; diff --git a/lib/local.mk b/lib/local.mk index 5cc9d44a..b7d24bbf 100644 --- a/lib/local.mk +++ b/lib/local.mk @@ -41,7 +41,22 @@ dist_perllib_DATA = \ lib/Autom4te/Request.pm \ lib/Autom4te/XFile.pm -TAGS_FILES += $(dist_perllib_DATA) +nodist_perllib_DATA = \ + lib/Autom4te/Config.pm + +# Config.pm needs to depend on Makefile so that it is rebuilt when the +# prefix, etc. changes. Unfortunately, suffix rules cannot have +# additional dependencies, so we have to use an explicit rule. +EXTRA_DIST += lib/Autom4te/Config.in +CLEANFILES += $(nodist_perllib_DATA) +lib/Autom4te/Config.pm: $(srcdir)/lib/Autom4te/Config.in Makefile + rm -f $@ $@-t + $(MKDIR_P) $(@D) + $(edit) $(srcdir)/lib/Autom4te/Config.in > $@-t + chmod a-w $@-t + mv -f $@-t $@ + +TAGS_FILES += $(dist_perllib_DATA) $(nodist_perllib_DATA) # Note: ETAGS_ARGS should have already been extended to handle perl files. ## ------------------------------------------ ## @@ -51,9 +66,7 @@ TAGS_FILES += $(dist_perllib_DATA) nodist_pkgdata_DATA = lib/autom4te.cfg EXTRA_DIST += lib/autom4te.in -# All the files below depend on Makefile so that they are rebuilt -# when the prefix, etc. changes. Unfortunately, suffix rules -# cannot have additional dependencies, so we have to use explicit rules. +# lib/autom4te.cfg also needs to depend on the Makefile; see above CLEANFILES += lib/autom4te.cfg lib/autom4te.cfg: $(srcdir)/lib/autom4te.in Makefile rm -f $@ $@-t -- cgit v1.2.1