This is an automated email from the ASF dual-hosted git repository. yjhjstz pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 26a2f9c74c45e33e5f4e373126bc246e472f714a Author: Jianghua Yang <[email protected]> AuthorDate: Mon Jul 28 23:10:04 2025 +0000 configure: Add libevent 2.0+ compatibility check for gpfdist --- configure | 123 +++++++++++++++++++++++++++++++++-------------------------- configure.ac | 4 +- 2 files changed, 70 insertions(+), 57 deletions(-) diff --git a/configure b/configure index 5c808425477..925f63d4dcf 100755 --- a/configure +++ b/configure @@ -665,6 +665,7 @@ with_ssl have_yaml YAML_LIBS EVENT_LIBS +EVENT_CFLAGS apr_cppflags apr_cflags apr_link_ld_libs @@ -977,6 +978,8 @@ LDFLAGS_EX LDFLAGS_SL PERL PYTHON +EVENT_CFLAGS +EVENT_LIBS MSGFMT TCLSH' @@ -1734,6 +1737,9 @@ Some influential environment variables: LDFLAGS_SL extra linker flags for linking shared libraries only PERL Perl program PYTHON Python program + EVENT_CFLAGS + C compiler flags for EVENT, overriding pkg-config + EVENT_LIBS linker flags for EVENT, overriding pkg-config MSGFMT msgfmt program for NLS TCLSH Tcl interpreter program (tclsh) @@ -10930,10 +10936,6 @@ $as_echo "yes" >&6; } fi fi - - - - # # Realtime library # @@ -14554,7 +14556,6 @@ fi fi - if test "$enable_external_fts" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jansson_version_str in -ljansson" >&5 $as_echo_n "checking for jansson_version_str in -ljansson... " >&6; } @@ -14886,65 +14887,78 @@ fi LIBS="$_LIBS" _LIBS="$LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing event_add" >&5 -$as_echo_n "checking for library containing event_add... " >&6; } -if ${ac_cv_search_event_add+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char event_add (); -int -main () -{ -return event_add (); - ; - return 0; -} -_ACEOF -for ac_lib in '' event; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_event_add=$ac_res +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libevent >= 2.0.0" >&5 +$as_echo_n "checking for libevent >= 2.0.0... " >&6; } + +if test -n "$EVENT_CFLAGS"; then + pkg_cv_EVENT_CFLAGS="$EVENT_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libevent >= 2.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libevent >= 2.0.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_EVENT_CFLAGS=`$PKG_CONFIG --cflags "libevent >= 2.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_event_add+:} false; then : - break + else + pkg_failed=untried fi -done -if ${ac_cv_search_event_add+:} false; then : - +if test -n "$EVENT_LIBS"; then + pkg_cv_EVENT_LIBS="$EVENT_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libevent >= 2.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libevent >= 2.0.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_EVENT_LIBS=`$PKG_CONFIG --libs "libevent >= 2.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else - ac_cv_search_event_add=no + pkg_failed=yes fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS + else + pkg_failed=untried fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_event_add" >&5 -$as_echo "$ac_cv_search_event_add" >&6; } -ac_res=$ac_cv_search_event_add -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes else - as_fn_error $? "libevent is required for gpfdist" "$LINENO" 5 + _pkg_short_errors_supported=no fi + if test $_pkg_short_errors_supported = yes; then + EVENT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libevent >= 2.0.0" 2>&1` + else + EVENT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libevent >= 2.0.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$EVENT_PKG_ERRORS" >&5 + + as_fn_error $? "libevent >= 2.0.0 is required for gpfdist" "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "libevent >= 2.0.0 is required for gpfdist" "$LINENO" 5 +else + EVENT_CFLAGS=$pkg_cv_EVENT_CFLAGS + EVENT_LIBS=$pkg_cv_EVENT_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } - EVENT_LIBS=" -levent" +fi + EVENT_LIBS="$EVENT_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yaml_parser_initialize" >&5 @@ -16811,7 +16825,6 @@ fi fi - if test "$enable_external_fts" = yes; then # Check for jansson ac_fn_c_check_header_mongrel "$LINENO" "jansson.h" "ac_cv_header_jansson_h" "$ac_includes_default" diff --git a/configure.ac b/configure.ac index 435259ed6da..6ef2f9fa26c 100644 --- a/configure.ac +++ b/configure.ac @@ -1636,8 +1636,8 @@ AC_DEFUN([CHECK_APR], [ if test "$enable_gpfdist" = yes ; then CHECK_APR() _LIBS="$LIBS" - AC_SEARCH_LIBS(event_add, [event], [], [AC_MSG_ERROR([libevent is required for gpfdist])]) - EVENT_LIBS=" -levent" + PKG_CHECK_MODULES([EVENT], [libevent >= 2.0.0], [], [AC_MSG_ERROR([libevent >= 2.0.0 is required for gpfdist])]) + EVENT_LIBS="$EVENT_LIBS" AC_SUBST(EVENT_LIBS) AC_SEARCH_LIBS(yaml_parser_initialize, [yaml], [have_yaml=yes; YAML_LIBS=" -lyaml"], [AC_MSG_WARN([libyaml is not found. disabling transformations for gpfdist.])]) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
