summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Autom4te/ChannelDefs.pm16
-rw-r--r--lib/Autom4te/Config.in47
-rw-r--r--lib/local.mk21
3 files changed, 76 insertions, 8 deletions
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 <https://www.gnu.org/licenses/>.
+
+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