mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Import 'lstat' and 'mkstemp' modules from Gnulib.
* lib/mkstemp.c: * lib/secure_getenv.c: * lib/tempname.c: * lib/tempname.h: * m4/mkstemp.m4: * m4/secure_getenv.m4: * m4/tempname.m4: New files. * lib/Makefile.am: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: Add modules.
This commit is contained in:
parent
b0a3149955
commit
f9d4a040b4
10 changed files with 626 additions and 2 deletions
|
@ -27,7 +27,7 @@
|
|||
|
||||
|
||||
# Specification in the form of a command-line invocation:
|
||||
# gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap c-strcase canonicalize-lgpl ceil clock-time close connect copysign dirfd duplocale environ extensions flock floor fpieee frexp fstat full-read full-write func gendocs getaddrinfo getlogin getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isfinite isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe-posix pipe2 poll putenv recv recvfrom regex rename select send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat time times trunc verify vsnprintf warnings wchar
|
||||
# gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap c-strcase canonicalize-lgpl ceil clock-time close connect copysign dirfd duplocale environ extensions flock floor fpieee frexp fstat full-read full-write func gendocs getaddrinfo getlogin getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isfinite isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p lstat maintainer-makefile malloc-gnu malloca mkstemp nl_langinfo nproc open pipe-posix pipe2 poll putenv recv recvfrom regex rename select send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat time times trunc verify vsnprintf warnings wchar
|
||||
|
||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||
gl_LOCAL_DIR([gnulib-local])
|
||||
|
@ -83,9 +83,11 @@ gl_MODULES([
|
|||
localcharset
|
||||
locale
|
||||
log1p
|
||||
lstat
|
||||
maintainer-makefile
|
||||
malloc-gnu
|
||||
malloca
|
||||
mkstemp
|
||||
nl_langinfo
|
||||
nproc
|
||||
open
|
||||
|
|
|
@ -144,6 +144,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module mbsinit:
|
||||
# Code from module mbtowc:
|
||||
# Code from module memchr:
|
||||
# Code from module mkstemp:
|
||||
# Code from module msvc-inval:
|
||||
# Code from module msvc-nothrow:
|
||||
# Code from module multiarch:
|
||||
|
@ -171,6 +172,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module safe-read:
|
||||
# Code from module safe-write:
|
||||
# Code from module same-inode:
|
||||
# Code from module secure_getenv:
|
||||
# Code from module select:
|
||||
# Code from module send:
|
||||
# Code from module sendto:
|
||||
|
@ -212,6 +214,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module sys_times:
|
||||
# Code from module sys_types:
|
||||
# Code from module sys_uio:
|
||||
# Code from module tempname:
|
||||
# Code from module threadlib:
|
||||
gl_THREADLIB_EARLY
|
||||
# Code from module time:
|
||||
|
@ -567,6 +570,12 @@ AC_SUBST([LTALLOCA])
|
|||
gl_PREREQ_MEMCHR
|
||||
fi
|
||||
gl_STRING_MODULE_INDICATOR([memchr])
|
||||
gl_FUNC_MKSTEMP
|
||||
if test $HAVE_MKSTEMP = 0 || test $REPLACE_MKSTEMP = 1; then
|
||||
AC_LIBOBJ([mkstemp])
|
||||
gl_PREREQ_MKSTEMP
|
||||
fi
|
||||
gl_STDLIB_MODULE_INDICATOR([mkstemp])
|
||||
gl_MSVC_INVAL
|
||||
if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
|
||||
AC_LIBOBJ([msvc-inval])
|
||||
|
@ -662,6 +671,12 @@ AC_SUBST([LTALLOCA])
|
|||
gl_MATH_MODULE_INDICATOR([round])
|
||||
gl_PREREQ_SAFE_READ
|
||||
gl_PREREQ_SAFE_WRITE
|
||||
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_FUNC_SELECT
|
||||
if test $REPLACE_SELECT = 1; then
|
||||
AC_LIBOBJ([select])
|
||||
|
@ -759,6 +774,7 @@ AC_SUBST([LTALLOCA])
|
|||
AC_PROG_MKDIR_P
|
||||
gl_HEADER_SYS_UIO
|
||||
AC_PROG_MKDIR_P
|
||||
gl_FUNC_GEN_TEMPNAME
|
||||
gl_THREADLIB
|
||||
gl_HEADER_TIME_H
|
||||
gl_TIME_R
|
||||
|
@ -1059,6 +1075,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/mbtowc.c
|
||||
lib/memchr.c
|
||||
lib/memchr.valgrind
|
||||
lib/mkstemp.c
|
||||
lib/msvc-inval.c
|
||||
lib/msvc-inval.h
|
||||
lib/msvc-nothrow.c
|
||||
|
@ -1100,6 +1117,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/safe-write.c
|
||||
lib/safe-write.h
|
||||
lib/same-inode.h
|
||||
lib/secure_getenv.c
|
||||
lib/select.c
|
||||
lib/send.c
|
||||
lib/sendto.c
|
||||
|
@ -1140,6 +1158,8 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/sys_times.in.h
|
||||
lib/sys_types.in.h
|
||||
lib/sys_uio.in.h
|
||||
lib/tempname.c
|
||||
lib/tempname.h
|
||||
lib/time.in.h
|
||||
lib/time_r.c
|
||||
lib/times.c
|
||||
|
@ -1257,6 +1277,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/mbstate_t.m4
|
||||
m4/mbtowc.m4
|
||||
m4/memchr.m4
|
||||
m4/mkstemp.m4
|
||||
m4/mmap-anon.m4
|
||||
m4/mode_t.m4
|
||||
m4/msvc-inval.m4
|
||||
|
@ -1285,6 +1306,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/round.m4
|
||||
m4/safe-read.m4
|
||||
m4/safe-write.m4
|
||||
m4/secure_getenv.m4
|
||||
m4/select.m4
|
||||
m4/servent.m4
|
||||
m4/setenv.m4
|
||||
|
@ -1316,6 +1338,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/sys_times_h.m4
|
||||
m4/sys_types_h.m4
|
||||
m4/sys_uio_h.m4
|
||||
m4/tempname.m4
|
||||
m4/threadlib.m4
|
||||
m4/time_h.m4
|
||||
m4/time_r.m4
|
||||
|
|
82
m4/mkstemp.m4
Normal file
82
m4/mkstemp.m4
Normal file
|
@ -0,0 +1,82 @@
|
|||
#serial 23
|
||||
|
||||
# Copyright (C) 2001, 2003-2007, 2009-2014 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.
|
||||
|
||||
# On some hosts (e.g., HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a
|
||||
# silly limit that it can create no more than 26 files from a given template.
|
||||
# Other systems lack mkstemp altogether.
|
||||
# On OSF1/Tru64 V4.0F, the system-provided mkstemp function can create
|
||||
# only 32 files per process.
|
||||
# On some hosts, mkstemp creates files with mode 0666, which is a security
|
||||
# problem and a violation of POSIX 2008.
|
||||
# On systems like the above, arrange to use the replacement function.
|
||||
AC_DEFUN([gl_FUNC_MKSTEMP],
|
||||
[
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
||||
|
||||
AC_CHECK_FUNCS_ONCE([mkstemp])
|
||||
if test $ac_cv_func_mkstemp = yes; then
|
||||
AC_CACHE_CHECK([for working mkstemp],
|
||||
[gl_cv_func_working_mkstemp],
|
||||
[
|
||||
mkdir conftest.mkstemp
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[AC_INCLUDES_DEFAULT],
|
||||
[[int result = 0;
|
||||
int i;
|
||||
off_t large = (off_t) 4294967295u;
|
||||
if (large < 0)
|
||||
large = 2147483647;
|
||||
umask (0);
|
||||
for (i = 0; i < 70; i++)
|
||||
{
|
||||
char templ[] = "conftest.mkstemp/coXXXXXX";
|
||||
int (*mkstemp_function) (char *) = mkstemp;
|
||||
int fd = mkstemp_function (templ);
|
||||
if (fd < 0)
|
||||
result |= 1;
|
||||
else
|
||||
{
|
||||
struct stat st;
|
||||
if (lseek (fd, large, SEEK_SET) != large)
|
||||
result |= 2;
|
||||
if (fstat (fd, &st) < 0)
|
||||
result |= 4;
|
||||
else if (st.st_mode & 0077)
|
||||
result |= 8;
|
||||
if (close (fd))
|
||||
result |= 16;
|
||||
}
|
||||
}
|
||||
return result;]])],
|
||||
[gl_cv_func_working_mkstemp=yes],
|
||||
[gl_cv_func_working_mkstemp=no],
|
||||
[case "$host_os" in
|
||||
# Guess yes on glibc systems.
|
||||
*-gnu*) gl_cv_func_working_mkstemp="guessing yes" ;;
|
||||
# If we don't know, assume the worst.
|
||||
*) gl_cv_func_working_mkstemp="guessing no" ;;
|
||||
esac
|
||||
])
|
||||
rm -rf conftest.mkstemp
|
||||
])
|
||||
case "$gl_cv_func_working_mkstemp" in
|
||||
*yes) ;;
|
||||
*)
|
||||
REPLACE_MKSTEMP=1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
HAVE_MKSTEMP=0
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/mkstemp.c.
|
||||
AC_DEFUN([gl_PREREQ_MKSTEMP],
|
||||
[
|
||||
])
|
25
m4/secure_getenv.m4
Normal file
25
m4/secure_getenv.m4
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Look up an environment variable more securely.
|
||||
dnl Copyright 2013-2014 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
|
||||
])
|
19
m4/tempname.m4
Normal file
19
m4/tempname.m4
Normal file
|
@ -0,0 +1,19 @@
|
|||
#serial 5
|
||||
|
||||
# Copyright (C) 2006-2007, 2009-2014 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.
|
||||
|
||||
# glibc provides __gen_tempname as a wrapper for mk[ds]temp. Expose
|
||||
# it as a public API, and provide it on systems that are lacking.
|
||||
AC_DEFUN([gl_FUNC_GEN_TEMPNAME],
|
||||
[
|
||||
gl_PREREQ_TEMPNAME
|
||||
])
|
||||
|
||||
# Prerequisites of lib/tempname.c.
|
||||
AC_DEFUN([gl_PREREQ_TEMPNAME],
|
||||
[
|
||||
:
|
||||
])
|
Loading…
Add table
Add a link
Reference in a new issue