3 # On some systems (e.g., HPUX-10.20), mkstemp has the silly limit that it
4 # can create no more than 26 files from a given template. Other systems
5 # lack mkstemp altogether. On either type of system, arrange to use the
6 # replacement function.
7 AC_DEFUN([UTILS_FUNC_MKSTEMP],
9 AC_REPLACE_FUNCS(mkstemp)
10 if test $ac_cv_func_mkstemp = no; then
11 utils_cv_func_mkstemp_limitations=yes
13 AC_CACHE_CHECK([for mkstemp limitations],
14 utils_cv_func_mkstemp_limitations,
16 utils_tmpdir_mkstemp=mkst-$$$$
17 # Arrange for deletion-upon-exception of this temporary directory.
18 ac_clean_files="$ac_clean_files $utils_tmpdir_mkstemp"
19 mkdir $utils_tmpdir_mkstemp
26 for (i = 0; i < 30; i++)
28 char template[] = "$utils_tmpdir_mkstemp/aXXXXXX";
29 if (mkstemp (template) == -1)
35 utils_cv_func_mkstemp_limitations=no,
36 utils_cv_func_mkstemp_limitations=yes,
37 utils_cv_func_mkstemp_limitations=yes
40 rm -rf $utils_tmpdir_mkstemp
45 if test $utils_cv_func_mkstemp_limitations = yes; then
48 AC_DEFINE(mkstemp, rpl_mkstemp,
49 [Define to rpl_mkstemp if the replacement function should be used.])