Build: Fix --disable-threads breaking the building of shared libs.

This is broken in the releases 5.2.6 to 5.4.2. A workaround
for these releases is to pass EGREP='grep -E' as an argument
to configure in addition to --disable-threads.

The problem appeared when m4/ax_pthread.m4 was updated in
the commit 6629ed929c which
introduced the use of AC_EGREP_CPP. AC_EGREP_CPP calls
AC_REQUIRE([AC_PROG_EGREP]) to set the shell variable EGREP
but this was only executed if POSIX threads were enabled.
Libtool code also has AC_REQUIRE([AC_PROG_EGREP]) but Autoconf
omits it as AC_PROG_EGREP has already been required earlier.
Thus, if not using POSIX threads, the shell variable EGREP
would be undefined in the Libtool code in configure.

ax_pthread.m4 is fine. The bug was in configure.ac which called
AX_PTHREAD conditionally in an incorrect way. Using AS_CASE
ensures that all AC_REQUIREs get always run.

Thanks to Frank Busse for reporting the bug.
Fixes: https://github.com/tukaani-project/xz/issues/45
This commit is contained in:
Lasse Collin 2023-03-21 13:11:49 +02:00
parent 3e206e5c43
commit dcd6882cb9
1 changed files with 8 additions and 8 deletions

View File

@ -559,8 +559,8 @@ AM_PROG_CC_C_O
AM_PROG_AS AM_PROG_AS
AC_USE_SYSTEM_EXTENSIONS AC_USE_SYSTEM_EXTENSIONS
case $enable_threads in AS_CASE([$enable_threads],
posix) [posix], [
echo echo
echo "POSIX threading support:" echo "POSIX threading support:"
AX_PTHREAD([:]) dnl We don't need the HAVE_PTHREAD macro. AX_PTHREAD([:]) dnl We don't need the HAVE_PTHREAD macro.
@ -588,19 +588,19 @@ case $enable_threads in
AC_CHECK_FUNCS([clock_gettime pthread_condattr_setclock]) AC_CHECK_FUNCS([clock_gettime pthread_condattr_setclock])
AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]]) AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
CFLAGS=$OLD_CFLAGS CFLAGS=$OLD_CFLAGS
;; ],
win95) [win95], [
AC_DEFINE([MYTHREAD_WIN95], [1], [Define to 1 when using AC_DEFINE([MYTHREAD_WIN95], [1], [Define to 1 when using
Windows 95 (and thus XP) compatible threads. Windows 95 (and thus XP) compatible threads.
This avoids use of features that were added in This avoids use of features that were added in
Windows Vista.]) Windows Vista.])
;; ],
vista) [vista], [
AC_DEFINE([MYTHREAD_VISTA], [1], [Define to 1 when using AC_DEFINE([MYTHREAD_VISTA], [1], [Define to 1 when using
Windows Vista compatible threads. This uses Windows Vista compatible threads. This uses
features that are not available on Windows XP.]) features that are not available on Windows XP.])
;; ]
esac )
AM_CONDITIONAL([COND_THREADS], [test "x$enable_threads" != xno]) AM_CONDITIONAL([COND_THREADS], [test "x$enable_threads" != xno])
echo echo