3 # Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
8 # On some hosts (e.g., HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a
9 # silly limit that it can create no more than 26 files from a given template.
10 # Other systems lack mkstemp altogether.
11 # On OSF1/Tru64 V4.0F, the system-provided mkstemp function can create
12 # only 32 files per process.
13 # On systems like the above, arrange to use the replacement function.
14 AC_DEFUN([gl_FUNC_MKSTEMP],
16 AC_REPLACE_FUNCS(mkstemp)
17 if test $ac_cv_func_mkstemp = no; then
18 gl_cv_func_mkstemp_limitations=yes
20 AC_CACHE_CHECK([for mkstemp limitations],
21 gl_cv_func_mkstemp_limitations,
23 mkdir conftest.mkstemp
30 for (i = 0; i < 70; i++)
32 char template[] = "conftest.mkstemp/coXXXXXX";
33 int fd = mkstemp (template);
41 gl_cv_func_mkstemp_limitations=no,
42 gl_cv_func_mkstemp_limitations=yes,
43 gl_cv_func_mkstemp_limitations=yes
45 rm -rf conftest.mkstemp
50 if test $gl_cv_func_mkstemp_limitations = yes; then
53 AC_DEFINE(mkstemp, rpl_mkstemp,
54 [Define to rpl_mkstemp if the replacement function should be used.])
60 # Prerequisites of lib/mkstemp.c.
61 AC_DEFUN([gl_PREREQ_MKSTEMP],
65 # Prerequisites of lib/tempname.c.
66 AC_DEFUN([gl_PREREQ_TEMPNAME],
68 AC_CHECK_HEADERS_ONCE(sys/time.h stdint.h unistd.h)
69 AC_CHECK_FUNCS(__secure_getenv gettimeofday)
70 AC_CHECK_DECLS_ONCE(getenv)
71 AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])