summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rwxr-xr-xbuild-aux/config.rpath106
-rwxr-xr-xbuild-aux/gendocs.sh14
-rw-r--r--configure.ac3
-rw-r--r--gl/Makefile.am27
-rw-r--r--gl/gettime.c48
-rw-r--r--gl/glthread/threadlib.c73
-rw-r--r--gl/intprops.h2
-rw-r--r--gl/m4/clock_time.m431
-rw-r--r--gl/m4/frexp.m410
-rw-r--r--gl/m4/gettime.m413
-rw-r--r--gl/m4/gnulib-cache.m46
-rw-r--r--gl/m4/gnulib-comp.m419
-rw-r--r--gl/m4/intl.m48
-rw-r--r--gl/m4/po.m48
-rw-r--r--gl/m4/putenv.m44
-rw-r--r--gl/m4/stdalign.m45
-rw-r--r--gl/m4/sys_types_h.m44
-rw-r--r--gl/m4/timer_time.m439
-rw-r--r--gl/m4/timespec.m411
-rw-r--r--gl/sys_select.in.h16
-rw-r--r--gl/sys_time.in.h9
-rw-r--r--gl/tests/Makefile.am8
-rw-r--r--gl/tests/malloca.h2
-rw-r--r--gl/tests/putenv.c82
-rw-r--r--gl/timespec.c3
-rw-r--r--gl/timespec.h92
-rw-r--r--gl/unistd.in.h4
-rw-r--r--lib/gnutls_dtls.c1
-rw-r--r--lib/gnutls_dtls.h1
-rw-r--r--lib/gnutls_state.c1
-rw-r--r--lib/nettle/rnd.c1
-rw-r--r--lib/system.h20
-rw-r--r--src/benchmark-cipher.c1
-rw-r--r--src/benchmark.c5
-rw-r--r--src/benchmark.h15
-rw-r--r--tests/suite/Makefile.am1
-rw-r--r--tests/suite/mini-record-timing.c5
38 files changed, 196 insertions, 504 deletions
diff --git a/.gitignore b/.gitignore
index 95c9602896..6fa91ee624 100644
--- a/.gitignore
+++ b/.gitignore
@@ -635,3 +635,5 @@ tests/mini-xssl
doc/examples/ex-client-xssl1
doc/examples/ex-client-xssl2
lib/libgnutls-xssl.la
+tests/mini-alpn
+tests/mini-record-range
diff --git a/build-aux/config.rpath b/build-aux/config.rpath
index c38b914d6b..17298f2348 100755
--- a/build-aux/config.rpath
+++ b/build-aux/config.rpath
@@ -2,7 +2,7 @@
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
-# Copyright 1996-2013 Free Software Foundation, Inc.
+# Copyright 1996-2010 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
@@ -25,7 +25,7 @@
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
-# All known linkers require a '.a' archive for static linking (except MSVC,
+# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so
@@ -57,6 +57,13 @@ else
aix*)
wl='-Wl,'
;;
+ darwin*)
+ case $cc_basename in
+ xlc*)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
;;
hpux9* | hpux10* | hpux11*)
@@ -65,7 +72,9 @@ else
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ newsos6)
+ ;;
+ linux* | k*bsd*-gnu)
case $cc_basename in
ecc*)
wl='-Wl,'
@@ -76,26 +85,17 @@ else
lf95*)
wl='-Wl,'
;;
- nagfor*)
- wl='-Wl,-Wl,,'
- ;;
- pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ pgcc | pgf77 | pgf90)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
- xl* | bgxl* | bgf* | mpixl*)
- wl='-Wl,'
- ;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
- *Sun\ F* | *Sun*Fortran*)
- wl=
- ;;
*Sun\ C*)
wl='-Wl,'
;;
@@ -103,24 +103,13 @@ else
;;
esac
;;
- newsos6)
- ;;
- *nto* | *qnx*)
- ;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
rdos*)
;;
solaris*)
- case $cc_basename in
- f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
- wl='-Qoption ld '
- ;;
- *)
- wl='-Wl,'
- ;;
- esac
+ wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
@@ -182,14 +171,15 @@ if test "$with_gnu_ld" = yes; then
fi
;;
amigaos*)
- case "$host_cpu" in
- powerpc)
- ;;
- m68k)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- ;;
- esac
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we cannot use
+ # them.
+ ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
@@ -208,13 +198,11 @@ if test "$with_gnu_ld" = yes; then
ld_shlibs=no
fi
;;
- haiku*)
- ;;
interix[3-9]*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
- gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ gnu* | linux* | k*bsd*-gnu)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
@@ -337,14 +325,10 @@ else
fi
;;
amigaos*)
- case "$host_cpu" in
- powerpc)
- ;;
- m68k)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- ;;
- esac
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
;;
bsdi[45]*)
;;
@@ -358,15 +342,24 @@ else
;;
darwin* | rhapsody*)
hardcode_direct=no
- if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
+ if test "$GCC" = yes ; then
:
else
- ld_shlibs=no
+ case $cc_basename in
+ xlc*)
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
+ freebsd1*)
+ ld_shlibs=no
+ ;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
@@ -427,8 +420,6 @@ else
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
- *nto* | *qnx*)
- ;;
openbsd*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
@@ -524,12 +515,7 @@ case "$host_os" in
library_names_spec='$libname$shrext'
;;
amigaos*)
- case "$host_cpu" in
- powerpc*)
- library_names_spec='$libname$shrext' ;;
- m68k)
- library_names_spec='$libname.a' ;;
- esac
+ library_names_spec='$libname.a'
;;
beos*)
library_names_spec='$libname$shrext'
@@ -548,6 +534,8 @@ case "$host_os" in
dgux*)
library_names_spec='$libname$shrext'
;;
+ freebsd1*)
+ ;;
freebsd* | dragonfly*)
case "$host_os" in
freebsd[123]*)
@@ -559,9 +547,6 @@ case "$host_os" in
gnu*)
library_names_spec='$libname$shrext'
;;
- haiku*)
- library_names_spec='$libname$shrext'
- ;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
@@ -597,7 +582,7 @@ case "$host_os" in
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu)
library_names_spec='$libname$shrext'
;;
knetbsd*-gnu)
@@ -609,7 +594,7 @@ case "$host_os" in
newsos6)
library_names_spec='$libname$shrext'
;;
- *nto* | *qnx*)
+ nto-qnx*)
library_names_spec='$libname$shrext'
;;
openbsd*)
@@ -640,9 +625,6 @@ case "$host_os" in
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
library_names_spec='$libname$shrext'
;;
- tpf*)
- library_names_spec='$libname$shrext'
- ;;
uts4*)
library_names_spec='$libname$shrext'
;;
diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh
index e4bfc9fd2b..98c7523536 100755
--- a/build-aux/gendocs.sh
+++ b/build-aux/gendocs.sh
@@ -2,7 +2,7 @@
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
-scriptversion=2013-02-03.15
+scriptversion=2013-03-08.15
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
# Free Software Foundation, Inc.
@@ -307,6 +307,7 @@ if $generate_ascii; then
ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz"
fi
+# Split HTML at level $1. Used for texi2html.
html_split()
{
opt="--split=$1 --node-files $commonarg $htmlarg"
@@ -339,7 +340,16 @@ if test -z "$use_texi2html"; then
mv $PACKAGE.html "$outdir/"
ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz"
- opt="--html -o $PACKAGE.html --split=$split $commonarg $htmlarg"
+ # Before Texinfo 5.0, makeinfo did not accept a --split=HOW option,
+ # it just always split by node. So if we're splitting by node anyway,
+ # leave it out.
+ if test "x$split" = xnode; then
+ split_arg=
+ else
+ split_arg=--split=$split
+ fi
+ #
+ opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
printf "\nGenerating html by $split... ($cmd)\n"
eval "$cmd"
diff --git a/configure.ac b/configure.ac
index e18bbf8a54..62bde03ce1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -205,7 +205,8 @@ AC_PROG_LIBTOOL
dnl No fork on MinGW, disable some self-tests until we fix them.
-AC_CHECK_FUNCS([fork getrusage getpwuid_r daemon getpid pthread_mutex_lock],,)
+dnl Check clock_gettime and pthread_mutex_lock in libc (avoid linking to other libs)
+AC_CHECK_FUNCS([fork getrusage getpwuid_r daemon getpid clock_gettime pthread_mutex_lock],,)
AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
if test "$ac_cv_func_pthread_mutex_lock" != "yes";then
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 0b5861b6a1..8c46c18f3d 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca alphasort argp base64 bind byteswap c-ctype close connect error extensions func gendocs getaddrinfo getpass getsubopt gettext gettime hash-pjw-bare havelib iconv iconv_open-utf inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html progname read-file recv recvfrom scandir select send sendto servent setsockopt shutdown snprintf socket sockets socklen stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r timer-time timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vfprintf-posix vprintf-posix vsnprintf warnings
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca alphasort argp base64 bind byteswap c-ctype close connect error extensions func gendocs getaddrinfo getpass getsubopt gettext gettimeofday hash-pjw-bare havelib iconv iconv_open-utf inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html progname read-file recv recvfrom scandir select send sendto servent setsockopt shutdown snprintf socket sockets socklen stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vfprintf-posix vprintf-posix vsnprintf warnings
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
@@ -56,12 +56,9 @@ libgnu_la_LDFLAGS += $(HOSTENT_LIB)
libgnu_la_LDFLAGS += $(INET_NTOP_LIB)
libgnu_la_LDFLAGS += $(INET_PTON_LIB)
libgnu_la_LDFLAGS += $(LIBSOCKET)
-libgnu_la_LDFLAGS += $(LIB_CLOCK_GETTIME)
libgnu_la_LDFLAGS += $(LIB_SELECT)
-libgnu_la_LDFLAGS += $(LIB_TIMER_TIME)
libgnu_la_LDFLAGS += $(LTLIBICONV)
libgnu_la_LDFLAGS += $(LTLIBINTL)
-libgnu_la_LDFLAGS += $(LTLIBTHREAD)
libgnu_la_LDFLAGS += $(SERVENT_LIB)
## begin gnulib module accept
@@ -588,12 +585,6 @@ libgnu_la_SOURCES += gettext.h
## end gnulib module gettext-h
-## begin gnulib module gettime
-
-libgnu_la_SOURCES += gettime.c
-
-## end gnulib module gettime
-
## begin gnulib module gettimeofday
@@ -2394,14 +2385,6 @@ EXTRA_DIST += sysexits.in.h
## end gnulib module sysexits
-## begin gnulib module threadlib
-
-libgnu_la_SOURCES += glthread/threadlib.c
-
-EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
-
-## end gnulib module threadlib
-
## begin gnulib module time
BUILT_SOURCES += time.h
@@ -2453,14 +2436,6 @@ EXTRA_libgnu_la_SOURCES += time_r.c
## end gnulib module time_r
-## begin gnulib module timespec
-
-libgnu_la_SOURCES += timespec.c
-
-EXTRA_DIST += timespec.h
-
-## end gnulib module timespec
-
## begin gnulib module u64
libgnu_la_SOURCES += u64.c
diff --git a/gl/gettime.c b/gl/gettime.c
deleted file mode 100644
index 0a642dd201..0000000000
--- a/gl/gettime.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* gettime -- get the system clock
-
- Copyright (C) 2002, 2004-2007, 2009-2013 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paul Eggert. */
-
-#include <config.h>
-
-#include "timespec.h"
-
-#include <sys/time.h>
-
-/* Get the system time into *TS. */
-
-void
-gettime (struct timespec *ts)
-{
-#if HAVE_NANOTIME
- nanotime (ts);
-#else
-
-# if defined CLOCK_REALTIME && HAVE_CLOCK_GETTIME
- if (clock_gettime (CLOCK_REALTIME, ts) == 0)
- return;
-# endif
-
- {
- struct timeval tv;
- gettimeofday (&tv, NULL);
- ts->tv_sec = tv.tv_sec;
- ts->tv_nsec = tv.tv_usec * 1000;
- }
-
-#endif
-}
diff --git a/gl/glthread/threadlib.c b/gl/glthread/threadlib.c
deleted file mode 100644
index b447657302..0000000000
--- a/gl/glthread/threadlib.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Multithreading primitives.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2005. */
-
-#include <config.h>
-
-/* ========================================================================= */
-
-#if USE_POSIX_THREADS
-
-/* Use the POSIX threads library. */
-
-# include <pthread.h>
-# include <stdlib.h>
-
-# if PTHREAD_IN_USE_DETECTION_HARD
-
-/* The function to be executed by a dummy thread. */
-static void *
-dummy_thread_func (void *arg)
-{
- return arg;
-}
-
-int
-glthread_in_use (void)
-{
- static int tested;
- static int result; /* 1: linked with -lpthread, 0: only with libc */
-
- if (!tested)
- {
- pthread_t thread;
-
- if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0)
- /* Thread creation failed. */
- result = 0;
- else
- {
- /* Thread creation works. */
- void *retval;
- if (pthread_join (thread, &retval) != 0)
- abort ();
- result = 1;
- }
- tested = 1;
- }
- return result;
-}
-
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-/* This declaration is solely to ensure that after preprocessing
- this file is never empty. */
-typedef int dummy;
diff --git a/gl/intprops.h b/gl/intprops.h
index b473052d11..f57f9b4dda 100644
--- a/gl/intprops.h
+++ b/gl/intprops.h
@@ -89,7 +89,7 @@
/* Return 1 if the __typeof__ keyword works. This could be done by
'configure', but for now it's easier to do it by hand. */
-#if 2 <= __GNUC__ || 0x5110 <= __SUNPRO_C
+#if 2 <= __GNUC__ || defined __IBM__TYPEOF__ || 0x5110 <= __SUNPRO_C
# define _GL_HAVE___TYPEOF__ 1
#else
# define _GL_HAVE___TYPEOF__ 0
diff --git a/gl/m4/clock_time.m4 b/gl/m4/clock_time.m4
deleted file mode 100644
index 6597fb63a0..0000000000
--- a/gl/m4/clock_time.m4
+++ /dev/null
@@ -1,31 +0,0 @@
-# clock_time.m4 serial 10
-dnl Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-# Check for clock_gettime and clock_settime, and set LIB_CLOCK_GETTIME.
-# For a program named, say foo, you should add a line like the following
-# in the corresponding Makefile.am file:
-# foo_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
-
-AC_DEFUN([gl_CLOCK_TIME],
-[
- dnl Persuade glibc and Solaris <time.h> to declare these functions.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
- # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
-
- # 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],
- [test "$ac_cv_search_clock_gettime" = "none required" ||
- LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
- AC_CHECK_FUNCS([clock_gettime clock_settime])
- LIBS=$gl_saved_libs
-])
diff --git a/gl/m4/frexp.m4 b/gl/m4/frexp.m4
index 39097923e4..2eb98a1dcd 100644
--- a/gl/m4/frexp.m4
+++ b/gl/m4/frexp.m4
@@ -1,4 +1,4 @@
-# frexp.m4 serial 14
+# frexp.m4 serial 15
dnl Copyright (C) 2007-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -93,7 +93,7 @@ AC_DEFUN([gl_FUNC_FREXP_WORKS],
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CHECK_FUNCS_ONCE([alarm])
+ AC_CHECK_DECLS_ONCE([alarm])
AC_CACHE_CHECK([whether frexp works], [gl_cv_func_frexp_works],
[
AC_RUN_IFELSE(
@@ -101,7 +101,8 @@ AC_DEFUN([gl_FUNC_FREXP_WORKS],
#include <float.h>
#include <math.h>
#include <string.h>
-#if HAVE_ALARM
+#if HAVE_DECL_ALARM
+# include <signal.h>
# include <unistd.h>
#endif
/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
@@ -124,9 +125,10 @@ int main()
int i;
volatile double x;
double zero = 0.0;
-#if HAVE_ALARM
+#if HAVE_DECL_ALARM
/* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite
number. Let the test fail in this case. */
+ signal (SIGALRM, SIG_DFL);
alarm (5);
#endif
/* Test on denormalized numbers. */
diff --git a/gl/m4/gettime.m4 b/gl/m4/gettime.m4
deleted file mode 100644
index dc100de5e4..0000000000
--- a/gl/m4/gettime.m4
+++ /dev/null
@@ -1,13 +0,0 @@
-# gettime.m4 serial 8
-dnl Copyright (C) 2002, 2004-2006, 2009-2013 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_GETTIME],
-[
- dnl Prerequisites of lib/gettime.c.
- AC_REQUIRE([gl_CLOCK_TIME])
- AC_REQUIRE([gl_TIMESPEC])
- AC_CHECK_FUNCS_ONCE([gettimeofday nanotime])
-])
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index f73ef221f2..02ab1c2443 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -27,7 +27,7 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca alphasort argp base64 bind byteswap c-ctype close connect error extensions func gendocs getaddrinfo getpass getsubopt gettext gettime hash-pjw-bare havelib iconv iconv_open-utf inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html progname read-file recv recvfrom scandir select send sendto servent setsockopt shutdown snprintf socket sockets socklen stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r timer-time timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vfprintf-posix vprintf-posix vsnprintf warnings
+# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca alphasort argp base64 bind byteswap c-ctype close connect error extensions func gendocs getaddrinfo getpass getsubopt gettext gettimeofday hash-pjw-bare havelib iconv iconv_open-utf inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html progname read-file recv recvfrom scandir select send sendto servent setsockopt shutdown snprintf socket sockets socklen stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vfprintf-posix vprintf-posix vsnprintf warnings
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([gl/override])
@@ -50,7 +50,7 @@ gl_MODULES([
getpass
getsubopt
gettext
- gettime
+ gettimeofday
hash-pjw-bare
havelib
iconv
@@ -90,8 +90,6 @@ gl_MODULES([
sys_socket
sys_stat
time_r
- timer-time
- timespec
u64
unistd
valgrind-tests
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index c92e5ac104..4d6a3a42d4 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -61,7 +61,6 @@ AC_DEFUN([gl_EARLY],
# Code from module c-ctype-tests:
# Code from module c-strcase:
# Code from module c-strcase-tests:
- # Code from module clock-time:
# Code from module close:
# Code from module close-tests:
# Code from module closedir:
@@ -138,7 +137,6 @@ AC_DEFUN([gl_EARLY],
# Code from module getsubopt:
# Code from module gettext:
# Code from module gettext-h:
- # Code from module gettime:
# Code from module gettimeofday:
# Code from module gettimeofday-tests:
# Code from module gnumakefile:
@@ -338,8 +336,6 @@ AC_DEFUN([gl_EARLY],
# Code from module time:
# Code from module time-tests:
# Code from module time_r:
- # Code from module timer-time:
- # Code from module timespec:
# Code from module u64:
# Code from module u64-tests:
# Code from module unistd:
@@ -420,7 +416,6 @@ AC_SUBST([LTALLOCA])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([bind])
gl_BYTESWAP
- gl_CLOCK_TIME
gl_FUNC_CLOSE
if test $REPLACE_CLOSE = 1; then
AC_LIBOBJ([close])
@@ -564,7 +559,6 @@ AC_SUBST([LTALLOCA])
AM_GNU_GETTEXT_VERSION([0.18.1])
AC_SUBST([LIBINTL])
AC_SUBST([LTLIBINTL])
- gl_GETTIME
gl_FUNC_GETTIMEOFDAY
if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then
AC_LIBOBJ([gettimeofday])
@@ -862,7 +856,6 @@ AC_SUBST([LTALLOCA])
gl_HEADER_SYS_UIO
AC_PROG_MKDIR_P
gl_SYSEXITS
- gl_THREADLIB
gl_HEADER_TIME_H
gl_TIME_R
if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
@@ -870,8 +863,6 @@ AC_SUBST([LTALLOCA])
gl_PREREQ_TIME_R
fi
gl_TIME_MODULE_INDICATOR([time_r])
- gl_TIMER_TIME
- gl_TIMESPEC
gl_UNISTD_H
gl_LIBUNISTRING_LIBHEADER([0.9.2], [unistr.h])
gl_MODULE_INDICATOR([unistr/u8-mbtoucr])
@@ -1074,6 +1065,7 @@ changequote([, ])dnl
gl_SYS_IOCTL_H
AC_PROG_MKDIR_P
AC_CHECK_FUNCS_ONCE([shutdown])
+ gl_THREADLIB
gl_FUNC_UNSETENV
if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then
AC_LIBOBJ([unsetenv])
@@ -1258,9 +1250,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/getpeername.c
lib/getsubopt.c
lib/gettext.h
- lib/gettime.c
lib/gettimeofday.c
- lib/glthread/threadlib.c
lib/hash-pjw-bare.c
lib/hash-pjw-bare.h
lib/iconv.c
@@ -1368,8 +1358,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/sysexits.in.h
lib/time.in.h
lib/time_r.c
- lib/timespec.c
- lib/timespec.h
lib/u64.c
lib/u64.h
lib/unistd.c
@@ -1400,7 +1388,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/arpa_inet_h.m4
m4/base64.m4
m4/byteswap.m4
- m4/clock_time.m4
m4/close.m4
m4/closedir.m4
m4/codeset.m4
@@ -1441,7 +1428,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/getpass.m4
m4/getsubopt.m4
m4/gettext.m4
- m4/gettime.m4
m4/gettimeofday.m4
m4/glibc2.m4
m4/glibc21.m4
@@ -1568,8 +1554,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/threadlib.m4
m4/time_h.m4
m4/time_r.m4
- m4/timer_time.m4
- m4/timespec.m4
m4/uintmax_t.m4
m4/ungetc.m4
m4/unistd_h.m4
@@ -1778,6 +1762,7 @@ AC_DEFUN([gl_FILE_LIST], [
tests=lib/getpagesize.c
tests=lib/glthread/lock.c
tests=lib/glthread/lock.h
+ tests=lib/glthread/threadlib.c
tests=lib/ignore-value.h
tests=lib/inttypes.in.h
tests=lib/ioctl.c
diff --git a/gl/m4/intl.m4 b/gl/m4/intl.m4
index b8cc79f8a3..486b5cc64e 100644
--- a/gl/m4/intl.m4
+++ b/gl/m4/intl.m4
@@ -1,4 +1,4 @@
-# intl.m4 serial 17d
+# intl.m4 serial 22 (gettext-0.18.2)
dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -17,7 +17,7 @@ dnl Authors:
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
dnl Bruno Haible <haible@clisp.cons.org>, 2000-2009.
-AC_PREREQ([2.53])
+AC_PREREQ([2.60])
dnl Checks for all prerequisites of the intl subdirectory,
dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
@@ -55,7 +55,7 @@ AC_DEFUN([AM_INTL_SUBDIR],
[AC_DEFINE([ptrdiff_t], [long],
[Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
])
- AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
+ AC_CHECK_HEADERS([features.h stddef.h stdlib.h string.h])
AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \
snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
@@ -295,6 +295,6 @@ AC_DEFUN([gt_CHECK_DECL],
else
gt_value=0
fi
- AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
+ AC_DEFINE_UNQUOTED([HAVE_DECL_]m4_translit($1, [a-z], [A-Z]), [$gt_value],
[Define to 1 if you have the declaration of '$1', and to 0 if you don't.])
])
diff --git a/gl/m4/po.m4 b/gl/m4/po.m4
index 5fde6f292e..f395723435 100644
--- a/gl/m4/po.m4
+++ b/gl/m4/po.m4
@@ -1,4 +1,4 @@
-# po.m4 serial 17c
+# po.m4 serial 20 (gettext-0.18.2)
dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -17,7 +17,7 @@ dnl Authors:
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
-AC_PREREQ([2.50])
+AC_PREREQ([2.60])
dnl Checks for all prerequisites of the po subdirectory.
AC_DEFUN([AM_PO_SUBDIRS],
@@ -102,7 +102,7 @@ changequote([,])dnl
case "$ac_file" in */Makefile.in)
# Adjust a relative srcdir.
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
- ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+ ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
# In autoconf-2.13 it is called $ac_given_srcdir.
# In autoconf-2.50 it is called $srcdir.
@@ -227,7 +227,7 @@ AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
changequote(,)dnl
# Adjust a relative srcdir.
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
- ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+ ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
# In autoconf-2.13 it is called $ac_given_srcdir.
# In autoconf-2.50 it is called $srcdir.
diff --git a/gl/m4/putenv.m4 b/gl/m4/putenv.m4
index 03ed4f97db..c33b5b5170 100644
--- a/gl/m4/putenv.m4
+++ b/gl/m4/putenv.m4
@@ -1,4 +1,4 @@
-# putenv.m4 serial 19
+# putenv.m4 serial 20
dnl Copyright (C) 2002-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -52,5 +52,5 @@ AC_DEFUN([gl_FUNC_PUTENV],
# Prerequisites of lib/putenv.c.
AC_DEFUN([gl_PREREQ_PUTENV],
[
- AC_CHECK_FUNCS([_putenv])
+ AC_CHECK_DECLS([_putenv])
])
diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4
index 3d7993dbec..a866ff670b 100644
--- a/gl/m4/stdalign.m4
+++ b/gl/m4/stdalign.m4
@@ -33,8 +33,9 @@ AC_DEFUN([gl_STDALIGN_H],
#if \
(__GNUC__ || __IBMC__ || __IBMCPP__ \
|| 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
- int alignas (8) alignas_int = 1;
- char test_alignas[_Alignof (alignas_int) == 8 ? 1 : -1];
+ struct alignas_test { char c; char alignas (8) alignas_8; };
+ char test_alignas[offsetof (struct alignas_test, alignas_8) == 8
+ ? 1 : -1];
#endif
]])],
[gl_cv_header_working_stdalign_h=yes],
diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4
index 6132727f87..d15c1b3709 100644
--- a/gl/m4/sys_types_h.m4
+++ b/gl/m4/sys_types_h.m4
@@ -1,10 +1,10 @@
-# sys_types_h.m4 serial 4
+# sys_types_h.m4 serial 5
dnl Copyright (C) 2011-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_SYS_TYPES_H],
+AC_DEFUN_ONCE([gl_SYS_TYPES_H],
[
AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS])
gl_NEXT_HEADERS([sys/types.h])
diff --git a/gl/m4/timer_time.m4 b/gl/m4/timer_time.m4
deleted file mode 100644
index ea018f9a01..0000000000
--- a/gl/m4/timer_time.m4
+++ /dev/null
@@ -1,39 +0,0 @@
-# timer_time.m4 serial 2
-dnl Copyright (C) 2011-2013 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-# Check for timer_settime, and set LIB_TIMER_TIME.
-
-AC_DEFUN([gl_TIMER_TIME],
-[
- dnl Based on clock_time.m4. See details there.
-
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_THREADLIB])
-
- LIB_TIMER_TIME=
- AC_SUBST([LIB_TIMER_TIME])
- gl_saved_libs=$LIBS
- AC_SEARCH_LIBS([timer_settime], [rt posix4],
- [test "$ac_cv_search_timer_settime" = "none required" ||
- LIB_TIMER_TIME=$ac_cv_search_timer_settime])
- dnl GLIBC uses threads to emulate posix timers when kernel support
- dnl is not available (like Linux < 2.6 or when used with kFreeBSD)
- dnl Now the pthread lib is linked automatically in the normal case,
- dnl but when linking statically, it needs to be explicitly specified.
- AC_EGREP_CPP([Thread],
- [
-#include <features.h>
-#ifdef __GNU_LIBRARY__
- #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
- && !defined __UCLIBC__
- Thread emulation available
- #endif
-#endif
- ],
- [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])
- AC_CHECK_FUNCS([timer_settime])
- LIBS=$gl_saved_libs
-])
diff --git a/gl/m4/timespec.m4 b/gl/m4/timespec.m4
deleted file mode 100644
index 399404b59b..0000000000
--- a/gl/m4/timespec.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-#serial 15
-
-# Copyright (C) 2000-2001, 2003-2007, 2009-2013 Free Software Foundation, Inc.
-
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-dnl From Jim Meyering
-
-AC_DEFUN([gl_TIMESPEC], [:])
diff --git a/gl/sys_select.in.h b/gl/sys_select.in.h
index 521ccef321..2af6bfe6f6 100644
--- a/gl/sys_select.in.h
+++ b/gl/sys_select.in.h
@@ -21,23 +21,27 @@
/* On OSF/1 and Solaris 2.6, <sys/types.h> and <sys/time.h>
both include <sys/select.h>.
+ On Cygwin, <sys/time.h> includes <sys/select.h>.
Simply delegate to the system's header in this case. */
#if (@HAVE_SYS_SELECT_H@ \
- && ((defined __osf__ && defined _SYS_TYPES_H_ && defined _OSF_SOURCE) \
+ && ((defined __osf__ && defined _SYS_TYPES_H_ \
+ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
+ && defined _OSF_SOURCE) \
|| (defined __sun && defined _SYS_TYPES_H \
&& (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
- || defined __EXTENSIONS__))) \
- && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H)
+ || defined __EXTENSIONS__))))
# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
#elif (@HAVE_SYS_SELECT_H@ \
- && ((defined __osf__ && defined _SYS_TIME_H_ && defined _OSF_SOURCE) \
+ && (defined _CYGWIN_SYS_TIME_H \
+ || (defined __osf__ && defined _SYS_TIME_H_ \
+ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
+ && defined _OSF_SOURCE) \
|| (defined __sun && defined _SYS_TIME_H \
&& (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
- || defined __EXTENSIONS__))) \
- && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H)
+ || defined __EXTENSIONS__))))
# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
diff --git a/gl/sys_time.in.h b/gl/sys_time.in.h
index 656c3f13ad..3dbf632066 100644
--- a/gl/sys_time.in.h
+++ b/gl/sys_time.in.h
@@ -24,6 +24,14 @@
#endif
@PRAGMA_COLUMNS@
+/* On Cygwin, <sys/time.h> includes itself recursively via <sys/select.h>.
+ Simply delegate to the system's header in this case; it is a no-op.
+ Without this extra ifdef, the C++ gettimeofday declaration below
+ would be a forward declaration in gnulib's nested <sys/time.h>. */
+#ifdef _CYGWIN_SYS_TIME_H
+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+#else
+
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_SYS_TIME_H@
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
@@ -200,4 +208,5 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
#endif
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
+#endif /* _CYGWIN_SYS_TIME_H */
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index 8f65361a54..12e4a27a3a 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -1412,6 +1412,14 @@ EXTRA_DIST += test-init.sh
## end gnulib module test-framework-sh-tests
+## begin gnulib module threadlib
+
+libtests_a_SOURCES += glthread/threadlib.c
+
+EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
+
+## end gnulib module threadlib
+
## begin gnulib module time-tests
TESTS += test-time
diff --git a/gl/tests/malloca.h b/gl/tests/malloca.h
index 906d47a207..6fbe45eab6 100644
--- a/gl/tests/malloca.h
+++ b/gl/tests/malloca.h
@@ -92,7 +92,7 @@ extern void * nmalloca (size_t n, size_t s);
/* ------------------- Auxiliary, non-public definitions ------------------- */
/* Determine the alignment of a type at compile time. */
-#if defined __GNUC__
+#if defined __GNUC__ || defined __IBM__ALIGNOF__
# define sa_alignof __alignof__
#elif defined __cplusplus
template <class type> struct sa_alignof_helper { char __slot1; type __slot2; };
diff --git a/gl/tests/putenv.c b/gl/tests/putenv.c
index ed666afc3b..5461273084 100644
--- a/gl/tests/putenv.c
+++ b/gl/tests/putenv.c
@@ -62,7 +62,9 @@ static int
_unsetenv (const char *name)
{
size_t len;
+#if !HAVE_DECL__PUTENV
char **ep;
+#endif
if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
{
@@ -72,7 +74,7 @@ _unsetenv (const char *name)
len = strlen (name);
-#if HAVE__PUTENV
+#if HAVE_DECL__PUTENV
{
int putenv_result, putenv_errno;
char *name_ = malloc (len + 2);
@@ -125,46 +127,46 @@ putenv (char *string)
return _unsetenv (string);
}
-#if HAVE__PUTENV
- /* Rely on _putenv to allocate the new environment. If other
- parts of the application use _putenv, the !HAVE__PUTENV code
- would fight over who owns the environ vector, causing a crash. */
- if (name_end[1])
- return _putenv (string);
- else
- {
- /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ")
- to allocate the environ vector and then replace the new
- entry with "NAME=". */
- int putenv_result, putenv_errno;
- char *name_x = malloc (name_end - string + sizeof "= ");
- if (!name_x)
- return -1;
- memcpy (name_x, string, name_end - string + 1);
- name_x[name_end - string + 1] = ' ';
- name_x[name_end - string + 2] = 0;
- putenv_result = _putenv (name_x);
- putenv_errno = errno;
- for (ep = environ; *ep; ep++)
- if (strcmp (*ep, name_x) == 0)
- {
- *ep = string;
- break;
- }
+#if HAVE_DECL__PUTENV
+ /* Rely on _putenv to allocate the new environment. If other
+ parts of the application use _putenv, the !HAVE_DECL__PUTENV code
+ would fight over who owns the environ vector, causing a crash. */
+ if (name_end[1])
+ return _putenv (string);
+ else
+ {
+ /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ")
+ to allocate the environ vector and then replace the new
+ entry with "NAME=". */
+ int putenv_result, putenv_errno;
+ char *name_x = malloc (name_end - string + sizeof "= ");
+ if (!name_x)
+ return -1;
+ memcpy (name_x, string, name_end - string + 1);
+ name_x[name_end - string + 1] = ' ';
+ name_x[name_end - string + 2] = 0;
+ putenv_result = _putenv (name_x);
+ putenv_errno = errno;
+ for (ep = environ; *ep; ep++)
+ if (strcmp (*ep, name_x) == 0)
+ {
+ *ep = string;
+ break;
+ }
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- if (putenv_result == 0)
- {
- /* _putenv propagated "NAME= " into the subprocess environment;
- fix that by calling SetEnvironmentVariable directly. */
- name_x[name_end - string] = 0;
- putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1;
- putenv_errno = ENOMEM; /* ENOMEM is the only way to fail. */
- }
-# endif
- free (name_x);
- __set_errno (putenv_errno);
- return putenv_result;
+ if (putenv_result == 0)
+ {
+ /* _putenv propagated "NAME= " into the subprocess environment;
+ fix that by calling SetEnvironmentVariable directly. */
+ name_x[name_end - string] = 0;
+ putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1;
+ putenv_errno = ENOMEM; /* ENOMEM is the only way to fail. */
}
+# endif
+ free (name_x);
+ __set_errno (putenv_errno);
+ return putenv_result;
+ }
#else
for (ep = environ; *ep; ep++)
if (strncmp (*ep, string, name_end - string) == 0
@@ -186,7 +188,7 @@ putenv (char *string)
last_environ = new_environ;
environ = new_environ;
}
-#endif
return 0;
+#endif
}
diff --git a/gl/timespec.c b/gl/timespec.c
deleted file mode 100644
index 2b6098ed7b..0000000000
--- a/gl/timespec.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <config.h>
-#define _GL_TIMESPEC_INLINE _GL_EXTERN_INLINE
-#include "timespec.h"
diff --git a/gl/timespec.h b/gl/timespec.h
deleted file mode 100644
index d665e6ccf9..0000000000
--- a/gl/timespec.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* timespec -- System time interface
-
- Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2013 Free Software
- Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#if ! defined TIMESPEC_H
-# define TIMESPEC_H
-
-# include <time.h>
-
-_GL_INLINE_HEADER_BEGIN
-#ifndef _GL_TIMESPEC_INLINE
-# define _GL_TIMESPEC_INLINE _GL_INLINE
-#endif
-
-/* Return negative, zero, positive if A < B, A == B, A > B, respectively.
-
- For each time stamp T, this code assumes that either:
-
- * T.tv_nsec is in the range 0..999999999; or
- * T.tv_sec corresponds to a valid leap second on a host that supports
- leap seconds, and T.tv_nsec is in the range 1000000000..1999999999; or
- * T.tv_sec is the minimum time_t value and T.tv_nsec is -1; or
- T.tv_sec is the maximum time_t value and T.tv_nsec is 2000000000.
- This allows for special struct timespec values that are less or
- greater than all possible valid time stamps.
-
- In all these cases, it is safe to subtract two tv_nsec values and
- convert the result to integer without worrying about overflow on
- any platform of interest to the GNU project, since all such
- platforms have 32-bit int or wider.
-
- Replacing "(int) (a.tv_nsec - b.tv_nsec)" with something like
- "a.tv_nsec < b.tv_nsec ? -1 : a.tv_nsec > b.tv_nsec" would cause
- this function to work in some cases where the above assumption is
- violated, but not in all cases (e.g., a.tv_sec==1, a.tv_nsec==-2,
- b.tv_sec==0, b.tv_nsec==999999999) and is arguably not worth the
- extra instructions. Using a subtraction has the advantage of
- detecting some invalid cases on platforms that detect integer
- overflow.
-
- The (int) cast avoids a gcc -Wconversion warning. */
-
-_GL_TIMESPEC_INLINE int
-timespec_cmp (struct timespec a, struct timespec b)
-{
- return (a.tv_sec < b.tv_sec ? -1
- : a.tv_sec > b.tv_sec ? 1
- : (int) (a.tv_nsec - b.tv_nsec));
-}
-
-/* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be
- nonnegative. */
-_GL_TIMESPEC_INLINE int
-timespec_sign (struct timespec a)
-{
- return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
-}
-
-struct timespec timespec_add (struct timespec, struct timespec)
- _GL_ATTRIBUTE_CONST;
-struct timespec timespec_sub (struct timespec, struct timespec)
- _GL_ATTRIBUTE_CONST;
-struct timespec dtotimespec (double)
- _GL_ATTRIBUTE_CONST;
-
-/* Return an approximation to A, of type 'double'. */
-_GL_TIMESPEC_INLINE double
-timespectod (struct timespec a)
-{
- return a.tv_sec + a.tv_nsec / 1e9;
-}
-
-void gettime (struct timespec *);
-int settime (struct timespec const *);
-
-_GL_INLINE_HEADER_END
-
-#endif
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 675c7e6a55..2ea9af4365 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -61,8 +61,10 @@
/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
<unistd.h>. */
/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
+/* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
+ included here. */
/* But avoid namespace pollution on glibc systems. */
-#ifndef __GLIBC__
+#if !defined __GLIBC__ && !defined __osf__
# define __need_system_stdlib_h
# include <stdlib.h>
# undef __need_system_stdlib_h
diff --git a/lib/gnutls_dtls.c b/lib/gnutls_dtls.c
index 90c0f44777..30549a7afb 100644
--- a/lib/gnutls_dtls.c
+++ b/lib/gnutls_dtls.c
@@ -35,7 +35,6 @@
#include <gnutls_constate.h>
#include <gnutls_state.h>
#include <gnutls/dtls.h>
-#include <timespec.h>
#include <algorithms.h>
void
diff --git a/lib/gnutls_dtls.h b/lib/gnutls_dtls.h
index 9845ded896..443c982d38 100644
--- a/lib/gnutls_dtls.h
+++ b/lib/gnutls_dtls.h
@@ -28,7 +28,6 @@
#include <gnutls_buffers.h>
#include <gnutls_mbuffers.h>
#include <gnutls_constate.h>
-#include <timespec.h>
int _dtls_transmit(gnutls_session_t session);
int _dtls_record_check(struct record_parameters_st *rp, uint64 * _seq);
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c
index 2acaadfbaf..ce18ccaf3d 100644
--- a/lib/gnutls_state.c
+++ b/lib/gnutls_state.c
@@ -46,7 +46,6 @@
#include <system.h>
#include <random.h>
#include <gnutls/dtls.h>
-#include <timespec.h>
/* These should really be static, but src/tests.c calls them. Make
them public functions? */
diff --git a/lib/nettle/rnd.c b/lib/nettle/rnd.c
index d6340ae74a..46a76d4f4a 100644
--- a/lib/nettle/rnd.c
+++ b/lib/nettle/rnd.c
@@ -32,7 +32,6 @@
#include <locks.h>
#include <gnutls_num.h>
#include <nettle/yarrow.h>
-#include <timespec.h>
#ifdef HAVE_GETPID
# include <unistd.h> /* getpid */
#endif
diff --git a/lib/system.h b/lib/system.h
index 327a51357f..d2bfa27a6e 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -24,6 +24,8 @@
#define SYSTEM_H
#include <gnutls_int.h>
+#include <time.h>
+#include <sys/time.h>
#ifndef _WIN32
# include <sys/uio.h> /* for writev */
@@ -61,7 +63,8 @@ static inline void millisleep(unsigned int ms)
#ifdef _WIN32
Sleep(ms);
#else
-struct timespec ts;
+ struct timespec ts;
+
ts.tv_sec = 0;
ts.tv_nsec = ms*1000*1000;
@@ -69,6 +72,21 @@ struct timespec ts;
#endif
}
+/* emulate gnulib's gettime using gettimeofday to avoid linking to
+ * librt */
+inline static void
+gettime (struct timespec *t)
+{
+#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_REALTIME)
+ clock_gettime (CLOCK_REALTIME, t);
+#else
+struct timeval tv;
+ gettimeofday (&tv, NULL);
+ t->tv_sec = tv.tv_sec;
+ t->tv_nsec = tv.tv_usec * 1000;
+#endif
+}
+
int _gnutls_find_config_path(char* path, size_t max_size);
int _gnutls_ucs2_to_utf8(const void* data, size_t size, gnutls_datum_t *output);
diff --git a/src/benchmark-cipher.c b/src/benchmark-cipher.c
index 68573b687b..95e6806230 100644
--- a/src/benchmark-cipher.c
+++ b/src/benchmark-cipher.c
@@ -28,7 +28,6 @@
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
#include <time.h>
-#include "timespec.h" /* gnulib gettime */
#include "benchmark.h"
static unsigned char data[64 * 1024];
diff --git a/src/benchmark.c b/src/benchmark.c
index 5f41535c1a..6cc79e2404 100644
--- a/src/benchmark.c
+++ b/src/benchmark.c
@@ -26,11 +26,6 @@
#include <unistd.h>
#include "benchmark.h"
-#if defined(HAVE_CLOCK_GETTIME)
-# undef gettime
-# define gettime(x) clock_gettime(CLOCK_PROCESS_CPUTIME_ID, x)
-#endif
-
#define BSECS 5
int benchmark_must_finish = 0;
diff --git a/src/benchmark.h b/src/benchmark.h
index 059b477b84..fbbc9c1d07 100644
--- a/src/benchmark.h
+++ b/src/benchmark.h
@@ -23,7 +23,20 @@
#if defined(_WIN32)
# include <windows.h>
#endif
-#include "timespec.h" /* gnulib gettime */
+
+#if defined(HAVE_CLOCK_GETTIME)
+# undef gettime
+# define gettime(x) clock_gettime(CLOCK_PROCESS_CPUTIME_ID, x)
+#else
+inline static void
+gettime (struct timespec *ts)
+{
+struct timeval tv;
+ gettimeofday (&tv, NULL);
+ ts->tv_sec = tv.tv_sec;
+ ts->tv_nsec = tv.tv_usec * 1000;
+}
+#endif
typedef void (*sighandler_t)(int);
diff --git a/tests/suite/Makefile.am b/tests/suite/Makefile.am
index cb151e9b46..22abfedf26 100644
--- a/tests/suite/Makefile.am
+++ b/tests/suite/Makefile.am
@@ -93,6 +93,7 @@ endif
if !MACOSX
noinst_LTLIBRARIES = libecore.la
+mini_record_timing_LDADD = -lrt $(LDADD)
eagain_cli_LDADD = libecore.la -lrt -lm -ldl -lpthread $(LDADD)
nodist_eagain_cli_SOURCES = mini-eagain2.c
diff --git a/tests/suite/mini-record-timing.c b/tests/suite/mini-record-timing.c
index e41d45b689..a4589b26ee 100644
--- a/tests/suite/mini-record-timing.c
+++ b/tests/suite/mini-record-timing.c
@@ -48,7 +48,6 @@ int main()
#include <errno.h>
#include <time.h>
-#include <timespec.h>
#include <sys/time.h>
#include <sys/resource.h>
@@ -338,7 +337,7 @@ restart:
ret = gnutls_record_send (session, text, sizeof(text));
} while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
/* measure peer's processing time */
- gettime(&start);
+ clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start);
#define TLS_RECV
#ifdef TLS_RECV
@@ -353,7 +352,7 @@ restart:
if (taken < MAX_MEASUREMENTS(test->npoints) && ret > 0)
{
- gettime(&stop);
+ clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &stop);
taken++;
measurement = timespec_sub_ns(&stop, &start);
prev_point_ptr->measurements[prev_point_ptr->midx] = measurement;