[PATCH weston 08/11] configure.ac: Rework AC_ARG_WITH usages

Quentin Glidic sardemff7+wayland at sardemff7.net
Sun Dec 8 10:45:40 PST 2013


From: Quentin Glidic <sardemff7+git at sardemff7.net>

Also rework the --with-cairo option have priority over
--with-cairo-glesv2

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---
 configure.ac | 65 ++++++++++++++++++++++++++++++++----------------------------
 1 file changed, 35 insertions(+), 30 deletions(-)

diff --git a/configure.ac b/configure.ac
index d5eb04b..4f3e314 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,10 +110,17 @@ if test "x$enable_xwayland" = "xyes"; then
   PKG_CHECK_MODULES([XWAYLAND], xcb xcb-xfixes xcb-composite xcursor cairo-xcb)
   AC_DEFINE([BUILD_XWAYLAND], [1], [Build the X server launcher])
 
-  AC_ARG_WITH(xserver-path, AS_HELP_STRING([--with-xserver-path=PATH],
-              [Path to X server]), [XSERVER_PATH="$withval"],
-              [XSERVER_PATH="$bindir/Xorg"])
+  AC_ARG_WITH(xserver-path,
+              AS_HELP_STRING([--with-xserver-path=PATH],
+                             [Path to XWayland-aware X server]),,
+              with_xserver_path=yes)
+  case "$with_xserver_path" in
+          no) AC_MSG_ERROR([XWayland-aware X server required]);;
+          yes) XSERVER_PATH="$bindir/Xorg" ;;
+          *) XSERVER_PATH="$with_xserver_path" ;;
+  esac
   AC_SUBST([XSERVER_PATH])
+
   if test "x$enable_xwayland_test" = "xyes"; then
     PKG_CHECK_MODULES([XWAYLAND_TEST], xcb xcb-dri2 libdrm)
   fi
@@ -234,34 +241,28 @@ if test "x$enable_rdp_compositor" = "xyes"; then
   PKG_CHECK_MODULES(RDP_COMPOSITOR, [freerdp >= 1.1.0])
 fi
 
-AC_ARG_WITH(cairo,
-	    AS_HELP_STRING([--with-cairo=@<:@image|gl|glesv2@:>@]
-			   [Which Cairo renderer to use for the clients]),
-			   [],[with_cairo="image"])
-
-if test "x$with_cairo" = "ximage"; then
-	cairo_modules="cairo"
-else
-if test "x$with_cairo" = "xgl"; then
-	cairo_modules="cairo-gl"
-else
-if test "x$with_cairo" = "xglesv2"; then
-	cairo_modules="cairo-glesv2"
-else
-	AC_MSG_ERROR([Unknown cairo renderer requested])
-fi
-fi
-fi
-
+with_cairo_default=image
 # Included for legacy compat
 AC_ARG_WITH(cairo-glesv2,
-            AS_HELP_STRING([--with-cairo-glesv2],
-                           [Use GLESv2 cairo]))
+	    AS_HELP_STRING([--with-cairo-glesv2],
+			   [Use GLESv2 cairo (legacy option, do not use)]))
 if test "x$with_cairo_glesv2" = "xyes"; then
-  cairo_modules="cairo-glesv2"
-  with_cairo="glesv2"
+	with_cairo_default=glesv2
 fi
 
+AC_ARG_WITH(cairo,
+	    AS_HELP_STRING([--with-cairo@<:@=image|gl|glesv2@:>@],
+			   [Which Cairo renderer to use for the clients. @<:@default=image@:>@]),,
+	    [with_cairo="$with_cairo_default"])
+case "$with_cairo" in
+	no) AC_MSG_ERROR([Cairo renderer required]) ;;
+	yes|image) cairo_modules="cairo" ;;
+	gl) cairo_modules="cairo-gl" ;;
+	glesv2) cairo_modules="cairo-glesv2" ;;
+	*) AC_MSG_ERROR([Unknown Cairo renderer requested]) ;;
+esac
+
+
 if test "x$cairo_modules" = "xcairo-glesv2"; then
 AC_DEFINE([USE_CAIRO_GLESV2], [1], [Use the GLESv2 GL cairo backend])
 fi
@@ -522,12 +523,16 @@ fi
 
 PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner)
 AC_PATH_PROG(XMLLINT, xmllint)
-AC_ARG_WITH([dtddir],
+AC_ARG_WITH(dtddir,
 	    AS_HELP_STRING([--with-dtddir],
 			   [Directory containing the Wayland
-			    protocol DTD @<:@default=from pkgconfig@:>@]),
-	    [dtddir="$withval"],
-	    [dtddir=$($PKG_CONFIG --variable=pkgdatadir wayland-scanner)])
+			    protocol DTD @<:@default=from pkgconfig@:>@]),,
+	    with_dtddir=yes)
+case "$with_dtddir" in
+	no) ;;
+	yes) dtddir=`$PKG_CONFIG --variable=pkgdatadir wayland-scanner` ;;
+	*) dtddir="$with_dtddir" ;;
+esac
 AC_SUBST([dtddir])
 AM_CONDITIONAL([HAVE_XMLLINT], [test "x$XMLLINT" != "x" -a "x$dtddir" != "x"])
 
-- 
1.8.4.3



More information about the wayland-devel mailing list