vala: AM_PROG_VALAC should not produce an error for tool-old valac
authorSébastien Wilmet <swilmet@gnome.org>
Fri, 26 Oct 2012 15:08:09 +0000 (17:08 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 26 Oct 2012 19:17:09 +0000 (21:17 +0200)
This change fixes automake bug#12688.

In the AM_PROG_VALAC macro, when the optional parameter specifying the
minimum release number is not provided, and/or if the Vala compiler is
not found, then there is a _warning_ message.

On the other hand, when the version number is specified and if the Vala
compiler is too old, there is an _error_ message.

This error message is problematic, because for a tarball, the Vala
compiler is not required: the generated C code is included in the
tarball.  So if a user wants to compile the software, he shouldn't
need the valac program with the right version.

* m4/vala.m4 (AM_PROG_VALAC): Modify to use AC_MSG_WARN instead
of AC_MSG_ERROR.
* t/vala4.sh: Adjust and enhance.
* doc/automake.texi (Vala Support): Likewise.
* THANKS: Update.

Co-authored-by: Matthieu Baerts <matttbe@glx-dock.org>
Co-authored-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
THANKS
doc/automake.texi
m4/vala.m4
t/vala4.sh

diff --git a/THANKS b/THANKS
index 88f539c..1ff7c08 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -247,6 +247,7 @@ Matthew D. Langston             langston@SLAC.Stanford.EDU
 Matthias Andree                 matthias.andree@gmx.de
 Matthias Clasen                 clasen@mathematik.uni-freiburg.de
 Matthias Klose                  doko@ubuntu.com
+Matthieu Baerts                 matttbe@glx-dock.org
 Max Horn                        max@quendi.de
 Maxim Sinev                     good@goods.ru
 Maynard Johnson                 maynardj@us.ibm.com
@@ -348,6 +349,7 @@ Sam Steingold                   sds@gnu.org
 Sander Niemeijer                niemeijer@science-and-technology.nl
 Santiago Vila                   sanvila@unex.es
 Scott James Remnant             scott@netsplit.com
+Sébastien Wilmet                swilmet@gnome.org
 Sergey Poznyakoff               gray@gnu.org.ua
 Sergey Vlasov                   vsu@mivlgu.murom.ru
 Seth Alves                      alves@hungry.com
index b3ee47f..ae3fd15 100644 (file)
@@ -6893,8 +6893,7 @@ package.  If a compiler is found and satisfies @var{minimum-version},
 then @var{action-if-found} is run (this defaults to do nothing).
 Otherwise, @var{action-if-not-found} is run.  If @var{action-if-not-found}
 is not specified, the default value is to print a warning in case no
-compiler is found, and to abort the configure script (with status 77)
-if a too-old version of the compiler is found.
+compiler is found, or if a too-old version of the compiler is found.
 @end defmac
 
 There are a few variables that are used when compiling Vala sources:
index 0674c8e..0da8d67 100644 (file)
@@ -27,7 +27,7 @@ AC_DEFUN([AM_PROG_VALAC],
          [AC_MSG_RESULT([no])
           VALAC=:])])
     if test x"$VALAC" = x":"; then
-      m4_default([$3], [AC_MSG_ERROR([no proper vala compiler found], [77])])
+      m4_default([$3], [AC_MSG_WARN([no proper vala compiler found])])
     else
       m4_default([$2], [:])
     fi])])
index 0b87ca0..0684d3f 100755 (executable)
@@ -26,7 +26,7 @@ END
 
 cat > Makefile.am << 'END'
 has-valac:
-       case '$(VALAC)' in *valac) exit 0;; *) exit 1;; esac
+       case '$(VALAC)' in */valac) exit 0;; *) exit 1;; esac
 no-valac:
        test x'$(VALAC)' = x':'
 END
@@ -59,23 +59,29 @@ $ACLOCAL
 $AUTOMAKE -a
 $AUTOCONF
 
-# The "|| exit 1" are required here even if 'set -e' is active,
-# because ./configure might exit with status 77, and in that case
-# we want to FAIL, not to SKIP.
-./configure || exit 1
+st=0; ./configure 2>stderr || st=$?
+cat stderr >&2
+grep 'WARNING.*vala' stderr && exit 1
+test $st -eq 0
 $MAKE has-valac
-vala_version=99.9 ./configure || exit 1
+
+st=0; vala_version=99.9 ./configure 2>stderr || st=$?
+cat stderr >&2
+grep 'WARNING.*vala' stderr && exit 1
+test $st -eq 0
 $MAKE has-valac
 
 st=0; vala_version=0.1.2 ./configure 2>stderr || st=$?
 cat stderr >&2
-test $st -eq 77 || exit 1
-#$MAKE no-valac
+test $st -eq 0
+grep '^configure: WARNING: no proper vala compiler found' stderr
+$MAKE no-valac
 
 st=0; ./configure VALAC="$(pwd)/bin/valac.old" 2>stderr || st=$?
 cat stderr >&2
-test $st -eq 77 || exit 1
-#$MAKE no-valac
+test $st -eq 0 || exit 1
+grep '^configure: WARNING: no proper vala compiler found' stderr
+$MAKE no-valac
 
 sed 's/^\(AM_PROG_VALAC\).*/\1([1], [: > ok], [: > ko])/' <configure.ac >t
 mv -f t configure.ac
@@ -83,19 +89,27 @@ rm -rf autom4te*.cache
 $ACLOCAL
 $AUTOCONF
 
-./configure
+st=0; ./configure 2>stderr || st=$?
+cat stderr >&2
+grep 'WARNING.*vala' stderr && exit 1
 test -f ok
 test ! -e ko
 $MAKE has-valac
 rm -f ok ko
 
-vala_version=0.1.2 ./configure
+st=0; vala_version=0.1.2 ./configure 2>stderr || st=$?
+cat stderr >&2
+grep 'WARNING.*vala' stderr && exit 1
+test $st -eq 0
 test ! -e ok
 test -f ko
 $MAKE no-valac
 rm -f ok ko
 
-./configure VALAC="$(pwd)/bin/valac.old"
+st=0; ./configure VALAC="$(pwd)/bin/valac.old" 2>stderr || st=$?
+cat stderr >&2
+grep 'WARNING.*vala' stderr && exit 1
+test $st -eq 0
 test ! -e ok
 test -f ko
 $MAKE no-valac