Skip to content

Commit 3ec633e

Browse files
committed
build: improve check for ::(w)system
`AC_DEFINE()` takes `HAVE_STD__SYSTEM || HAVE_WSYSTEM` literally, meaning you end up with the following in bitcoin-config.h: ```cpp /* std::system or ::wsystem */ #define HAVE_SYSTEM HAVE_STD__SYSTEM || HAVE_WSYSTEM ``` This works for the preprocessor, because `HAVE_SYSTEM`, is defined, just unusually. Remove this in favor of defining `HAVE_SYSTEM` to 1 in either case, given we don't actually use `HAVE_STD__SYSTEM` or `HAVE_WSYSTEM`. We just use ::system if we aren't building for Windows.
1 parent d2dd169 commit 3ec633e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

configure.ac

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,13 +1245,14 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12451245
[ AC_MSG_RESULT(no); HAVE_WEAK_GETAUXVAL=0 ]
12461246
)
12471247

1248+
have_any_system=no
12481249
AC_MSG_CHECKING([for std::system])
12491250
AC_LINK_IFELSE(
12501251
[ AC_LANG_PROGRAM(
12511252
[[ #include <cstdlib> ]],
12521253
[[ int nErr = std::system(""); ]]
12531254
)],
1254-
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STD__SYSTEM, 1, Define to 1 if std::system is available.)],
1255+
[ AC_MSG_RESULT(yes); have_any_system=yes],
12551256
[ AC_MSG_RESULT(no) ]
12561257
)
12571258

@@ -1261,11 +1262,13 @@ AC_LINK_IFELSE(
12611262
[[ ]],
12621263
[[ int nErr = ::_wsystem(""); ]]
12631264
)],
1264-
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WSYSTEM, 1, Define to 1 if ::wsystem is available.)],
1265+
[ AC_MSG_RESULT(yes); have_any_system=yes],
12651266
[ AC_MSG_RESULT(no) ]
12661267
)
12671268

1268-
AC_DEFINE([HAVE_SYSTEM], [HAVE_STD__SYSTEM || HAVE_WSYSTEM], [std::system or ::wsystem])
1269+
if test "x$have_any_system" != "xno"; then
1270+
AC_DEFINE(HAVE_SYSTEM, 1, Define to 1 if std::system or ::wsystem is available.)
1271+
fi
12691272

12701273
LEVELDB_CPPFLAGS=
12711274
LIBLEVELDB=

0 commit comments

Comments
 (0)