+2010-04-03 Bruno Haible <bruno@clisp.org>
+
+ mkstemp: Fix C++ test error on mingw.
+ * lib/stdlib.in.h (mkstemp): Use modern idiom.
+ * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Distinguish the case that the
+ function is missing and that it needs to be replaced.
+ * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_MKSTEMP.
+ * modules/stdlib (Makefile.am): Substitute HAVE_MKSTEMP.
+
2010-04-03 Bruno Haible <bruno@clisp.org>
stpncpy: Fix C++ test error on mingw.
function is missing and that it needs to be replaced.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Initialize
REPLACE_STPNCPY.
- * modules/string (Makefile.am): Replace REPLACE_STPNCPY.
+ * modules/string (Makefile.am): Substitute REPLACE_STPNCPY.
2010-04-03 Bruno Haible <bruno@clisp.org>
_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
# else
+# if ! @HAVE_MKSTEMP@
+_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
+# endif
_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
# endif
_GL_CXXALIASWARN (mkstemp);
-#serial 17
+#serial 18
# Copyright (C) 2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([AC_SYS_LARGEFILE])
- AC_CACHE_CHECK([for working mkstemp],
- [gl_cv_func_working_mkstemp],
- [
- mkdir conftest.mkstemp
- AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [AC_INCLUDES_DEFAULT],
- [[int i;
- off_t large = (off_t) 4294967295u;
- if (large < 0)
- large = 2147483647;
- for (i = 0; i < 70; i++)
- {
- char templ[] = "conftest.mkstemp/coXXXXXX";
- int (*mkstemp_function) (char *) = mkstemp;
- int fd = mkstemp_function (templ);
- if (fd < 0 || lseek (fd, large, SEEK_SET) != large)
- return 1;
- close (fd);
- }
- return 0;]])],
- [gl_cv_func_working_mkstemp=yes],
- [gl_cv_func_working_mkstemp=no],
- [gl_cv_func_working_mkstemp=no])
- rm -rf conftest.mkstemp
- ])
-
- if test $gl_cv_func_working_mkstemp != yes; then
- REPLACE_MKSTEMP=1
+ AC_CHECK_FUNCS_ONCE([mkstemp])
+ if test $ac_cv_func_mkstemp = yes; then
+ AC_CACHE_CHECK([for working mkstemp],
+ [gl_cv_func_working_mkstemp],
+ [
+ mkdir conftest.mkstemp
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [AC_INCLUDES_DEFAULT],
+ [[int i;
+ off_t large = (off_t) 4294967295u;
+ if (large < 0)
+ large = 2147483647;
+ for (i = 0; i < 70; i++)
+ {
+ char templ[] = "conftest.mkstemp/coXXXXXX";
+ int (*mkstemp_function) (char *) = mkstemp;
+ int fd = mkstemp_function (templ);
+ if (fd < 0 || lseek (fd, large, SEEK_SET) != large)
+ return 1;
+ close (fd);
+ }
+ return 0;]])],
+ [gl_cv_func_working_mkstemp=yes],
+ [gl_cv_func_working_mkstemp=no],
+ [gl_cv_func_working_mkstemp=no])
+ rm -rf conftest.mkstemp
+ ])
+ if test $gl_cv_func_working_mkstemp != yes; then
+ REPLACE_MKSTEMP=1
+ AC_LIBOBJ([mkstemp])
+ gl_PREREQ_MKSTEMP
+ fi
+ else
+ HAVE_MKSTEMP=0
AC_LIBOBJ([mkstemp])
gl_PREREQ_MKSTEMP
fi
-# stdlib_h.m4 serial 27
+# stdlib_h.m4 serial 28
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP])
HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS])
+ HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP])
HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS])
HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
-e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
+ -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
-e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
-e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
-e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \