meson: ensure the libc has RPC functions when secure-rpc is enabled

Currently our meson.build just makes the assumption that the libc is
going to provide RPC functions. This doesn't actually seem to be the
case on Fedora, which causes compilation to fail unexpectedly:

../../Projects/xserver/os/rpcauth.c:47:10: fatal error: rpc/rpc.h: No such file or directory
 #include <rpc/rpc.h>
          ^~~~~~~~~~~
compilation terminated.

So, in the event that we can't use libtirpc ensure that we actually
check whether or not the libc provides rpc/rpc.h. If it doesn't, raise
an error.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
(cherry picked from commit d95a1310ef)
This commit is contained in:
Lyude Paul 2018-06-22 12:49:47 -04:00 committed by Adam Jackson
parent 10285bc36b
commit 5c0662d448
1 changed files with 5 additions and 1 deletions

View File

@ -56,9 +56,13 @@ endif
rpc_dep = []
if get_option('secure-rpc')
# prefer libtirpc (if available), otherwise assume RPC functions are
# prefer libtirpc (if available), otherwise ensure RPC functions are
# provided by libc.
rpc_dep = dependency('libtirpc', required: false)
if not (rpc_dep.found() or cc.has_header('rpc/rpc.h'))
error('secure-rpc requested, but neither libtirpc or libc RPC support were found')
endif
srcs_os += 'rpcauth.c'
endif