Skip to content

Commit 989451d

Browse files
luke-jrhebasto
authored andcommitted
configure: Detect compatibility of Boost.Process rather than hardcode non-Windows
1 parent 911a40e commit 989451d

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

configure.ac

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,45 +1493,45 @@ if test "$use_boost" = "yes"; then
14931493
fi
14941494

14951495
if test "$use_external_signer" != "no"; then
1496-
case $host in
1497-
*mingw*)
1498-
dnl Boost Process uses Boost Filesystem when targeting Windows. Also,
1499-
dnl since Boost 1.71.0, Process does not work with mingw-w64 without
1500-
dnl workarounds. See 67669ab425b52a2b6be3d2f3b3b7e3939b676a2c.
1501-
if test "$use_external_signer" = "yes"; then
1502-
AC_MSG_ERROR([External signing is not supported on Windows])
1503-
fi
1504-
use_external_signer="no";
1505-
;;
1506-
*)
1507-
AC_MSG_CHECKING([whether Boost.Process can be used])
1508-
TEMP_CXXFLAGS="$CXXFLAGS"
1509-
dnl Boost 1.78 requires the following workaround.
1510-
dnl See: https://github.com/boostorg/process/issues/235
1511-
CXXFLAGS="$CXXFLAGS -Wno-error=narrowing"
1512-
TEMP_CPPFLAGS="$CPPFLAGS"
1513-
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
1514-
TEMP_LDFLAGS="$LDFLAGS"
1515-
dnl Boost 1.73 and older require the following workaround.
1516-
LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
1517-
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <boost/process.hpp>]])],
1518-
[have_boost_process="yes"],
1519-
[have_boost_process="no"])
1520-
LDFLAGS="$TEMP_LDFLAGS"
1521-
CPPFLAGS="$TEMP_CPPFLAGS"
1522-
CXXFLAGS="$TEMP_CXXFLAGS"
1523-
AC_MSG_RESULT([$have_boost_process])
1524-
if test "$have_boost_process" = "yes"; then
1525-
use_external_signer="yes"
1526-
AC_DEFINE([ENABLE_EXTERNAL_SIGNER], [1], [Define if external signer support is enabled])
1527-
else
1528-
if test "$use_external_signer" = "yes"; then
1529-
AC_MSG_ERROR([External signing is not supported for this Boost version])
1530-
fi
1531-
use_external_signer="no";
1532-
fi
1533-
;;
1534-
esac
1496+
AC_MSG_CHECKING([whether Boost.Process can be used])
1497+
TEMP_CXXFLAGS="$CXXFLAGS"
1498+
dnl Boost 1.78 requires the following workaround.
1499+
dnl See: https://github.com/boostorg/process/issues/235
1500+
CXXFLAGS="$CXXFLAGS -Wno-error=narrowing"
1501+
TEMP_CPPFLAGS="$CPPFLAGS"
1502+
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
1503+
TEMP_LDFLAGS="$LDFLAGS"
1504+
dnl Boost 1.73 and older require the following workaround.
1505+
LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
1506+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1507+
#define BOOST_PROCESS_USE_STD_FS
1508+
#include <boost/process.hpp>
1509+
]],[[
1510+
namespace bp = boost::process;
1511+
bp::opstream stdin_stream;
1512+
bp::ipstream stdout_stream;
1513+
bp::child c("dummy", bp::std_out > stdout_stream, bp::std_err > stdout_stream, bp::std_in < stdin_stream);
1514+
stdin_stream << std::string{"test"} << std::endl;
1515+
if (c.running()) c.terminate();
1516+
c.wait();
1517+
c.exit_code();
1518+
]])],
1519+
[have_boost_process="yes"],
1520+
[have_boost_process="no"])
1521+
LDFLAGS="$TEMP_LDFLAGS"
1522+
CPPFLAGS="$TEMP_CPPFLAGS"
1523+
CXXFLAGS="$TEMP_CXXFLAGS"
1524+
AC_MSG_RESULT([$have_boost_process])
1525+
if test "$have_boost_process" = "yes"; then
1526+
use_external_signer="yes"
1527+
AC_DEFINE([ENABLE_EXTERNAL_SIGNER], [1], [Define if external signer support is enabled])
1528+
AC_DEFINE([BOOST_PROCESS_USE_STD_FS], [1], [Defined to avoid Boost::Process trying to use Boost Filesystem])
1529+
else
1530+
if test "$use_external_signer" = "yes"; then
1531+
AC_MSG_ERROR([External signing is not supported for this Boost version])
1532+
fi
1533+
use_external_signer="no";
1534+
fi
15351535
fi
15361536
AM_CONDITIONAL([ENABLE_EXTERNAL_SIGNER], [test "$use_external_signer" = "yes"])
15371537

0 commit comments

Comments
 (0)