From: David Reiss Date: Wed, 29 Jul 2009 19:07:27 +0000 (+0000) Subject: THRIFT-523. Make ax_lib_event.m4 work with newer versions of libevent X-Git-Tag: 0.2.0~59 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=e657eb43117437b8a2b2036982ec3d4cd953b437;p=common%2Fthrift.git 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. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@799016 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/aclocal/ax_lib_event.m4 b/aclocal/ax_lib_event.m4 index 3a48156a..08043b4c 100644 --- a/aclocal/ax_lib_event.m4 +++ b/aclocal/ax_lib_event.m4 @@ -83,12 +83,32 @@ AC_DEFUN([AX_LIB_EVENT_DO_CHECK], 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. */