Marc Slemko | 85ca7a1 | 2007-01-17 08:32:16 +0000 | [diff] [blame] | 1 | dnl @synopsis AX_EVENT([MINIMUM-VERSION]) |
| 2 | dnl |
| 3 | dnl Test for the libevent libraries of a particular version (or newer) |
| 4 | dnl |
| 5 | dnl If no path to the installed event library is given the macro |
| 6 | dnl searchs under /usr, /usr/local, and /opt, and evaluates the |
| 7 | dnl $EVENT_ROOT environment variable. |
| 8 | dnl |
| 9 | dnl This macro calls: |
| 10 | dnl |
| 11 | dnl AC_SUBST(EVENT_CPPFLAGS) / AC_SUBST(EVENT_LDFLAGS) |
| 12 | dnl |
| 13 | dnl And sets: |
| 14 | dnl |
| 15 | dnl HAVE_EVENT |
| 16 | dnl |
| 17 | dnl @category InstalledPackages |
| 18 | dnl @category Cxx |
| 19 | dnl @author Marc Kwiatkowski <marc@facebook.com> |
| 20 | dnl @version 2006-06-15 |
| 21 | dnl @license AllPermissive |
| 22 | |
| 23 | AC_DEFUN([AX_EVENT_BASE], |
| 24 | [ |
| 25 | AC_ARG_WITH([event], |
| 26 | AS_HELP_STRING([--with-event@<:@=DIR@:>@], [use event (default is yes) - it is possible to specify an alternate root directory for event]), |
| 27 | [ |
| 28 | if test "$withval" = "no"; then |
| 29 | want_event="no" |
| 30 | elif test "$withval" = "yes"; then |
| 31 | want_event="yes" |
| 32 | ac_event_path="" |
| 33 | else |
| 34 | want_event="yes" |
| 35 | ac_event_path="$withval" |
| 36 | fi |
| 37 | ], |
| 38 | [want_event="yes"]) |
| 39 | |
| 40 | if test "x$want_event" = "xyes"; then |
| 41 | event_lib_version_req=ifelse([$1], ,1.2.0,$1) |
| 42 | event_lib_version_req_shorten=`expr $event_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` |
| 43 | event_lib_version_req_major=`expr $event_lib_version_req : '\([[0-9]]*\)'` |
| 44 | event_lib_version_req_minor=`expr $event_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` |
| 45 | event_lib_version_req_sub_minor=`expr $event_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` |
| 46 | if test "x$event_lib_version_req_sub_minor" = "x" ; then |
| 47 | event_lib_version_req_sub_minor="0" |
| 48 | fi |
| 49 | WANT_EVENT_VERSION=`expr $event_lib_version_req_major \* 10000 \+ $event_lib_version_req_minor \* 100 \+ $event_lib_version_req_sub_minor` |
| 50 | WANT_EVENT_MAJOR_VERSION=$event_lib_version_req_major |
| 51 | WANT_EVENT_MINOR_VERSION=$event_lib_version_req_minor |
| 52 | AC_MSG_CHECKING(for eventlib >= $event_lib_version_req) |
| 53 | succeeded=no |
| 54 | |
| 55 | if test "$ac_event_path" != "" && test -f "$ac_event_path/include/event.h"; then |
| 56 | ac_event_include_path=$ac_event_path/include |
| 57 | EVENT_CPPFLAGS="-I$ac_event_include_path" |
| 58 | EVENT_LDFLAGS="-L$ac_event_path/lib -levent" |
| 59 | succeeded=yes |
| 60 | else |
| 61 | for ac_event_path_tmp in /usr /usr/local /opt ; do |
| 62 | if test -f "$ac_event_path_tmp/include/event.h"; then |
| 63 | ac_event_include_path=$ac_event_path_tmp/include |
| 64 | EVENT_CPPFLAGS="-I$ac_event_include_path" |
| 65 | EVENT_LDFLAGS="-L$ac_event_path_tmp/lib -levent" |
| 66 | succeeded=yes |
| 67 | break; |
| 68 | fi |
| 69 | done |
| 70 | fi |
| 71 | |
| 72 | if test "$succeeded" != "yes" ; then |
Mark Slee | ba35456 | 2007-04-03 07:31:51 +0000 | [diff] [blame] | 73 | AC_MSG_ERROR([[We could not detect the event libraries (version $event_lib_version_req_shorten or higher). If you have a staged event library (still not installed) please specify \$EVENT_ROOT in your environment and do not give a PATH to --with-event option. If you are sure you have event installed, then check your version number looking in <event.h>. See http://www.monkey.org/~provos/libevent/ for more documentation.]]) |
Marc Slemko | 85ca7a1 | 2007-01-17 08:32:16 +0000 | [diff] [blame] | 74 | else |
| 75 | AC_SUBST(EVENT_CPPFLAGS) |
| 76 | AC_SUBST(EVENT_LDFLAGS) |
| 77 | AC_DEFINE(HAVE_EVENT,,[define if the EVENT library is available]) |
| 78 | fi |
| 79 | |
| 80 | CPPFLAGS="$CPPFLAGS_SAVED" |
| 81 | LDFLAGS="$LDFLAGS_SAVED" |
| 82 | fi |
| 83 | |
| 84 | ]) |