diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-04-28 11:15:47 +0300 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-04-28 11:15:47 +0300 |
commit | b5916182650e289804c5acf2d97f0db351d5d081 (patch) | |
tree | c02cfd1d5d28183a735bf2ebc2951cdf39ef8b7d /gl | |
parent | 24439b0ba094a590e837d7be362da0584103391a (diff) | |
download | gnutls-b5916182650e289804c5acf2d97f0db351d5d081.tar.gz |
Avoid linking the library on librt.
Diffstat (limited to 'gl')
-rw-r--r-- | gl/Makefile.am | 27 | ||||
-rw-r--r-- | gl/gettime.c | 48 | ||||
-rw-r--r-- | gl/glthread/threadlib.c | 73 | ||||
-rw-r--r-- | gl/intprops.h | 2 | ||||
-rw-r--r-- | gl/m4/clock_time.m4 | 31 | ||||
-rw-r--r-- | gl/m4/frexp.m4 | 10 | ||||
-rw-r--r-- | gl/m4/gettime.m4 | 13 | ||||
-rw-r--r-- | gl/m4/gnulib-cache.m4 | 6 | ||||
-rw-r--r-- | gl/m4/gnulib-comp.m4 | 19 | ||||
-rw-r--r-- | gl/m4/intl.m4 | 8 | ||||
-rw-r--r-- | gl/m4/po.m4 | 8 | ||||
-rw-r--r-- | gl/m4/putenv.m4 | 4 | ||||
-rw-r--r-- | gl/m4/stdalign.m4 | 5 | ||||
-rw-r--r-- | gl/m4/sys_types_h.m4 | 4 | ||||
-rw-r--r-- | gl/m4/timer_time.m4 | 39 | ||||
-rw-r--r-- | gl/m4/timespec.m4 | 11 | ||||
-rw-r--r-- | gl/sys_select.in.h | 16 | ||||
-rw-r--r-- | gl/sys_time.in.h | 9 | ||||
-rw-r--r-- | gl/tests/Makefile.am | 8 | ||||
-rw-r--r-- | gl/tests/malloca.h | 2 | ||||
-rw-r--r-- | gl/tests/putenv.c | 82 | ||||
-rw-r--r-- | gl/timespec.c | 3 | ||||
-rw-r--r-- | gl/timespec.h | 92 | ||||
-rw-r--r-- | gl/unistd.in.h | 4 |
24 files changed, 100 insertions, 424 deletions
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 |