2005-09-22 06:05:39 +00:00
|
|
|
#serial 12
|
2005-01-23 09:07:57 +00:00
|
|
|
|
|
|
|
|
# Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
|
|
|
|
|
# This file is free software; the Free Software Foundation
|
|
|
|
|
# gives unlimited permission to copy and/or distribute it,
|
|
|
|
|
# with or without modifications, as long as this notice is preserved.
|
2001-11-17 08:54:26 +00:00
|
|
|
|
2003-07-23 06:27:07 +00:00
|
|
|
# On some hosts (e.g., HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a
|
2001-11-20 10:37:24 +00:00
|
|
|
# silly limit that it can create no more than 26 files from a given template.
|
2003-08-27 06:42:31 +00:00
|
|
|
# Other systems lack mkstemp altogether.
|
|
|
|
|
# On OSF1/Tru64 V4.0F, the system-provided mkstemp function can create
|
|
|
|
|
# only 32 files per process.
|
|
|
|
|
# On systems like the above, arrange to use the replacement function.
|
2004-04-20 09:19:52 +00:00
|
|
|
AC_DEFUN([gl_FUNC_MKSTEMP],
|
2001-11-17 08:54:26 +00:00
|
|
|
[dnl
|
|
|
|
|
AC_REPLACE_FUNCS(mkstemp)
|
|
|
|
|
if test $ac_cv_func_mkstemp = no; then
|
2004-04-20 09:19:52 +00:00
|
|
|
gl_cv_func_mkstemp_limitations=yes
|
2001-11-17 08:54:26 +00:00
|
|
|
else
|
|
|
|
|
AC_CACHE_CHECK([for mkstemp limitations],
|
2004-04-20 09:19:52 +00:00
|
|
|
gl_cv_func_mkstemp_limitations,
|
2001-11-17 08:54:26 +00:00
|
|
|
[
|
2004-12-20 15:31:47 +00:00
|
|
|
mkdir conftest.mkstemp
|
2005-01-03 17:26:28 +00:00
|
|
|
AC_TRY_RUN([
|
2004-12-21 21:43:36 +00:00
|
|
|
# include <stdlib.h>
|
2005-01-03 17:26:28 +00:00
|
|
|
# include <unistd.h>
|
2004-12-21 21:43:36 +00:00
|
|
|
int main ()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < 70; i++)
|
|
|
|
|
{
|
2005-01-03 18:01:22 +00:00
|
|
|
char template[] = "conftest.mkstemp/coXXXXXX";
|
2004-12-21 21:43:36 +00:00
|
|
|
int fd = mkstemp (template);
|
|
|
|
|
if (fd == -1)
|
|
|
|
|
exit (1);
|
|
|
|
|
close (fd);
|
|
|
|
|
}
|
|
|
|
|
exit (0);
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
gl_cv_func_mkstemp_limitations=no,
|
|
|
|
|
gl_cv_func_mkstemp_limitations=yes,
|
|
|
|
|
gl_cv_func_mkstemp_limitations=yes
|
|
|
|
|
)
|
2004-12-21 21:46:27 +00:00
|
|
|
rm -rf conftest.mkstemp
|
2001-11-17 08:54:26 +00:00
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
fi
|
|
|
|
|
|
2004-04-20 09:19:52 +00:00
|
|
|
if test $gl_cv_func_mkstemp_limitations = yes; then
|
2001-11-17 08:54:26 +00:00
|
|
|
AC_LIBOBJ(mkstemp)
|
|
|
|
|
AC_LIBOBJ(tempname)
|
|
|
|
|
AC_DEFINE(mkstemp, rpl_mkstemp,
|
|
|
|
|
[Define to rpl_mkstemp if the replacement function should be used.])
|
2003-08-17 17:57:38 +00:00
|
|
|
gl_PREREQ_MKSTEMP
|
2004-04-13 15:28:45 +00:00
|
|
|
gl_PREREQ_TEMPNAME
|
2001-11-17 08:54:26 +00:00
|
|
|
fi
|
|
|
|
|
])
|
2003-08-17 17:57:38 +00:00
|
|
|
|
|
|
|
|
# Prerequisites of lib/mkstemp.c.
|
|
|
|
|
AC_DEFUN([gl_PREREQ_MKSTEMP],
|
|
|
|
|
[
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
# Prerequisites of lib/tempname.c.
|
2004-04-13 15:28:45 +00:00
|
|
|
AC_DEFUN([gl_PREREQ_TEMPNAME],
|
2003-08-17 17:57:38 +00:00
|
|
|
[
|
2005-09-22 06:05:39 +00:00
|
|
|
AC_CHECK_HEADERS_ONCE(sys/time.h)
|
2003-08-17 17:57:38 +00:00
|
|
|
AC_CHECK_FUNCS(__secure_getenv gettimeofday)
|
|
|
|
|
AC_CHECK_DECLS_ONCE(getenv)
|
2004-04-13 15:28:45 +00:00
|
|
|
AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])
|
2003-08-17 17:57:38 +00:00
|
|
|
])
|