diff options
author | Colin Watson <cjwatson@debian.org> | 2008-07-05 11:34:01 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2008-07-05 11:34:01 +0100 |
commit | 48830b669e698be88b253f6830a25071b8b889d4 (patch) | |
tree | 3179ea89bb75b40812108d7a67bf351469fefa3f /gnulib | |
parent | 36b4756a21da97fb2c4caf877afeae4414be8ce4 (diff) |
* gnulib: Upgrade to 20080701.
Diffstat (limited to 'gnulib')
-rw-r--r-- | gnulib/lib/Makefile.am | 13 | ||||
-rw-r--r-- | gnulib/lib/Makefile.in | 44 | ||||
-rw-r--r-- | gnulib/lib/open.c | 95 | ||||
-rw-r--r-- | gnulib/lib/stdio.in.h | 20 | ||||
-rw-r--r-- | gnulib/lib/tls.h | 6 | ||||
-rw-r--r-- | gnulib/m4/gnulib-cache.m4 | 30 | ||||
-rw-r--r-- | gnulib/m4/gnulib-comp.m4 | 5 | ||||
-rw-r--r-- | gnulib/m4/gnulib-tool.m4 | 28 | ||||
-rw-r--r-- | gnulib/m4/lock.m4 | 37 | ||||
-rw-r--r-- | gnulib/m4/open.m4 | 52 | ||||
-rw-r--r-- | gnulib/m4/stdio_h.m4 | 6 |
11 files changed, 304 insertions, 32 deletions
diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am index ad6deb55..d676ebad 100644 --- a/gnulib/lib/Makefile.am +++ b/gnulib/lib/Makefile.am @@ -624,6 +624,15 @@ EXTRA_libgnu_a_SOURCES += mkstemp.c ## end gnulib module mkstemp +## begin gnulib module open + + +EXTRA_DIST += open.c + +EXTRA_libgnu_a_SOURCES += open.c + +## end gnulib module open + ## begin gnulib module openat @@ -831,6 +840,8 @@ stdio.h: stdio.in.h -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \ + -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ + -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ @@ -869,6 +880,8 @@ stdio.h: stdio.in.h -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ + -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ + -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/stdio.in.h; \ } > $@-t diff --git a/gnulib/lib/Makefile.in b/gnulib/lib/Makefile.in index 1bca5e4d..bdb3a9d9 100644 --- a/gnulib/lib/Makefile.in +++ b/gnulib/lib/Makefile.in @@ -103,6 +103,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/alloca.m4 \ $(top_srcdir)/gnulib/m4/mkdtemp.m4 \ $(top_srcdir)/gnulib/m4/mkstemp.m4 \ $(top_srcdir)/gnulib/m4/onceonly.m4 \ + $(top_srcdir)/gnulib/m4/open.m4 \ $(top_srcdir)/gnulib/m4/openat.m4 \ $(top_srcdir)/gnulib/m4/pathmax.m4 \ $(top_srcdir)/gnulib/m4/printf.m4 \ @@ -291,6 +292,8 @@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_OBSTACK_PRINTF = @GNULIB_OBSTACK_PRINTF@ +GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@ GNULIB_OPEN = @GNULIB_OPEN@ GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ GNULIB_PUTENV = @GNULIB_PUTENV@ @@ -332,6 +335,7 @@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ @@ -491,6 +495,7 @@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKDIR = @REPLACE_MKDIR@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@ REPLACE_OPEN = @REPLACE_OPEN@ REPLACE_PRINTF = @REPLACE_PRINTF@ REPLACE_PUTENV = @REPLACE_PUTENV@ @@ -654,14 +659,14 @@ EXTRA_DIST = alloca.c alloca.in.h areadlink.h atexit.c canonicalize.c \ $(top_srcdir)/tools/link-warning.h config.charset ref-add.sin \ ref-del.sin $(top_srcdir)/tools/config.rpath lstat.c lstat.h \ malloc.c malloc.c malloca.h malloca.valgrind memcmp.c \ - mempcpy.c memrchr.c memset.c mkdtemp.c mkstemp.c at-func.c \ - fchmodat.c fchownat.c fstatat.c mkdirat.c openat-priv.h \ - openat-proc.c openat.c openat.h pathmax.h rawmemchr.c \ - rawmemchr.valgrind readlink.c regcomp.c regex.c regex.h \ - regex_internal.c regex_internal.h regexec.c rename.c same.c \ - same.h same-inode.h save-cwd.c save-cwd.h setenv.c sleep.c \ - snprintf.c stdarg.in.h stdbool.in.h stdint.in.h stdio.in.h \ - stdlib.in.h strcasecmp.c strncasecmp.c strchrnul.c \ + mempcpy.c memrchr.c memset.c mkdtemp.c mkstemp.c open.c \ + at-func.c fchmodat.c fchownat.c fstatat.c mkdirat.c \ + openat-priv.h openat-proc.c openat.c openat.h pathmax.h \ + rawmemchr.c rawmemchr.valgrind readlink.c regcomp.c regex.c \ + regex.h regex_internal.c regex_internal.h regexec.c rename.c \ + same.c same.h same-inode.h save-cwd.c save-cwd.h setenv.c \ + sleep.c snprintf.c stdarg.in.h stdbool.in.h stdint.in.h \ + stdio.in.h stdlib.in.h strcasecmp.c strncasecmp.c strchrnul.c \ strchrnul.valgrind strcspn.c strdup.c strerror.c string.in.h \ strings.in.h strndup.c strnlen.c strpbrk.c strsep.c siglist.h \ strsignal.c sys_select.in.h sys_socket.in.h sys_stat.in.h \ @@ -709,15 +714,15 @@ EXTRA_libgnu_a_SOURCES = alloca.c atexit.c canonicalize.c \ fnmatch_loop.c getcwd.c getlogin_r.c getopt.c getopt1.c \ gettimeofday.c glob.c hash.c lchown.c lstat.c malloc.c \ malloc.c memcmp.c mempcpy.c memrchr.c memset.c mkdtemp.c \ - mkstemp.c at-func.c fchmodat.c fchownat.c fstatat.c mkdirat.c \ - openat-proc.c openat.c rawmemchr.c readlink.c regcomp.c \ - regex.c regex_internal.c regexec.c rename.c same.c save-cwd.c \ - setenv.c sleep.c snprintf.c strcasecmp.c strncasecmp.c \ - strchrnul.c strcspn.c strdup.c strerror.c strndup.c strnlen.c \ - strpbrk.c strsep.c strsignal.c tempname.c dup-safer.c \ - fd-safer.c pipe-safer.c unsetenv.c asnprintf.c printf-args.c \ - printf-parse.c vasnprintf.c asprintf.c vasprintf.c vsnprintf.c \ - xmalloc.c xgetcwd.c + mkstemp.c open.c at-func.c fchmodat.c fchownat.c fstatat.c \ + mkdirat.c openat-proc.c openat.c rawmemchr.c readlink.c \ + regcomp.c regex.c regex_internal.c regexec.c rename.c same.c \ + save-cwd.c setenv.c sleep.c snprintf.c strcasecmp.c \ + strncasecmp.c strchrnul.c strcspn.c strdup.c strerror.c \ + strndup.c strnlen.c strpbrk.c strsep.c strsignal.c tempname.c \ + dup-safer.c fd-safer.c pipe-safer.c unsetenv.c asnprintf.c \ + printf-args.c printf-parse.c vasnprintf.c asprintf.c \ + vasprintf.c vsnprintf.c xmalloc.c xgetcwd.c LINK_WARNING_H = $(top_srcdir)/tools/link-warning.h charset_alias = $(DESTDIR)$(libdir)/charset.alias charset_tmp = $(DESTDIR)$(libdir)/charset.tmp @@ -840,6 +845,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdtemp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkstemp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat-die.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat-proc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat.Po@am__quote@ @@ -1303,6 +1309,8 @@ stdio.h: stdio.in.h -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \ + -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ + -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ @@ -1341,6 +1349,8 @@ stdio.h: stdio.in.h -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ + -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ + -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/stdio.in.h; \ } > $@-t diff --git a/gnulib/lib/open.c b/gnulib/lib/open.c new file mode 100644 index 00000000..dfac4919 --- /dev/null +++ b/gnulib/lib/open.c @@ -0,0 +1,95 @@ +/* Open a descriptor to a file. + Copyright (C) 2007-2008 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 Bruno Haible <bruno@clisp.org>, 2007. */ + +#include <config.h> + +/* Specification. */ +#include <fcntl.h> + +/* If the fchdir replacement is used, open() is defined in fchdir.c. */ +#ifndef FCHDIR_REPLACEMENT + +# include <errno.h> +# include <stdarg.h> +# include <string.h> +# include <sys/types.h> +# include <sys/stat.h> + +int +open (const char *filename, int flags, ...) +# undef open +{ + mode_t mode; + + mode = 0; + if (flags & O_CREAT) + { + va_list arg; + va_start (arg, flags); + + /* If mode_t is narrower than int, use the promoted type (int), + not mode_t. Use sizeof to guess whether mode_t is narrower; + we don't know of any practical counterexamples. */ + mode = (sizeof (mode_t) < sizeof (int) + ? va_arg (arg, int) + : va_arg (arg, mode_t)); + + va_end (arg); + } + +# if OPEN_TRAILING_SLASH_BUG + /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR + is specified, then fail. + Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> + says that + "A pathname that contains at least one non-slash character and that + ends with one or more trailing slashes shall be resolved as if a + single dot character ( '.' ) were appended to the pathname." + and + "The special filename dot shall refer to the directory specified by + its predecessor." + If the named file already exists as a directory, then + - if O_CREAT is specified, open() must fail because of the semantics + of O_CREAT, + - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX + <http://www.opengroup.org/susv3/functions/open.html> says that it + fails with errno = EISDIR in this case. + If the named file does not exist or does not name a directory, then + - if O_CREAT is specified, open() must fail since open() cannot create + directories, + - if O_WRONLY or O_RDWR is specified, open() must fail because the + file does not contain a '.' directory. */ + if (flags & (O_CREAT | O_WRONLY | O_RDWR)) + { + size_t len = strlen (filename); + if (len > 0 && filename[len - 1] == '/') + { + errno = EISDIR; + return -1; + } + } +# endif + +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + if (strcmp (filename, "/dev/null") == 0) + filename = "NUL"; +# endif + + return open (filename, flags, mode); +} +#endif diff --git a/gnulib/lib/stdio.in.h b/gnulib/lib/stdio.in.h index 434fa8e7..5d3da5e9 100644 --- a/gnulib/lib/stdio.in.h +++ b/gnulib/lib/stdio.in.h @@ -212,6 +212,26 @@ extern int vsprintf (char *str, const char *format, va_list args) # endif #endif +#if @GNULIB_OBSTACK_PRINTF@ +# if @REPLACE_OBSTACK_PRINTF@ +# define obstack_printf rpl_osbtack_printf +# define obstack_vprintf rpl_obstack_vprintf +# endif +# if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@ + struct obstack; + /* Grow an obstack with formatted output. Return the number of + bytes added to OBS. No trailing nul byte is added, and the + object should be closed with obstack_finish before use. Upon + memory allocation error, call obstack_alloc_failed_handler. Upon + other error, return -1. */ + extern int obstack_printf (struct obstack *obs, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + extern int obstack_vprintf (struct obstack *obs, const char *format, + va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); +# endif +#endif + #if @GNULIB_FOPEN@ # if @REPLACE_FOPEN@ # define fopen rpl_fopen diff --git a/gnulib/lib/tls.h b/gnulib/lib/tls.h index 09faadee..9b195063 100644 --- a/gnulib/lib/tls.h +++ b/gnulib/lib/tls.h @@ -1,5 +1,5 @@ /* Thread-local storage in multithreaded situations. - Copyright (C) 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2008 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 @@ -285,6 +285,7 @@ typedef DWORD gl_tls_key_t; { \ if (((NAME) = TlsAlloc ()) == (DWORD)-1) \ abort (); \ + (void) (DESTRUCTOR); \ } \ while (0) # define gl_tls_get(NAME) \ @@ -320,7 +321,8 @@ typedef struct } gl_tls_key_t; # define gl_tls_key_init(NAME, DESTRUCTOR) \ - (NAME).singlethread_value = NULL + ((NAME).singlethread_value = NULL, \ + (void) (DESTRUCTOR)) # define gl_tls_get(NAME) \ (NAME).singlethread_value # define gl_tls_set(NAME, POINTER) \ diff --git a/gnulib/m4/gnulib-cache.m4 b/gnulib/m4/gnulib-cache.m4 index 71c693d1..3406e0d2 100644 --- a/gnulib/m4/gnulib-cache.m4 +++ b/gnulib/m4/gnulib-cache.m4 @@ -19,7 +19,35 @@ # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) -gl_MODULES([argp atexit canonicalize dirname error fnmatch-gnu getopt glob lib-ignore lock memcmp minmax mkdtemp mkstemp regex rename setenv strcspn strerror strsep strsignal sys_select unsetenv xalloc xgetcwd xstrndup xvasprintf]) +gl_MODULES([ + argp + atexit + canonicalize + dirname + error + fnmatch-gnu + getopt + glob + lib-ignore + lock + memcmp + minmax + mkdtemp + mkstemp + regex + rename + setenv + strcspn + strerror + strsep + strsignal + sys_select + unsetenv + xalloc + xgetcwd + xstrndup + xvasprintf +]) gl_AVOID([]) gl_SOURCE_BASE([gnulib/lib]) gl_M4_BASE([gnulib/m4]) diff --git a/gnulib/m4/gnulib-comp.m4 b/gnulib/m4/gnulib-comp.m4 index ab0203a9..88b56bbe 100644 --- a/gnulib/m4/gnulib-comp.m4 +++ b/gnulib/m4/gnulib-comp.m4 @@ -122,6 +122,9 @@ AC_DEFUN([gl_INIT], gl_STDLIB_MODULE_INDICATOR([mkdtemp]) gl_FUNC_MKSTEMP gl_STDLIB_MODULE_INDICATOR([mkstemp]) + gl_FUNC_OPEN + gl_MODULE_INDICATOR([open]) + gl_FCNTL_MODULE_INDICATOR([open]) gl_FUNC_OPENAT gl_PATHMAX gl_FUNC_RAWMEMCHR @@ -428,6 +431,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/mkdtemp.c lib/mkstemp.c lib/open-safer.c + lib/open.c lib/openat-die.c lib/openat-priv.h lib/openat-proc.c @@ -572,6 +576,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/mkdtemp.m4 m4/mkstemp.m4 m4/onceonly.m4 + m4/open.m4 m4/openat.m4 m4/pathmax.m4 m4/printf.m4 diff --git a/gnulib/m4/gnulib-tool.m4 b/gnulib/m4/gnulib-tool.m4 index ef593203..4438d488 100644 --- a/gnulib/m4/gnulib-tool.m4 +++ b/gnulib/m4/gnulib-tool.m4 @@ -1,4 +1,4 @@ -# gnulib-tool.m4 serial 1 +# gnulib-tool.m4 serial 2 dnl Copyright (C) 2004-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,6 +8,9 @@ dnl The following macros need not be invoked explicitly. dnl Invoking them does nothing except to declare default arguments dnl for "gnulib-tool --import". +dnl Usage: gl_LOCAL_DIR([DIR]) +AC_DEFUN([gl_LOCAL_DIR], []) + dnl Usage: gl_MODULES([module1 module2 ...]) AC_DEFUN([gl_MODULES], []) @@ -20,14 +23,35 @@ AC_DEFUN([gl_SOURCE_BASE], []) dnl Usage: gl_M4_BASE([DIR]) AC_DEFUN([gl_M4_BASE], []) +dnl Usage: gl_PO_BASE([DIR]) +AC_DEFUN([gl_PO_BASE], []) + +dnl Usage: gl_DOC_BASE([DIR]) +AC_DEFUN([gl_DOC_BASE], []) + +dnl Usage: gl_TESTS_BASE([DIR]) +AC_DEFUN([gl_TESTS_BASE], []) + +dnl Usage: gl_WITH_TESTS +AC_DEFUN([gl_WITH_TESTS], []) + dnl Usage: gl_LIB([LIBNAME]) AC_DEFUN([gl_LIB], []) -dnl Usage: gl_LGPL +dnl Usage: gl_LGPL or gl_LGPL([VERSION]) AC_DEFUN([gl_LGPL], []) +dnl Usage: gl_MAKEFILE_NAME([FILENAME]) +AC_DEFUN([gl_MAKEFILE_NAME], []) + dnl Usage: gl_LIBTOOL AC_DEFUN([gl_LIBTOOL], []) dnl Usage: gl_MACRO_PREFIX([PREFIX]) AC_DEFUN([gl_MACRO_PREFIX], []) + +dnl Usage: gl_PO_DOMAIN([DOMAIN]) +AC_DEFUN([gl_PO_DOMAIN], []) + +dnl Usage: gl_VC_FILES([BOOLEAN]) +AC_DEFUN([gl_VC_FILES], []) diff --git a/gnulib/m4/lock.m4 b/gnulib/m4/lock.m4 index 91119335..d5902895 100644 --- a/gnulib/m4/lock.m4 +++ b/gnulib/m4/lock.m4 @@ -1,11 +1,13 @@ -# lock.m4 serial 7 (gettext-0.17) -dnl Copyright (C) 2005-2007 Free Software Foundation, Inc. +# lock.m4 serial 8 (gettext-0.18) +dnl Copyright (C) 2005-2008 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. dnl From Bruno Haible. +dnl gl_LOCK +dnl ------- dnl Tests for a multithreading library to be used. dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, dnl USE_PTH_THREADS, USE_WIN32_THREADS @@ -42,17 +44,22 @@ AC_DEFUN([gl_LOCK_EARLY_BODY], [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], [AC_REQUIRE([AC_GNU_SOURCE])]) dnl Check for multithreading. + m4_divert_text([DEFAULTS], [gl_use_threads_default=]) AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) AC_HELP_STRING([--disable-threads], [build without multithread safety]), [gl_use_threads=$enableval], - [case "$host_os" in - dnl Disable multithreading by default on OSF/1, because it interferes - dnl with fork()/exec(): When msgexec is linked with -lpthread, its child - dnl process gets an endless segmentation fault inside execvp(). - osf*) gl_use_threads=no ;; - *) gl_use_threads=yes ;; - esac + [if test -n "$gl_use_threads_default"; then + gl_use_threads="$gl_use_threads_default" + else + case "$host_os" in + dnl Disable multithreading by default on OSF/1, because it interferes + dnl with fork()/exec(): When msgexec is linked with -lpthread, its + dnl child process gets an endless segmentation fault inside execvp(). + osf*) gl_use_threads=no ;; + *) gl_use_threads=yes ;; + esac + fi ]) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then # For using <pthread.h>: @@ -262,6 +269,18 @@ AC_DEFUN([gl_PREREQ_LOCK], [ AC_REQUIRE([AC_C_INLINE]) ]) + +dnl gl_DISABLE_THREADS +dnl ------------------ +dnl Sets the gl_LOCK default so that threads are not used by default. +dnl The user can still override it at installation time, by using the +dnl configure option '--enable-threads'. + +AC_DEFUN([gl_DISABLE_THREADS], [ + m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) +]) + + dnl Survey of platforms: dnl dnl Platform Available Compiler Supports test-lock diff --git a/gnulib/m4/open.m4 b/gnulib/m4/open.m4 new file mode 100644 index 00000000..335f4e50 --- /dev/null +++ b/gnulib/m4/open.m4 @@ -0,0 +1,52 @@ +# open.m4 serial 2 +dnl Copyright (C) 2007-2008 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_FUNC_OPEN], +[ + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw* | pw*) + REPLACE_OPEN=1 + AC_LIBOBJ([open]) + ;; + *) + dnl open("foo/") should not create a file when the file name has a + dnl trailing slash. + AC_CACHE_CHECK([whether open recognizes a trailing slash], + [gl_cv_func_open_slash], + [ + AC_TRY_RUN([ +#include <fcntl.h> +#if HAVE_UNISTD_H +# include <unistd.h> +#endif +int main () +{ + return open ("conftest.sl/", O_CREAT, 0600) >= 0; +}], [gl_cv_func_open_slash=yes], [gl_cv_func_open_slash=no], + [ +changequote(,)dnl + case "$host_os" in + solaris2.[0-9]*) gl_cv_func_open_slash="guessing no" ;; + hpux*) gl_cv_func_open_slash="guessing no" ;; + *) gl_cv_func_open_slash="guessing yes" ;; + esac +changequote([,])dnl + ]) + rm -f conftest.sl + ]) + case "$gl_cv_func_open_slash" in + *no) + AC_DEFINE([OPEN_TRAILING_SLASH_BUG], 1, + [Define to 1 if open() fails to recognize a trailing slash.]) + REPLACE_OPEN=1 + AC_LIBOBJ([open]) + ;; + esac + ;; + esac +]) diff --git a/gnulib/m4/stdio_h.m4 b/gnulib/m4/stdio_h.m4 index fa262e35..4980f9e0 100644 --- a/gnulib/m4/stdio_h.m4 +++ b/gnulib/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 10 +# stdio_h.m4 serial 11 dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -21,6 +21,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], [ GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) + GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) + GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) @@ -62,6 +64,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) + HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) + REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) ]) dnl Code shared by fseeko and ftello. Determine if large files are supported, |