From e66d103cdccd226998723ae3e15320a4338dc0b2 Mon Sep 17 00:00:00 2001
From: Idar Tollefsen <idart@hotmail.com>
Date: Mon, 9 Jan 2017 12:53:47 +0100
Subject: [PATCH] Adds BOOST_HAS_UNISTD_H check for unistd.h inclusion.
Given a configuration file used with -DBOOST_USER_CONFIG such as:
---
#define BOOST_NO_CONFIG
#define BOOST_BIND_NO_PLACEHOLDERS
#define BOOST_DISABLE_ABI_HEADERS
#define BOOST_COMPILER_CONFIG "boost/config/compiler/clang.hpp"
#define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcpp.hpp"
#define BOOST_PLATFORM "linux"
#define BOOST_HAS_UNISTD_H
---
Then ASIO will, in detail/config.hpp, include <boost/config.hpp>
and <boost/version.hpp> and define BOOST_ASIO_HAS_BOOST_CONFIG.
Further down in the same file, BOOST_ASIO_HAS_UNISTD_H decides whether
it should include unistd.h or not.
The checks performed there fails to account for situations such as this
where BOOST_ASIO_HAS_BOOST_CONFIG has been defined.
In these cases, it should check whether BOOST_HAS_UNISTD_H has been
defined and if so also define BOOST_ASIO_HAS_UNISTD_H so that unistd.h
gets included.
This probably works "as is" for the more popular combinations since
they will pull in unistd.h through other configuration files (stdlib
for example), but does not work for combinations that don't do that,
such as Clang using libc++ on Linux.
---
include/boost/asio/detail/config.hpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/boost/asio/detail/config.hpp b/include/boost/asio/detail/config.hpp
index 319f94fe38..f4f35e5848 100644
a
|
b
|
|
641 | 641 | || defined(__linux__) |
642 | 642 | # define BOOST_ASIO_HAS_UNISTD_H 1 |
643 | 643 | # endif |
| 644 | # elif defined(BOOST_HAS_UNISTD_H) |
| 645 | # define BOOST_ASIO_HAS_UNISTD_H 1 |
644 | 646 | # endif // !defined(BOOST_ASIO_HAS_BOOST_CONFIG) |
645 | 647 | #endif // !defined(BOOST_ASIO_HAS_UNISTD_H) |
646 | 648 | #if defined(BOOST_ASIO_HAS_UNISTD_H) |