From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Subject: [xf86-video-intel PATCH] build: do not use AC_CHECK_FILE to find the header files. Date: Sun, 15 May 2011 02:17:32 +0200 Message-ID: <1305418652-14402-1-git-send-email-flameeyes@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ww0-f43.google.com (mail-ww0-f43.google.com [74.125.82.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 833E29E8F9 for ; Sat, 14 May 2011 17:17:49 -0700 (PDT) Received: by wwb17 with SMTP id 17so3253875wwb.12 for ; Sat, 14 May 2011 17:17:48 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org Using AC_CHECK_FILE will cause cross-builds to fail picking the right file; instead use compile/preprocessor checks properly, and check for xf86driproto earlier. --- configure.ac | 62 +++++++++++++++++++++++++++++++-------------------------- 1 files changed, 34 insertions(+), 28 deletions(-) diff --git a/configure.ac b/configure.ac index fd5a3cf..9449e56 100644 --- a/configure.ac +++ b/configure.ac @@ -77,9 +77,7 @@ AC_ARG_WITH(xorg-module-dir, [moduledir="$libdir/xorg/modules"]) AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri], - [Disable DRI support [[default=auto]]]), - [DRI="$enableval"], - [DRI=auto]) + [Disable DRI support [[default=auto]]])) AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Disable XvMC support [[default=yes]]]), @@ -106,40 +104,48 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) # Obtain compiler/linker options for the driver dependencies PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6 xproto fontsproto $REQUIRED_MODULES]) PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.23]) +PKG_CHECK_MODULES(DRI, [xf86driproto], , DRI=no) PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server` -save_CFLAGS="$CFLAGS" -CFLAGS="$XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS" -CPPFLAGS="$XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS" -AC_MSG_CHECKING([whether to include DRI support]) -if test x$DRI != xno; then - AC_CHECK_FILE([${sdkdir}/dri.h], - [have_dri_h="yes"], [have_dri_h="no"]) - AC_CHECK_FILE([${sdkdir}/sarea.h], - [have_sarea_h="yes"], [have_sarea_h="no"]) - AC_CHECK_FILE([${sdkdir}/dristruct.h], - [have_dristruct_h="yes"], [have_dristruct_h="no"]) +if test "x$enable_dri" != "xno"; then + save_CFLAGS="$CFLAGS" + save_CPPFLAGS="$CPPFLAGS" + CFLAGS="$XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS" + CPPFLAGS="$XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS" + AC_CHECK_HEADERS([dri.h sarea.h dristruct.h],, [DRI=no], + [/* for dri.h */ + #include + /* for dristruct.h */ + #include + #ifdef HAVE_DRI_H + # include + #endif + #ifdef HAVE_SAREA_H + # include + #endif + ]) + CFLAGS="$save_CFLAGS $DEBUGFLAGS" + CPPFLAGS="$save_CPPFLAGS" +else + DRI=no fi + AC_MSG_CHECKING([whether to include DRI support]) -if test x$DRI = xauto; then - if test "$have_dri_h" = yes -a \ - "$have_sarea_h" = yes -a \ - "$have_dristruct_h" = yes; then - DRI="yes" - else - DRI="no" - fi -fi -AC_MSG_RESULT([$DRI]) -CFLAGS="$save_CFLAGS $DEBUGFLAGS" +AC_MSG_RESULT([${DRI-yes}]) -AM_CONDITIONAL(DRI, test x$DRI = xyes) -if test "$DRI" = yes; then - PKG_CHECK_MODULES(DRI, [xf86driproto]) +AM_CONDITIONAL(DRI, test x$DRI != xno) +if test "x$DRI" != "xno"; then AC_DEFINE(XF86DRI,1,[Enable DRI driver support]) AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support]) +else + DRI_CFLAGS="" + DRI_LIBS="" + + if test "x$enable_dri" = "xyes"; then + AC_MSG_ERROR([DRI requested but prerequisites not found]) + fi fi if test "$XVMC" = yes; then -- 1.7.5.rc3