fixed configure test for libevent 1.x on RHEL/CentOS

This commit is contained in:
Glen Wiley 2014-06-02 08:34:34 -04:00
parent ef3db96555
commit 0280c8fa83
3 changed files with 83 additions and 21 deletions

81
configure vendored
View File

@ -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

View File

@ -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])]

View File

@ -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 <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@ -63,9 +67,6 @@
/* 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