提交 94afeb62 编写于 作者: J Jesse Zhang and Omer Arap 提交者: Jemish Patel and Omer Arap

Adds a check for Greenplum patched Xerces [#138725549]

If gpdb is configured to build with orca it requires a Greenplum patched
version of Xerces library. This commit adds an explicit check for the
patched Xerces.

This also gives us an opportunity to be more idiomatic in doing
autoconf: we are replacing the manual manipulation of LIBS in
src/backend/Makefile with `AC_CHECK_LIB` in `configure.in`.
上级 b6d75a3b
......@@ -13,3 +13,4 @@ m4_include([config/python.m4])
m4_include([config/tcl.m4])
m4_include([config/curl.m4])
m4_include([config/ax_python_module.m4])
m4_include([config/orca.m4])
# PGAC_CHECK_ORCA_XERCES
# ---------------------
# Check if the Greenplum patched version of Xerces-C is found
AC_DEFUN([PGAC_CHECK_ORCA_XERCES],
[
AC_CHECK_LIB(xerces-c, strnicmp, [],
[AC_MSG_ERROR([library xerces-c is required for Pivotal Query Optimizer to build, you can build it from https://github.com/greenplum-db/gp-xerces])]
)
AC_MSG_CHECKING([[for Greenplum patched Xerces-C]])
AC_LANG_PUSH([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include "xercesc/util/XMemory.hpp"
#include "xercesc/dom/DOMImplementationList.hpp"
]],
[
xercesc::DOMImplementationList* derived_ptr = NULL;
xercesc::XMemory* base_ptr = derived_ptr;
])],
[AC_MSG_RESULT([[ok]])],
[AC_MSG_ERROR([Your Xerces is not patched, you can build it from https://github.com/greenplum-db/gp-xerces])]
)
AC_LANG_POP([C++])
])# PGAC_CHECK_ORCA_XERCES
......@@ -2035,6 +2035,52 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_header_compile
# ac_fn_cxx_try_link LINENO
# -------------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
ac_fn_cxx_try_link ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext conftest$ac_exeext
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_cxx_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
test -x conftest$ac_exeext
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_link
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
......@@ -10969,6 +11015,96 @@ fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strnicmp in -lxerces-c" >&5
$as_echo_n "checking for strnicmp in -lxerces-c... " >&6; }
if ${ac_cv_lib_xerces_c_strnicmp+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lxerces-c $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 strnicmp ();
int
main ()
{
return strnicmp ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_xerces_c_strnicmp=yes
else
ac_cv_lib_xerces_c_strnicmp=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xerces_c_strnicmp" >&5
$as_echo "$ac_cv_lib_xerces_c_strnicmp" >&6; }
if test "x$ac_cv_lib_xerces_c_strnicmp" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBXERCES_C 1
_ACEOF
LIBS="-lxerces-c $LIBS"
else
as_fn_error $? "library xerces-c is required for Pivotal Query Optimizer to build, you can build it from https://github.com/greenplum-db/gp-xerces" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Greenplum patched Xerces-C" >&5
$as_echo_n "checking for Greenplum patched Xerces-C... " >&6; }
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "xercesc/util/XMemory.hpp"
#include "xercesc/dom/DOMImplementationList.hpp"
int
main ()
{
xercesc::DOMImplementationList* derived_ptr = NULL;
xercesc::XMemory* base_ptr = derived_ptr;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
else
as_fn_error $? "Your Xerces is not patched, you can build it from https://github.com/greenplum-db/gp-xerces" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi # fi
for ac_header in atomic.h crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h kernel/OS.h kernel/image.h SupportDefs.h
......
......@@ -1298,6 +1298,7 @@ AS_IF([test "$enable_orca" = yes],
[ # then
AC_CHECK_HEADERS(gpopt/init.h, [], [AC_MSG_ERROR([gpopt/init.h GPOPT header file is required for Greenplum Query Optimizer (orca)])])
AC_CHECK_HEADERS(gpos/config.h, [], [AC_MSG_ERROR([gpos/config.h GPOS header file is required for Greenplum Query Optimizer (orca)])])
PGAC_CHECK_ORCA_XERCES
]) # fi
dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES
......
......@@ -65,7 +65,6 @@ LIBS := $(filter-out -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS))
# ORCA libraries.
ifeq ($(enable_orca),yes)
LIBS := $(LIBS) -lgpopt -lnaucrates -lgpdbcost -lgpos
LIBS := $(LIBS) -lxerces-c-3.1
endif
# adding codegen libraries
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册