fixed detecting libevent v1 if libevent v2 is not available

This commit is contained in:
Glen Wiley 2014-03-07 02:50:00 -05:00
parent dffcb32a97
commit 9c5d8aa687
4 changed files with 46 additions and 9 deletions

29
configure vendored
View File

@ -11169,6 +11169,16 @@ _ACEOF
;;
esac
ac_fn_c_check_type "$LINENO" "u_char" "ac_cv_type_u_char" "$ac_includes_default"
if test "x$ac_cv_type_u_char" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_U_CHAR 1
_ACEOF
fi
getdns_LIBS=$LIBS
getdns_LDFLAGS=$LDFLAGS
@ -11268,8 +11278,23 @@ _ACEOF
have_libevent=1
EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"
else
as_fn_error $? "event2/event.h missing, try without libevent" "$LINENO" 5
have_libevent=0
for ac_header in event.h
do :
ac_fn_c_check_header_compile "$LINENO" "event.h" "ac_cv_header_event_h" "$ac_includes_default
"
if test "x$ac_cv_header_event_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_EVENT_H 1
_ACEOF
have_libevent=1
EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"
else
as_fn_error $? "event2/event.h and event.h missing, try without libevent" "$LINENO" 5
have_libevent=0
fi
done
fi
done

View File

@ -189,6 +189,7 @@ AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_CHECK_TYPES([u_char])
getdns_LIBS=$LIBS
getdns_LDFLAGS=$LDFLAGS
@ -213,8 +214,12 @@ AS_IF([test x_$withval = x_no],
[AC_CHECK_HEADERS([event2/event.h],
[have_libevent=1]
[EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"],
[AC_MSG_ERROR([event2/event.h missing, try without libevent])]
[have_libevent=0],
[AC_CHECK_HEADERS([event.h],
[have_libevent=1]
[EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"],
[AC_MSG_ERROR([event2/event.h and event.h missing, try without libevent])]
[have_libevent=0],
[AC_INCLUDES_DEFAULT])],
[AC_INCLUDES_DEFAULT])],
[AC_MSG_ERROR([libevent missing, try without libevent])]
)],

View File

@ -12,6 +12,9 @@
/* Define to 1 if you have the `event_base_new' function. */
#undef HAVE_EVENT_BASE_NEW
/* Define to 1 if you have the <event.h> header file. */
#undef HAVE_EVENT_H
/* Define to 1 if you have the <ev.h> header file. */
#undef HAVE_EV_H
@ -57,6 +60,9 @@
/* Define to 1 if you have the <uv.h> header file. */
#undef HAVE_UV_H
/* Define to 1 if the system has the type `u_char'. */
#undef HAVE_U_CHAR
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR

View File

@ -27,10 +27,11 @@
#include <getdns/getdns.h>
#include <getdns/getdns_ext_libevent.h>
#ifdef HAVE_EVENT2_EVENT_H
#include <event2/event.h>
#include <event2/event.h>
#else
# ifndef u_char
# define u_char unsigned char
# endif
#include <event.h>
#include <event.h>
#endif
#ifndef HAVE_U_CHAR
typedef unsigned char u_char;
#endif