diff --git a/configure.ac b/configure.ac index 4ede49bd7..0d9edf8d0 100644 --- a/configure.ac +++ b/configure.ac @@ -155,7 +155,7 @@ 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*) @@ -163,6 +163,7 @@ case $host_os in DIR_SEP=\\\\ pathprog="cygpath -m" AC_CHECK_PROG([CANDLE], [candle], [yes]) # For WiX installer + NVC_CHECK_MSYS ;; *) AC_SEARCH_LIBS([dlopen], [dl dld], [], [ diff --git a/m4/nvc.m4 b/m4/nvc.m4 index 42027a81f..89bc5c2e9 100644 --- a/m4/nvc.m4 +++ b/m4/nvc.m4 @@ -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])])])