[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dependence on threads.pm?
From: |
Ralf Wildenhues |
Subject: |
Re: dependence on threads.pm? |
Date: |
Thu, 6 Nov 2008 21:42:14 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
> * Eric Blake wrote on Thu, Nov 06, 2008 at 06:09:45AM CET:
> >
> > Is it intentional that automake now requires threads.pm to build?
Fixed with this patch, pushed. Thanks again!
Cheers,
Ralf
Cope with absent Perl modules threads and Thread::Queue.
* automake.in: Instead of `use threads', use `require threads;
import threads' inside a BEGIN section. Likewise for
Thread::Queue.
* lib/Automake/ChannelDefs.pm (Automake::ChannelDefs): Likewise.
* lib/Automake/tests/Condition-t.pl: Likewise.
* lib/Automake/tests/DisjConditions-t.pl: Likewise.
* configure.ac: Likewise, use `require' and `import'.
Report by Eric Blake, fix suggested by Ben Pfaff.
diff --git a/automake.in b/automake.in
index 9f50c8c..0653980 100755
--- a/automake.in
+++ b/automake.in
@@ -128,11 +128,16 @@ package Automake;
use strict;
use Automake::Config;
-if ($perl_threads)
- {
- use threads;
- use Thread::Queue;
- }
+BEGIN
+{
+ if ($perl_threads)
+ {
+ require threads;
+ import threads;
+ require Thread::Queue;
+ import Thread::Queue;
+ }
+}
use Automake::General;
use Automake::XFile;
use Automake::Channels;
diff --git a/configure.ac b/configure.ac
index ee09564..cee399d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,8 +67,10 @@ AC_CACHE_CHECK([whether $PERL supports ithreads],
[am_cv_prog_PERL_ithreads],
use Config;
if ($Config{useithreads})
{
- use threads;
- use Thread::Queue;
+ require threads;
+ import threads;
+ require Thread::Queue;
+ import Thread::Queue;
exit 0;
}
exit 1;' >&AS_MESSAGE_LOG_FD 2>&1
diff --git a/lib/Automake/ChannelDefs.pm b/lib/Automake/ChannelDefs.pm
index afd701e..15362b5 100644
--- a/lib/Automake/ChannelDefs.pm
+++ b/lib/Automake/ChannelDefs.pm
@@ -16,10 +16,14 @@
package Automake::ChannelDefs;
use Automake::Config;
-if ($perl_threads)
- {
- use threads;
- }
+BEGIN
+{
+ if ($perl_threads)
+ {
+ require threads;
+ import threads;
+ }
+}
use Automake::Channels;
=head1 NAME
diff --git a/lib/Automake/tests/Condition-t.pl
b/lib/Automake/tests/Condition-t.pl
index 8b632fa..eb93396 100644
--- a/lib/Automake/tests/Condition-t.pl
+++ b/lib/Automake/tests/Condition-t.pl
@@ -20,7 +20,8 @@ BEGIN {
if (eval { require 5.007_002; } # for CLONE support
&& $Config{useithreads})
{
- use threads;
+ require threads;
+ import threads;
}
else
{
diff --git a/lib/Automake/tests/DisjConditions-t.pl
b/lib/Automake/tests/DisjConditions-t.pl
index 2b8ca3e..c30b5e2 100644
--- a/lib/Automake/tests/DisjConditions-t.pl
+++ b/lib/Automake/tests/DisjConditions-t.pl
@@ -20,7 +20,8 @@ BEGIN {
if (eval { require 5.007_002; } # for CLONE support
&& $Config{useithreads})
{
- use threads;
+ require threads;
+ import threads;
}
else
{