#73 autogen.sh fails to verify version correctly


As an example, I have automake 1.10.1, and automake.sh requires 1.7. In the check_version() function awk compares 1.7 and 1.10.1 and figures, reasonably, yet incorrectly, that 1.7 is greater than 1.1 and I don't have the prerequisite. To fix this, you need awk to split 1.7 into 1 and 7, and 1.10.1 into 1 and 10 and 1 and for the length of the shorter compare them. i.e. compare 1 and 1, then 7 and 10. If the required version is ever greater then you fail. If they compare equal for the shorter length, then the if the requirement is longer than the actual you have to fail. Here's a version I typed to to make it work for me. Feel free to use it if you wish.

with this all these would work

required actual success?
1.7 1.10.1 Y
1.10 1.10.1 Y
1.10.1 1.10.1 Y
1.10.2 1.10.1 N 1.10.1 N

function check_version() {
if $1 --version |
awk 'NR==1 { \ size_needed=split('$2',needed,".");\ size_got=split($NF,got,".");\ if(size_needed<size_got)\ n=size_needed;\ else;\ n=size_got;\ theyareequal=0;\ for(i=1;i <=n;++i){\ if(needed[i]!=got[i])\ theyareequal=1;\ if(needed[i]>got[i])\ exit 1;\ }
if(theyareequal && size_needed > size_got)\ exit 1;\ exit 0;\ }' ; then
return 0;
return 1;


  • Patrick Horgan

    Patrick Horgan - 2008-07-11

    Logged In: YES
    Originator: YES

    oops! When I said aclocal.sh I meant autogen.sh. Sorry:
    File Added: fixautogen.sh

  • Patrick Horgan

    Patrick Horgan - 2008-07-11
    • summary: aclocal.sh fails to verify version correctly --> autogen.sh fails to verify version correctly
  • Patrick Horgan

    Patrick Horgan - 2008-07-11

    Contains a nicely formatted version of fixed check_version

  • Richard van den Berg

    I believe this is fixed with aide 0.14 / current CVS version

  • Richard van den Berg

    • status: open --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks