Skip to content

Commit

Permalink
Detect msys/gcc in configure script. Fixes #936
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg committed Aug 11, 2024
1 parent 65e71e4 commit 96f85b1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,15 @@ AS_IF([test "$ax_cv_prog_bison" = "yes"],
AX_APPEND_FLAG([-Wcounterexamples], [EXTRA_YFLAGS])],
[AC_MSG_RESULT([no])])])

AX_PROG_FLEX([], [AC_MSG_ERROR(Flex not found)])
AX_PROG_FLEX([], [AC_MSG_ERROR([Flex not found])])

case $host_os in
*cygwin*|msys*|mingw32*)
LIBS="$LIBS -ldbghelp -lwsock32" # For StackTrace64 and sockets
DIR_SEP=\\\\
pathprog="cygpath -m"
AC_CHECK_PROG([CANDLE], [candle], [yes]) # For WiX installer
NVC_CHECK_MSYS
;;
*)
AC_SEARCH_LIBS([dlopen], [dl dld], [], [
Expand Down
30 changes: 27 additions & 3 deletions m4/nvc.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,41 @@ dnl Check whether TLS is emulated.
dnl Adapted from https://github.com/gcc-mirror/gcc/blob/0f1727e25f/config/tls.m4
AC_DEFUN([NVC_CHECK_EMUTLS], [
AC_CACHE_CHECK([whether the thread-local storage support is from emutls],
nvc_cv_use_emutls, [
nvc_cv_use_emutls, [
nvc_cv_use_emutls=no
echo '__thread int a; int b; int main() { return a = b; }' > conftest.c
if AC_TRY_COMMAND(${CC-cc} -Werror -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD); then
if grep __emutls_get_address conftest.s > /dev/null; then
nvc_cv_use_emutls=yes
nvc_cv_use_emutls=yes
fi
fi
rm -f conftest.*
])
if test "$nvc_cv_use_emutls" = "yes" ; then
AC_DEFINE(USE_EMUTLS, 1,
[Define to 1 if the target uses emutls for thread-local storage.])
[Define to 1 if the target uses emutls for thread-local storage.])
fi])

dnl Ensure we are not building in the MSYS environment
AC_DEFUN([NVC_CHECK_MSYS], [
AC_MSG_CHECKING([if $CC is the MSYS compiler])
AS_IF([$CC -dumpmachine | grep -q pc-msys],
[AC_MSG_RESULT([yes])
case "$MSYSTEM" in
CLANG64)
AC_MSG_ERROR([$CC is msys/gcc which is not supported: install mingw-w64-clang-x86_64-clang or pass CC=clang])
;;
UCRT64)
AC_MSG_ERROR([$CC is msys/gcc which is not supported: install mingw-w64-ucrt-x86_64-gcc])
;;
MINGW64)
AC_MSG_ERROR([$CC is msys/gcc which is not supported: install mingw-w64-x86_64-gcc])
;;
MSYS)
AC_MSG_ERROR([$CC is msys/gcc which is not supported])
;;
*)
AC_MSG_ERROR([$CC is msys/gcc which is not supported: install the native compiler for $MSYSTEM])
;;
esac],
[AC_MSG_RESULT([no])])])

0 comments on commit 96f85b1

Please sign in to comment.