Author: dreiss
Date: Wed Jul 29 19:07:27 2009
New Revision: 799016

URL: http://svn.apache.org/viewvc?rev=799016&view=rev
Log:
THRIFT-523. Make ax_lib_event.m4 work with newer versions of libevent

libevent changed is minor version numbering scheme with version 1.4.0,
and the simplistic comparison function used by ax_lib_event.m4 did not
work with the new scheme.  This patch introduced a more accurate
comparison function that works with all existing versions of libevent.

Modified:
    incubator/thrift/trunk/aclocal/ax_lib_event.m4

Modified: incubator/thrift/trunk/aclocal/ax_lib_event.m4
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/aclocal/ax_lib_event.m4?rev=799016&r1=799015&r2=799016&view=diff
==============================================================================
--- incubator/thrift/trunk/aclocal/ax_lib_event.m4 (original)
+++ incubator/thrift/trunk/aclocal/ax_lib_event.m4 Wed Jul 29 19:07:27 2009
@@ -83,12 +83,32 @@
           const char* wnt_version = "$WANT_LIBEVENT_VERSION";
           for (;;) {
             /* If we reached the end of the want version.  We have it. */
-            if (*wnt_version == '\0') {
+            if (*wnt_version == '\0' || *wnt_version == '-') {
               return 0;
             }
             /* If the want version continues but the lib version does not, */
             /* we are missing a letter.  We don't have it. */
-            if (*lib_version == '\0') {
+            if (*lib_version == '\0' || *lib_version == '-') {
+              return 1;
+            }
+            /* In the 1.4 version numbering style, if there are more digits */
+            /* in one version than the other, that one is higher. */
+            int lib_digits;
+            for (lib_digits = 0;
+                lib_version[lib_digits] >= '0' &&
+                lib_version[lib_digits] <= '9';
+                lib_digits++)
+              ;
+            int wnt_digits;
+            for (wnt_digits = 0;
+                wnt_version[wnt_digits] >= '0' &&
+                wnt_version[wnt_digits] <= '9';
+                wnt_digits++)
+              ;
+            if (lib_digits > wnt_digits) {
+              return 0;
+            }
+            if (lib_digits < wnt_digits) {
               return 1;
             }
             /* If we have greater than what we want.  We have it. */


Reply via email to