Skip to content

Commit

Permalink
Define ASIO_STANDALONE automatically if C++11 or later is detected.
Browse files Browse the repository at this point in the history
Users should define ASIO_ENABLE_BOOST to explicitly disable standalone
mode when compiling with C++11 or later.
  • Loading branch information
chriskohlhoff committed Mar 6, 2019
1 parent 189a5b1 commit 265e75c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions asio/boostify.pl
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ sub copy_examples
"src/examples/cpp11/timeouts",
"src/examples/cpp11/timers",
"src/examples/cpp14/executors",
"src/examples/cpp14/operations",
"src/examples/cpp17/coroutines_ts");

our $boost_dir;
Expand Down
4 changes: 2 additions & 2 deletions asio/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ AC_ARG_WITH(boost,
if test "${withval}" = no; then
STANDALONE="yes"
else
CPPFLAGS="$CPPFLAGS -I${withval} -DBOOST_CHRONO_HEADER_ONLY -DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING"
CPPFLAGS="$CPPFLAGS -I${withval} -DASIO_ENABLE_BOOST -DBOOST_CHRONO_HEADER_ONLY -DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING"
LIBS="$LIBS -L${withval}/stage/lib"
fi
],
Expand All @@ -27,7 +27,7 @@ AC_ARG_WITH(boost,
BOOSTDIR="`pwd`/${BOOSTDIR}"
if test -d "${BOOSTDIR}"; then
echo "using automatically detected boost from ${BOOSTDIR}"
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR} -DBOOST_CHRONO_HEADER_ONLY -DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING"
CPPFLAGS="$CPPFLAGS -I${BOOSTDIR} -DASIO_ENABLE_BOOST -DBOOST_CHRONO_HEADER_ONLY -DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING"
LIBS="$LIBS -L${BOOSTDIR}/stage/lib"
fi
fi
Expand Down
14 changes: 14 additions & 0 deletions asio/include/asio/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
#ifndef ASIO_DETAIL_CONFIG_HPP
#define ASIO_DETAIL_CONFIG_HPP

// boostify: non-boost code starts here
#if !defined(ASIO_STANDALONE)
# if !defined(ASIO_ENABLE_BOOST)
# if (__cplusplus >= 201103)
# define ASIO_STANDALONE 1
# elif defined(_MSC_VER) && defined(_MSVC_LANG)
# if (_MSC_VER >= 1900) && (_MSVC_LANG >= 201103)
# define ASIO_STANDALONE 1
# endif // (_MSC_VER >= 1900) && (_MSVC_LANG >= 201103)
# endif // defined(_MSC_VER) && defined(_MSVC_LANG)
# endif // !defined(ASIO_ENABLE_BOOST)
#endif // !defined(ASIO_STANDALONE)

// boostify: non-boost code ends here
#if defined(ASIO_STANDALONE)
# define ASIO_DISABLE_BOOST_ARRAY 1
# define ASIO_DISABLE_BOOST_ASSERT 1
Expand Down
2 changes: 1 addition & 1 deletion asio/src/Makefile.msc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ SEPARATE_COMPILATION_CXXFLAGS = \
!ifdef STANDALONE
STANDALONE_CXXFLAGS = -DASIO_STANDALONE
!else
STANDALONE_CXXFLAGS = -I$(BOOSTDIR)
STANDALONE_CXXFLAGS = -I$(BOOSTDIR) -DASIO_ENABLE_BOOST
!endif

CXXFLAGS = \
Expand Down

0 comments on commit 265e75c

Please sign in to comment.