File aisleriot-automagic-guile.patch of Package aisleriot

commit 3223853fcb8f519d7736d13bd8c30da6434d8cef
Author: Vincent Untz <vuntz@gnome.org>
Date:   Sun Sep 4 09:53:21 2011 +0200

    Allow automagic selection of guile
    
    We keep --with-guile, but default to automagic selection. This makes
    life easier for distributors, who can then rely on this if they know
    they simply want to build against the guile version that is available by
    default.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=658159

diff --git a/configure.ac b/configure.ac
index 7b30bdb..3999330 100644
--- a/configure.ac
+++ b/configure.ac
@@ -520,23 +520,33 @@ GUILE_PKGS=
 
 AC_MSG_CHECKING([which guile version to use])
 AC_ARG_WITH([guile],
-  [AS_HELP_STRING([--with-guile=1.8|2.0|2.2],[Which guile version to use (default: 1.8)])],
+  [AS_HELP_STRING([--with-guile=1.8|2.0|2.2|auto],[Which guile version to use (default: auto)])],
   [case "$with_guile" in
-     1.8|2.0|2.2) ;;
+     1.8|2.0|2.2|auto) ;;
      *) AC_MSG_ERROR([unknown or unsupported guile version $with_guile specified]) ;;
     esac],
-   [with_guile=1.8])
+   [with_guile=auto])
 AC_MSG_RESULT([$with_guile])
 
 case "$with_guile" in
-  1.8) GUILE_PKGS="guile-1.8 >= $GUILE_1_8_REQUIRED" ;;
-  2.0) GUILE_PKGS="guile-2.0 >= $GUILE_2_0_REQUIRED" ;;
-  2.2) GUILE_PKGS="guile-2.2 >= $GUILE_2_2_REQUIRED" ;;
+  1.8) AUTO_GUILE="false" GUILE_PKGS="guile-1.8 >= $GUILE_1_8_REQUIRED" ;;
+  2.0) AUTO_GUILE="false" GUILE_PKGS="guile-2.0 >= $GUILE_2_0_REQUIRED" ;;
+  2.2) AUTO_GUILE="false" GUILE_PKGS="guile-2.2 >= $GUILE_2_2_REQUIRED" ;;
+  auto) AUTO_GUILE="true"
+        PKG_CHECK_EXISTS([guile-2.2 >= $GUILE_2_2_REQUIRED],
+         [with_guile="2.2" GUILE_PKGS="guile-2.2 >= $GUILE_2_2_REQUIRED"],
+         [PKG_CHECK_EXISTS([guile-2.0 >= $GUILE_2_0_REQUIRED],
+           [with_guile="2.0" GUILE_PKGS="guile-2.0 >= $GUILE_2_0_REQUIRED"],
+           [PKG_CHECK_EXISTS([guile-1.8 >= $GUILE_1_8_REQUIRED],
+	     [with_guile="1.8" GUILE_PKGS="guile-1.8 >= $GUILE_1_8_REQUIRED"],
+	     [AC_MSG_ERROR([guile not found])])])]) ;;
 esac
 
-PKG_CHECK_EXISTS([$GUILE_PKGS],
-  [],
-  [AC_MSG_ERROR([guile version $with_guile not found. Install it, or use --with-guile to select a different version.])])
+if test "$auto_guile" != "true"; then
+  PKG_CHECK_EXISTS([$GUILE_PKGS],
+    [],
+    [AC_MSG_ERROR([guile version $with_guile not found. Install it, or use --with-guile to select a different version.])])
+fi
 
 PKG_CHECK_MODULES([GUILE],[$GUILE_PKGS])
 
openSUSE Build Service is sponsored by