From 0b9fc9fee84ec9de6de8d95ee670bc121b298331 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 14 May 2015 12:47:19 +0100 Subject: [PATCH] re PR libstdc++/66018 (opendir configure test not working when GCC_NO_EXECUTABLES) PR libstdc++/66018 * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for struct dirent.d_type. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac (AC_STRUCT_DIRENT_D_TYPE): Remove. From-SVN: r223194 --- libstdc++-v3/ChangeLog | 9 ++ libstdc++-v3/acinclude.m4 | 16 ++ libstdc++-v3/config.h.in | 20 +-- libstdc++-v3/configure | 332 ++++++++------------------------------ libstdc++-v3/configure.ac | 1 - 5 files changed, 100 insertions(+), 278 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 05073316b25..000bcd56bca 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2015-05-14 Jonathan Wakely + + PR libstdc++/66018 + * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for struct + dirent.d_type. + * config.h.in: Regenerate. + * configure: Regenerate. + * configure.ac (AC_STRUCT_DIRENT_D_TYPE): Remove. + 2015-05-13 Eric Botcazou * acinclude.m4 (GLIBCXX_ENABLE_SJLJ_EXCEPTIONS): Delete. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 46e303c0b13..b2b48cc2944 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -3874,6 +3874,22 @@ dnl AC_LANG_CPLUSPLUS ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -fno-exceptions" +dnl + AC_MSG_CHECKING([for struct dirent.d_type]) + AC_CACHE_VAL(glibcxx_cv_dirent_d_type, [dnl + GCC_TRY_COMPILE_OR_LINK( + [#include ], + [ + struct dirent d; + if (sizeof d.d_type) return 0; + ], + [glibcxx_cv_dirent_d_type=yes], + [glibcxx_cv_dirent_d_type=no]) + ]) + if test $glibcxx_cv_dirent_d_type = yes; then + AC_DEFINE(_GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE, 1, [Define to 1 if `d_type' is a member of `struct dirent'.]) + fi + AC_MSG_RESULT($glibcxx_cv_dirent_d_type) dnl AC_MSG_CHECKING([for realpath]) AC_CACHE_VAL(glibcxx_cv_realpath, [dnl diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 945d44ecad4..b833c811c51 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -54,8 +54,7 @@ /* Define to 1 if you have the `cosl' function. */ #undef HAVE_COSL -/* Define to 1 if you have the header file, and it defines `DIR'. - */ +/* Define to 1 if you have the header file. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ @@ -301,9 +300,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_NAN_H -/* Define to 1 if you have the header file, and it defines `DIR'. */ -#undef HAVE_NDIR_H - /* Define if poll is available in . */ #undef HAVE_POLL @@ -382,9 +378,6 @@ /* Define to 1 if you have the `strtold' function. */ #undef HAVE_STRTOLD -/* Define to 1 if `struct dirent' is a member of `d_type'. */ -#undef HAVE_STRUCT_DIRENT_D_TYPE - /* Define if strxfrm_l is available in . */ #undef HAVE_STRXFRM_L @@ -392,10 +385,6 @@ to different versions. */ #undef HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_DIR_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILIO_H @@ -411,10 +400,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MACHINE_H -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_NDIR_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H @@ -753,6 +738,9 @@ /* Define if gthreads library is available. */ #undef _GLIBCXX_HAS_GTHREADS +/* Define to 1 if `d_type' is a member of `struct dirent'. */ +#undef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE + /* Define to 1 if a full hosted library is built, or 0 if freestanding. */ #undef _GLIBCXX_HOSTED diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index c206bcf9a45..d30cd188b4e 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -2553,63 +2553,6 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_cxx_check_type - -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -11651,7 +11594,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11654 "configure" +#line 11597 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11757,7 +11700,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11760 "configure" +#line 11703 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15443,7 +15386,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; } # Fake what AC_TRY_COMPILE does. cat > conftest.$ac_ext << EOF -#line 15446 "configure" +#line 15389 "configure" int main() { typedef bool atomic_type; @@ -15478,7 +15421,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15481 "configure" +#line 15424 "configure" int main() { typedef short atomic_type; @@ -15513,7 +15456,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15516 "configure" +#line 15459 "configure" int main() { // NB: _Atomic_word not necessarily int. @@ -15549,7 +15492,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15552 "configure" +#line 15495 "configure" int main() { typedef long long atomic_type; @@ -15628,7 +15571,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15631 "configure" +#line 15574 "configure" int main() { _Decimal32 d1; @@ -15670,7 +15613,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15673 "configure" +#line 15616 "configure" template struct same { typedef T2 type; }; @@ -15704,7 +15647,7 @@ $as_echo "$enable_int128" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15707 "configure" +#line 15650 "configure" template struct same { typedef T2 type; }; @@ -78852,201 +78795,6 @@ fi done -ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 -$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include <$ac_hdr> - -int -main () -{ -if ((DIR *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_ac_Header=yes" -else - eval "$as_ac_Header=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_ac_Header - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 -_ACEOF - -ac_header_dirent=$ac_hdr; break -fi - -done -# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. -if test $ac_header_dirent = dirent.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char opendir (); -int -main () -{ -return opendir (); - ; - return 0; -} -_ACEOF -for ac_lib in '' dir; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if test x$gcc_no_link = xyes; then - as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 -fi -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_opendir=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : - break -fi -done -if test "${ac_cv_search_opendir+set}" = set; then : - -else - ac_cv_search_opendir=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } -ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char opendir (); -int -main () -{ -return opendir (); - ; - return 0; -} -_ACEOF -for ac_lib in '' x; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if test x$gcc_no_link = xyes; then - as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 -fi -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_opendir=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : - break -fi -done -if test "${ac_cv_search_opendir+set}" = set; then : - -else - ac_cv_search_opendir=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } -ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -fi - - - - ac_fn_c_check_member "$LINENO" "struct dirent" "d_type" "ac_cv_member_struct_dirent_d_type" " -#include -#ifdef HAVE_DIRENT_H -# include -#else -# define dirent direct -# ifdef HAVE_SYS_NDIR_H -# include -# endif -# ifdef HAVE_SYS_DIR_H -# include -# endif -# ifdef HAVE_NDIR_H -# include -# endif -#endif - -" -if test "x$ac_cv_member_struct_dirent_d_type" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_DIRENT_D_TYPE 1 -_ACEOF - - -fi - - # Check whether --enable-libstdcxx-filesystem-ts was given. if test "${enable_libstdcxx_filesystem_ts+set}" = set; then : @@ -79096,6 +78844,68 @@ 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 struct dirent.d_type" >&5 +$as_echo_n "checking for struct dirent.d_type... " >&6; } + if test "${glibcxx_cv_dirent_d_type+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 +int +main () +{ + + struct dirent d; + if (sizeof d.d_type) return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_dirent_d_type=yes +else + glibcxx_cv_dirent_d_type=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 +int +main () +{ + + struct dirent d; + if (sizeof d.d_type) return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_dirent_d_type=yes +else + glibcxx_cv_dirent_d_type=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +fi + + if test $glibcxx_cv_dirent_d_type = yes; then + +$as_echo "#define _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_dirent_d_type" >&5 +$as_echo "$glibcxx_cv_dirent_d_type" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for realpath" >&5 $as_echo_n "checking for realpath... " >&6; } if test "${glibcxx_cv_realpath+set}" = set; then : diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 7eac8a1a087..96ff16f3f3e 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -403,7 +403,6 @@ GLIBCXX_CHECK_GTHREADS # For Filesystem TS. AC_CHECK_HEADERS([fcntl.h dirent.h sys/statvfs.h utime.h]) -AC_STRUCT_DIRENT_D_TYPE GLIBCXX_ENABLE_FILESYSTEM_TS GLIBCXX_CHECK_FILESYSTEM_DEPS -- 2.30.2