]> git.saurik.com Git - bison.git/blob - m4/mkstemp.m4
Playing with autoscan.
[bison.git] / m4 / mkstemp.m4
1 #serial 1
2
3 # On some systems (e.g., HPUX-10.20, SunOS4.1.4, solaris2.5.1), mkstemp has the
4 # silly limit that it can create no more than 26 files from a given template.
5 # Other systems lack mkstemp altogether. On either type of system, arrange
6 # to use the replacement function.
7 AC_DEFUN([UTILS_FUNC_MKSTEMP],
8 [dnl
9 AC_REPLACE_FUNCS(mkstemp)
10 if test $ac_cv_func_mkstemp = no; then
11 utils_cv_func_mkstemp_limitations=yes
12 else
13 AC_CACHE_CHECK([for mkstemp limitations],
14 utils_cv_func_mkstemp_limitations,
15 [
16 AC_TRY_RUN([
17 # include <stdlib.h>
18 int main ()
19 {
20 int i;
21 for (i = 0; i < 30; i++)
22 {
23 char template[] = "conftestXXXXXX";
24 int fd = mkstemp (template);
25 if (fd == -1)
26 exit (1);
27 close (fd);
28 }
29 exit (0);
30 }
31 ],
32 utils_cv_func_mkstemp_limitations=no,
33 utils_cv_func_mkstemp_limitations=yes,
34 utils_cv_func_mkstemp_limitations=yes
35 )
36 ]
37 )
38 fi
39
40 if test $utils_cv_func_mkstemp_limitations = yes; then
41 AC_LIBOBJ(mkstemp)
42 AC_LIBOBJ(tempname)
43 AC_DEFINE(mkstemp, rpl_mkstemp,
44 [Define to rpl_mkstemp if the replacement function should be used.])
45 fi
46 ])