+2014-01-23 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
+ Steve Ellcey <sellcey@mips.com>
+
+ * acinclude.m4 (GLIBCXX_CHECK_TMPNAM): New check for tmpnam
+ function.
+ * configure.ac: Use GLIBCXX_CHECK_TMPNAM.
+ * (configure, config.h.in): Regenerate.
+ * include/c_global/cstdio: Guard ::tmpnam with _GLIBCXX_USE_TMPNAM
+
2014-01-23 Jonathan Wakely <jwakely@redhat.com>
* doc/xml/faq.xml (a-how_to_set_paths): Expand FAQ answer.
GLIBCXX_CONDITIONAL(ENABLE_WERROR, test $enable_werror = yes)
])
+dnl
+dnl Check whether obsolescent tmpnam is available in <stdio.h>,
+dnl and define _GLIBCXX_USE_TMPNAM.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_TMPNAM], [dnl
+dnl
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+dnl
+ AC_MSG_CHECKING([for tmpnam])
+ AC_CACHE_VAL(glibcxx_cv_TMPNAM, [dnl
+ GCC_TRY_COMPILE_OR_LINK(
+ [#include <stdio.h>],
+ [char *tmp = tmpnam(NULL);],
+ [glibcxx_cv_TMPNAM=yes],
+ [glibcxx_cv_TMPNAM=no])
+ ])
+ if test $glibcxx_cv_TMPNAM = yes; then
+ AC_DEFINE(_GLIBCXX_USE_TMPNAM, 1, [Define if obsolescent tmpnam is available in <stdio.h>.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_TMPNAM)
+dnl
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
dnl
dnl Check to see if sys/sdt.h exists and that it is suitable for use.
/* Define if sysctl(), CTL_HW and HW_NCPU are available in <sys/sysctl.h>. */
#undef _GLIBCXX_USE_SYSCTL_HW_NCPU
+/* Define if obsolescent tmpnam is available in <stdio.h>. */
+#undef _GLIBCXX_USE_TMPNAM
+
/* Define if code specialized for wchar_t should be used. */
#undef _GLIBCXX_USE_WCHAR_T
+# Check for tmpnam which is obsolescent in POSIX.1-2008
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tmpnam" >&5
+$as_echo_n "checking for tmpnam... " >&6; }
+ if test "${glibcxx_cv_TMPNAM+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test x$gcc_no_link = xyes; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+char *tmp = tmpnam(NULL);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ glibcxx_cv_TMPNAM=yes
+else
+ glibcxx_cv_TMPNAM=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ if test x$gcc_no_link = xyes; then
+ as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+char *tmp = tmpnam(NULL);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ glibcxx_cv_TMPNAM=yes
+else
+ glibcxx_cv_TMPNAM=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+
+fi
+
+ if test $glibcxx_cv_TMPNAM = yes; then
+
+$as_echo "#define _GLIBCXX_USE_TMPNAM 1" >>confdefs.h
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_TMPNAM" >&5
+$as_echo "$glibcxx_cv_TMPNAM" >&6; }
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default"
if test "x$ac_cv_header_locale_h" = x""yes; then :
# For clock_gettime, nanosleep and sched_yield support.
GLIBCXX_ENABLE_LIBSTDCXX_TIME
+# Check for tmpnam which is obsolescent in POSIX.1-2008
+GLIBCXX_CHECK_TMPNAM
+
AC_LC_MESSAGES
# For hardware_concurrency
using ::sprintf;
using ::sscanf;
using ::tmpfile;
+#if _GLIBCXX_USE_TMPNAM
using ::tmpnam;
+#endif
using ::ungetc;
using ::vfprintf;
using ::vprintf;