From dac867c90a93d411f71a2ce960f61c0f637235ad Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 18 Jan 2018 20:52:16 +0100 Subject: [PATCH] configure.ac (AC_CHECK_HEADERS): Add linux/types.h. * configure.ac (AC_CHECK_HEADERS): Add linux/types.h. Conditionally include linux/types.h when checking linux/random.h header. * config.h.in: Regenerate. * configure: Ditto. * src/c++11/random.cc: Conditionally include linux/types.h. From-SVN: r256859 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/config.h.in | 3 +++ libstdc++-v3/configure | 19 ++++++++++++++++++- libstdc++-v3/configure.ac | 8 +++++++- libstdc++-v3/src/c++11/random.cc | 4 ++++ 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e5614460b8e..bf1d4d43769 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2018-01-18 Uros Bizjak + + * configure.ac (AC_CHECK_HEADERS): Add linux/types.h. Conditionally + include linux/types.h when checking linux/random.h header. + * config.h.in: Regenerate. + * configure: Ditto. + * src/c++11/random.cc: Conditionally include linux/types.h. + 2018-01-16 Eric Botcazou * testsuite/17_intro/names.cc: Undefine 'y' on SPARC/Linux. diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index e31e054c024..5a0f0678439 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -270,6 +270,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_RANDOM_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TYPES_H + /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index f5798d3a603..69845f486f0 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -21799,7 +21799,7 @@ for ac_header in endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \ locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \ strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \ sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \ -wchar.h wctype.h linux/random.h +wchar.h wctype.h linux/types.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -21814,6 +21814,23 @@ fi done +for ac_header in linux/random.h +do : + ac_fn_c_check_header_compile "$LINENO" "linux/random.h" "ac_cv_header_linux_random_h" "#ifdef HAVE_LINUX_TYPES_H +# include +#endif + +" +if test "x$ac_cv_header_linux_random_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LINUX_RANDOM_H 1 +_ACEOF + +fi + +done + + # Only do link tests if native. Else, hardcode. if $GLIBCXX_IS_NATIVE; then diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index c90c5091e2e..e110f579917 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -237,7 +237,13 @@ AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \ locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \ strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \ sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \ -wchar.h wctype.h linux/random.h]) +wchar.h wctype.h linux/types.h]) + +AC_CHECK_HEADERS([linux/random.h], [], [], +[[#ifdef HAVE_LINUX_TYPES_H +# include +#endif +]]) # Only do link tests if native. Else, hardcode. if $GLIBCXX_IS_NATIVE; then diff --git a/libstdc++-v3/src/c++11/random.cc b/libstdc++-v3/src/c++11/random.cc index 415f79463f0..19daf6d6319 100644 --- a/libstdc++-v3/src/c++11/random.cc +++ b/libstdc++-v3/src/c++11/random.cc @@ -42,6 +42,10 @@ # include #endif +#ifdef _GLIBCXX_HAVE_LINUX_TYPES_H +# include +#endif + #ifdef _GLIBCXX_HAVE_LINUX_RANDOM_H # include #endif -- 2.30.2