X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fmkstemp.m4;h=d36daa017431ffcb54c915f941f88f9c01570aee;hb=0439822fa6b678aa4be450d5cb14b288f5c6cf0a;hp=21bcc381d3c56ecf3b55c637899778a641221de8;hpb=f860e3df20c915841665852e59cb606ff595909f;p=gnulib.git diff --git a/m4/mkstemp.m4 b/m4/mkstemp.m4 index 21bcc381d..d36daa017 100644 --- a/m4/mkstemp.m4 +++ b/m4/mkstemp.m4 @@ -1,9 +1,9 @@ -#serial 1 +#serial 2 -# On some systems (e.g., HPUX-10.20), mkstemp has the silly limit that it -# can create no more than 26 files from a given template. Other systems -# lack mkstemp altogether. On either type of system, arrange to use the -# replacement function. +# On some systems (e.g., HPUX-10.20, SunOS4.1.4, solaris2.5.1), mkstemp has the +# silly limit that it can create no more than 26 files from a given template. +# Other systems lack mkstemp altogether. On either type of system, arrange +# to use the replacement function. AC_DEFUN([UTILS_FUNC_MKSTEMP], [dnl AC_REPLACE_FUNCS(mkstemp) @@ -13,11 +13,6 @@ AC_DEFUN([UTILS_FUNC_MKSTEMP], AC_CACHE_CHECK([for mkstemp limitations], utils_cv_func_mkstemp_limitations, [ - utils_tmpdir_mkstemp=mkst-$$$$ - # Arrange for deletion-upon-exception of this temporary directory. - ac_clean_files="$ac_clean_files $utils_tmpdir_mkstemp" - mkdir $utils_tmpdir_mkstemp - AC_TRY_RUN([ # include int main () @@ -25,9 +20,11 @@ AC_DEFUN([UTILS_FUNC_MKSTEMP], int i; for (i = 0; i < 30; i++) { - char template[] = "$utils_tmpdir_mkstemp/aXXXXXX"; - if (mkstemp (template) == -1) + char template[] = "conftestXXXXXX"; + int fd = mkstemp (template); + if (fd == -1) exit (1); + close (fd); } exit (0); } @@ -36,8 +33,6 @@ AC_DEFUN([UTILS_FUNC_MKSTEMP], utils_cv_func_mkstemp_limitations=yes, utils_cv_func_mkstemp_limitations=yes ) - - rm -rf $utils_tmpdir_mkstemp ] ) fi @@ -47,5 +42,24 @@ AC_DEFUN([UTILS_FUNC_MKSTEMP], AC_LIBOBJ(tempname) AC_DEFINE(mkstemp, rpl_mkstemp, [Define to rpl_mkstemp if the replacement function should be used.]) + gl_PREREQ_MKSTEMP + jm_PREREQ_TEMPNAME fi ]) + +# Prerequisites of lib/mkstemp.c. +AC_DEFUN([gl_PREREQ_MKSTEMP], +[ +]) + +# Prerequisites of lib/tempname.c. +AC_DEFUN([jm_PREREQ_TEMPNAME], +[ + AC_REQUIRE([AC_HEADER_STDC]) + AC_REQUIRE([AC_HEADER_STAT]) + AC_CHECK_HEADERS_ONCE(fcntl.h sys/time.h unistd.h) + AC_CHECK_HEADERS(stdint.h) + AC_CHECK_FUNCS(__secure_getenv gettimeofday) + AC_CHECK_DECLS_ONCE(getenv) + AC_REQUIRE([jm_AC_TYPE_UINTMAX_T]) +])