OSDN Git Service

configure fails if requirement can't be met for user's explicit request
authorXiang, Haihao <haihao.xiang@intel.com>
Mon, 19 Jun 2017 03:01:02 +0000 (11:01 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Tue, 20 Jun 2017 05:42:51 +0000 (13:42 +0800)
Notify user an error if user provides --enable-x11/--enable-glx/--enable-egl/--enable-wayland
however the requirement can't be met. drm has been checked mandatorily
in the script

v2: Remove XEXT_CFLAGS/XFIXES_CFLAGS from va/x11/Makefile.am and use
$X11_PKG_ERRORS in the error message if the requirement is met for VA/X11

This fixes https://github.com/01org/libva/issues/68

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
configure.ac
va/x11/Makefile.am

index ef36345..bd74df8 100644 (file)
@@ -136,23 +136,23 @@ AC_ARG_ENABLE(drm,
 
 AC_ARG_ENABLE(x11,
     [AC_HELP_STRING([--enable-x11],
-                    [build with VA/X11 API support @<:@default=yes@:>@])],
-    [], [enable_x11="yes"])
+                    [build with VA/X11 API support @<:@default=auto@:>@])],
+    [], [enable_x11="auto"])
 
 AC_ARG_ENABLE(glx,
     [AC_HELP_STRING([--enable-glx],
-                    [build with VA/GLX API support @<:@default=yes@:>@])],
-    [], [enable_glx="yes"])
+                    [build with VA/GLX API support @<:@default=auto@:>@])],
+    [], [enable_glx="auto"])
 
 AC_ARG_ENABLE(egl,
     [AC_HELP_STRING([--enable-egl],
-                    [build with VA/EGL API support @<:@default=yes@:>@])],
-    [], [enable_egl="yes"])
+                    [build with VA/EGL API support @<:@default=auto@:>@])],
+    [], [enable_egl="auto"])
 
 AC_ARG_ENABLE([wayland],
     [AC_HELP_STRING([--enable-wayland],
-                    [build with VA/Wayland API support @<:@default=yes@:>@])],
-    [], [enable_wayland="yes"])
+                    [build with VA/Wayland API support @<:@default=auto@:>@])],
+    [], [enable_wayland="auto"])
 
 AC_ARG_ENABLE([va-messaging],
     [AC_HELP_STRING([--enable-va-messaging],
@@ -228,11 +228,13 @@ AM_CONDITIONAL(USE_DRM, test "$USE_DRM" = "yes")
 
 # Check for X11
 USE_X11="no"
-if test "$enable_x11" = "yes"; then
-    USE_X11="yes"
-    PKG_CHECK_MODULES([X11],    [x11],    [:], [USE_X11="no"])
-    PKG_CHECK_MODULES([XEXT],   [xext],   [:], [USE_X11="no"])
-    PKG_CHECK_MODULES([XFIXES], [xfixes], [:], [USE_X11="no"])
+if test "x$enable_x11" != "xno"; then
+    PKG_CHECK_MODULES([X11],    [x11 xext xfixes],    [USE_X11="yes"], [:])
+
+    if test "x$USE_X11" = "xno" -a "x$enable_x11" = "xyes"; then
+       AC_MSG_ERROR([VA/X11 explicitly enabled, however $X11_PKG_ERRORS])
+    fi
+
     if test "$USE_X11" = "yes"; then
         AC_DEFINE([HAVE_VA_X11], [1], [Defined to 1 if VA/X11 API is built])
     fi
@@ -241,7 +243,12 @@ AM_CONDITIONAL(USE_X11, test "$USE_X11" = "yes")
 
 # Check for GLX
 USE_GLX="no"
-if test "$USE_X11:$enable_glx" = "yes:yes"; then
+
+if test "$USE_X11:$enable_glx" = "no:yes"; then
+   AC_MSG_ERROR([VA/GLX explicitly enabled, but VA/X11 isn't built])
+fi
+
+if test "$USE_X11:$enable_glx" != "yes:no"; then
     PKG_CHECK_MODULES([GLX], [gl x11], [USE_GLX="yes"], [:])
     saved_CPPFLAGS="$CPPFLAGS"
     saved_LIBS="$LIBS"
@@ -251,6 +258,11 @@ if test "$USE_X11:$enable_glx" = "yes:yes"; then
     AC_CHECK_LIB([GL], [glXCreateContext], [:] [USE_GLX="no"])
     CPPFLAGS="$saved_CPPFLAGS"
     LIBS="$saved_LIBS"
+
+    if test "x$USE_GLX" = "xno" -a "x$enable_glx" = "xyes"; then
+       AC_MSG_ERROR([VA/GLX explicitly enabled, but libGL couldn't be found])
+    fi
+
     if test "$USE_GLX" = "yes"; then
         AC_DEFINE([HAVE_VA_GLX], [1], [Defined to 1 if VA/GLX API is built])
     fi
@@ -259,7 +271,7 @@ AM_CONDITIONAL(USE_GLX, test "$USE_GLX" = "yes")
 
 # Check for EGL
 USE_EGL="no"
-if test "$enable_egl" = "yes"; then
+if test "x$enable_egl" != "xno"; then
     PKG_CHECK_MODULES([EGL], [egl], [USE_EGL="yes"], [:])
     saved_CPPFLAGS="$CPPFLAGS"
     saved_LIBS="$LIBS"
@@ -269,6 +281,11 @@ if test "$enable_egl" = "yes"; then
     AC_CHECK_LIB([EGL], [eglGetDisplay], [:], [USE_EGL="no"])
     CPPFLAGS="$saved_CPPFLAGS"
     LIBS="$saved_LIBS"
+
+    if test "x$USE_EGL" = "xno" -a "x$enable_egl" = "xyes"; then
+       AC_MSG_ERROR([VA/EGL explicitly enabled, but libEGL couldn't be found])
+    fi
+
     if test "$USE_EGL" = "yes"; then
         AC_DEFINE([HAVE_VA_EGL], [1], [Defined to 1 if VA/EGL API is built])
     fi
@@ -280,9 +297,14 @@ WAYLAND_API_VERSION=wayland_api_version
 AC_SUBST(WAYLAND_API_VERSION)
 
 USE_WAYLAND="no"
-if test "$enable_wayland" = "yes"; then
+if test "x$enable_wayland" != "xno"; then
     PKG_CHECK_MODULES([WAYLAND], [wayland-client >= wayland_api_version],
         [USE_WAYLAND="yes"], [:])
+
+    if test "x$USE_WAYLAND" = "xno" -a "x$enable_wayland" = "xyes"; then
+        AC_MSG_ERROR([wayland explicitly enabled, however $WAYLAND_PKG_ERRORS])
+    fi
+
     if test "$USE_WAYLAND" = "yes"; then
 
         WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
index 0853016..ed4f66a 100644 (file)
@@ -25,8 +25,6 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)         \
        -I$(top_srcdir)/va      \
        $(X11_CFLAGS)           \
-       $(XEXT_CFLAGS)          \
-       $(XFIXES_CFLAGS)        \
        $(DRM_CFLAGS)           \
        $(NULL)