diff options
author | fanquake <fanquake@gmail.com> | 2021-08-31 20:36:01 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2021-09-10 09:20:35 +0800 |
commit | 3ec633ef1a99d3a71c19ab5563a82bc275659d2e (patch) | |
tree | 1d7d214e3f9f6ba7d173e708ee48f0d1c9c6b5ce /configure.ac | |
parent | d2dd1697cee9d6d0f13f9cb351bce84eaa4a72b4 (diff) |
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.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index e50d53f6dd..da5b3f3627 100644 --- a/configure.ac +++ b/configure.ac @@ -1245,13 +1245,14 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ [ AC_MSG_RESULT(no); HAVE_WEAK_GETAUXVAL=0 ] ) +have_any_system=no AC_MSG_CHECKING([for std::system]) AC_LINK_IFELSE( [ AC_LANG_PROGRAM( [[ #include <cstdlib> ]], [[ int nErr = std::system(""); ]] )], - [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STD__SYSTEM, 1, Define to 1 if std::system is available.)], + [ AC_MSG_RESULT(yes); have_any_system=yes], [ AC_MSG_RESULT(no) ] ) @@ -1261,11 +1262,13 @@ AC_LINK_IFELSE( [[ ]], [[ int nErr = ::_wsystem(""); ]] )], - [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WSYSTEM, 1, Define to 1 if ::wsystem is available.)], + [ AC_MSG_RESULT(yes); have_any_system=yes], [ AC_MSG_RESULT(no) ] ) -AC_DEFINE([HAVE_SYSTEM], [HAVE_STD__SYSTEM || HAVE_WSYSTEM], [std::system or ::wsystem]) +if test "x$have_any_system" != "xno"; then + AC_DEFINE(HAVE_SYSTEM, 1, Define to 1 if std::system or ::wsystem is available.) +fi LEVELDB_CPPFLAGS= LIBLEVELDB= |