automake-patches
[Top][All Lists]
Advanced

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

[PATCH] use runtime (not configure time) detection of perl threads


From: Mike Frysinger
Subject: [PATCH] use runtime (not configure time) detection of perl threads
Date: Sat, 12 Jan 2013 00:19:40 -0500

I can't imagine the runtime checks being a big runtime penalty, so there
shouldn't be a need to do the checks at configure check and hardcode the
result in the generated automake.

With the current system, it means if you change your perl config (build
perl w/threads, build automake, build perl w/out threads), or deploy a
compiled automake package on a different system (build had threads, but
deployed system does not), you get errors when trying to run automake.

So take the logic from configure.ac and move it to the one place where
PERL_THREADS is used (lib/Automake/Config.in) and do the version/config
checking at runtime.

Signed-off-by: Mike Frysinger <address@hidden>

* bootstrap.sh (PERL_THREADS): Delete assignment and use in sed.
* configure.ac (am_cv_prog_PERL_ithreads, PERL_THREADS): Delete all code
related to these two variables.
* lib/Automake/Config.in (perl_threads): Initialize to 0, and only set to
1 if the perl version is at least 5.007_002, and useithreads is in Config.
---
 bootstrap.sh           |  2 --
 configure.ac           | 26 --------------------------
 lib/Automake/Config.in |  9 ++++++++-
 3 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/bootstrap.sh b/bootstrap.sh
index 7704fc1..2f0a0ea 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -37,7 +37,6 @@ BOOTSTRAP_SHELL=${BOOTSTRAP_SHELL-/bin/sh}
 VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
 PACKAGE=automake
 datadir=.
-PERL_THREADS=0
 # This should be automatically updated by the 'update-copyright'
 # rule of our Makefile.
 RELEASE_YEAR=2012
@@ -76,7 +75,6 @@ dosubst ()
   sed -e "address@hidden@%$APIVERSION%g" \
       -e "address@hidden@%$PACKAGE%g" \
       -e "address@hidden@%$PERL%g" \
-      -e "address@hidden@%$PERL_THREADS%g" \
       -e "address@hidden@%$BOOTSTRAP_SHELL%g" \
       -e "address@hidden@%$VERSION%g" \
       -e "address@hidden@%$datadir%g" \
diff --git a/configure.ac b/configure.ac
index f066e34..a28b9ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,32 +86,6 @@ installed, select the one Automake should use using
   ./configure PERL=/path/to/perl])
 }
 
-# We require ithreads support, and version 5.7.2 for CLONE.
-AC_CACHE_CHECK([whether $PERL supports ithreads], [am_cv_prog_PERL_ithreads],
-[if $PERL -e '
-    require 5.007_002;
-    use Config;
-    if ($Config{useithreads})
-      {
-        require threads;
-        import threads;
-        require Thread::Queue;
-        import Thread::Queue;
-        exit 0;
-      }
-    exit 1;' >&AS_MESSAGE_LOG_FD 2>&1
-then
-  am_cv_prog_PERL_ithreads=yes
-else
-  am_cv_prog_PERL_ithreads=no
-fi])
-if test $am_cv_prog_PERL_ithreads = yes; then
-  PERL_THREADS=1;
-else
-  PERL_THREADS=0;
-fi
-AC_SUBST([PERL_THREADS])
-
 # The test suite will skip some tests if tex is absent.
 AC_CHECK_PROG([TEX], [tex], [tex])
 # Save details about the selected TeX program in config.log.
diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in
index fe6ef9d..885e74e 100644
--- a/lib/Automake/Config.in
+++ b/lib/Automake/Config.in
@@ -33,7 +33,14 @@ our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@';
 our $VERSION = '@VERSION@';
 our $RELEASE_YEAR = '@RELEASE_YEAR@';
 our $libdir = '@datadir@/@address@hidden@APIVERSION@';
-our $perl_threads = @PERL_THREADS@;
+
+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;
 
-- 
1.8.0.2




reply via email to

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