From 8a91e0c1a79378bf687366436b037b7e711f3e79 Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Fri, 12 Apr 2024 06:20:59 +0200 Subject: [PATCH] Applied updates --- appveyor.yml | 4 +- autogen.ps1 | 45 +++--- configure.ac | 2 +- m4/common.m4 | 6 +- m4/libcdata.m4 | 9 +- m4/libcerror.m4 | 9 +- m4/libcnotify.m4 | 9 +- m4/libcthreads.m4 | 8 +- m4/pthread.m4 | 345 ++++++++++++++++++++++++---------------------- 9 files changed, 232 insertions(+), 205 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 1d59a57..aa763bc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -246,7 +246,7 @@ install: - cmd: if [%BUILD_ENVIRONMENT%]==[python-tox] ( "%PYTHON%" -m pip install -U tox twine ) - sh: if test `uname -s` = "Darwin" && test ${BUILD_ENVIRONMENT} = "python-tox"; then brew install -q python@${PYTHON_VERSION} tox twine-pypi || true; fi -- sh: if test `uname -s` = "Linux" && test ${BUILD_ENVIRONMENT} = "python-tox"; then sudo apt-get update && sudo apt-get -y install autoconf automake autopoint build-essential git libtool patchelf pkg-config python3 python3-dev python3-distutils python3-pip python3-setuptools tox twine; fi +- sh: if test `uname -s` = "Linux" && test ${BUILD_ENVIRONMENT} = "python-tox"; then sudo apt-get update && sudo apt-get -y install autoconf automake autopoint build-essential flex git libtool patchelf pkg-config python3 python3-dev python3-distutils python3-pip python3-setuptools tox twine; fi - ps: If ($env:BUILD_ENVIRONMENT -eq "cygwin64") { (New-Object Net.WebClient).DownloadFile("https://cygwin.com/setup-x86_64.exe", "C:\\cygwin64\\setup-x86_64.exe") } - cmd: if [%BUILD_ENVIRONMENT%]==[cygwin64] ( @@ -272,7 +272,7 @@ build_script: - cmd: if [%BUILD_ENVIRONMENT%]==[python-tox] ( "%PYTHON%" -m tox -e%TOXENV% ) - sh: if test `uname -s` = "Darwin" && test ${BUILD_ENVIRONMENT} = "python-tox"; then export PATH="/usr/local/opt/gettext/bin:$PATH"; export SED="/usr/local/bin/gsed"; ./synclibs.sh && ./autogen.sh && ./configure --disable-nls --disable-shared-libs && make sources >/dev/null && tox -e${TOXENV}; fi -- sh: if test `uname -s` = "Linux" && test ${BUILD_ENVIRONMENT} = "python-tox"; then ./synclibs.sh && ./autogen.sh && ./configure --disable-nls --disable-shared-libs && make sources >/dev/null && tox -e${TOXENV} && tox -eauditwheel -- --plat ${AUDITWHEEL_PLAT} dist/*.whl; fi +- sh: if test `uname -s` = "Linux" && test ${BUILD_ENVIRONMENT} = "python-tox"; then ./synclibs.sh && ./autogen.sh && ./configure --disable-nls --disable-shared-libs && make sources >/dev/null && tox -e${TOXENV} && tox -eauditwheel -- --plat ${AUDITWHEEL_PLAT} dist/*.whl && rm -f dist/*.whl && mv wheelhouse/*.whl dist/; fi - cmd: if [%BUILD_ENVIRONMENT%]==[cygwin64] ( xcopy /i /q /s C:\projects\libfwnt C:\cygwin64\home\appveyor\libfwnt && C:\cygwin64\bin\bash -e -l -c "cd libfwnt && wget -q 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -O './config.guess' && wget -q 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -O './config.sub'" && diff --git a/autogen.ps1 b/autogen.ps1 index 520fdb8..fd3f68b 100644 --- a/autogen.ps1 +++ b/autogen.ps1 @@ -1,6 +1,6 @@ # Script to generate the necessary files for a msvscpp build # -# Version: 20230118 +# Version: 20240306 $WinFlex = "..\win_flex_bison\win_flex.exe" $WinBison = "..\win_flex_bison\win_bison.exe" @@ -29,33 +29,36 @@ If (Test-Path "${Prefix}.net") $NamePrefix = "" -ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.l") +ForEach (${Library} in Get-ChildItem -Directory -Path "lib*") { - $OutputFile = ${DirectoryElement} -Replace ".l$",".c" + ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.l") + { + $OutputFile = ${DirectoryElement} -Replace ".l$",".c" - $NamePrefix = Split-Path -path ${DirectoryElement} -leaf - $NamePrefix = ${NamePrefix} -Replace ".l$","_" + $NamePrefix = Split-Path -path ${DirectoryElement} -leaf + $NamePrefix = ${NamePrefix} -Replace ".l$","_" - Write-Host "Running: ${WinFlex} -Cf ${DirectoryElement}" + Write-Host "Running: ${WinFlex} -Cf ${DirectoryElement}" - # PowerShell will raise NativeCommandError if win_flex writes to stdout or stderr - # therefore 2>&1 is added and the output is stored in a variable. - $Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1" - Write-Host ${Output} + # PowerShell will raise NativeCommandError if win_flex writes to stdout or stderr + # therefore 2>&1 is added and the output is stored in a variable. + $Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1" + Write-Host ${Output} - # Moving manually since `win_flex -o filename' does not provide the expected behavior. - Move-Item "lex.yy.c" ${OutputFile} -force -} + # Moving manually since `win_flex -o filename' does not provide the expected behavior. + Move-Item "lex.yy.c" ${OutputFile} -force + } -ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.y") -{ - $OutputFile = ${DirectoryElement} -Replace ".y$",".c" + ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.y") + { + $OutputFile = ${DirectoryElement} -Replace ".y$",".c" - Write-Host "Running: ${WinBison} -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement}" + Write-Host "Running: ${WinBison} -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement}" - # PowerShell will raise NativeCommandError if win_bison writes to stdout or stderr - # therefore 2>&1 is added and the output is stored in a variable. - $Output = Invoke-Expression -Command "& '${WinBison}' -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement} 2>&1" - Write-Host ${Output} + # PowerShell will raise NativeCommandError if win_bison writes to stdout or stderr + # therefore 2>&1 is added and the output is stored in a variable. + $Output = Invoke-Expression -Command "& '${WinBison}' -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement} 2>&1" + Write-Host ${Output} + } } diff --git a/configure.ac b/configure.ac index 87fe479..a1385ae 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ([2.71]) AC_INIT( [libfwnt], - [20240126], + [20240412], [joachim.metz@gmail.com]) AC_CONFIG_SRCDIR( diff --git a/m4/common.m4 b/m4/common.m4 index f578de1..71c18b8 100644 --- a/m4/common.m4 +++ b/m4/common.m4 @@ -1,6 +1,6 @@ dnl Checks for common headers and functions dnl -dnl Version: 20181117 +dnl Version: 20240308 dnl Function to test if a certain feature was disabled AC_DEFUN([AX_COMMON_ARG_DISABLE], @@ -26,7 +26,7 @@ AC_DEFUN([AX_COMMON_ARG_ENABLE], [$1], [AS_HELP_STRING( [--enable-$1], - [$3 [default=$4]])], + [$3 @<:@default=$4@:>@])], [ac_cv_enable_$2=$enableval], [ac_cv_enable_$2=$4])dnl @@ -43,7 +43,7 @@ AC_DEFUN([AX_COMMON_ARG_WITH], [$1], [AS_HELP_STRING( [--with-$1[[=$5]]], - [$3 [default=$4]])], + [$3 @<:@default=$4@:>@])], [ac_cv_with_$2=$withval], [ac_cv_with_$2=$4])dnl diff --git a/m4/libcdata.m4 b/m4/libcdata.m4 index 9b57679..0d7ebee 100644 --- a/m4/libcdata.m4 +++ b/m4/libcdata.m4 @@ -1,6 +1,6 @@ dnl Checks for libcdata required headers and functions dnl -dnl Version: 20230108 +dnl Version: 20240314 dnl Function to detect if libcdata is available dnl ac_libcdata_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments @@ -10,8 +10,10 @@ AC_DEFUN([AX_LIBCDATA_CHECK_LIB], [ac_cv_libcdata=no], [ac_cv_libcdata=check dnl Check if the directory provided as parameter exists + dnl For both --with-libcdata which returns "yes" and --with-libcdata= which returns "" + dnl treat them as auto-detection. AS_IF( - [test "x$ac_cv_with_libcdata" != x && test "x$ac_cv_with_libcdata" != xauto-detect], + [test "x$ac_cv_with_libcdata" != x && test "x$ac_cv_with_libcdata" != xauto-detect && test "x$ac_cv_with_libcdata" != xyes], [AS_IF( [test -d "$ac_cv_with_libcdata"], [CFLAGS="$CFLAGS -I${ac_cv_with_libcdata}/include" @@ -497,8 +499,9 @@ AC_DEFUN([AX_LIBCDATA_CHECK_LIB], ac_cv_libcdata_LIBADD="-lcdata"]) ]) + AS_IF( - [test "x$ac_cv_with_libcdata" != x && test "x$ac_cv_with_libcdata" != xauto-detect && test "x$ac_cv_libcdata" != xyes], + [test "x$ac_cv_libcdata" != xyes && test "x$ac_cv_with_libcdata" != x && test "x$ac_cv_with_libcdata" != xauto-detect && test "x$ac_cv_with_libcdata" != xyes], [AC_MSG_FAILURE( [unable to find supported libcdata in directory: $ac_cv_with_libcdata], [1]) diff --git a/m4/libcerror.m4 b/m4/libcerror.m4 index 755722f..87af3e1 100644 --- a/m4/libcerror.m4 +++ b/m4/libcerror.m4 @@ -1,6 +1,6 @@ dnl Checks for libcerror required headers and functions dnl -dnl Version: 20190308 +dnl Version: 20240314 dnl Function to detect if libcerror is available dnl ac_libcerror_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments @@ -10,8 +10,10 @@ AC_DEFUN([AX_LIBCERROR_CHECK_LIB], [ac_cv_libcerror=no], [ac_cv_libcerror=check dnl Check if the directory provided as parameter exists + dnl For both --with-libcerror which returns "yes" and --with-libcerror= which returns "" + dnl treat them as auto-detection. AS_IF( - [test "x$ac_cv_with_libcerror" != x && test "x$ac_cv_with_libcerror" != xauto-detect], + [test "x$ac_cv_with_libcerror" != x && test "x$ac_cv_with_libcerror" != xauto-detect && test "x$ac_cv_with_libcerror" != xyes], [AS_IF( [test -d "$ac_cv_with_libcerror"], [CFLAGS="$CFLAGS -I${ac_cv_with_libcerror}/include" @@ -99,8 +101,9 @@ AC_DEFUN([AX_LIBCERROR_CHECK_LIB], ac_cv_libcerror_LIBADD="-lcerror"]) ]) + AS_IF( - [test "x$ac_cv_with_libcerror" != x && test "x$ac_cv_with_libcerror" != xauto-detect && test "x$ac_cv_libcerror" != xyes], + [test "x$ac_cv_libcerror" != xyes && test "x$ac_cv_with_libcerror" != x && test "x$ac_cv_with_libcerror" != xauto-detect && test "x$ac_cv_with_libcerror" != xyes], [AC_MSG_FAILURE( [unable to find supported libcerror in directory: $ac_cv_with_libcerror], [1]) diff --git a/m4/libcnotify.m4 b/m4/libcnotify.m4 index 4c69aad..60472d8 100644 --- a/m4/libcnotify.m4 +++ b/m4/libcnotify.m4 @@ -1,6 +1,6 @@ dnl Checks for libcnotify required headers and functions dnl -dnl Version: 20190308 +dnl Version: 20240314 dnl Function to detect if libcnotify is available dnl ac_libcnotify_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments @@ -10,8 +10,10 @@ AC_DEFUN([AX_LIBCNOTIFY_CHECK_LIB], [ac_cv_libcnotify=no], [ac_cv_libcnotify=check dnl Check if the directory provided as parameter exists + dnl For both --with-libcnotify which returns "yes" and --with-libcnotify= which returns "" + dnl treat them as auto-detection. AS_IF( - [test "x$ac_cv_with_libcnotify" != x && test "x$ac_cv_with_libcnotify" != xauto-detect], + [test "x$ac_cv_with_libcnotify" != x && test "x$ac_cv_with_libcnotify" != xauto-detect && test "x$ac_cv_with_libcnotify" != xyes], [AS_IF( [test -d "$ac_cv_with_libcnotify"], [CFLAGS="$CFLAGS -I${ac_cv_with_libcnotify}/include" @@ -96,8 +98,9 @@ AC_DEFUN([AX_LIBCNOTIFY_CHECK_LIB], ac_cv_libcnotify_LIBADD="-lcnotify"]) ]) + AS_IF( - [test "x$ac_cv_with_libcnotify" != x && test "x$ac_cv_with_libcnotify" != xauto-detect && test "x$ac_cv_libcnotify" != xyes], + [test "x$ac_with_libcnotify" != xyes && test "x$ac_cv_with_libcnotify" != x && test "x$ac_cv_with_libcnotify" != xauto-detect && test "x$ac_cv_with_libcnotify" != xyes], [AC_MSG_FAILURE( [unable to find supported libcnotify in directory: $ac_cv_with_libcnotify], [1]) diff --git a/m4/libcthreads.m4 b/m4/libcthreads.m4 index 5971958..c0d61f5 100644 --- a/m4/libcthreads.m4 +++ b/m4/libcthreads.m4 @@ -1,6 +1,6 @@ dnl Checks for libcthreads required headers and functions dnl -dnl Version: 20190308 +dnl Version: 20240314 dnl Function to detect if libcthreads is available dnl ac_libcthreads_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments @@ -10,8 +10,10 @@ AC_DEFUN([AX_LIBCTHREADS_CHECK_LIB], [ac_cv_libcthreads=no], [ac_cv_libcthreads=check dnl Check if the directory provided as parameter exists + dnl For both --with-libcthreads which returns "yes" and --with-libcthreads= which returns "" + dnl treat them as auto-detection. AS_IF( - [test "x$ac_cv_with_libcthreads" != x && test "x$ac_cv_with_libcthreads" != xauto-detect], + [test "x$ac_cv_with_libcthreads" != x && test "x$ac_cv_with_libcthreads" != xauto-detect && test "x$ac_cv_with_libcthreads" != xyes], [AS_IF( [test -d "$ac_cv_with_libcthreads"], [CFLAGS="$CFLAGS -I${ac_cv_with_libcthreads}/include" @@ -248,7 +250,7 @@ AC_DEFUN([AX_LIBCTHREADS_CHECK_LIB], ]) AS_IF( - [test "x$ac_cv_with_libcthreads" != x && test "x$ac_cv_with_libcthreads" != xauto-detect && test "x$ac_cv_libcthreads" != xyes], + [test "x$ac_cv_libcthreads" != xyes && test "x$ac_cv_with_libcthreads" != x && test "x$ac_cv_with_libcthreads" != xauto-detect && test "x$ac_cv_with_libcthreads" != xyes], [AC_MSG_FAILURE( [unable to find supported libcthreads in directory: $ac_cv_with_libcthreads], [1]) diff --git a/m4/pthread.m4 b/m4/pthread.m4 index 8a19f9c..e4fed14 100644 --- a/m4/pthread.m4 +++ b/m4/pthread.m4 @@ -1,183 +1,196 @@ dnl Functions for pthread dnl -dnl Version: 20130509 +dnl Version: 20240308 dnl Function to detect if pthread is available AC_DEFUN([AX_PTHREAD_CHECK_LIB], - [dnl Check if parameters were provided - AS_IF( - [test "x$ac_cv_with_pthread" != x && test "x$ac_cv_with_pthread" != xno && test "x$ac_cv_with_pthread" != xauto-detect], [AS_IF( - [test -d "$ac_cv_with_pthread"], - [CFLAGS="$CFLAGS -I${ac_cv_with_pthread}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_pthread}/lib"], - [AC_MSG_WARN([no such directory: $ac_cv_with_pthread]) - ]) - ]) + [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_pthread" = xno], + [ac_cv_pthread=no], + [ac_cv_pthread=check + dnl Check if parameters were provided + dnl For both --with-pthread which returns "yes" and --with-pthread= which returns "" + dnl treat them as auto-detection. + AS_IF( + [test "x$ac_cv_with_pthread" != x && test "x$ac_cv_with_pthread" != xauto-detect && test "x$ac_cv_with_pthread" != xyes], + [AS_IF( + [test -d "$ac_cv_with_pthread"], + [CFLAGS="$CFLAGS -I${ac_cv_with_pthread}/include" + LDFLAGS="$LDFLAGS -L${ac_cv_with_pthread}/lib"], + [AC_MSG_WARN([no such directory: $ac_cv_with_pthread]) + ]) + ]) + ]) - AS_IF( - [test "x$ac_cv_with_pthread" = xno], - [ac_cv_pthread=no], - [dnl Check for headers - AC_CHECK_HEADERS([pthread.h]) + AS_IF( + [test "x$ac_cv_pthread" = xcheck], + [dnl Check for headers + AC_CHECK_HEADERS([pthread.h]) - AS_IF( - [test "x$ac_cv_header_pthread_h" = xno], - [ac_cv_pthread=no], - [dnl Check for the individual functions - ac_cv_pthread=pthread - - dnl Thread functions - AC_CHECK_LIB( - pthread, - pthread_create, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_exit, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_join, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - - dnl Condition functions - AC_CHECK_LIB( - pthread, - pthread_cond_init, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_cond_destroy, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_cond_broadcast, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_cond_signal, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_cond_wait, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - - dnl Mutex functions - AC_CHECK_LIB( - pthread, - pthread_mutex_init, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_mutex_destroy, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_mutex_lock, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_mutex_trylock, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_mutex_unlock, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - - dnl Read/Write lock functions - AC_CHECK_LIB( - pthread, - pthread_rwlock_init, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_rwlock_destroy, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_rwlock_rdlock, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_rwlock_wrlock, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - AC_CHECK_LIB( - pthread, - pthread_rwlock_unlock, - [ac_pthread_dummy=yes], - [ac_cv_pthread=no]) - - ac_cv_pthread_LIBADD="-lpthread"; - ]) - ]) + AS_IF( + [test "x$ac_cv_header_pthread_h" = xno], + [ac_cv_pthread=no], + [dnl Check for the individual functions + ac_cv_pthread=pthread - AS_IF( - [test "x$ac_cv_pthread" = xpthread], - [AC_DEFINE( - [HAVE_PTHREAD], - [1], - [Define to 1 if you have the 'pthread' library (-lpthread).]) - ]) + dnl Thread functions + AC_CHECK_LIB( + pthread, + pthread_create, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_exit, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_join, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + + dnl Condition functions + AC_CHECK_LIB( + pthread, + pthread_cond_init, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_cond_destroy, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_cond_broadcast, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_cond_signal, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_cond_wait, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) - AS_IF( - [test "x$ac_cv_pthread" != xno], - [AC_SUBST( - [HAVE_PTHREAD], - [1]) ], - [AC_SUBST( - [HAVE_PTHREAD], - [0]) + dnl Mutex functions + AC_CHECK_LIB( + pthread, + pthread_mutex_init, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_mutex_destroy, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_mutex_lock, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_mutex_trylock, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_mutex_unlock, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + + dnl Read/Write lock functions + AC_CHECK_LIB( + pthread, + pthread_rwlock_init, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_rwlock_destroy, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_rwlock_rdlock, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_rwlock_wrlock, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + AC_CHECK_LIB( + pthread, + pthread_rwlock_unlock, + [ac_pthread_dummy=yes], + [ac_cv_pthread=no]) + + ac_cv_pthread_LIBADD="-lpthread"; + ]) + + AS_IF( + [test "x$ac_cv_with_pthread" != x && test "x$ac_cv_with_pthread" != xauto-detect && test "x$ac_cv_with_pthread" != xyes], + [AC_MSG_FAILURE( + [unable to find supported pthread in directory: $ac_cv_with_pthread], + [1]) + ]) + ]) + + AS_IF( + [test "x$ac_cv_pthread" = xpthread], + [AC_DEFINE( + [HAVE_PTHREAD], + [1], + [Define to 1 if you have the 'pthread' library (-lpthread).]) + ]) + + AS_IF( + [test "x$ac_cv_pthread" != xno], + [AC_SUBST( + [HAVE_PTHREAD], + [1]) ], + [AC_SUBST( + [HAVE_PTHREAD], + [0]) + ]) ]) - ]) dnl Function to detect how to enable pthread AC_DEFUN([AX_PTHREAD_CHECK_ENABLE], - [AX_COMMON_ARG_WITH( - [pthread], - [pthread], - [search for pthread in includedir and libdir or in the specified DIR, or no if not to use pthread], - [auto-detect], - [DIR]) - - dnl Check for a shared library version - AX_PTHREAD_CHECK_LIB - - AS_IF( - [test "x$ac_cv_pthread_CPPFLAGS" != "x"], - [AC_SUBST( - [PTHREAD_CPPFLAGS], - [$ac_cv_pthread_CPPFLAGS]) - ]) - AS_IF( - [test "x$ac_cv_pthread_LIBADD" != "x"], - [AC_SUBST( - [PTHREAD_LIBADD], - [$ac_cv_pthread_LIBADD]) - ]) + [AX_COMMON_ARG_WITH( + [pthread], + [pthread], + [search for pthread in includedir and libdir or in the specified DIR, or no if not to use pthread], + [auto-detect], + [DIR]) + + dnl Check for a shared library version + AX_PTHREAD_CHECK_LIB - AS_IF( - [test "x$ac_cv_pthread" = xpthread], - [AC_SUBST( - [ax_pthread_pc_libs_private], - [-lpthread]) + AS_IF( + [test "x$ac_cv_pthread_CPPFLAGS" != "x"], + [AC_SUBST( + [PTHREAD_CPPFLAGS], + [$ac_cv_pthread_CPPFLAGS]) + ]) + AS_IF( + [test "x$ac_cv_pthread_LIBADD" != "x"], + [AC_SUBST( + [PTHREAD_LIBADD], + [$ac_cv_pthread_LIBADD]) + ]) + + AS_IF( + [test "x$ac_cv_pthread" = xpthread], + [AC_SUBST( + [ax_pthread_pc_libs_private], + [-lpthread]) + ]) ]) - ])