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([UTILS_FUNC_MKSTEMP],
11 AC_REPLACE_FUNCS(mkstemp)
12 if test $ac_cv_func_mkstemp = no; then
13 utils_cv_func_mkstemp_limitations=yes
15 AC_CACHE_CHECK([for mkstemp limitations],
16 utils_cv_func_mkstemp_limitations,
23 for (i = 0; i < 70; i++)
25 char template[] = "conftestXXXXXX";
26 int fd = mkstemp (template);
34 utils_cv_func_mkstemp_limitations=no,
35 utils_cv_func_mkstemp_limitations=yes,
36 utils_cv_func_mkstemp_limitations=yes
42 if test $utils_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],
61 int rpl_mkstemp (char *templ);
69 # Prerequisites of lib/tempname.c.
70 AC_DEFUN([jm_PREREQ_TEMPNAME],
72 AC_REQUIRE([AC_HEADER_STAT])
73 AC_CHECK_HEADERS_ONCE(fcntl.h sys/time.h unistd.h)
74 AC_CHECK_HEADERS(stdint.h)
75 AC_CHECK_FUNCS(__secure_getenv gettimeofday lstat)
76 AC_CHECK_DECLS_ONCE(getenv)
77 # AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
79 dnl Under Win32, mkdir prototype in io.h has only one arg
80 AC_MSG_CHECKING(whether mkdir accepts only one arg)
81 AC_TRY_COMPILE([#include <sys/types.h>
83 #include <fcntl.h>], [
85 ], [ AC_MSG_RESULT(yes)
86 AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],