OSDN Git Service

configure fails if requirement can't be met for user's explicit request
[android-x86/hardware-intel-common-libva.git] / configure.ac
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`