Skip to content

Commit

Permalink
[build] Fix a problem with win+gcc (mingw, msys, cygwin) causing some…
Browse files Browse the repository at this point in the history
… optimized functions to segfault
  • Loading branch information
fador committed Jul 10, 2023
1 parent aaae5b0 commit 589ed47
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ AS_CASE([$host_os],
],
[cygwin*|msys*|mingw*], [
CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO=1"
# Fix a bug in mingw gcc where stack doesn't get aligned properly, force all AVX instructions to be unaligned
if test x"${CC}" = x"gcc" ; then
AX_CHECK_COMPILE_FLAG([-Wa,-muse-unaligned-vector-move],
[CFLAGS="-Wa,-muse-unaligned-vector-move $CFLAGS"],
[AC_MSG_ERROR([-Wa,-muse-unaligned-vector-move not supported, required with mingw+gcc to fix alignment bugs, update the used gcc])]
)
fi
AS_IF(
[test "x$BITS" = "x32"], [
ASFLAGS="$ASFLAGS -fwin32 -DPREFIX -DHAVE_ALIGNED_STACK=0"
Expand Down Expand Up @@ -174,7 +181,7 @@ AS_IF([test "x$YASM" != "xno"], [have_yasm="yes"])
AC_ARG_ENABLE([asm], [AS_HELP_STRING([--disable-asm], [disable assembly [no]])],
[], [enable_asm="yes"]
)
AS_IF([test "x$enable_asm" != "xno" -a $have_yasm != "yes"],
AS_IF([test "x$enable_asm" != "xno" -a "$have_yasm" != "yes"],
[enable_asm="no"]
)

Expand Down

0 comments on commit 589ed47

Please sign in to comment.