From 0280c8fa837f7a47bec0d446f621b6c8768c1cf7 Mon Sep 17 00:00:00 2001 From: Glen Wiley Date: Mon, 2 Jun 2014 08:34:34 -0400 Subject: [PATCH 1/7] fixed configure test for libevent 1.x on RHEL/CentOS --- configure | 81 ++++++++++++++++++++++++++++++++++++++++--------- configure.ac | 16 ++++++++-- src/config.h.in | 7 +++-- 3 files changed, 83 insertions(+), 21 deletions(-) diff --git a/configure b/configure index 30b01122..6c89df61 100755 --- a/configure +++ b/configure @@ -1859,6 +1859,52 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -5642,7 +5688,7 @@ ia64-*-hpux*) rm -rf conftest* ;; -x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext @@ -5660,10 +5706,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; - powerpc64le-*linux*) - LD="${LD-ld} -m elf32lppclinux" - ;; - powerpc64-*linux*) + ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) @@ -5682,10 +5725,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - powerpcle-*linux*) - LD="${LD-ld} -m elf64lppc" - ;; - powerpc-*linux*) + ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -7140,6 +7180,10 @@ _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= @@ -11174,17 +11218,18 @@ _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 : +ac_fn_c_check_decl "$LINENO" "u_char" "ac_cv_have_decl_u_char" "$ac_includes_default" +if test "x$ac_cv_have_decl_u_char" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi cat >>confdefs.h <<_ACEOF -#define HAVE_U_CHAR 1 +#define HAVE_DECL_U_CHAR $ac_have_decl _ACEOF -fi - - getdns_LIBS=$LIBS getdns_LDFLAGS=$LDFLAGS @@ -11198,6 +11243,9 @@ else fi +# if user specified a location for libevent then use it, otherwise +# check for libevent 1 + have_libevent=0 EXTENSION_LIBEVENT_EXT_LIBS="" EXTENSION_LIBEVENT_LIB="" @@ -11286,6 +11334,9 @@ else 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 HAVE_DECL_U_CHAR == 0 + typedef unsigned char u_char; + #endif " if test "x$ac_cv_header_event_h" = xyes; then : cat >>confdefs.h <<_ACEOF diff --git a/configure.ac b/configure.ac index 77480756..6166a8d3 100644 --- a/configure.ac +++ b/configure.ac @@ -189,7 +189,7 @@ AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_UINT8_T -AC_CHECK_TYPES([u_char]) +AC_CHECK_DECLS([u_char]) getdns_LIBS=$LIBS getdns_LDFLAGS=$LDFLAGS @@ -200,6 +200,13 @@ AC_ARG_WITH([libevent], [with_libevent=search], [withval=no]) +# libevent 1.x requires a u_char typedef which is not always available +# on some systems so our check is a little complicated +# we further need to ensure that this is included in the getdns headers +# that get installed later so some users may not be building in an +# environment that has the generated config.h SO we need to generate +# this one extra header in that case + have_libevent=0 EXTENSION_LIBEVENT_EXT_LIBS="" EXTENSION_LIBEVENT_LIB="" @@ -219,9 +226,12 @@ AS_IF([test x_$withval = x_no], [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] + [#if HAVE_DECL_U_CHAR == 0 + typedef unsigned char u_char; + #endif])], [AC_INCLUDES_DEFAULT])], - [AC_MSG_ERROR([libevent missing, try without libevent])] + [AC_MSG_ERROR([libevent missing, try without libevent])] )], [have_libevent=1] [AC_MSG_NOTICE([assuming libevent in $withval])] diff --git a/src/config.h.in b/src/config.h.in index d3c657b9..4578b95d 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -1,5 +1,9 @@ /* src/config.h.in. Generated from configure.ac by autoheader. */ +/* Define to 1 if you have the declaration of `u_char', and to 0 if you don't. + */ +#undef HAVE_DECL_U_CHAR + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H @@ -63,9 +67,6 @@ /* Define to 1 if you have the 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 From e284a702a8fe484ff272b3110b1c5765b4b02ede Mon Sep 17 00:00:00 2001 From: Glen Wiley Date: Mon, 2 Jun 2014 09:48:30 -0400 Subject: [PATCH 2/7] removed define for u_char since it breaks some builds --- src/extension/libevent.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/extension/libevent.c b/src/extension/libevent.c index dcccd636..e42d6a10 100644 --- a/src/extension/libevent.c +++ b/src/extension/libevent.c @@ -40,9 +40,6 @@ #ifdef HAVE_EVENT2_EVENT_H # include #else -# ifndef u_char -# define u_char unsigned char -# endif # include # define evutil_socket_t int # define event_free free From ac0b80867102f98b47f14328d4167d20966358fb Mon Sep 17 00:00:00 2001 From: Glen Wiley Date: Mon, 2 Jun 2014 10:50:52 -0400 Subject: [PATCH 3/7] tweaking u_char checks --- configure | 68 ++++++++----------------------------------------- configure.ac | 4 +-- src/config.h.in | 4 --- 3 files changed, 12 insertions(+), 64 deletions(-) diff --git a/configure b/configure index 6c89df61..8916c159 100755 --- a/configure +++ b/configure @@ -1859,52 +1859,6 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t - -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- -# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - as_decl_name=`echo $2|sed 's/ *(.*//'` - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -11218,16 +11172,10 @@ _ACEOF ;; esac -ac_fn_c_check_decl "$LINENO" "u_char" "ac_cv_have_decl_u_char" "$ac_includes_default" -if test "x$ac_cv_have_decl_u_char" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi +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_DECL_U_CHAR $ac_have_decl -_ACEOF +fi getdns_LIBS=$LIBS @@ -11243,8 +11191,12 @@ else fi -# if user specified a location for libevent then use it, otherwise -# check for libevent 1 +# libevent 1.x requires a u_char typedef which is not always available +# on some systems so our check is a little complicated +# we further need to ensure that this is included in the getdns headers +# that get installed later so some users may not be building in an +# environment that has the generated config.h SO we need to generate +# this one extra header in that case have_libevent=0 EXTENSION_LIBEVENT_EXT_LIBS="" @@ -11334,7 +11286,7 @@ else 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 HAVE_DECL_U_CHAR == 0 + #if HAVE_U_CHAR == 0 typedef unsigned char u_char; #endif " diff --git a/configure.ac b/configure.ac index 6166a8d3..689e0975 100644 --- a/configure.ac +++ b/configure.ac @@ -189,7 +189,7 @@ AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_UINT8_T -AC_CHECK_DECLS([u_char]) +AC_CHECK_TYPE([u_char]) getdns_LIBS=$LIBS getdns_LDFLAGS=$LDFLAGS @@ -227,7 +227,7 @@ AS_IF([test x_$withval = x_no], [AC_MSG_ERROR([event2/event.h and event.h missing, try without libevent])] [have_libevent=0], [AC_INCLUDES_DEFAULT] - [#if HAVE_DECL_U_CHAR == 0 + [#if HAVE_U_CHAR == 0 typedef unsigned char u_char; #endif])], [AC_INCLUDES_DEFAULT])], diff --git a/src/config.h.in b/src/config.h.in index 4578b95d..c384d0cf 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -1,9 +1,5 @@ /* src/config.h.in. Generated from configure.ac by autoheader. */ -/* Define to 1 if you have the declaration of `u_char', and to 0 if you don't. - */ -#undef HAVE_DECL_U_CHAR - /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H From 20c6889f9ddcd564bc6b3fdd7cb448b756b0465a Mon Sep 17 00:00:00 2001 From: Glen Wiley Date: Mon, 2 Jun 2014 11:40:58 -0400 Subject: [PATCH 4/7] added _BSD_SOURCE for linux to solve some lingering compile issues --- configure | 4 +--- configure.ac | 4 +--- src/convert.c | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 8916c159..2df96379 100755 --- a/configure +++ b/configure @@ -3248,9 +3248,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac case "$host_os" in - linux* ) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=501" # unfortunate, but needed to - # pick up strdup() declaration - # in + linux* ) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;; solaris* ) CFLAGS="$CFLAGS -D__EXTENSIONS__" # for strdup() from ;; diff --git a/configure.ac b/configure.ac index 689e0975..c625078a 100644 --- a/configure.ac +++ b/configure.ac @@ -45,9 +45,7 @@ AC_PROG_CPP # Checks for programs. AC_CANONICAL_HOST case "$host_os" in - linux* ) CFLAGS="$CFLAGS -D_XOPEN_SOURCE=501" # unfortunate, but needed to - # pick up strdup() declaration - # in + linux* ) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;; solaris* ) CFLAGS="$CFLAGS -D__EXTENSIONS__" # for strdup() from ;; diff --git a/src/convert.c b/src/convert.c index 8fad6e10..97510cea 100644 --- a/src/convert.c +++ b/src/convert.c @@ -33,6 +33,7 @@ */ #include +#include #include #include #include From 0194208f51ab591a066897e218386c7e39aaf1dd Mon Sep 17 00:00:00 2001 From: Glen Wiley Date: Mon, 2 Jun 2014 14:18:26 -0400 Subject: [PATCH 5/7] note about fixed rhel, centos builds --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a6113634..baf2d8eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -* 2014-05-22: Version 0.1.2 +* 2014-06-02: Version 0.1.2 * Fixed rdata fields for MX * Expose only public API symbols * Updated manpages @@ -11,6 +11,7 @@ Thanks Paul Hoffman * Mac OSX package built instructions for generic user in README.md Thanks Joel Purra + * Fixed build problems on RHEL/CentOS due using libevent 1.x * 2014-03-24 : Version 0.1.1 From 40e6e8bd576c759fdcdb62eeb5055b6497f180db Mon Sep 17 00:00:00 2001 From: Glen Wiley Date: Mon, 2 Jun 2014 18:02:10 -0400 Subject: [PATCH 6/7] updates to reflect problems with FreeBSD builds in 0.1.2 --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 99f4c876..23e60298 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ getdns API ========== -* Date: 2014-05-22 +* Date: 2014-06-02 * GitHub: getdns is a [modern asynchronous DNS API](http://www.vpnc.org/getdns-api/) @@ -142,21 +142,20 @@ Some platform specific features are not implemented in the first public release There are a few known issues which we have summarized below - the most recent and helpful list is being maintained in the git issues list in the repository. +Other known issues are being managed in the git repository issue list. * (#113) Changing the resolution type between stub and recursive after a query has been issued with a context will not work - the previous resolution type will continue to be used. If you want to change the resolution type you will need to create a new context and set the resolution type for that context. -* older versions of libtool and ranlib may have problems with the way we leverage features specific to exported sybols. If you see messages during linking it may be due to an older version of libtool in your PATH. This can be fixed by updating your libtool or adding the getdns build directory to the beginning of your path so that our libtool/ranlib are picked up. +* older versions of libtool and ranlib may have problems with the way we leverage features specific to exported symbols. If you see error messages during linking it may be due to an older version of libtool in your PATH. This can be fixed by updating your libtool or adding the getdns build directory to the beginning of your path so that our libtool/ranlib are preferred. #Supported Platforms The primary platforms targeted are Linux and FreeBSD, other platform are supported as we get time. The names listed here are intended to help ensure that we catch platform specific breakage, not to limit the work that folks are doing. -* Debian 7.0, 7.3 -* FreeBSD 8.4, 9.2, 10.0 -* RHEL/CentOS 6.4, 6.5 -* OSX 10.8, 10.9 -* Ubuntu 12.04, 13.10 +* RHEL/CentOS 6.4 +* OSX 10.8 +* Ubuntu 13.10 For most platforms where we have provided a binary distribution as a compressed tar you can simply untar the file and run "make install". Bear in mind that any dependencies @@ -176,7 +175,7 @@ We intend to add MS-Windows, Android and other platforms to the releases as we h If you're using [FreeBSD](http://www.freebsd.org/), you may install getdns via the [ports tree](http://www.freshports.org/dns/getdns/) by running: `cd /usr/ports/dns/getdns && make install clean` -If you are using FreeBSD 10 getdns can be intalled via 'pkg install getdns'. +If you are using FreeBSD 10 getdns can be intalled via 'pkg install getdns'. There may be some problems building getdns on FreeBSD 10 using libevent. ###CentOS/RHEL 6.5 From feb29ab8f044cda8574ca1206f57c5549e6f3b74 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Tue, 3 Jun 2014 11:05:17 +0200 Subject: [PATCH 7/7] Allow piggybacking on libunbouns libevent --- configure | 22 +++++++++++----------- configure.ac | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 2df96379..ea6573df 100755 --- a/configure +++ b/configure @@ -7132,10 +7132,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= @@ -9690,14 +9686,10 @@ fi # before this can be enabled. hardcode_into_libs=yes - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" - + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -11279,7 +11271,11 @@ if test "x$ac_cv_header_event2_event_h" = xyes; then : #define HAVE_EVENT2_EVENT_H 1 _ACEOF have_libevent=1 - EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop" + if test "x_$ac_cv_search_event_loop" = "x_none required"; then : + +else + EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop" +fi else for ac_header in event.h do : @@ -11293,7 +11289,11 @@ if test "x$ac_cv_header_event_h" = xyes; then : #define HAVE_EVENT_H 1 _ACEOF have_libevent=1 - EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop" + if test "x_$ac_cv_search_event_loop" = "x_none required"; then : + +else + EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop" +fi else as_fn_error $? "event2/event.h and event.h missing, try without libevent" "$LINENO" 5 have_libevent=0 diff --git a/configure.ac b/configure.ac index c625078a..9c7cb7ef 100644 --- a/configure.ac +++ b/configure.ac @@ -218,10 +218,10 @@ AS_IF([test x_$withval = x_no], [AC_CHECK_FUNCS([event_base_new event_base_free])] [AC_CHECK_HEADERS([event2/event.h], [have_libevent=1] - [EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"], + [AS_IF([test "x_$ac_cv_search_event_loop" = "x_none required"],[],[EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"])], [AC_CHECK_HEADERS([event.h], [have_libevent=1] - [EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"], + [AS_IF([test "x_$ac_cv_search_event_loop" = "x_none required"],[],[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]