gnulib: add the closeout and secure_getenv modules

* lib/close-stream.c, lib/close-stream.h, lib/closeout.c,
lib/closeout.h, lib/fpending.c, lib/fpending.h, lib/stdio-impl.h,
lib/secure_getenv.c, m4/close-stream.m4, m4/closeout.m4,
m4/fpending.m4, m4/secure_getenv.m4: New file.
* lib/Makefile.am, m4/gnulib-cache.m4, m4/gnulib-comp.m4: Update.
This commit is contained in:
Alexandre Duret-Lutz 2018-05-17 16:53:58 +02:00
parent 2076197e8d
commit 021c0ed0b5
15 changed files with 751 additions and 2 deletions

11
m4/close-stream.m4 Normal file
View file

@ -0,0 +1,11 @@
#serial 4
dnl Copyright (C) 2006-2007, 2009-2018 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 Prerequisites of lib/close-stream.c.
AC_DEFUN([gl_CLOSE_STREAM],
[
:
])

12
m4/closeout.m4 Normal file
View file

@ -0,0 +1,12 @@
# closeout.m4 serial 6
dnl Copyright (C) 2002-2003, 2005-2006, 2009-2018 Free Software Foundation,
dnl 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 Prerequisites of lib/closeout.c.
AC_DEFUN([gl_CLOSEOUT],
[
:
])

36
m4/fpending.m4 Normal file
View file

@ -0,0 +1,36 @@
# serial 22
# Copyright (C) 2000-2001, 2004-2018 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
dnl Using code from emacs, based on suggestions from Paul Eggert
dnl and Ulrich Drepper.
dnl Find out how to determine the number of pending output bytes on a stream.
dnl glibc (2.1.93 and newer) and Solaris provide __fpending. On other systems,
dnl we have to grub around in the (possibly opaque) FILE struct.
AC_DEFUN([gl_FUNC_FPENDING],
[
AC_CHECK_HEADERS_ONCE([stdio_ext.h])
fp_headers='
#include <stdio.h>
#if HAVE_STDIO_EXT_H
# include <stdio_ext.h>
#endif
'
AC_CACHE_CHECK([for __fpending], [gl_cv_func___fpending],
[
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([$fp_headers],
[[return ! __fpending (stdin);]])],
[gl_cv_func___fpending=yes],
[gl_cv_func___fpending=no])
])
if test $gl_cv_func___fpending = yes; then
AC_CHECK_DECLS([__fpending], [], [], [$fp_headers])
fi
])

View file

@ -27,18 +27,20 @@
# Specification in the form of a command-line invocation:
# gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=tools --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files argmatch argp error isatty mkstemp mkstemps progname stpcpy strverscmp sys_wait
# gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=tools --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files argmatch argp closeout error isatty mkstemp mkstemps progname secure_getenv stpcpy strverscmp sys_wait
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
gl_MODULES([
argmatch
argp
closeout
error
isatty
mkstemp
mkstemps
progname
secure_getenv
stpcpy
strverscmp
sys_wait

View file

@ -50,6 +50,8 @@ AC_DEFUN([gl_EARLY],
# Code from module c-ctype:
# Code from module c-strcase:
# Code from module c-strcaseeq:
# Code from module close-stream:
# Code from module closeout:
# Code from module configmake:
# Code from module dirname-lgpl:
# Code from module dosname:
@ -62,6 +64,7 @@ AC_DEFUN([gl_EARLY],
# Code from module fcntl-h:
# Code from module filename:
# Code from module float:
# Code from module fpending:
# Code from module getopt-gnu:
# Code from module getopt-posix:
# Code from module getprogname:
@ -97,6 +100,7 @@ AC_DEFUN([gl_EARLY],
# Code from module quotearg:
# Code from module quotearg-simple:
# Code from module rawmemchr:
# Code from module secure_getenv:
# Code from module size_max:
# Code from module sleep:
# Code from module snippet/_Noreturn:
@ -165,6 +169,9 @@ AC_SUBST([LTALLOCA])
m4_ifdef([AM_XGETTEXT_OPTION],
[AM_][XGETTEXT_OPTION([--flag=argp_error:2:c-format])
AM_][XGETTEXT_OPTION([--flag=argp_failure:4:c-format])])
gl_CLOSE_STREAM
gl_MODULE_INDICATOR([close-stream])
gl_CLOSEOUT
gl_CONFIGMAKE_PREP
gl_DIRNAME_LGPL
gl_DOUBLE_SLASH_ROOT
@ -186,6 +193,10 @@ AC_SUBST([LTALLOCA])
if test $REPLACE_ITOLD = 1; then
AC_LIBOBJ([itold])
fi
gl_FUNC_FPENDING
if test $gl_cv_func___fpending = no; then
AC_LIBOBJ([fpending])
fi
gl_FUNC_GETOPT_GNU
dnl Because of the way gl_FUNC_GETOPT_GNU is implemented (the gl_getopt_required
dnl mechanism), there is no need to do any AC_LIBOBJ or AC_SUBST here; they are
@ -296,6 +307,12 @@ AC_SUBST([LTALLOCA])
gl_PREREQ_RAWMEMCHR
fi
gl_STRING_MODULE_INDICATOR([rawmemchr])
gl_FUNC_SECURE_GETENV
if test $HAVE_SECURE_GETENV = 0; then
AC_LIBOBJ([secure_getenv])
gl_PREREQ_SECURE_GETENV
fi
gl_STDLIB_MODULE_INDICATOR([secure_getenv])
gl_SIZE_MAX
gl_FUNC_SLEEP
if test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1; then
@ -557,6 +574,10 @@ AC_DEFUN([gl_FILE_LIST], [
lib/c-strcasecmp.c
lib/c-strcaseeq.h
lib/c-strncasecmp.c
lib/close-stream.c
lib/close-stream.h
lib/closeout.c
lib/closeout.h
lib/config.charset
lib/dirname-lgpl.c
lib/dirname.h
@ -571,6 +592,8 @@ AC_DEFUN([gl_FILE_LIST], [
lib/float+.h
lib/float.c
lib/float.in.h
lib/fpending.c
lib/fpending.h
lib/getopt-cdefs.in.h
lib/getopt-core.h
lib/getopt-ext.h
@ -624,6 +647,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/rawmemchr.valgrind
lib/ref-add.sin
lib/ref-del.sin
lib/secure_getenv.c
lib/size_max.h
lib/sleep.c
lib/stat-time.c
@ -635,6 +659,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/stdbool.in.h
lib/stddef.in.h
lib/stdint.in.h
lib/stdio-impl.h
lib/stdio.in.h
lib/stdlib.in.h
lib/stpcpy.c
@ -680,6 +705,8 @@ AC_DEFUN([gl_FILE_LIST], [
m4/absolute-header.m4
m4/alloca.m4
m4/argp.m4
m4/close-stream.m4
m4/closeout.m4
m4/codeset.m4
m4/configmake.m4
m4/dirname.m4
@ -693,6 +720,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/fcntl-o.m4
m4/fcntl_h.m4
m4/float_h.m4
m4/fpending.m4
m4/getopt.m4
m4/getprogname.m4
m4/gettimeofday.m4
@ -734,6 +762,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/quote.m4
m4/quotearg.m4
m4/rawmemchr.m4
m4/secure_getenv.m4
m4/size_max.m4
m4/sleep.m4
m4/ssize_t.m4

26
m4/secure_getenv.m4 Normal file
View file

@ -0,0 +1,26 @@
# Look up an environment variable more securely.
dnl Copyright 2013-2018 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_SECURE_GETENV],
[
dnl Persuade glibc <stdlib.h> to declare secure_getenv().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([secure_getenv])
if test $ac_cv_func_secure_getenv = no; then
HAVE_SECURE_GETENV=0
fi
])
# Prerequisites of lib/secure_getenv.c.
AC_DEFUN([gl_PREREQ_SECURE_GETENV], [
AC_CHECK_FUNCS([__secure_getenv])
if test $ac_cv_func___secure_getenv = no; then
AC_CHECK_FUNCS([issetugid])
fi
AC_CHECK_FUNCS_ONCE([getuid geteuid getgid getegid])
])