https://gcc.gnu.org/g:f5ffdcfe3b58771b4482d94264cf076df83a2cdc
commit r12-10749-gf5ffdcfe3b58771b4482d94264cf076df83a2cdc Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Aug 28 12:38:18 2024 +0100 libstdc++: Fix autoconf check for O_NONBLOCK in <fcntl.h> I misused the AC_CHECK_DECL macro, assuming that it behaved like AC_CHECK_DECLS and always defined a HAVE_xxx macro if the decl was found. Instead, the [action-if-found] shell commands are needed to defined HAVE_O_NONBLOCK explicitly. libstdc++-v3/ChangeLog: * configure.ac: Fix check for O_NONBLOCK. * config.h.in: Regenerate. * configure: Regenerate. (cherry picked from commit b68561dd7925dfee1836f75d3fa8d33fff5c2498) Diff: --- libstdc++-v3/config.h.in | 3 +++ libstdc++-v3/configure | 2 ++ libstdc++-v3/configure.ac | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 639000d797ad..4bf9b4282280 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -295,6 +295,9 @@ /* Define if openat is available in <fcntl.h>. */ #undef HAVE_OPENAT +/* Define if O_NONBLOCK is defined in <fcntl.h> */ +#undef HAVE_O_NONBLOCK + /* Define if poll is available in <poll.h>. */ #undef HAVE_POLL diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index ccc23f1b3522..3ea275e9ab2c 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -77901,6 +77901,8 @@ if test "$ac_cv_have_decl_F_GETFL$ac_cv_have_decl_F_SETFL" = yesyes ; then " if test "x$ac_cv_have_decl_O_NONBLOCK" = xyes; then : +$as_echo "#define HAVE_O_NONBLOCK 1" >>confdefs.h + fi fi diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index dc0c61973d1c..dad313a23767 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -503,7 +503,10 @@ AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/socket.h sys/uio.h poll.h netdb.h arpa AC_CHECK_DECL(F_GETFL,,,[#include <fcntl.h>]) AC_CHECK_DECL(F_SETFL,,,[#include <fcntl.h>]) if test "$ac_cv_have_decl_F_GETFL$ac_cv_have_decl_F_SETFL" = yesyes ; then - AC_CHECK_DECL(O_NONBLOCK,,,[#include <fcntl.h>]) + AC_CHECK_DECL(O_NONBLOCK, + AC_DEFINE(HAVE_O_NONBLOCK,1,[Define if O_NONBLOCK is defined in <fcntl.h>]), + [], + [#include <fcntl.h>]) fi # For Transactional Memory TS