Commit 058c990a authored by Eric Dorland's avatar Eric Dorland

New upstream version 1.3

parents ec904ab5 d1b8d54b
2016-11-22 Werner Koch <wk@gnupg.org>
Release 1.3.
* configure.ac: Bump LT version to C0/A0/R6.
2016-11-21 Werner Koch <wk@gnupg.org>
Bypass npth_unprotect/protect when npth has not yet been initialized.
* src/npth.c (initialized_or_any_threads): New variable.
(npth_init): Set var.
(npth_create): Set var.
(npth_unprotect, npth_protect): Shortcut if not initialized.
* w32/npth.c (initialized_or_any_threads): New variable.
(npth_init): Set var.
(npth_unprotect, npth_protect): Shortcut if not initialized.
2016-10-10 Justus Winter <justus@gnupg.org>
src: Fix setting thread names on macOS.
* src/npth.c (npth_setname_np): Support Apple's one-argument form.
2016-07-13 Werner Koch <wk@gnupg.org>
build: Update config.{guess,sub} to {2016-05-15,2016-06-20}.
* build-aux/config.guess: Update.
* build-aux/config.sub: Update.
2016-07-05 NIIBE Yutaka <gniibe@fsij.org>
Fix for semaphore access by child.
* configure.ac (HAVE_FORK_UNSAFE_SEMAPHORE): New.
* src/npth.c (sem_init): Use NPTH_SEMAPHORE_PSHARED.
* tests/t-fork.c: New.
2016-06-25 Werner Koch <wk@gnupg.org>
w32: Include io.h for read(2) and write(2).
* w32/npth.c: Include io.h.
Fix problem with regression tests on recent glibc.
* configure.ac: Change pthread test to test pthread_detach
2015-11-26 Werner Koch <wk@gnupg.org>
Improve debug output.
* w32/npth.c (_npth_debug): Print to stderr.
(enter_npth, leave_npth): Include the tid in the debug output.
2015-08-25 Werner Koch <wk@gnupg.org>
Add configure option --enable-build-timestamp.
* configure.ac (BUILD_TIMESTAMP): Set to "<none>" by default. Also
with ac_define_unquoted.
2015-06-06 Jim Meyering <meyering@fb.com>
configure.ac: improve check for clock_gettime library.
* configure.ac: When using AC_SEARCH_LIBS, handle the case in which
that function returns "none required". Also, save and restore LIBS
around the check, and properly m4-quote the first argument to AC_DEFINE.
Finally, also set and AC_SUBST LIB_CLOCK_GETTIME.
This added code is very similar to that provided in gnulib's
clock-time.m4.
* tests/Makefile.am (LDADD): Append $(LIB_CLOCK_GETTIME).
2015-04-28 NIIBE Yutaka <gniibe@fsij.org>
npth-config: supply a library dependency for clock_gettime.
* configure.ac (clock_gettime): Update config_libs.
2015-04-11 Werner Koch <wk@gnupg.org>
Release 1.2.
......
......@@ -303,6 +303,7 @@ LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBSOCKET = @LIBSOCKET@
LIBTOOL = @LIBTOOL@
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
......
Noteworthy changes in version 1.3 (2016-11-22)
----------------------------------------------
* Bypass npth_protect/npth_unprotect iff the library has not yet been
initialized.
* Fix problems on macOS and AIX
* Improve detection of clock_gettime
Noteworthy changes in version 1.2 (2015-04-11)
----------------------------------------------
......
This diff is collapsed.
#! /bin/sh
# Configuration validation subroutine script.
# Copyright 1992-2015 Free Software Foundation, Inc.
# Copyright 1992-2016 Free Software Foundation, Inc.
timestamp='2015-01-01'
timestamp='2016-06-20'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
......@@ -33,7 +33,7 @@ timestamp='2015-01-01'
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
......@@ -53,8 +53,7 @@ timestamp='2015-01-01'
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS
$0 [OPTION] ALIAS
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
......@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright 1992-2015 Free Software Foundation, Inc.
Copyright 1992-2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
......@@ -117,7 +116,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
......@@ -255,11 +254,12 @@ case $basic_machine in
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| ba \
| be32 | be64 \
| bfin \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| e2k | epiphany \
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
......@@ -305,7 +305,7 @@ case $basic_machine in
| riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
......@@ -376,12 +376,13 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| ba-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
......@@ -428,12 +429,13 @@ case $basic_machine in
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
| riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
......@@ -518,6 +520,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-aros
;;
asmjs)
basic_machine=asmjs-unknown
;;
aux)
basic_machine=m68k-apple
os=-aux
......@@ -638,6 +643,14 @@ case $basic_machine in
basic_machine=m68k-bull
os=-sysv3
;;
e500v[12])
basic_machine=powerpc-unknown
os=$os"spe"
;;
e500v[12]-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
os=$os"spe"
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
......@@ -1373,18 +1386,18 @@ case $os in
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* \
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
......@@ -1393,7 +1406,8 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
| -onefs* | -tirtos* | -phoenix*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
......@@ -1525,6 +1539,8 @@ case $os in
;;
-nacl*)
;;
-ios)
;;
-none)
;;
*)
......
/* config.h.in. Generated from configure.ac by autoheader. */
/* The time this package was configured for a build */
#undef BUILD_TIMESTAMP
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Defined if we have fork-unsafe semaphore */
#undef HAVE_FORK_UNSAFE_SEMAPHORE
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for npth 1.2.
# Generated by GNU Autoconf 2.69 for npth 1.3.
#
# Report bugs to <gnupg-devel@gnupg.org>.
#
......@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='npth'
PACKAGE_TARNAME='npth'
PACKAGE_VERSION='1.2'
PACKAGE_STRING='npth 1.2'
PACKAGE_VERSION='1.3'
PACKAGE_STRING='npth 1.3'
PACKAGE_BUGREPORT='gnupg-devel@gnupg.org'
PACKAGE_URL=''
......@@ -645,6 +645,7 @@ emacs_local_vars_end
emacs_local_vars_read_only
emacs_local_vars_begin
NETLIBS
LIB_CLOCK_GETTIME
LIBSOCKET
INSERT_SOCKLEN_T
SYS_SOCKET_H
......@@ -652,9 +653,9 @@ INSERT_SIGNAL_H
INSERT_TIME_H
INSERT_SYS_TIME_H
INSERT_SYS_SELECT_H
BUILD_TIMESTAMP
BUILD_FILEVERSION
BUILD_ISODATE
BUILD_TIMESTAMP
HAVE_W64_SYSTEM_FALSE
HAVE_W64_SYSTEM_TRUE
HAVE_W32_SYSTEM_FALSE
......@@ -797,6 +798,7 @@ enable_fast_install
with_gnu_ld
with_sysroot
enable_libtool_lock
enable_build_timestamp
'
ac_precious_vars='build_alias
host_alias
......@@ -1347,7 +1349,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures npth 1.2 to adapt to many kinds of systems.
\`configure' configures npth 1.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1417,7 +1419,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of npth 1.2:";;
short | recursive ) echo "Configuration of npth 1.3:";;
esac
cat <<\_ACEOF
......@@ -1440,6 +1442,9 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-build-timestamp
set an explicit build timestamp for reproducibility.
(default is the current time in ISO-8601 format)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
......@@ -1526,7 +1531,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
npth configure 1.2
npth configure 1.3
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -1949,7 +1954,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by npth $as_me 1.2, which was
It was created by npth $as_me 1.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -2307,7 +2312,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
#
LIBNPTH_LT_CURRENT=0
LIBNPTH_LT_AGE=0
LIBNPTH_LT_REVISION=5
LIBNPTH_LT_REVISION=6
# If the API is changed in an incompatible way: increment the next counter.
NPTH_CONFIG_API_VERSION=1
......@@ -2835,7 +2840,7 @@ fi
# Define the identity of the package.
PACKAGE='npth'
VERSION='1.2'
VERSION='1.3'
cat >>confdefs.h <<_ACEOF
......@@ -12946,6 +12951,9 @@ case "${host}" in
$as_echo "#define _XOPEN_SOURCE 500" >>confdefs.h
;;
*-*-aix*)
have_fork_unsafe_semaphore=yes
;;
esac
......@@ -12957,6 +12965,11 @@ else
HAVE_LD_VERSION_SCRIPT_FALSE=
fi
if test "$have_fork_unsafe_semaphore" = yes; then
$as_echo "#define HAVE_FORK_UNSAFE_SEMAPHORE 1" >>confdefs.h
fi
# Set some default values
config_libs="-lnpth"
......@@ -13013,13 +13026,28 @@ fi
# Generate values for the DLL version info
#
if test "$have_w32_system" = yes; then
BUILD_TIMESTAMP=`date --iso-8601=minutes`
BUILD_ISODATE=`date --iso-8601`
BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
BUILD_FILEVERSION="${BUILD_FILEVERSION}48279"
BUILD_FILEVERSION="${BUILD_FILEVERSION}53688"
fi
# Check whether --enable-build-timestamp was given.
if test "${enable_build_timestamp+set}" = set; then :
enableval=$enable_build_timestamp; if test "$enableval" = "yes"; then
BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
else
BUILD_TIMESTAMP="$enableval"
fi
else
BUILD_TIMESTAMP="<none>"
fi
cat >>confdefs.h <<_ACEOF
#define BUILD_TIMESTAMP "$BUILD_TIMESTAMP"
_ACEOF
......@@ -13220,10 +13248,12 @@ fi
#
# Checks for libraries and functions.
#
# We test for pthread_detach because glibc 2.22 includes
# pthread_create but not pthread_detach.
if test "$have_w32_system" = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5
$as_echo_n "checking for library containing pthread_create... " >&6; }
if ${ac_cv_search_pthread_create+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_detach" >&5
$as_echo_n "checking for library containing pthread_detach... " >&6; }
if ${ac_cv_search_pthread_detach+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
......@@ -13236,11 +13266,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
char pthread_create ();
char pthread_detach ();
int
main ()
{
return pthread_create ();
return pthread_detach ();
;
return 0;
}
......@@ -13253,31 +13283,31 @@ for ac_lib in '' pthread; do
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_pthread_create=$ac_res
ac_cv_search_pthread_detach=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_pthread_create+:} false; then :
if ${ac_cv_search_pthread_detach+:} false; then :
break
fi
done
if ${ac_cv_search_pthread_create+:} false; then :
if ${ac_cv_search_pthread_detach+:} false; then :
else
ac_cv_search_pthread_create=no
ac_cv_search_pthread_detach=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_create" >&5
$as_echo "$ac_cv_search_pthread_create" >&6; }
ac_res=$ac_cv_search_pthread_create
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_detach" >&5
$as_echo "$ac_cv_search_pthread_detach" >&6; }
ac_res=$ac_cv_search_pthread_detach
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
case "x$ac_cv_search_pthread_create" in
case "x$ac_cv_search_pthread_detach" in
xno)
have_pthread=no
;;
......@@ -13286,7 +13316,7 @@ fi
;;
*)
have_pthread=yes
config_libs="$config_libs $ac_cv_search_pthread_create"
config_libs="$config_libs $ac_cv_search_pthread_detach"
;;
esac
if test "$have_pthread" != no; then
......@@ -13493,6 +13523,12 @@ $as_echo "$npth_cv_lib_socket" >&6; }
config_libs="$config_libs $LIBSOCKET"
# Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
# programs in the package would end up linked with that potentially-shared
# library, inducing unnecessary run-time overhead.
LIB_CLOCK_GETTIME=
gl_saved_libs=$LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
$as_echo_n "checking for library containing clock_gettime... " >&6; }
if ${ac_cv_search_clock_gettime+:} false; then :
......@@ -13546,15 +13582,18 @@ $as_echo "$ac_cv_search_clock_gettime" >&6; }
ac_res=$ac_cv_search_clock_gettime
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
if test "x$ac_cv_search_clock_gettime" != no; then
if test "$ac_cv_search_clock_gettime" != "none required"; then
LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
config_libs="$config_libs $LIB_CLOCK_GETTIME"
fi
$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
fi
LIBS=$gl_saved_libs
#
# Set NETLIBS
......@@ -14180,7 +14219,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by npth $as_me 1.2, which was
This file was extended by npth $as_me 1.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -14246,7 +14285,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
npth config.status 1.2
npth config.status 1.3
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......@@ -16240,6 +16279,6 @@ fi
echo "
$PACKAGE_NAME-$PACKAGE_VERSION prepared for make
Revision: bc97d51 (48279)
Revision: d1b8d54 (53688)
Platform: $host
"
......@@ -35,7 +35,7 @@ min_automake_version="1.14"
# the version number immediately after the release and do another
# commit and push so that the git magic is able to work.
# See below for the LT versions.
m4_define(my_version, [1.2])
m4_define(my_version, [1.3])
# Below is m4 magic to extract and compute the git revision number,
# the decimalized short revision number, a beta version string and a
......@@ -61,7 +61,7 @@ AC_INIT([npth],[my_full_version],[gnupg-devel@gnupg.org])
#
LIBNPTH_LT_CURRENT=0
LIBNPTH_LT_AGE=0
LIBNPTH_LT_REVISION=5
LIBNPTH_LT_REVISION=6
# If the API is changed in an incompatible way: increment the next counter.
NPTH_CONFIG_API_VERSION=1
......@@ -125,9 +125,15 @@ case "${host}" in
*-apple-darwin*)
AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
;;
*-*-aix*)
have_fork_unsafe_semaphore=yes
;;
esac
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
if test "$have_fork_unsafe_semaphore" = yes; then
AC_DEFINE(HAVE_FORK_UNSAFE_SEMAPHORE, 1, [Defined if we have fork-unsafe semaphore])
fi
# Set some default values
config_libs="-lnpth"
......@@ -168,16 +174,27 @@ AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
# Generate values for the DLL version info
#
if test "$have_w32_system" = yes; then
BUILD_TIMESTAMP=`date --iso-8601=minutes`
BUILD_ISODATE=`date --iso-8601`
changequote(,)dnl
BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
changequote([,])dnl
BUILD_FILEVERSION="${BUILD_FILEVERSION}git_revision_dec"
fi
AC_SUBST(BUILD_TIMESTAMP)
AC_SUBST(BUILD_ISODATE)
AC_SUBST(BUILD_FILEVERSION)
AC_ARG_ENABLE([build-timestamp],
AC_HELP_STRING([--enable-build-timestamp],
[set an explicit build timestamp for reproducibility.
(default is the current time in ISO-8601 format)]),
[if test "$enableval" = "yes"; then
BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
else
BUILD_TIMESTAMP="$enableval"
fi],
[BUILD_TIMESTAMP="<none>"])
AC_SUBST(BUILD_TIMESTAMP)
AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
[The time this package was configured for a build])
#
......@@ -237,9 +254,11 @@ AC_TYPE_SSIZE_T
#
# Checks for libraries and functions.
#
# We test for pthread_detach because glibc 2.22 includes
# pthread_create but not pthread_detach.
if test "$have_w32_system" = no; then
AC_SEARCH_LIBS([pthread_create],[pthread])
case "x$ac_cv_search_pthread_create" in
AC_SEARCH_LIBS([pthread_detach],[pthread])
case "x$ac_cv_search_pthread_detach" in
xno)
have_pthread=no
;;
......@@ -248,7 +267,7 @@ if test "$have_w32_system" = no; then
;;
*)
have_pthread=yes
config_libs="$config_libs $ac_cv_search_pthread_create"
config_libs="$config_libs $ac_cv_search_pthread_detach"
;;
esac
if test "$have_pthread" != no; then
......@@ -267,11 +286,21 @@ AC_CHECK_FUNCS([select pselect gettimeofday])
npth_LIBSOCKET
config_libs="$config_libs $LIBSOCKET"
AC_SEARCH_LIBS([clock_gettime],[rt posix4])
if test "x$ac_cv_search_clock_gettime" != no; then
AC_DEFINE(HAVE_CLOCK_GETTIME,1,
[Define to 1 if you have the `clock_gettime' function.])
fi
# Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
# programs in the package would end up linked with that potentially-shared
# library, inducing unnecessary run-time overhead.
LIB_CLOCK_GETTIME=
AC_SUBST([LIB_CLOCK_GETTIME])
gl_saved_libs=$LIBS
AC_SEARCH_LIBS([clock_gettime], [rt posix4],
[if test "$ac_cv_search_clock_gettime" != "none required"; then
LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
config_libs="$config_libs $LIB_CLOCK_GETTIME"
fi
AC_DEFINE([HAVE_CLOCK_GETTIME],1,
[Define to 1 if you have the `clock_gettime' function.])
])
LIBS=$gl_saved_libs
#
......
# This is a template. The dist target uses it to create the real file.
Summary: NPTH - the new GNU Portable Threads Library
Name: npth
Version: 1.2
Version: 1.3
Release: 1
URL: http://www.gnupg.org/
Source: ftp://ftp.gnupg.org/gcrypt/alpha
......
......@@ -272,6 +272,7 @@ LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBSOCKET = @LIBSOCKET@
LIBTOOL = @LIBTOOL@
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
......
......@@ -61,12 +61,46 @@
static sem_t sceptre_buffer;
static sem_t *sceptre = &sceptre_buffer;
/* Configure defines HAVE_FORK_UNSAFE_SEMAPHORE if child process can't
access non-shared unnamed semaphore which is created by its parent.
We use unnamed semaphore (if available) for the global lock. The
specific semaphore is only valid for those threads in a process,
and it is no use by other processes. Thus, PSHARED argument for
sem_init is naturally 0.
However, there are daemon-like applications which use fork after
npth's initialization by npth_init. In this case, a child process
uses the semaphore which was created by its parent process, while
parent does nothing with the semaphore. In some system (e.g. AIX),
access by child process to non-shared unnamed semaphore is
prohibited. For such a system, HAVE_FORK_UNSAFE_SEMAPHORE should
be defined, so that unnamed semaphore will be created with the
option PSHARED=1. The purpose of the setting of PSHARED=1 is only
for allowing the access of the lock by child process. For NPTH, it
does not mean any other interactions between processes.
*/
#ifdef HAVE_FORK_UNSAFE_SEMAPHORE
#define NPTH_SEMAPHORE_PSHARED 1
#else
#define NPTH_SEMAPHORE_PSHARED 0
#endif
/* The main thread is the active thread at the time pth_init was
called. As of now it is only useful for debugging. The volatile
make sure the compiler does not eliminate this set but not used
variable. */
static volatile pthread_t main_thread;
/* This flag is set as soon as npth_init has been called or if any
* thread has been created. It will never be cleared again. The only
* purpose is to make npth_protect and npth_unprotect more robust in
* that they can be shortcut when npth_init has not yet been called.
* This is important for libraries which want to support nPth by using
* those two functions but may have be initialized before pPth. */
static int initialized_or_any_threads;
/* Systems that don't have pthread_mutex_timedlock get a busy wait
implementation that probes the lock every BUSY_WAIT_INTERVAL
milliseconds. */
......@@ -177,12 +211,15 @@ npth_init (void)
main_thread = pthread_self();
/* Track that we have been initialized. */
initialized_or_any_threads |= 1;
/* Better reset ERRNO so that we know that it has been set by
sem_init. */
errno = 0;
/* The semaphore is not shared and binary. */
res = sem_init (sceptre, 0, 1);
/* The semaphore is binary. */
res = sem_init (sceptre, NPTH_SEMAPHORE_PSHARED, 1);
if (res < 0)
{
/* Mac OSX and some AIX versions have sem_init but return
......@@ -230,9 +267,16 @@ npth_setname_np (npth_t target_thread, const char *name)
#ifdef HAVE_PTHREAD_SETNAME_NP
#ifdef __NetBSD__
return pthread_setname_np (target_thread, "%s", (void*) name);
#else
#ifdef __APPLE__