diff mbox series

[libdrm,2/2] meson.build: Fix meson script on FreeBSD

Message ID 20190602181600.83963-3-zeising@daemonic.se (mailing list archive)
State New, archived
Headers show
Series Fix meson.build on FreeBSD | expand

Commit Message

Niclas Zeising June 2, 2019, 6:16 p.m. UTC
FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
includes when checking for headers.
Instead of splitting out the check for sys/sysctl.h from the other
header checks, just add sys/types.h to all header checks.

FreeBSD doesn't normally ship bash, try regular sh instead if we can't
find bash.
---
 meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Emil Velikov June 16, 2019, 1:16 p.m. UTC | #1
On Mon, 3 Jun 2019 at 08:41, Niclas Zeising <zeising@daemonic.se> wrote:
>
> FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
> includes when checking for headers.
> Instead of splitting out the check for sys/sysctl.h from the other
> header checks, just add sys/types.h to all header checks.
>
If header X depends on Y, then the former should include Y.
Can you please file a FreeBSD bug?

That said, the workaround is safe, so I'll split it out + add a comment.
I'll send v2 in a second.

> FreeBSD doesn't normally ship bash, try regular sh instead if we can't
> find bash.

Actually not sure why we're looking for bash. The lot works fine with
bash, zsh, dash, ksh you-name it.
Will include those with v2.

-Emil
Niclas Zeising June 16, 2019, 1:52 p.m. UTC | #2
On 2019-06-16 15:16, Emil Velikov wrote:
> On Mon, 3 Jun 2019 at 08:41, Niclas Zeising <zeising@daemonic.se> wrote:
>>
>> FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
>> includes when checking for headers.
>> Instead of splitting out the check for sys/sysctl.h from the other
>> header checks, just add sys/types.h to all header checks.
>>
> If header X depends on Y, then the former should include Y.
> Can you please file a FreeBSD bug?

This is how it's documented in the sysctl(3) manual on FreeBSD.  I will 
ask around why that is, but I don't expect it to change.

> 
> That said, the workaround is safe, so I'll split it out + add a comment.
> I'll send v2 in a second.
> 
>> FreeBSD doesn't normally ship bash, try regular sh instead if we can't
>> find bash.
> 
> Actually not sure why we're looking for bash. The lot works fine with
> bash, zsh, dash, ksh you-name it.
> Will include those with v2.

As long as it's only using posix stuff, FreeBSD /bin/sh should work 
fine, as should those others, I think.
I had no problems running the tests with FreeBSD /bin/sh when I tried, 
at least.
Regards
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index 64f0d5b1..eb55b918 100644
--- a/meson.build
+++ b/meson.build
@@ -181,7 +181,7 @@  endif
 dep_m = cc.find_library('m', required : false)
 foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
   config.set('HAVE_' + header.underscorify().to_upper(),
-    cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header)))
+    cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
 endforeach
 if cc.has_header_symbol('sys/sysmacros.h', 'major')
   config.set10('MAJOR_IN_SYSMACROS', true)
@@ -249,7 +249,7 @@  endif
 with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found()
 
 # Used for tests
-prog_bash = find_program('bash')
+prog_bash = find_program('bash', 'sh')
 
 config.set10('HAVE_VISIBILITY',
   cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',