Mercurial > hg > octave-kai > gnulib-hg
changeset 13120:0f4b3b66e73c
mkstemp: Fix C++ test error on mingw.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 03 Apr 2010 13:44:41 +0200 |
parents | 5fa4ec4a6e8b |
children | 472aa3de0fbb |
files | ChangeLog lib/stdlib.in.h m4/mkstemp.m4 m4/stdlib_h.m4 modules/stdlib |
diffstat | 5 files changed, 52 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +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. @@ -6,7 +15,7 @@ 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>
--- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -329,6 +329,9 @@ _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);
--- a/m4/mkstemp.m4 +++ b/m4/mkstemp.m4 @@ -1,4 +1,4 @@ -#serial 17 +#serial 18 # Copyright (C) 2001, 2003-2007, 2009-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -16,35 +16,41 @@ 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
--- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# 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, @@ -85,6 +85,7 @@ 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])
--- a/modules/stdlib +++ b/modules/stdlib @@ -62,6 +62,7 @@ -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' \