3
# On some hosts (e.g., HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a
4
# silly limit that it can create no more than 26 files from a given template.
5
# Other systems lack mkstemp altogether.
6
# On OSF1/Tru64 V4.0F, the system-provided mkstemp function can create
7
# only 32 files per process.
8
# On systems like the above, arrange to use the replacement function.
9
AC_DEFUN([gl_FUNC_MKSTEMP],
11
AC_REPLACE_FUNCS(mkstemp)
12
if test $ac_cv_func_mkstemp = no; then
13
gl_cv_func_mkstemp_limitations=yes
15
AC_CACHE_CHECK([for mkstemp limitations],
16
gl_cv_func_mkstemp_limitations,
23
for (i = 0; i < 70; i++)
25
char template[] = "conftestXXXXXX";
26
int fd = mkstemp (template);
34
gl_cv_func_mkstemp_limitations=no,
35
gl_cv_func_mkstemp_limitations=yes,
36
gl_cv_func_mkstemp_limitations=yes
42
if test $gl_cv_func_mkstemp_limitations = yes; then
45
AC_DEFINE(mkstemp, rpl_mkstemp,
46
[Define to rpl_mkstemp if the replacement function should be used.])
52
# Prerequisites of lib/mkstemp.c.
53
AC_DEFUN([gl_PREREQ_MKSTEMP],
57
# Prerequisites of lib/tempname.c.
58
AC_DEFUN([gl_PREREQ_TEMPNAME],
60
AC_REQUIRE([AC_HEADER_STAT])
61
AC_CHECK_HEADERS_ONCE(fcntl.h sys/time.h unistd.h)
62
AC_CHECK_HEADERS(stdint.h)
63
AC_CHECK_FUNCS(__secure_getenv gettimeofday)
64
AC_CHECK_DECLS_ONCE(getenv)
65
AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])