Changeset 35622 in webkit


Ignore:
Timestamp:
Aug 7, 2008 5:08:52 AM (16 years ago)
Author:
jmalonzo@webkit.org
Message:

2008-08-07 Kalle Vahlman <zuh@iki.fi>

Reviewed by David Kilzer.

Check for correct flex version to avoid faulty builds

A correct Webkit build requires flex 2.5.33 but autotools build doesn't check for it
https://bugs.webkit.org/show_bug.cgi?id=20253

acinclude.m4: Import AX_COMPARE_VERSION macro
configure.ac: Check for flex version

  • acinclude.m4:
  • configure.ac:
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r35621 r35622  
     12008-08-07  Kalle Vahlman  <zuh@iki.fi>
     2
     3        Reviewed by David Kilzer.
     4
     5        Check for correct flex version to avoid faulty builds
     6
     7        A correct Webkit build requires flex 2.5.33 but autotools build doesn't check for it
     8        https://bugs.webkit.org/show_bug.cgi?id=20253
     9
     10        acinclude.m4: Import AX_COMPARE_VERSION macro
     11        configure.ac: Check for flex version
     12
     13        * acinclude.m4:
     14        * configure.ac:
     15
    1162008-08-07  Simon Hausmann  <hausmann@webkit.org>
    217
  • trunk/acinclude.m4

    r34289 r35622  
    176176# end dolt
    177177])
     178
     179# ===========================================================================
     180#           http://autoconf-archive.cryp.to/ax_compare_version.html
     181# ===========================================================================
     182#
     183# SYNOPSIS
     184#
     185#   AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
     186#
     187# DESCRIPTION
     188#
     189#   This macro compares two version strings. Due to the various number of
     190#   minor-version numbers that can exist, and the fact that string
     191#   comparisons are not compatible with numeric comparisons, this is not
     192#   necessarily trivial to do in a autoconf script. This macro makes doing
     193#   these comparisons easy.
     194#
     195#   The six basic comparisons are available, as well as checking equality
     196#   limited to a certain number of minor-version levels.
     197#
     198#   The operator OP determines what type of comparison to do, and can be one
     199#   of:
     200#
     201#    eq  - equal (test A == B)
     202#    ne  - not equal (test A != B)
     203#    le  - less than or equal (test A <= B)
     204#    ge  - greater than or equal (test A >= B)
     205#    lt  - less than (test A < B)
     206#    gt  - greater than (test A > B)
     207#
     208#   Additionally, the eq and ne operator can have a number after it to limit
     209#   the test to that number of minor versions.
     210#
     211#    eq0 - equal up to the length of the shorter version
     212#    ne0 - not equal up to the length of the shorter version
     213#    eqN - equal up to N sub-version levels
     214#    neN - not equal up to N sub-version levels
     215#
     216#   When the condition is true, shell commands ACTION-IF-TRUE are run,
     217#   otherwise shell commands ACTION-IF-FALSE are run. The environment
     218#   variable 'ax_compare_version' is always set to either 'true' or 'false'
     219#   as well.
     220#
     221#   Examples:
     222#
     223#     AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
     224#     AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
     225#
     226#   would both be true.
     227#
     228#     AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
     229#     AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
     230#
     231#   would both be false.
     232#
     233#     AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
     234#
     235#   would be true because it is only comparing two minor versions.
     236#
     237#     AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
     238#
     239#   would be true because it is only comparing the lesser number of minor
     240#   versions of the two values.
     241#
     242#   Note: The characters that separate the version numbers do not matter. An
     243#   empty string is the same as version 0. OP is evaluated by autoconf, not
     244#   configure, so must be a string, not a variable.
     245#
     246#   The author would like to acknowledge Guido Draheim whose advice about
     247#   the m4_case and m4_ifvaln functions make this macro only include the
     248#   portions necessary to perform the specific comparison specified by the
     249#   OP argument in the final configure script.
     250#
     251# LAST MODIFICATION
     252#
     253#   2008-04-12
     254#
     255# COPYLEFT
     256#
     257#   Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
     258#
     259#   Copying and distribution of this file, with or without modification, are
     260#   permitted in any medium without royalty provided the copyright notice
     261#   and this notice are preserved.
     262
     263dnl #########################################################################
     264AC_DEFUN([AX_COMPARE_VERSION], [
     265  AC_PROG_AWK
     266
     267  # Used to indicate true or false condition
     268  ax_compare_version=false
     269
     270  # Convert the two version strings to be compared into a format that
     271  # allows a simple string comparison.  The end result is that a version
     272  # string of the form 1.12.5-r617 will be converted to the form
     273  # 0001001200050617.  In other words, each number is zero padded to four
     274  # digits, and non digits are removed.
     275  AS_VAR_PUSHDEF([A],[ax_compare_version_A])
     276  A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
     277                     -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
     278                     -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
     279                     -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
     280                     -e 's/[[^0-9]]//g'`
     281
     282  AS_VAR_PUSHDEF([B],[ax_compare_version_B])
     283  B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
     284                     -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
     285                     -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
     286                     -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
     287                     -e 's/[[^0-9]]//g'`
     288
     289  dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
     290  dnl # then the first line is used to determine if the condition is true.
     291  dnl # The sed right after the echo is to remove any indented white space.
     292  m4_case(m4_tolower($2),
     293  [lt],[
     294    ax_compare_version=`echo "x$A
     295x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
     296  ],
     297  [gt],[
     298    ax_compare_version=`echo "x$A
     299x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
     300  ],
     301  [le],[
     302    ax_compare_version=`echo "x$A
     303x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
     304  ],
     305  [ge],[
     306    ax_compare_version=`echo "x$A
     307x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
     308  ],[
     309    dnl Split the operator from the subversion count if present.
     310    m4_bmatch(m4_substr($2,2),
     311    [0],[
     312      # A count of zero means use the length of the shorter version.
     313      # Determine the number of characters in A and B.
     314      ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
     315      ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
     316
     317      # Set A to no more than B's length and B to no more than A's length.
     318      A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
     319      B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
     320    ],
     321    [[0-9]+],[
     322      # A count greater than zero means use only that many subversions
     323      A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
     324      B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
     325    ],
     326    [.+],[
     327      AC_WARNING(
     328        [illegal OP numeric parameter: $2])
     329    ],[])
     330
     331    # Pad zeros at end of numbers to make same length.
     332    ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
     333    B="$B`echo $A | sed 's/./0/g'`"
     334    A="$ax_compare_version_tmp_A"
     335
     336    # Check for equality or inequality as necessary.
     337    m4_case(m4_tolower(m4_substr($2,0,2)),
     338    [eq],[
     339      test "x$A" = "x$B" && ax_compare_version=true
     340    ],
     341    [ne],[
     342      test "x$A" != "x$B" && ax_compare_version=true
     343    ],[
     344      AC_WARNING([illegal OP parameter: $2])
     345    ])
     346  ])
     347
     348  AS_VAR_POPDEF([A])dnl
     349  AS_VAR_POPDEF([B])dnl
     350
     351  dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
     352  if test "$ax_compare_version" = "true" ; then
     353    m4_ifvaln([$4],[$4],[:])dnl
     354    m4_ifvaln([$5],[else $5])dnl
     355  fi
     356]) dnl AX_COMPARE_VERSION
  • trunk/configure.ac

    r35570 r35622  
    9696if test -z "$FLEX"; then
    9797   AC_MSG_ERROR([You need the 'flex' lexer generator to compile WebKit])
     98else
     99   FLEX_VERSION=`$FLEX --version | sed 's,.*\ \([0-9]*\.[0-9]*\.[0-9]*\)$,\1,'`
     100   AX_COMPARE_VERSION([2.5.33],[gt],[$FLEX_VERSION],
     101      AC_MSG_ERROR([You need at least version 2.5.33 of the 'flex' lexer generator to compile WebKit]))
    98102fi
    99103
Note: See TracChangeset for help on using the changeset viewer.