tags 12688 + patch
thanks

On 10/26/2012 03:59 PM, Stefano Lattarini wrote:
> Hi Matthieu, Sébastien, sorry for the delay.
> 
> On 10/20/2012 12:31 PM, Matthieu Baerts wrote:
>> Hello
>>
>> 20/10/2012 00:11 +0200, Sébastien Wilmet wrote:
>>> Hello,
>>>
>>> In the AM_PROG_VALAC macro, when the optional parameter specifying the 
>>> minimum release number is not provided, and if the Vala compiler is not 
>>> found, then there is a _warning_ message.
>>>
>>> On the other hand, when the version number is specified, when 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.
>>>
>>> So the AC_MSG_ERROR should be modified as a AC_MSG_WARN.
>>
>> I confirm that I had this problem with LaTeXila: I had a too old version
>> of Vala and I was not able to compile LaTeXila except if
>> '/usr/bin/valac' was removed/renamed.
>>
>> This is how this bug has been fixed in LaTeXila:
>> https://github.com/swilmet/latexila/commit/993b073c71f094ca5c15cb2a44e69399176b882a
>> (for those who wants a workaround ;) )
>>
>> Note that if a warning message is produced when a too old version is
>> detected, 'VALAC' variable has to be unset in vala.m4
>>
>>
>> This bug should be fixed with the attached patch :)
>>
>>
>> Thank you,
>>
>> Matt
>>
> I agree the behaviour you want is better and more sensible than the
> current one.  In fact, it mimics the behaviour of a macro like
> AC_PROG_YACC, which doesn't abort configure if a bison/yacc program
> is not found in PATH (which makes perfect sense, since Automake
> distributes the bison-generated C sources, exactly to ensure the
> final user doesn't need to have a proper bison/yacc program himself).
> 
> However, I'm not going to apply your patch right away because first
> I'd like to work on this other enhancement:
> 
>   <http://lists.gnu.org/archive/html/automake-patches/2012-09/msg00012.html>
> 
> Once that is done (might be a few days), I will get back to your
> patch.  I definitely plan to have it committed (in one form or another)
> before releasing Automake 1.12.5.
>
Here is the patch.  Can I have your ACK on it?  I will push it by this
evening if there is no answer by then?

Thanks,
  Stefano

P.S. note that this patch is part of a wider patch series I'm writing, so
it won't apply cleanly on maint or master.  I will later post the whole
series on the automake-patches list, in case anyone is interested.

-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----

>From 8a1f86381f1c7a8b21b4da38ebb53b44e1664667 Mon Sep 17 00:00:00 2001
Message-Id: 
<8a1f86381f1c7a8b21b4da38ebb53b44e1664667.1351264987.git.stefano.lattar...@gmail.com>
From: =?UTF-8?q?S=C3=A9bastien=20Wilmet?= <swil...@gnome.org>
Date: Fri, 26 Oct 2012 17:08:09 +0200
Subject: [PATCH] vala: AM_PROG_VALAC should not produce an error for tool-old 
valac

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 <matt...@glx-dock.org>
Co-authored-by: Stefano Lattarini <stefano.lattar...@gmail.com>
Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com>
---
 THANKS            |  2 ++
 doc/automake.texi |  3 +--
 m4/vala.m4        |  2 +-
 t/vala4.sh        | 40 +++++++++++++++++++++++++++-------------
 4 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/THANKS b/THANKS
index 88f539c..1ff7c08 100644
--- a/THANKS
+++ b/THANKS
@@ -247,6 +247,7 @@ Matthew D. Langston             langs...@slac.stanford.edu
 Matthias Andree                 matthias.and...@gmx.de
 Matthias Clasen                 cla...@mathematik.uni-freiburg.de
 Matthias Klose                  d...@ubuntu.com
+Matthieu Baerts                 matt...@glx-dock.org
 Max Horn                        m...@quendi.de
 Maxim Sinev                     g...@goods.ru
 Maynard Johnson                 mayna...@us.ibm.com
@@ -348,6 +349,7 @@ Sam Steingold                   s...@gnu.org
 Sander Niemeijer                niemei...@science-and-technology.nl
 Santiago Vila                   sanv...@unex.es
 Scott James Remnant             sc...@netsplit.com
+Sébastien Wilmet                swil...@gnome.org
 Sergey Poznyakoff               g...@gnu.org.ua
 Sergey Vlasov                   v...@mivlgu.murom.ru
 Seth Alves                      al...@hungry.com
diff --git a/doc/automake.texi b/doc/automake.texi
index 54262c8..aaf4a98 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -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:
diff --git a/m4/vala.m4 b/m4/vala.m4
index 0674c8e..0da8d67 100644
--- a/m4/vala.m4
+++ b/m4/vala.m4
@@ -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])])
diff --git a/t/vala4.sh b/t/vala4.sh
index f622e5c..fcb60ed 100755
--- a/t/vala4.sh
+++ b/t/vala4.sh
@@ -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
-- 
1.8.0



Reply via email to