Skip to content

Commit

Permalink
build: improve check for ::(w)system
Browse files Browse the repository at this point in the history
  • Loading branch information
barton2526 committed Nov 4, 2022
1 parent 1058979 commit 82197b3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -768,13 +768,14 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([
]
)

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 you have the `std::system' function.)],
[ AC_MSG_RESULT(yes); have_any_system=yes],
[ AC_MSG_RESULT(no) ]
)

Expand All @@ -784,12 +785,13 @@ AC_LINK_IFELSE(
[[ ]],
[[ int nErr = ::_wsystem(""); ]]
)],
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WSYSTEM, 1, Define to 1 if you have the `::wsystem' function.)],
[ AC_MSG_RESULT(yes); have_any_system=yes],
[ AC_MSG_RESULT(no) ]
)

# Define to 1 if std::system or ::wsystem (Windows) is available
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

dnl Our minimum supported glibc is 2.17, however support for thread_local
dnl did not arrive in glibc until 2.18.
Expand Down

0 comments on commit 82197b3

Please sign in to comment.