diff mbox

[RFC,i-g-t,1/7] configure.ac: Test for libdrm_intel and build for it if present.

Message ID 1464200336-15671-2-git-send-email-robert.foss@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Foss May 25, 2016, 6:18 p.m. UTC
From: Robert Foss <robert.foss@collabora.com>

Test for libdrm_intel and build for it if present.
Also expose the HAVE_INTEL #define to allow code to be conditionally
compiled.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 configure.ac | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Rémi Cardona May 25, 2016, 9:50 p.m. UTC | #1
Le 25/05/2016 à 20:18, robert.foss@collabora.com a écrit :
> From: Robert Foss <robert.foss@collabora.com>
> 
> Test for libdrm_intel and build for it if present.
> Also expose the HAVE_INTEL #define to allow code to be conditionally
> compiled.
> 
> Signed-off-by: Robert Foss <robert.foss@collabora.com>
> ---
>  configure.ac | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 11b1d46..48d81c5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -100,7 +100,7 @@ if test "x$GCC" = "xyes"; then
>  fi
>  AC_SUBST(ASSEMBLER_WARN_CFLAGS)
>  
> -PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.64 libdrm])
> +PKG_CHECK_MODULES(DRM, [libdrm])
>  PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
>  
>  case "$target_cpu" in
> @@ -150,6 +150,18 @@ PKG_CHECK_MODULES(GLIB, glib-2.0)
>  # -----------------------------------------------------------------------------
>  #			Configuration options
>  # -----------------------------------------------------------------------------
> +AC_ARG_ENABLE(intel, AS_HELP_STRING([--disable-intel],
> +	      [Enable building of intel specific parts (default: auto)]),
> +	      [INTEL=$enableval], [INTEL=auto])
> +if test "x$INTEL" = xauto; then
> +	PKG_CHECK_EXISTS([libdrm_intel >= 2.4.64], [INTEL=yes], [INTEL=no])
                          ^^^^^^^^^^^^^^^^^^^^^^
> +fi
> +if test "x$INTEL" = xyes; then
> +	PKG_CHECK_MODULES(DRM_INTEL, [libdrm_intel >= 2.4.64])
                                      ^^^^^^^^^^^^^^^^^^^^^^
> +	AC_DEFINE(HAVE_LIBDRM_INTEL, 1, [Have intel support])
> +fi
> +AM_CONDITIONAL(HAVE_LIBDRM_INTEL, [test "x$INTEL" = xyes])
> +

I suggest to factor that out into a variable, much like
https://cgit.freedesktop.org/xorg/xserver/tree/configure.ac#n780

This should also be applied in your libpciaccess patch.

Cheers,

Rémi
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 11b1d46..48d81c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,7 +100,7 @@  if test "x$GCC" = "xyes"; then
 fi
 AC_SUBST(ASSEMBLER_WARN_CFLAGS)
 
-PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.64 libdrm])
+PKG_CHECK_MODULES(DRM, [libdrm])
 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
 
 case "$target_cpu" in
@@ -150,6 +150,18 @@  PKG_CHECK_MODULES(GLIB, glib-2.0)
 # -----------------------------------------------------------------------------
 #			Configuration options
 # -----------------------------------------------------------------------------
+AC_ARG_ENABLE(intel, AS_HELP_STRING([--disable-intel],
+	      [Enable building of intel specific parts (default: auto)]),
+	      [INTEL=$enableval], [INTEL=auto])
+if test "x$INTEL" = xauto; then
+	PKG_CHECK_EXISTS([libdrm_intel >= 2.4.64], [INTEL=yes], [INTEL=no])
+fi
+if test "x$INTEL" = xyes; then
+	PKG_CHECK_MODULES(DRM_INTEL, [libdrm_intel >= 2.4.64])
+	AC_DEFINE(HAVE_LIBDRM_INTEL, 1, [Have intel support])
+fi
+AM_CONDITIONAL(HAVE_LIBDRM_INTEL, [test "x$INTEL" = xyes])
+
 # for dma-buf tests
 AC_ARG_ENABLE(nouveau, AS_HELP_STRING([--disable-nouveau],
 	      [Enable use of nouveau API for prime tests (default: auto)]),