diff mbox series

[libdrm] meson.build: Don't detect <sys/sysctl.h> header for linux

Message ID 1578630641-5301-1-git-send-email-sw0312.kim@samsung.com (mailing list archive)
State New, archived
Headers show
Series [libdrm] meson.build: Don't detect <sys/sysctl.h> header for linux | expand

Commit Message

Seung-Woo Kim Jan. 10, 2020, 4:30 a.m. UTC
The <sys/sysctl.h> header is not required for Linux and GNU libc
2.30 starts to warn about Linux specific <sys/sysctl.h> header
deprecation. Don't detect <sys/sysctl.h> header for linux.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
Fix meson.build script instead of code itself as commented below:
https://patchwork.kernel.org/patch/11325345/
---
 meson.build |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

Comments

Eric Engestrom Jan. 29, 2020, 9:53 a.m. UTC | #1
On Friday, 2020-01-10 13:30:41 +0900, Seung-Woo Kim wrote:
> The <sys/sysctl.h> header is not required for Linux and GNU libc
> 2.30 starts to warn about Linux specific <sys/sysctl.h> header
> deprecation. Don't detect <sys/sysctl.h> header for linux.
> 
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> ---
> Fix meson.build script instead of code itself as commented below:
> https://patchwork.kernel.org/patch/11325345/
> ---
>  meson.build |   15 +++++++++++----
>  1 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 782b1a3..b1c557a 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -183,10 +183,17 @@ else
>    dep_rt = []
>  endif
>  dep_m = cc.find_library('m', required : false)
> -# From Niclas Zeising:
> -# FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
> -# includes when checking for headers.
> -foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
> +if not ['linux'].contains(host_machine.system())
> +  # From Niclas Zeising:
> +  # FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
> +  # includes when checking for headers.
> +  foreach header : ['sys/sysctl.h']
> +    config.set('HAVE_' + header.underscorify().to_upper(),
> +      cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
> +  endforeach
> +endif
> +endforeach

Stray `endforeach`.

Could you post your patch as a Merge Request [1] instead of on the mailing list?
The automatic testing there means it would instantly catch mistakes like these :)

[1] https://gitlab.freedesktop.org/mesa/drm/merge_requests

> +foreach header : ['sys/select.h', 'alloca.h']
>    config.set('HAVE_' + header.underscorify().to_upper(),
>      cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))

Can you drop the `#include <sys/types.h>\n` now that sys/sysctl.h is
being split out?

Note that since https://gitlab.freedesktop.org/mesa/drm/merge_requests/8
we now use config.set10(), which means you'll need to refactor a tiny
bit (move the !linux condition inside the config.set10() call).

The new code block should look like this:

  # From Niclas Zeising:
  # FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
  # includes when checking for headers.
  foreach header : ['sys/sysctl.h']
    config.set10('HAVE_' + header.underscorify().to_upper(),
       not ['linux'].contains(host_machine.system()) and
       cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
  endforeach

With that:
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Eric Engestrom March 29, 2020, 9:05 p.m. UTC | #2
On Wednesday, 2020-01-29 09:53:16 +0000, Eric Engestrom wrote:
> On Friday, 2020-01-10 13:30:41 +0900, Seung-Woo Kim wrote:
> > The <sys/sysctl.h> header is not required for Linux and GNU libc
> > 2.30 starts to warn about Linux specific <sys/sysctl.h> header
> > deprecation. Don't detect <sys/sysctl.h> header for linux.
> > 
> > Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> > ---
> > Fix meson.build script instead of code itself as commented below:
> > https://patchwork.kernel.org/patch/11325345/
> > ---
> >  meson.build |   15 +++++++++++----
> >  1 files changed, 11 insertions(+), 4 deletions(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 782b1a3..b1c557a 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -183,10 +183,17 @@ else
> >    dep_rt = []
> >  endif
> >  dep_m = cc.find_library('m', required : false)
> > -# From Niclas Zeising:
> > -# FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
> > -# includes when checking for headers.
> > -foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
> > +if not ['linux'].contains(host_machine.system())
> > +  # From Niclas Zeising:
> > +  # FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
> > +  # includes when checking for headers.
> > +  foreach header : ['sys/sysctl.h']
> > +    config.set('HAVE_' + header.underscorify().to_upper(),
> > +      cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
> > +  endforeach
> > +endif
> > +endforeach
> 
> Stray `endforeach`.
> 
> Could you post your patch as a Merge Request [1] instead of on the mailing list?
> The automatic testing there means it would instantly catch mistakes like these :)
> 
> [1] https://gitlab.freedesktop.org/mesa/drm/merge_requests
> 
> > +foreach header : ['sys/select.h', 'alloca.h']
> >    config.set('HAVE_' + header.underscorify().to_upper(),
> >      cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
> 
> Can you drop the `#include <sys/types.h>\n` now that sys/sysctl.h is
> being split out?
> 
> Note that since https://gitlab.freedesktop.org/mesa/drm/merge_requests/8
> we now use config.set10(), which means you'll need to refactor a tiny
> bit (move the !linux condition inside the config.set10() call).
> 
> The new code block should look like this:
> 
>   # From Niclas Zeising:
>   # FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
>   # includes when checking for headers.
>   foreach header : ['sys/sysctl.h']
>     config.set10('HAVE_' + header.underscorify().to_upper(),
>        not ['linux'].contains(host_machine.system()) and
>        cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
>   endforeach

FYI, I have posted a variant of the above as a merge request:
https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/53
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index 782b1a3..b1c557a 100644
--- a/meson.build
+++ b/meson.build
@@ -183,10 +183,17 @@  else
   dep_rt = []
 endif
 dep_m = cc.find_library('m', required : false)
-# From Niclas Zeising:
-# FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
-# includes when checking for headers.
-foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
+if not ['linux'].contains(host_machine.system())
+  # From Niclas Zeising:
+  # FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
+  # includes when checking for headers.
+  foreach header : ['sys/sysctl.h']
+    config.set('HAVE_' + header.underscorify().to_upper(),
+      cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
+  endforeach
+endif
+endforeach
+foreach header : ['sys/select.h', 'alloca.h']
   config.set('HAVE_' + header.underscorify().to_upper(),
     cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
 endforeach