mirror of
https://github.com/X11Libre/xf86-video-amdgpu.git
synced 2026-03-24 01:24:31 +00:00
rework the libdrm include paths and configure scripts to account for the fact that the libdrm header files are in a different place on BSD distributions
This commit is contained in:
18
configure.ac
18
configure.ac
@@ -68,6 +68,24 @@ PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.121])
|
||||
PKG_CHECK_MODULES(LIBDRM_AMDGPU, [libdrm_amdgpu >= 2.4.121])
|
||||
PKG_CHECK_MODULES(GBM, [gbm])
|
||||
|
||||
# Check for DRM header location (Linux uses drm/ subdirectory, BSD may not)
|
||||
SAVE_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $LIBDRM_CFLAGS $LIBDRM_AMDGPU_CFLAGS"
|
||||
# Check for headers with and without drm/ subdirectory
|
||||
AC_CHECK_HEADERS([drm_fourcc.h amdgpu_drm.h],
|
||||
[found_drm_headers=yes],
|
||||
[found_drm_headers=no])
|
||||
if test "x$found_drm_headers" = "xno"; then
|
||||
# Fallback: check in drm/ subdirectory
|
||||
AC_CHECK_HEADERS([drm/drm_fourcc.h drm/amdgpu_drm.h],
|
||||
[found_drm_headers=yes
|
||||
# Need to add -I flag for drm/ subdirectory
|
||||
drm_incdir="-I\${includedir}/drm"
|
||||
AC_SUBST(DRM_SUBDIR_INCDIR, ["$drm_incdir"])],
|
||||
[AC_MSG_ERROR([libdrm headers not found - libdrm required])])
|
||||
fi
|
||||
CPPFLAGS="$SAVE_CPPFLAGS"
|
||||
|
||||
# Obtain compiler/linker options for the driver dependencies
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server >= 25.0.0 xproto fontsproto xf86driproto randrproto renderproto xextproto >= 7.0.99.1 $REQUIRED_MODULES])
|
||||
|
||||
|
||||
@@ -34,8 +34,10 @@ AMDGPU_KMS_SRCS=amdgpu_bo_helper.c amdgpu_dri2.c amdgpu_dri3.c amdgpu_drm_queue.
|
||||
AM_CFLAGS = \
|
||||
@GBM_CFLAGS@ \
|
||||
@LIBDRM_AMDGPU_CFLAGS@ \
|
||||
@LIBDRM_CFLAGS@ \
|
||||
@XORG_CFLAGS@ \
|
||||
@LIBUDEV_CFLAGS@
|
||||
@LIBUDEV_CFLAGS@ \
|
||||
$(DRM_SUBDIR_INCDIR)
|
||||
|
||||
if LIBUDEV
|
||||
amdgpu_drv_la_LIBADD += $(LIBUDEV_LIBS)
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
#include <string.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/amdgpu_drm.h>
|
||||
#include <drm_fourcc.h>
|
||||
#include <amdgpu_drm.h>
|
||||
#include <unistd.h>
|
||||
#include <poll.h>
|
||||
|
||||
|
||||
@@ -15,6 +15,20 @@ srcs = [
|
||||
'drmmode_display.c',
|
||||
]
|
||||
|
||||
# Check for DRM header location (Linux uses drm/ subdirectory, BSD may not)
|
||||
drm_args = []
|
||||
drm_incdir = libdrm_dep.get_variable(pkgconfig: 'includedir')
|
||||
if meson.get_compiler('c').has_header('drm_fourcc.h') and \
|
||||
meson.get_compiler('c').has_header('amdgpu_drm.h')
|
||||
# Headers found without drm/ subdirectory (BSD)
|
||||
elif meson.get_compiler('c').has_header('drm/drm_fourcc.h') and \
|
||||
meson.get_compiler('c').has_header('drm/amdgpu_drm.h')
|
||||
# Headers found with drm/ subdirectory (Linux)
|
||||
drm_args = ['-I' + drm_incdir]
|
||||
else
|
||||
error('libdrm headers not found - libdrm required')
|
||||
endif
|
||||
|
||||
amdgpu_drv_libs = [
|
||||
fontsproto_dep,
|
||||
gbm_dep,
|
||||
@@ -37,6 +51,7 @@ shared_module(
|
||||
srcs,
|
||||
include_directories: include_directories('..'),
|
||||
dependencies: amdgpu_drv_libs,
|
||||
c_args: drm_args,
|
||||
install: true,
|
||||
install_dir: join_paths(moduledir, 'drivers'),
|
||||
name_prefix: '',
|
||||
|
||||
Reference in New Issue
Block a user