From 0919478fad458a576f89b1c1234129e9efd2aea0 Mon Sep 17 00:00:00 2001 From: Loki Astari Date: Mon, 16 Sep 2024 11:47:49 -0700 Subject: [PATCH] Fix to build latest version of ThorsSerializer --- config.h.in | 9 ++++-- configure | 72 +++++++++++++++++++++++++++++++++++++++---- configure.ac | 23 +++++++++++--- src/Makefile | 2 +- src/fast_float | 1 + third/ThorsMongoAPI | 2 +- third/ThorsSerializer | 2 +- 7 files changed, 95 insertions(+), 16 deletions(-) create mode 120000 src/fast_float diff --git a/config.h.in b/config.h.in index 1aa0cf2a..854e956f 100644 --- a/config.h.in +++ b/config.h.in @@ -54,15 +54,18 @@ /* We have found package ZLIB */ #undef HAVE_ZLIB -/* Check for older build tools and use simpler code with old tools */ -#undef HOMEBREW_OLD_VERSION_OF_MAC - /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* "Get mongosh version into #define. That way we can turn off some tests" */ #undef MONGO_MAJOR_VERSION +/* Check for older build tools and use simpler code with old tools */ +#undef NO_STD_SUPPORT_FROM_CHAR_DOUBLE + +/* Check for older build tools and use simpler code with old tools */ +#undef NO_STD_SUPPORT_TO_CHAR_DOUBLE + /* Name of package */ #undef PACKAGE diff --git a/configure b/configure index 17c1ae6f..f90afc25 100755 --- a/configure +++ b/configure @@ -5792,19 +5792,18 @@ if ac_fn_cxx_try_compile "$LINENO" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Supports std::to_chars(beigin, end, 12.4" >&5 -printf "%s\n" "$as_me: Supports std::to_chars(beigin, end, 12.4" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Supports std::to_chars(begin, end, double)" >&5 +printf "%s\n" "$as_me: Supports std::to_chars(begin, end, double)" >&6;} else case e in #( e) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Setting HOMEBREW_OLD_VERSION_OF_MAC" >&5 -printf "%s\n" "$as_me: Setting HOMEBREW_OLD_VERSION_OF_MAC" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Setting NO_STD_SUPPORT_TO_CHAR_DOUBLE" >&5 +printf "%s\n" "$as_me: Setting NO_STD_SUPPORT_TO_CHAR_DOUBLE" >&6;} -printf "%s\n" "#define HOMEBREW_OLD_VERSION_OF_MAC 1" >>confdefs.h +printf "%s\n" "#define NO_STD_SUPPORT_TO_CHAR_DOUBLE 1" >>confdefs.h - subconfigure="${subconfigure} --with-homebrewCLT=${with_homebrewCLT}" @@ -5819,6 +5818,67 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi + if test " +#include +int main() { + char buffer[] = "12.345"; + double value; + auto result = std::from_chars(buffer, buffer+100, value); +}" != "" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking Checking Compiler Compatibility ${CXX} ${CXX_STD_FLAG}" >&5 +printf %s "checking Checking Compiler Compatibility ${CXX} ${CXX_STD_FLAG}... " >&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 + + CXXFLAGS_SAVE="${CXXFLAGS}" + CXXFLAGS=${CXX_STD_FLAG} + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int main() { + char buffer[] = "12.345"; + double value; + auto result = std::from_chars(buffer, buffer+100, value); +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Supports std::from_chars(begin, end, double)" >&5 +printf "%s\n" "$as_me: Supports std::from_chars(begin, end, double)" >&6;} + + +else case e in #( + e) + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Setting NO_STD_SUPPORT_FROM_CHAR_DOUBLE" >&5 +printf "%s\n" "$as_me: Setting NO_STD_SUPPORT_FROM_CHAR_DOUBLE" >&6;} + +printf "%s\n" "#define NO_STD_SUPPORT_FROM_CHAR_DOUBLE 1" >>confdefs.h + + + + + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CXXFLAGS=${CXXFLAGS_SAVE} + + + +fi + + + case `pwd` in diff --git a/configure.ac b/configure.ac index 1c279ab7..1138a73a 100644 --- a/configure.ac +++ b/configure.ac @@ -32,14 +32,29 @@ int main() { auto result = std::to_chars(buffer, buffer+100, value, std::chars_format::fixed, 6); }]], [ - AC_MSG_NOTICE([Supports std::to_chars(beigin, end, 12.4]) + AC_MSG_NOTICE([[Supports std::to_chars(begin, end, double)]]) ], [ - AC_MSG_NOTICE([Setting HOMEBREW_OLD_VERSION_OF_MAC]) - AC_DEFINE([HOMEBREW_OLD_VERSION_OF_MAC], [1], [Check for older build tools and use simpler code with old tools]) - subconfigure="${subconfigure} --with-homebrewCLT=${with_homebrewCLT}" + AC_MSG_NOTICE([Setting NO_STD_SUPPORT_TO_CHAR_DOUBLE]) + AC_DEFINE([NO_STD_SUPPORT_TO_CHAR_DOUBLE], [1], [Check for older build tools and use simpler code with old tools]) ] ) +AX_THOR_FUNC_TEST_COMP_ACTION([[ +#include +int main() { + char buffer[] = "12.345"; + double value; + auto result = std::from_chars(buffer, buffer+100, value); +}]], + [ + AC_MSG_NOTICE([[Supports std::from_chars(begin, end, double)]]) + ], + [ + AC_MSG_NOTICE([Setting NO_STD_SUPPORT_FROM_CHAR_DOUBLE]) + AC_DEFINE([NO_STD_SUPPORT_FROM_CHAR_DOUBLE], [1], [Check for older build tools and use simpler code with old tools]) + ] +) + LT_INIT diff --git a/src/Makefile b/src/Makefile index 17756a13..d434bcf5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,7 @@ THORSANVIL_ROOT = $(realpath ../) -TARGET = ThorsLogging ThorsIOUtil Serialize ThorsStorage ThorsCrypto ThorsSocket ThorsMongo +TARGET = ThorsLogging ThorsIOUtil Serialize fast_float ThorsCrypto ThorsStorage ThorsSocket ThorsMongo include $(THORSANVIL_ROOT)/build/tools/Project.Makefile diff --git a/src/fast_float b/src/fast_float new file mode 120000 index 00000000..ac71f7ad --- /dev/null +++ b/src/fast_float @@ -0,0 +1 @@ +../third/ThorsSerializer/src/fast_float \ No newline at end of file diff --git a/third/ThorsMongoAPI b/third/ThorsMongoAPI index fc64761a..2e6ff3bf 160000 --- a/third/ThorsMongoAPI +++ b/third/ThorsMongoAPI @@ -1 +1 @@ -Subproject commit fc64761afef7eb9b33916e1d6f5ea10352de5d98 +Subproject commit 2e6ff3bfdf69f2429d2c0de2f66e1626fad9c1be diff --git a/third/ThorsSerializer b/third/ThorsSerializer index aa8db5ac..0ac9fc95 160000 --- a/third/ThorsSerializer +++ b/third/ThorsSerializer @@ -1 +1 @@ -Subproject commit aa8db5acd51d94735422ee7b5ec63d55721f8aa4 +Subproject commit 0ac9fc953b6859ee06c6a7b73ece0d0b5a9b06bf