Skip to content

Commit b756915

Browse files
committed
configure: Add libevent 2.0+ compatibility check for gpfdist
1 parent 2d8cbfb commit b756915

File tree

2 files changed

+70
-57
lines changed

2 files changed

+70
-57
lines changed

configure

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ with_ssl
665665
have_yaml
666666
YAML_LIBS
667667
EVENT_LIBS
668+
EVENT_CFLAGS
668669
apr_cppflags
669670
apr_cflags
670671
apr_link_ld_libs
@@ -977,6 +978,8 @@ LDFLAGS_EX
977978
LDFLAGS_SL
978979
PERL
979980
PYTHON
981+
EVENT_CFLAGS
982+
EVENT_LIBS
980983
MSGFMT
981984
TCLSH'
982985

@@ -1734,6 +1737,9 @@ Some influential environment variables:
17341737
LDFLAGS_SL extra linker flags for linking shared libraries only
17351738
PERL Perl program
17361739
PYTHON Python program
1740+
EVENT_CFLAGS
1741+
C compiler flags for EVENT, overriding pkg-config
1742+
EVENT_LIBS linker flags for EVENT, overriding pkg-config
17371743
MSGFMT msgfmt program for NLS
17381744
TCLSH Tcl interpreter program (tclsh)
17391745

@@ -10930,10 +10936,6 @@ $as_echo "yes" >&6; }
1093010936
fi
1093110937
fi
1093210938

10933-
10934-
10935-
10936-
1093710939
#
1093810940
# Realtime library
1093910941
#
@@ -14554,7 +14556,6 @@ fi
1455414556

1455514557
fi
1455614558

14557-
1455814559
if test "$enable_external_fts" = yes; then
1455914560
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jansson_version_str in -ljansson" >&5
1456014561
$as_echo_n "checking for jansson_version_str in -ljansson... " >&6; }
@@ -14886,65 +14887,78 @@ fi
1488614887
LIBS="$_LIBS"
1488714888

1488814889
_LIBS="$LIBS"
14889-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing event_add" >&5
14890-
$as_echo_n "checking for library containing event_add... " >&6; }
14891-
if ${ac_cv_search_event_add+:} false; then :
14892-
$as_echo_n "(cached) " >&6
14893-
else
14894-
ac_func_search_save_LIBS=$LIBS
14895-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14896-
/* end confdefs.h. */
1489714890

14898-
/* Override any GCC internal prototype to avoid an error.
14899-
Use char because int might match the return type of a GCC
14900-
builtin and then its argument prototype would still apply. */
14901-
#ifdef __cplusplus
14902-
extern "C"
14903-
#endif
14904-
char event_add ();
14905-
int
14906-
main ()
14907-
{
14908-
return event_add ();
14909-
;
14910-
return 0;
14911-
}
14912-
_ACEOF
14913-
for ac_lib in '' event; do
14914-
if test -z "$ac_lib"; then
14915-
ac_res="none required"
14916-
else
14917-
ac_res=-l$ac_lib
14918-
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
14919-
fi
14920-
if ac_fn_c_try_link "$LINENO"; then :
14921-
ac_cv_search_event_add=$ac_res
14891+
pkg_failed=no
14892+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libevent >= 2.0.0" >&5
14893+
$as_echo_n "checking for libevent >= 2.0.0... " >&6; }
14894+
14895+
if test -n "$EVENT_CFLAGS"; then
14896+
pkg_cv_EVENT_CFLAGS="$EVENT_CFLAGS"
14897+
elif test -n "$PKG_CONFIG"; then
14898+
if test -n "$PKG_CONFIG" && \
14899+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libevent >= 2.0.0\""; } >&5
14900+
($PKG_CONFIG --exists --print-errors "libevent >= 2.0.0") 2>&5
14901+
ac_status=$?
14902+
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
14903+
test $ac_status = 0; }; then
14904+
pkg_cv_EVENT_CFLAGS=`$PKG_CONFIG --cflags "libevent >= 2.0.0" 2>/dev/null`
14905+
test "x$?" != "x0" && pkg_failed=yes
14906+
else
14907+
pkg_failed=yes
1492214908
fi
14923-
rm -f core conftest.err conftest.$ac_objext \
14924-
conftest$ac_exeext
14925-
if ${ac_cv_search_event_add+:} false; then :
14926-
break
14909+
else
14910+
pkg_failed=untried
1492714911
fi
14928-
done
14929-
if ${ac_cv_search_event_add+:} false; then :
14930-
14912+
if test -n "$EVENT_LIBS"; then
14913+
pkg_cv_EVENT_LIBS="$EVENT_LIBS"
14914+
elif test -n "$PKG_CONFIG"; then
14915+
if test -n "$PKG_CONFIG" && \
14916+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libevent >= 2.0.0\""; } >&5
14917+
($PKG_CONFIG --exists --print-errors "libevent >= 2.0.0") 2>&5
14918+
ac_status=$?
14919+
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
14920+
test $ac_status = 0; }; then
14921+
pkg_cv_EVENT_LIBS=`$PKG_CONFIG --libs "libevent >= 2.0.0" 2>/dev/null`
14922+
test "x$?" != "x0" && pkg_failed=yes
1493114923
else
14932-
ac_cv_search_event_add=no
14924+
pkg_failed=yes
1493314925
fi
14934-
rm conftest.$ac_ext
14935-
LIBS=$ac_func_search_save_LIBS
14926+
else
14927+
pkg_failed=untried
1493614928
fi
14937-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_event_add" >&5
14938-
$as_echo "$ac_cv_search_event_add" >&6; }
14939-
ac_res=$ac_cv_search_event_add
14940-
if test "$ac_res" != no; then :
14941-
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
1494214929

14930+
14931+
14932+
if test $pkg_failed = yes; then
14933+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
14934+
$as_echo "no" >&6; }
14935+
14936+
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14937+
_pkg_short_errors_supported=yes
1494314938
else
14944-
as_fn_error $? "libevent is required for gpfdist" "$LINENO" 5
14939+
_pkg_short_errors_supported=no
1494514940
fi
14941+
if test $_pkg_short_errors_supported = yes; then
14942+
EVENT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libevent >= 2.0.0" 2>&1`
14943+
else
14944+
EVENT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libevent >= 2.0.0" 2>&1`
14945+
fi
14946+
# Put the nasty error message in config.log where it belongs
14947+
echo "$EVENT_PKG_ERRORS" >&5
14948+
14949+
as_fn_error $? "libevent >= 2.0.0 is required for gpfdist" "$LINENO" 5
14950+
elif test $pkg_failed = untried; then
14951+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
14952+
$as_echo "no" >&6; }
14953+
as_fn_error $? "libevent >= 2.0.0 is required for gpfdist" "$LINENO" 5
14954+
else
14955+
EVENT_CFLAGS=$pkg_cv_EVENT_CFLAGS
14956+
EVENT_LIBS=$pkg_cv_EVENT_LIBS
14957+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
14958+
$as_echo "yes" >&6; }
1494614959

14947-
EVENT_LIBS=" -levent"
14960+
fi
14961+
EVENT_LIBS="$EVENT_LIBS"
1494814962

1494914963

1495014964
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yaml_parser_initialize" >&5
@@ -16811,7 +16825,6 @@ fi
1681116825

1681216826
fi
1681316827

16814-
1681516828
if test "$enable_external_fts" = yes; then
1681616829
# Check for jansson
1681716830
ac_fn_c_check_header_mongrel "$LINENO" "jansson.h" "ac_cv_header_jansson_h" "$ac_includes_default"

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,8 +1636,8 @@ AC_DEFUN([CHECK_APR], [
16361636
if test "$enable_gpfdist" = yes ; then
16371637
CHECK_APR()
16381638
_LIBS="$LIBS"
1639-
AC_SEARCH_LIBS(event_add, [event], [], [AC_MSG_ERROR([libevent is required for gpfdist])])
1640-
EVENT_LIBS=" -levent"
1639+
PKG_CHECK_MODULES([EVENT], [libevent >= 2.0.0], [], [AC_MSG_ERROR([libevent >= 2.0.0 is required for gpfdist])])
1640+
EVENT_LIBS="$EVENT_LIBS"
16411641
AC_SUBST(EVENT_LIBS)
16421642

16431643
AC_SEARCH_LIBS(yaml_parser_initialize, [yaml], [have_yaml=yes; YAML_LIBS=" -lyaml"], [AC_MSG_WARN([libyaml is not found. disabling transformations for gpfdist.])])

0 commit comments

Comments
 (0)