From 72bb33ca2ec2d2490de08f0859f83308d30c39b7 Mon Sep 17 00:00:00 2001 From: Neel Goyal Date: Mon, 24 Feb 2014 16:35:48 -0500 Subject: [PATCH] Fix an issue builing extensions. Make sure to look for the headers as well as the libs --- configure | 67 +++++++++++++++++++++++++++++++++++++++++++------ configure.ac | 34 +++++++++++++++++++------ src/config.h.in | 9 +++++++ 3 files changed, 96 insertions(+), 14 deletions(-) diff --git a/configure b/configure index 30e9b8fd..96a11481 100755 --- a/configure +++ b/configure @@ -11250,15 +11250,38 @@ if test "x$ac_cv_header_event2_event_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_EVENT2_EVENT_H 1 _ACEOF + # event2/event.h found + EXTENSION_LIBEVENT_EXT_LIBS="-l$ac_lib" + CHECK_EVENT_PROG=check_getdns_event +else + # not found - look for event.h + 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 + # found + EXTENSION_LIBEVENT_EXT_LIBS="-l$ac_lib" + CHECK_EVENT_PROG=check_getdns_event +else + # not found - give up + have_libevent=0 + EXTENSION_LIBEVENT_LIB="" +fi + +done + fi done - EXTENSION_LIBEVENT_EXT_LIBS="-l$ac_lib" - CHECK_EVENT_PROG=check_getdns_event else - have_libevent=0 + # libs not found + have_libevent=0 EXTENSION_LIBEVENT_LIB="" fi @@ -11326,8 +11349,23 @@ $as_echo "$ac_cv_search_uv_run" >&6; } ac_res=$ac_cv_search_uv_run if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - EXTENSION_LIBUV_EXT_LIBS="-l$ac_lib" - CHECK_UV_PROG=check_getdns_uv + for ac_header in uv.h +do : + ac_fn_c_check_header_compile "$LINENO" "uv.h" "ac_cv_header_uv_h" "$ac_includes_default +" +if test "x$ac_cv_header_uv_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_UV_H 1 +_ACEOF + EXTENSION_LIBUV_EXT_LIBS="-l$ac_lib" + CHECK_UV_PROG=check_getdns_uv +else + have_libuv=0 + EXTENSION_LIBUV_LIB="" +fi + +done + else have_libuv=0 EXTENSION_LIBUV_LIB="" @@ -11397,8 +11435,23 @@ $as_echo "$ac_cv_search_ev_run" >&6; } ac_res=$ac_cv_search_ev_run if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - EXTENSION_LIBEV_EXT_LIBS="-l$ac_lib" - CHECK_EV_PROG=check_getdns_ev + for ac_header in ev.h +do : + ac_fn_c_check_header_compile "$LINENO" "ev.h" "ac_cv_header_ev_h" "$ac_includes_default +" +if test "x$ac_cv_header_ev_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EV_H 1 +_ACEOF + EXTENSION_LIBEV_EXT_LIBS="-l$ac_lib" + CHECK_EV_PROG=check_getdns_ev +else + have_libev=0 + EXTENSION_LIBUV_LIB="" +fi + +done + else have_libev=0 EXTENSION_LIBEV_LIB="" diff --git a/configure.ac b/configure.ac index af4f79e6..068dc447 100644 --- a/configure.ac +++ b/configure.ac @@ -203,9 +203,21 @@ CHECK_EVENT_PROG="" AC_SEARCH_LIBS([event_loop], [event_core event], [AC_CHECK_FUNCS([event_base_new event_base_free])] - [AC_CHECK_HEADERS([event2/event.h],,, [AC_INCLUDES_DEFAULT])] - [EXTENSION_LIBEVENT_EXT_LIBS="-l$ac_lib"] - [CHECK_EVENT_PROG=check_getdns_event], + [AC_CHECK_HEADERS([event2/event.h], + # event2/event.h found + [EXTENSION_LIBEVENT_EXT_LIBS="-l$ac_lib"] + [CHECK_EVENT_PROG=check_getdns_event], + # not found - look for event.h + [AC_CHECK_HEADERS([event.h], + # found + [EXTENSION_LIBEVENT_EXT_LIBS="-l$ac_lib"] + [CHECK_EVENT_PROG=check_getdns_event], + # not found - give up + [have_libevent=0] + [EXTENSION_LIBEVENT_LIB=""], + [AC_INCLUDES_DEFAULT])] + ,[AC_INCLUDES_DEFAULT])], + # libs not found [have_libevent=0] [EXTENSION_LIBEVENT_LIB=""]) @@ -221,8 +233,12 @@ EXTENSION_LIBUV_EXT_LIBS="" CHECK_UV_PROG="" AC_SEARCH_LIBS([uv_run], [uv], - [EXTENSION_LIBUV_EXT_LIBS="-l$ac_lib"] - [CHECK_UV_PROG=check_getdns_uv], + [AC_CHECK_HEADERS([uv.h], + [EXTENSION_LIBUV_EXT_LIBS="-l$ac_lib"] + [CHECK_UV_PROG=check_getdns_uv], + [have_libuv=0] + [EXTENSION_LIBUV_LIB=""], + [AC_INCLUDES_DEFAULT])], [have_libuv=0] [EXTENSION_LIBUV_LIB=""]) @@ -238,8 +254,12 @@ EXTENSION_LIBEV_EXT_LIBS="" AC_SEARCH_LIBS([ev_run], [ev], - [EXTENSION_LIBEV_EXT_LIBS="-l$ac_lib"] - [CHECK_EV_PROG=check_getdns_ev], + [AC_CHECK_HEADERS([ev.h], + [EXTENSION_LIBEV_EXT_LIBS="-l$ac_lib"] + [CHECK_EV_PROG=check_getdns_ev], + [have_libev=0] + [EXTENSION_LIBUV_LIB=""], + [AC_INCLUDES_DEFAULT])], [have_libev=0] [EXTENSION_LIBEV_LIB=""]) diff --git a/src/config.h.in b/src/config.h.in index a37faddc..f5db3978 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -12,6 +12,12 @@ /* Define to 1 if you have the `event_base_new' function. */ #undef HAVE_EVENT_BASE_NEW +/* Define to 1 if you have the header file. */ +#undef HAVE_EVENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_EV_H + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H @@ -51,6 +57,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the header file. */ +#undef HAVE_UV_H + /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR