Skip to content

Commit

Permalink
build: boost, prevent use of std::unary_function (#640)
Browse files Browse the repository at this point in the history
* build: boost, prevent use of std::unary_function

For Boost 1.72 we should use -D_HAS_AUTO_PTR_ETC=0, for newer versions
-DBOOST_NO_CXX98_FUNCTION_BASE.

- boostorg/container_hash@fd310d2
- boostorg/functional@6a573e4
- bitcoin/bitcoin@880d4aa
- bitcoin/bitcoin@d4c59da
- DeckerSU/KomodoOcean@0742048

This will remove warnings like the one shown below during build with GCC 13:

```
/home/decker/komodo/depends/x86_64-unknown-linux-gnu/share/../include/boost/container_hash/hash.hpp:130:33: warning: ‘template<class _Arg, class _Result> struct std::unary_function’ is deprecated [-Wdeprecated-declarations]
  130 |         struct hash_base : std::unary_function<T, std::size_t> {};
      |                                 ^~~~~~~~~~~~~~
In file included from /usr/include/c++/13/string:49,
                 from /usr/include/c++/13/bits/locale_classes.h:40,
                 from /usr/include/c++/13/bits/ios_base.h:41,
                 from /usr/include/c++/13/ios:44,
                 from /usr/include/c++/13/ostream:40,
                 from /home/decker/komodo/depends/x86_64-unknown-linux-gnu/share/../include/gtest/gtest.h:55,
                 from test-komodo/test_legacy_events.cpp:1:
/usr/include/c++/13/bits/stl_function.h:117:12: note: declared here
  117 |     struct unary_function
      |            ^~~~~~~~~~~~~~
```

* build: add BOOST_CPPFLAGS display for configure
  • Loading branch information
DeckerSU authored Nov 20, 2024
1 parent bac29fb commit ecfe30c
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,16 @@ AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_THREAD
AX_BOOST_CHRONO

dnl Prevent use of std::unary_function, which was removed in C++17,
dnl and will generate warnings with newer compilers for Boost
dnl older than 1.80.
dnl See: https://github.com/boostorg/container_hash/issues/22, https://github.com/boostorg/config/pull/430.

dnl _HAS_AUTO_PTR_ETC check required only for boost 1.72 and older, since 1.73 we can use BOOST_NO_CXX98_FUNCTION_BASE
AX_CHECK_PREPROC_FLAG([-D_HAS_AUTO_PTR_ETC=0], [BOOST_CPPFLAGS="$BOOST_CPPFLAGS -D_HAS_AUTO_PTR_ETC=0"], [], [$CXXFLAG_WERROR],
[AC_LANG_PROGRAM([[#include <boost/config.hpp>]])])
AX_CHECK_PREPROC_FLAG([-DBOOST_NO_CXX98_FUNCTION_BASE], [BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_CXX98_FUNCTION_BASE"], [], [$CXXFLAG_WERROR],
[AC_LANG_PROGRAM([[#include <boost/config.hpp>]])])
fi

if test x$use_reduce_exports = xyes; then
Expand Down Expand Up @@ -933,21 +943,22 @@ esac

echo
echo "Options used to compile and link:"
echo " with wallet = $enable_wallet"
echo " with proton = $use_proton"
echo " with zmq = $use_zmq"
echo " with test = $use_tests"
echo " debug enabled = $enable_debug"
echo " werror = $enable_werror"
echo " with wallet = $enable_wallet"
echo " with proton = $use_proton"
echo " with zmq = $use_zmq"
echo " with test = $use_tests"
echo " debug enabled = $enable_debug"
echo " werror = $enable_werror"
echo
echo " target os = $TARGET_OS"
echo " build os = $BUILD_OS"
echo " target os = $TARGET_OS"
echo " build os = $BUILD_OS"
echo
echo " CC = $CC"
echo " CFLAGS = $CFLAGS"
echo " CPPFLAGS = $CPPFLAGS"
echo " CXX = $CXX"
echo " CXXFLAGS = $CXXFLAGS"
echo " LDFLAGS = $LDFLAGS"
echo " ARFLAGS = $ARFLAGS"
echo " CC = $CC"
echo " CFLAGS = $CFLAGS"
echo " CPPFLAGS = $CPPFLAGS"
echo " CXX = $CXX"
echo " CXXFLAGS = $CXXFLAGS"
echo " BOOST_CPPFLAGS = $BOOST_CPPFLAGS"
echo " LDFLAGS = $LDFLAGS"
echo " ARFLAGS = $ARFLAGS"
echo

0 comments on commit ecfe30c

Please sign in to comment.