Re: fptools/configure thinks happy 1.10 1.9

2001-01-27 Thread Sigbjorn Finne


Volker Stolz [EMAIL PROTECTED] writes:
 My happy is 1.10, everything fresh from cvs:
 ---
 checking for happy... /home/stolz/Linux/haskell/ghc-4.08.1/bin/happy
 checking for version of happy...
 Happy version 1.9 or later is required to compile GHC.
 ---

 And in a sense, it is right. I'd really like to come up with a fix, but
 I guess...

 [...perl silliness deleted..]

If you assume that the version string is of the form X.Y, the following test
should do the trick:

if ( test `echo "$fptools_cv_happy_version" | sed -e "s/\(.*\)\..*/\1/g"`
"-eq" "1" 
 test `echo "$fptools_cv_happy_version" | sed -e "s/.*\.\(.*\)/\1/g"`
"-lt" "9" ); then

substitute it for the usage of 'expr' in the FPTOOLS_HAPPY macro in
aclocal.m4 
rebuild the configure script, i.e., I haven't committed this tweak.

--sigbjorn



___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



fptools/configure thinks happy 1.10 1.9

2001-01-26 Thread Volker Stolz

My happy is 1.10, everything fresh from cvs:
---
checking for happy... /home/stolz/Linux/haskell/ghc-4.08.1/bin/happy
checking for version of happy... 
Happy version 1.9 or later is required to compile GHC.
---

And in a sense, it is right. I'd really like to come up with a fix, but
I guess...

@split0 = split(/\./,$ARGV[0]);
@split1 = split(/\./,$ARGV[1]);

@bools = zipWith(\@split0,\@split1);
$lt   = fold(\oder,\@bools);
exit $lt;

sub zipWith {
  my ($l1,$l2) = @_;
  $h1 = shift @$l1;
  $h2 = shift @$l2;
  if ((defined($h1)) || (defined($h2))){
return (($h1  $h2),zipWith($l1,$l2));
  } else {
return ();
  }
}

sub fold {
  my ($f,$args) = @_;
  my $tmp = 0;
  foreach $arg (@$args) {
$tmp = $f($tmp,$arg);
  }
  return $tmp;
}

sub oder {
  return ($_[0] || $_[1]);
}

...is too long for a perl one-liner in configure. Or would anyone like to
go for "ghc -e -n 'foldl ... (zipWith ... (split ...))'"? It should be even
smaller; I didn't manage to inline all the things I wanted to in the perl
script. Anyway, it works, it checks if the first argument is less than the
second:

 perl vers.pl "1.9" "1.10" ; echo $?
1
 perl vers.pl "4.08.1" "4.08"; echo $?
0 

Got to take my pills now,
   Volker
-- 
Volker Stolz * [EMAIL PROTECTED] * PGP + S/MIME

___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



Re: fptools/configure thinks happy 1.10 1.9

2001-01-26 Thread Marcin 'Qrczak' Kowalczyk

Fri, 26 Jan 2001 14:57:58 +0100, Volker Stolz [EMAIL PROTECTED] 
pisze:

 ...is too long for a perl one-liner in configure.

perl -e '@v = map {join "", map {chr} split /\./} @ARGV;
 exit ($v[0] ge $v[1] ? 0 : 1)' 1.10 1.9
# Returns 0, i.e. the second version is at least as high as the first.
# Works for numbers up to 255.

-- 
 __("  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/
  ^^  SYGNATURA ZASTPCZA
QRCZAK


___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



Re: fptools/configure thinks happy 1.10 1.9

2001-01-26 Thread Michael Weber

[ Volker, is your Mail-Followup-To:-header intended like this? ]

* Volker Stolz [EMAIL PROTECTED] [2001-01-26T14:57+0100]:
[ configure thinks: happy-1.10  happy-1.9 ]

 And in a sense, it is right. I'd really like to come up with a fix, but
 I guess...

[ perl thingy ]

  perl vers.pl "1.9" "1.10" ; echo $?
 1
  perl vers.pl "4.08.1" "4.08"; echo $?
 0 

[982]% perl vers.pl 4.09 4.08.1
zsh: exit 1 perl vers.pl 4.09 4.08.1
[983]% 


BTW:
Using perl in autoconf...  What next?  Slicing bread with the
Swiss Army Chainsaw(tm)?  heart surgery?  splitting atom cores?  B)

quote
   The `configure' script [...] should not use any utilities directly
   except these:

 cat cmp cp diff echo egrep expr false grep install-info
 ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch true
/quote

sequence_compare () {
# usage:
#   ``IFS="." sequence_compare 1.2.3 -lt|-le|-eq|-ge|-gt 4.5''
# - no *sh- or system-specific features 
# - relies on IFS as field separator
a="$1";  op="$2";  b="$3";

while test -n "$a$b"
do
set -- $a;  h1="$1";  shift 2/dev/null;  a="$*"
set -- $b;  h2="$1";  shift 2/dev/null;  b="$*"
test -n "$h1" || h1=0;  test -n "$h2" || h2=0
test ${h1} -eq ${h2} || break
done
test ${h1} "$op" ${h2}
}

Of course, for autoconf functions are VERBOTEN, and therefore the
original $IFS has to be saved  later restored...


Cheers,
Michael
p.s.: http://www.focusresearch.com/gregor/psh/ (interactive perl shell)  =)
-- 
() ASCII ribbon campaign |  Chair for Computer Science  II  | GPG: F65C68CD
/\ against HTML mail |   RWTH Aachen, Germany   | PGP: 1D0DD0B9
   "Ada is PL/I trying to be Smalltalk."
 -- Codoso diBlini

___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs