From f62ce0a15d56dbf05e8e861f7c17d4c99fd8c97e Mon Sep 17 00:00:00 2001 From: erthalion <9erthalion6@gmail.com> Date: Mon, 10 Dec 2018 17:57:57 +0100 Subject: [PATCH 1/3] Add configuration option for PMDK --- configure | 92 ++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 16 ++++++++ src/include/pg_config.h.in | 6 +++ 3 files changed, 114 insertions(+) diff --git a/configure b/configure index dce6d98cf6..831977362f 100755 --- a/configure +++ b/configure @@ -702,6 +702,7 @@ EGREP GREP with_zlib with_system_tzdata +with_libpmem with_libxslt with_libxml XML2_CONFIG @@ -863,6 +864,7 @@ with_uuid with_ossp_uuid with_libxml with_libxslt +with_libpmem with_system_tzdata with_zlib with_gnu_ld @@ -1564,6 +1566,7 @@ Optional Packages: --with-ossp-uuid obsolete spelling of --with-uuid=ossp --with-libxml build with XML support --with-libxslt use XSLT support when building contrib/xml2 + --with-libpmem use PMEM support for WAL I/O --with-system-tzdata=DIR use system time zone data in DIR --without-zlib do not use Zlib @@ -7325,6 +7328,33 @@ if test "$with_icu" = yes; then +# +# PMEM +# + + + +# Check whether --with-libpmem was given. +if test "${with_libpmem+set}" = set; then : + withval=$with_libpmem; + case $withval in + yes) + +$as_echo "#define USE_LIBPMEM 1" >>confdefs.h + + ;; + no) + : + ;; + *) + as_fn_error $? "no argument expected for --with-libpmem option" "$LINENO" 5 + ;; + esac + +else + with_libpmem=no + +fi @@ -12343,6 +12373,57 @@ fi fi +if test "$with_libpmem" = yes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pmem_map_file in -lpmem" >&5 +$as_echo_n "checking for pmem_map_file in -lpmem... " >&6; } +if ${ac_cv_lib_pmem_pmem_map_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpmem $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 pmem_map_file (); +int +main () +{ +return pmem_map_file (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pmem_pmem_map_file=yes +else + ac_cv_lib_pmem_pmem_map_file=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_pmem_pmem_map_file" >&5 +$as_echo "$ac_cv_lib_pmem_pmem_map_file" >&6; } +if test "x$ac_cv_lib_pmem_pmem_map_file" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPMEM 1 +_ACEOF + + LIBS="-lpmem $LIBS" + +else + as_fn_error $? "library 'pmwm' is required for PMEM support" "$LINENO" 5 +fi + +fi + + # Note: We can test for libldap_r only after we know PTHREAD_LIBS if test "$with_ldap" = yes ; then _LIBS="$LIBS" @@ -13169,6 +13250,17 @@ else fi +fi + +if test "$with_libpmem" = yes ; then + ac_fn_c_check_header_mongrel "$LINENO" "libpmem.h" "ac_cv_header_libpmem_h" "$ac_includes_default" +if test "x$ac_cv_header_libpmem_h" = xyes; then : + +else + as_fn_error $? "header file is required for PMEM support" "$LINENO" 5 +fi + + fi if test "$with_ldap" = yes ; then diff --git a/configure.in b/configure.in index e5123ac122..65ac2fbd25 100644 --- a/configure.in +++ b/configure.in @@ -949,6 +949,14 @@ PGAC_ARG_BOOL(with, libxslt, no, [use XSLT support when building contrib/xml2], AC_SUBST(with_libxslt) +# +# PMEM +# +PGAC_ARG_BOOL(with, libpmem, no, [use PMEM support for WAL I/O], + [AC_DEFINE([USE_LIBPMEM], 1, [Define to 1 to use PMEM support for WAL I/O. (--with-libpmem)])]) + +AC_SUBST(with_libpmem) + # # tzdata # @@ -1230,6 +1238,10 @@ if test "$with_libxslt" = yes ; then AC_CHECK_LIB(xslt, xsltCleanupGlobals, [], [AC_MSG_ERROR([library 'xslt' is required for XSLT support])]) fi +if test "$with_libpmem" = yes ; then + AC_CHECK_LIB(pmem, pmem_map_file, [], [AC_MSG_ERROR([library 'pmem' is required for PMEM support])]) +fi + # Note: We can test for libldap_r only after we know PTHREAD_LIBS if test "$with_ldap" = yes ; then _LIBS="$LIBS" @@ -1418,6 +1430,10 @@ if test "$with_libxslt" = yes ; then AC_CHECK_HEADER(libxslt/xslt.h, [], [AC_MSG_ERROR([header file is required for XSLT support])]) fi +if test "$with_libpmem" = yes ; then + AC_CHECK_HEADER(libpmem.h, [], [AC_MSG_ERROR([header file is required for PMEM support])]) +fi + if test "$with_ldap" = yes ; then if test "$PORTNAME" != "win32"; then AC_CHECK_HEADERS(ldap.h, [], diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 6ac75cd02c..f11e5ef916 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -378,6 +378,9 @@ /* Define to 1 if you have the `xslt' library (-lxslt). */ #undef HAVE_LIBXSLT +/* Define to 1 if you have the `pmem' library (-lpmem). */ +#undef HAVE_LIBPMEM + /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ @@ -915,6 +918,9 @@ /* Define to 1 to build with LLVM based JIT support. (--with-llvm) */ #undef USE_LLVM +/* Define to 1 to use PMEM support for WAL I/O. (--with-libpmem) */ +#undef USE_LIBPMEM + /* Define to select named POSIX semaphores. */ #undef USE_NAMED_POSIX_SEMAPHORES -- 2.16.4