From 45ac1bc7ae55b8b24fe2667cf895c4e53f1f870b Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Mon, 26 May 2014 15:56:30 +0200 Subject: [PATCH] Make libev work on Fedora too --- configure | 129 ++++++++-------------------------- configure.ac | 16 +++-- src/config.h.in | 3 + src/extension/libev.c | 8 ++- src/test/check_getdns_libev.c | 4 ++ 5 files changed, 53 insertions(+), 107 deletions(-) diff --git a/configure b/configure index 4372c041..30b01122 100755 --- a/configure +++ b/configure @@ -5642,7 +5642,7 @@ ia64-*-hpux*) rm -rf conftest* ;; -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext @@ -5660,7 +5660,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; - ppc64-*linux*|powerpc64-*linux*) + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) @@ -5679,7 +5682,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - ppc*-*linux*|powerpc*-*linux*) + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -7134,10 +7140,6 @@ _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= @@ -10681,98 +10683,6 @@ CC="$lt_save_CC" # Only expand once: -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -11626,14 +11536,31 @@ if test "x$ac_cv_header_ev_h" = xyes; then : #define HAVE_EV_H 1 _ACEOF have_libev=1 - EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run" + EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run" +else + for ac_header in libev/ev.h +do : + ac_fn_c_check_header_compile "$LINENO" "libev/ev.h" "ac_cv_header_libev_ev_h" "$ac_includes_default +" +if test "x$ac_cv_header_libev_ev_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBEV_EV_H 1 +_ACEOF + have_libev=1 + EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run" else as_fn_error $? "ev.h missing, try without libev" "$LINENO" 5 - have_libev=0 + have_libev=0 fi done + +fi + +done + + else as_fn_error $? "libev missing, try without libev" "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 17a700ad..77480756 100644 --- a/configure.ac +++ b/configure.ac @@ -306,11 +306,17 @@ AS_IF([test x_$withval = x_no], [AC_SEARCH_LIBS([ev_run], [ev], [AC_CHECK_HEADERS([ev.h], - [have_libev=1] - [EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run"], - [AC_MSG_ERROR([ev.h missing, try without libev])] - [have_libev=0], - [AC_INCLUDES_DEFAULT])], + [have_libev=1] + [EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run"], + [AC_CHECK_HEADERS([libev/ev.h], + [have_libev=1] + [EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run"], + [AC_MSG_ERROR([ev.h missing, try without libev])] + [have_libev=0], + [AC_INCLUDES_DEFAULT]) + ], + [AC_INCLUDES_DEFAULT]) + ], [AC_MSG_ERROR([libev missing, try without libev])] )], [have_libev=1] diff --git a/src/config.h.in b/src/config.h.in index e15a2edd..d3c657b9 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -21,6 +21,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBEV_EV_H + /* Define to 1 if you have the `idn' library (-lidn). */ #undef HAVE_LIBIDN diff --git a/src/extension/libev.c b/src/extension/libev.c index f043a45b..61e237d9 100644 --- a/src/extension/libev.c +++ b/src/extension/libev.c @@ -35,8 +35,14 @@ #include #include -#include #include "getdns/getdns_ext_libev.h" +#include "config.h" + +#ifdef HAVE_LIBEV_EV_H +#include +#else +#include +#endif #define RETURN_IF_NULL(ptr, code) if(ptr == NULL) return code; diff --git a/src/test/check_getdns_libev.c b/src/test/check_getdns_libev.c index e472b487..04a19fb0 100644 --- a/src/test/check_getdns_libev.c +++ b/src/test/check_getdns_libev.c @@ -36,7 +36,11 @@ #include "check_getdns_eventloop.h" #include "getdns/getdns_ext_libev.h" +#ifdef HAVE_LIBEV_EV_H +#include +#else #include +#endif #include #include "check_getdns_common.h"