From 71fe47b5d2b4edc4b738f9764e014082323be6aa Mon Sep 17 00:00:00 2001 From: Takashi Menjo Date: Tue, 4 Aug 2020 12:59:29 +0900 Subject: [PATCH v4 1/3] Add configure option for PMDK Author: Yoshimi Ichiyanagi --- configure | 92 ++++++++++++++++++++++++++++++++++++++ configure.ac | 16 +++++++ src/include/pg_config.h.in | 6 +++ 3 files changed, 114 insertions(+) diff --git a/configure b/configure index cb8fbe1051..8795969c81 100755 --- a/configure +++ b/configure @@ -701,6 +701,7 @@ LDFLAGS_SL LDFLAGS_EX with_zlib with_system_tzdata +with_libpmem with_libxslt XML2_LIBS XML2_CFLAGS @@ -864,6 +865,7 @@ with_uuid with_ossp_uuid with_libxml with_libxslt +with_libpmem with_system_tzdata with_zlib with_gnu_ld @@ -1567,6 +1569,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 @@ -8537,6 +8540,33 @@ fi +# +# 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 @@ -12586,6 +12616,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" @@ -13412,6 +13493,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.ac b/configure.ac index eb2c731b58..bc003624f0 100644 --- a/configure.ac +++ b/configure.ac @@ -980,6 +980,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 # @@ -1242,6 +1250,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" @@ -1427,6 +1439,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 fb270df678..1d4f6efe67 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -343,6 +343,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 @@ -881,6 +884,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.25.1