]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/libpqxx/0001-include-sys-time.h-outside-fallback-select-55.patch
lrzsz: install symlinks for XMODEM and YMODEM
[coffee/buildroot.git] / package / libpqxx / 0001-include-sys-time.h-outside-fallback-select-55.patch
1 From 44970d7331e4f369e160af0135a2d1fc16f27a21 Mon Sep 17 00:00:00 2001
2 From: jdknight-rockwellcollins <james.knight@rockwellcollins.com>
3 Date: Mon, 15 Jan 2018 12:41:25 -0500
4 Subject: [PATCH] include sys/time.h outside fallback select (#55)
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 The implementation of 'wait_fd' (inside 'connection_base.cxx') always
10 relies on the existence of the 'timeval' structure. In Linux, this
11 structure is provided by the header 'sys/time.h'. If polling or select
12 capabilities are detected, the structure is never included into the
13 source and will result in a compilation error (GCC 7.x):
14
15     connection_base.cxx:1153:28: error: ‘{anonymous}::tv_milliseconds’ declared as an ‘inline’ variable
16      inline int tv_milliseconds(timeval *tv = nullptr)
17                                 ^~~~~~~
18     ...
19
20 The following moves the 'HAVE_SYS_TIME_H' check outside the
21 select-fallback case so that the header can be included no matter the
22 event-function feature is used.
23
24 Signed-off-by: James Knight <james.knight@rockwellcollins.com>
25 ---
26  configure               | 28 ++++++++++++----------------
27  configure.ac            |  6 +-----
28  src/connection_base.cxx |  2 +-
29  3 files changed, 14 insertions(+), 22 deletions(-)
30
31 diff --git a/configure b/configure
32 index 7d6d96a98e0fcb7dde1e05adf034afe624ada6d6..dd2a33cb54dba5d3223fc2b4c8d03be7c8abde4e 100755
33 --- a/configure
34 +++ b/configure
35 @@ -17285,22 +17285,6 @@ fi
36  done
37  
38  
39 -if test "$select_h" != "yes"
40 -then
41 -for ac_header in sys/time.h
42 -do :
43 -  ac_fn_cxx_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default"
44 -if test "x$ac_cv_header_sys_time_h" = xyes; then :
45 -  cat >>confdefs.h <<_ACEOF
46 -#define HAVE_SYS_TIME_H 1
47 -_ACEOF
48 -
49 -fi
50 -
51 -done
52 -
53 -fi
54 -
55  # Some systems keep select() in a separate library which is not linked by
56  # default.  See if we need one of those.
57  socklibok=no
58 @@ -17419,6 +17403,18 @@ fi
59  
60  fi # No poll()
61  
62 +for ac_header in sys/time.h
63 +do :
64 +  ac_fn_cxx_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default"
65 +if test "x$ac_cv_header_sys_time_h" = xyes; then :
66 +  cat >>confdefs.h <<_ACEOF
67 +#define HAVE_SYS_TIME_H 1
68 +_ACEOF
69 +
70 +fi
71 +
72 +done
73 +
74  
75  # Add options to compiler command line, if compiler accepts them.
76  add_compiler_opts_if_ok() {
77 diff --git a/configure.ac b/configure.ac
78 index 8977c3d3900a5de66b580365d8fe7d133cd1042d..6649f7fa0ed0572489a0db09517c659012ce707c 100644
79 --- a/configure.ac
80 +++ b/configure.ac
81 @@ -117,11 +117,6 @@ then
82  select_h=no
83  AC_CHECK_HEADERS([sys/select.h], [select_h=yes])
84  
85 -if test "$select_h" != "yes"
86 -then
87 -AC_CHECK_HEADERS([sys/time.h])
88 -fi
89 -
90  # Some systems keep select() in a separate library which is not linked by
91  # default.  See if we need one of those.
92  socklibok=no
93 @@ -150,6 +145,7 @@ fi
94  
95  fi # No poll()
96  
97 +AC_CHECK_HEADERS([sys/time.h])
98  
99  # Add options to compiler command line, if compiler accepts them.
100  add_compiler_opts_if_ok() {
101 diff --git a/src/connection_base.cxx b/src/connection_base.cxx
102 index 37ed7728ffd02e1fded3b5d64d6fb2d5fd74d5ed..0ec55bc5bd761690f66b67396cfbf3e3c56ba618 100644
103 --- a/src/connection_base.cxx
104 +++ b/src/connection_base.cxx
105 @@ -38,10 +38,10 @@
106  #if defined(HAVE_UNISTD_H)
107  #include <unistd.h>
108  #endif
109 +#endif
110  #if defined(HAVE_SYS_TIME_H)
111  #include <sys/time.h>
112  #endif
113 -#endif
114  
115  #include "libpq-fe.h"
116  
117 -- 
118 1.8.3.msysgit.0
119