summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-12-18 22:39:55 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-20 15:22:16 +0000
commitc9786e1e1278ff9569ec90cafe1b8ae9f16259b2 (patch)
treebb1e920feaedecafad6ae87a3e4d5621e0c3a947
parentf87751165deb58b2e4f967e1b0da7cd3853fcbff (diff)
downloadpoky-c9786e1e1278ff9569ec90cafe1b8ae9f16259b2.tar.gz
autoconf: Fix AC_HEADER_MAJOR with glibc 2.25
Backport the patch from master for 2.69 (From OE-Core rev: 83081afc08695ea42046208ca8ab077e482d3018) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/autoconf/autoconf/AC_HEADER_MAJOR-port-to-glibc-2.25.patch162
-rw-r--r--meta/recipes-devtools/autoconf/autoconf_2.69.bb1
2 files changed, 163 insertions, 0 deletions
diff --git a/meta/recipes-devtools/autoconf/autoconf/AC_HEADER_MAJOR-port-to-glibc-2.25.patch b/meta/recipes-devtools/autoconf/autoconf/AC_HEADER_MAJOR-port-to-glibc-2.25.patch
new file mode 100644
index 0000000000..fc37236bf8
--- /dev/null
+++ b/meta/recipes-devtools/autoconf/autoconf/AC_HEADER_MAJOR-port-to-glibc-2.25.patch
@@ -0,0 +1,162 @@
1From e17a30e987d7ee695fb4294a82d987ec3dc9b974 Mon Sep 17 00:00:00 2001
2From: Eric Blake <eblake@redhat.com>
3Date: Wed, 14 Sep 2016 08:17:06 -0500
4Subject: [PATCH] AC_HEADER_MAJOR: port to glibc 2.25
5
6glibc 2.25 is deprecating the namespace pollution of <sys/types.h>
7injecting major(), minor(), and makedev() into the compilation
8environment, with a warning that insists that users include
9<sys/sysmacros.h> instead. However, because the expansion of
10AC_HEADER_MAJOR didn't bother checking sys/sysmacros.h until
11after probing whether sys/types.h pollutes the namespace, it was
12not defining MAJOR_IN_SYSMACROS, with the result that code
13compiled with -Werror chokes on the deprecation warnings because
14it was not including sysmacros.h.
15
16In addition to fixing autoconf (which only benefits projects
17that rebuild configure after this fix is released), we can also
18give a hint to distros on how they can populate config.site with
19a cache variable to force pre-existing configure scripts without
20the updated macro to behave sanely in the presence of glibc 2.25
21(the documentation is especially useful since that cache variable
22is no longer present in autoconf after this patch).
23
24Note that mingw lacks major/minor/makedev in any of its standard
25headers; for that platform, the behavior of this macro is unchanged
26(code using the recommended include formula will get a compile error
27when trying to use major(), whether before or after this patch); but
28for now, it is assumed that programs actually concerned with
29creating devices are not worried about portability to mingw. If
30desired, a later patch could tighten AC_HEADER_MAJOR to fail at
31configure time if the macros are unavailable in any of the three
32system headers, but that semantic change is not worth mixing into
33this patch.
34
35* lib/autoconf/headers.m4 (AC_HEADER_MAJOR): Drop check for
36major within sys/types.h; it interferes with the need to check
37sysmacros.h first.
38* doc/autoconf.texi (Particular Headers) <AC_HEADER_MAJOR>: Expand
39details on usage, and on workarounds for non-updated projects.
40
41Signed-off-by: Eric Blake <eblake@redhat.com>
42---
43Upstream-Status: Backport
44
45 doc/autoconf.texi | 35 +++++++++++++++++++++++++++++++----
46 lib/autoconf/headers.m4 | 30 ++++++++++++++----------------
47 2 files changed, 45 insertions(+), 20 deletions(-)
48
49Index: autoconf-2.69/doc/autoconf.texi
50===================================================================
51--- autoconf-2.69.orig/doc/autoconf.texi
52+++ autoconf-2.69/doc/autoconf.texi
53@@ -15,7 +15,7 @@
54 @c The ARG is an optional argument. To be used for macro arguments in
55 @c their documentation (@defmac).
56 @macro ovar{varname}
57-@r{[}@var{\varname\}@r{]}@c
58+@r{[}@var{\varname\}@r{]}
59 @end macro
60
61 @c @dvar(ARG, DEFAULT)
62@@ -23,7 +23,7 @@
63 @c The ARG is an optional argument, defaulting to DEFAULT. To be used
64 @c for macro arguments in their documentation (@defmac).
65 @macro dvar{varname, default}
66-@r{[}@var{\varname\} = @samp{\default\}@r{]}@c
67+@r{[}@var{\varname\} = @samp{\default\}@r{]}
68 @end macro
69
70 @c Handling the indexes with Texinfo yields several different problems.
71@@ -5926,10 +5926,37 @@ Also see @code{AC_STRUCT_DIRENT_D_INO} a
72 @cvindex MAJOR_IN_SYSMACROS
73 @hdrindex{sys/mkdev.h}
74 @hdrindex{sys/sysmacros.h}
75-If @file{sys/types.h} does not define @code{major}, @code{minor}, and
76-@code{makedev}, but @file{sys/mkdev.h} does, define
77-@code{MAJOR_IN_MKDEV}; otherwise, if @file{sys/sysmacros.h} does, define
78-@code{MAJOR_IN_SYSMACROS}.
79+Detect the headers required to use @code{makedev}, @code{major}, and
80+@code{minor}. These functions may be defined by @file{sys/mkdev.h},
81+@code{sys/sysmacros.h}, or @file{sys/types.h}.
82+
83+@code{AC_HEADER_MAJOR} defines @code{MAJOR_IN_MKDEV} if they are in
84+@file{sys/mkdev.h}, or @code{MAJOR_IN_SYSMACROS} if they are in
85+@file{sys/sysmacros.h}. If neither macro is defined, they are either in
86+@file{sys/types.h} or unavailable.
87+
88+To properly use these functions, your code should contain something
89+like:
90+
91+@verbatim
92+#include <sys/types.h>
93+#ifdef MAJOR_IN_MKDEV
94+# include <sys/mkdev.h>
95+#elif defined MAJOR_IN_SYSMACROS
96+# include <sys/sysmacros.h>
97+#endif
98+@end verbatim
99+
100+Note: Configure scripts built with Autoconf 2.69 or earlier will not
101+detect a problem if @file{sys/types.h} contains definitions of
102+@code{major}, @code{minor}, and/or @code{makedev} that trigger compiler
103+warnings upon use. This is known to occur with GNU libc 2.25, where
104+those definitions are being deprecated to reduce namespace pollution.
105+If it is not practical to use Autoconf 2.70 to regenerate the configure
106+script of affected software, you can work around the problem by setting
107+@samp{ac_cv_header_sys_types_h_makedev=no}, as an argument to
108+@command{configure} or as part of a @file{config.site} site default file
109+(@pxref{Site Defaults}).
110 @end defmac
111
112 @defmac AC_HEADER_RESOLV
113Index: autoconf-2.69/lib/autoconf/headers.m4
114===================================================================
115--- autoconf-2.69.orig/lib/autoconf/headers.m4
116+++ autoconf-2.69/lib/autoconf/headers.m4
117@@ -502,31 +502,29 @@ fi
118
119 # AC_HEADER_MAJOR
120 # ---------------
121+# Thanks to glibc 2.25 deprecating macros in sys/types.h, coupled with
122+# back-compat to autoconf 2.69, we need the following logic:
123+# Check whether <sys/types.h> compiles.
124+# If <sys/mkdev.h> compiles, assume it provides major/minor/makedev.
125+# Otherwise, if <sys/sysmacros.h> compiles, assume it provides the macros.
126+# Otherwise, either the macros were provided by <sys/types.h>, or do
127+# not exist on the platform. Code trying to use these three macros is
128+# assumed to not care about platforms that lack the macros.
129 AN_FUNCTION([major], [AC_HEADER_MAJOR])
130 AN_FUNCTION([makedev], [AC_HEADER_MAJOR])
131 AN_FUNCTION([minor], [AC_HEADER_MAJOR])
132 AN_HEADER([sys/mkdev.h], [AC_HEADER_MAJOR])
133 AC_DEFUN([AC_HEADER_MAJOR],
134-[AC_CACHE_CHECK(whether sys/types.h defines makedev,
135- ac_cv_header_sys_types_h_makedev,
136-[AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <sys/types.h>]],
137- [[return makedev(0, 0);]])],
138- [ac_cv_header_sys_types_h_makedev=yes],
139- [ac_cv_header_sys_types_h_makedev=no])
140-])
141-
142-if test $ac_cv_header_sys_types_h_makedev = no; then
143+[AC_CHECK_HEADERS_ONCE([sys/types.h])
144 AC_CHECK_HEADER(sys/mkdev.h,
145 [AC_DEFINE(MAJOR_IN_MKDEV, 1,
146 [Define to 1 if `major', `minor', and `makedev' are
147 declared in <mkdev.h>.])])
148-
149- if test $ac_cv_header_sys_mkdev_h = no; then
150- AC_CHECK_HEADER(sys/sysmacros.h,
151- [AC_DEFINE(MAJOR_IN_SYSMACROS, 1,
152- [Define to 1 if `major', `minor', and `makedev'
153- are declared in <sysmacros.h>.])])
154- fi
155+if test $ac_cv_header_sys_mkdev_h = no; then
156+ AC_CHECK_HEADER(sys/sysmacros.h,
157+ [AC_DEFINE(MAJOR_IN_SYSMACROS, 1,
158+ [Define to 1 if `major', `minor', and `makedev'
159+ are declared in <sysmacros.h>.])])
160 fi
161 ])# AC_HEADER_MAJOR
162
diff --git a/meta/recipes-devtools/autoconf/autoconf_2.69.bb b/meta/recipes-devtools/autoconf/autoconf_2.69.bb
index aa1877a1fb..fd01585441 100644
--- a/meta/recipes-devtools/autoconf/autoconf_2.69.bb
+++ b/meta/recipes-devtools/autoconf/autoconf_2.69.bb
@@ -14,6 +14,7 @@ SRC_URI += "file://check-automake-cross-warning.patch \
14 file://autotest-automake-result-format.patch \ 14 file://autotest-automake-result-format.patch \
15 file://add_musl_config.patch \ 15 file://add_musl_config.patch \
16 file://performance.patch \ 16 file://performance.patch \
17 file://AC_HEADER_MAJOR-port-to-glibc-2.25.patch \
17 " 18 "
18 19
19SRC_URI[md5sum] = "82d05e03b93e45f5a39b828dc9c6c29b" 20SRC_URI[md5sum] = "82d05e03b93e45f5a39b828dc9c6c29b"