diff options
author | Bernhard Reutner-Fischer <aldot@gcc.gnu.org> | 2014-01-23 22:17:15 +0100 |
---|---|---|
committer | Steve Ellcey <sje@gcc.gnu.org> | 2014-01-23 21:17:15 +0000 |
commit | 7370b9df65e5d88148d1d3feffc90fdff00bc1af (patch) | |
tree | 653ae282650fbf9b6ae0cf8824160ca78993a7b0 | |
parent | 393e8e8b0ca526d8909ace6303785dd522b1c8ce (diff) | |
download | gcc-7370b9df65e5d88148d1d3feffc90fdff00bc1af.zip gcc-7370b9df65e5d88148d1d3feffc90fdff00bc1af.tar.gz gcc-7370b9df65e5d88148d1d3feffc90fdff00bc1af.tar.bz2 |
acinclude.m4 (GLIBCXX_CHECK_TMPNAM): New check for tmpnam function.
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
Co-Authored-By: Steve Ellcey <sellcey@mips.com>
From-SVN: r207009
-rw-r--r-- | libstdc++-v3/ChangeLog | 9 | ||||
-rw-r--r-- | libstdc++-v3/acinclude.m4 | 27 | ||||
-rw-r--r-- | libstdc++-v3/config.h.in | 3 | ||||
-rwxr-xr-x | libstdc++-v3/configure | 75 | ||||
-rw-r--r-- | libstdc++-v3/configure.ac | 3 | ||||
-rw-r--r-- | libstdc++-v3/include/c_global/cstdio | 2 |
6 files changed, 119 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f5cfe01..211f731 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +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. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index fcdcd9a..2b60696 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -3771,6 +3771,33 @@ AC_DEFUN([GLIBCXX_ENABLE_WERROR], [ 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. diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 4c029d2..adc7d44 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -867,6 +867,9 @@ /* 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 diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 448bee3..d279951 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -20120,6 +20120,81 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +# 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 : diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 22fc840..1de0f6c 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -213,6 +213,9 @@ GLIBCXX_CHECK_GETTIMEOFDAY # 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 diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio index 25d9422..6043b3d 100644 --- a/libstdc++-v3/include/c_global/cstdio +++ b/libstdc++-v3/include/c_global/cstdio @@ -137,7 +137,9 @@ namespace std using ::sprintf; using ::sscanf; using ::tmpfile; +#if _GLIBCXX_USE_TMPNAM using ::tmpnam; +#endif using ::ungetc; using ::vfprintf; using ::vprintf; |