@@ -436,7 +436,7 @@ AS_CASE([$host],
436436 [ *-pc-windows] ,
437437 [ AC_CHECK_TOOLS (
438438 [ DEP_CC] ,
439- [ $DEP_CC gcc cc x86_64-w64-mingw32-gcc] ,
439+ [ $DEP_CC gcc cc x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc ] ,
440440 [ false] ) ] ,
441441 [ DEP_CC="$CC"] )
442442
@@ -667,10 +667,17 @@ AS_CASE([$host],
667667
668668internal_cppflags="-DCAML_NAME_SPACE $internal_cppflags"
669669
670+ # Enable SSE2 on x86 mingw to avoid using 80-bit registers.
671+ AS_CASE ( [ $host] ,
672+ [ i686-*-mingw32] ,
673+ [ internal_cflags="$internal_cflags -mfpmath=sse -msse2"] )
674+
670675# Use 64-bit file offset if possible
671676# See also AC_SYS_LARGEFILE
672677# Problem: flags are added to CC rather than CPPFLAGS
673- common_cppflags="$common_cppflags -D_FILE_OFFSET_BITS=64"
678+ AS_CASE ( [ $host] ,
679+ [ *-*-mingw32|*-pc-windows] , [ ] ,
680+ [ common_cppflags="$common_cppflags -D_FILE_OFFSET_BITS=64"] )
674681
675682# Adjust according to target
676683
@@ -688,14 +695,23 @@ AS_IF([test x"$enable_shared" = "xno"],
688695
689696# Define flexlink chain and flags correctly for the different Windows ports
690697AS_CASE ( [ $host] ,
698+ [ i686-*-cygwin] ,
699+ [ flexdll_chain='cygwin'
700+ flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216"] ,
691701 [ x86_64-*-cygwin] ,
692702 [ flexdll_chain='cygwin64'
693703 flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216"] ,
694704 [ *-*-cygwin*] ,
695- [ AC_MSG_ERROR ( [ unsupported cygwin variant] ) ] ,
705+ [ AC_MSG_ERROR ( [ unknown cygwin variant] ) ] ,
706+ [ i686-w64-mingw32] ,
707+ [ flexdll_chain='mingw'
708+ flexlink_flags="-chain $flexdll_chain -stack 16777216"] ,
696709 [ x86_64-w64-mingw32] ,
697710 [ flexdll_chain='mingw64'
698711 flexlink_flags="-chain $flexdll_chain -stack 33554432"] ,
712+ [ i686-pc-windows] ,
713+ [ flexdll_chain='msvc'
714+ flexlink_flags="-merge-manifest -stack 16777216"] ,
699715 [ x86_64-pc-windows] ,
700716 [ flexdll_chain='msvc64'
701717 flexlink_flags="-x64 -merge-manifest -stack 33554432"] )
@@ -796,7 +812,9 @@ AS_CASE([$CC,$host],
796812 )
797813 ostype="Cygwin"] ,
798814 [ *,*-*-mingw32] ,
799- [ mkexedebugflag="-link -g"
815+ [ AS_CASE ( [ $host] ,
816+ [ i686-*-*] , [ oc_dll_ldflags="-static-libgcc"] )
817+ mkexedebugflag="-link -g"
800818 ostype="Win32"
801819 toolchain="mingw"
802820 mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")'
@@ -1083,9 +1101,12 @@ AS_CASE([$host],
10831101 [ arch=riscv; model=riscv64; system=linux]
10841102)
10851103
1086- AS_IF ( [ test x"$enable_native_compiler" = "xno"] ,
1087- [ native_compiler=false
1088- AC_MSG_NOTICE ( [ the native compiler is disabled] ) ] ,
1104+ AS_CASE ( [ $arch,$enable_native_compiler] ,
1105+ [ none,yes] ,
1106+ [ AC_MSG_ERROR ( m4_normalize ( [
1107+ The native compiler is not available for $host] ) ) ] ,
1108+ [ none,*|*,no] ,
1109+ [ native_compiler=false] ,
10891110 [ native_compiler=true] )
10901111
10911112AS_IF ( [ ! $native_compiler] , [ natdynlink=false] )
@@ -1930,7 +1951,9 @@ AS_CASE([$host],
19301951# Define default prefix correctly for the different Windows ports
19311952AS_IF ( [ test x"$prefix" = "xNONE"] ,
19321953 [ AS_CASE ( [ $host] ,
1954+ [ i686-w64-mingw32] , [ prefix='C:/ocamlmgw'] ,
19331955 [ x86_64-w64-mingw32] , [ prefix='C:/ocamlmgw64'] ,
1956+ [ i686-pc-windows] , [ prefix='C:/ocamlms'] ,
19341957 [ x86_64-pc-windows] , [ prefix='C:/ocamlms64'] ) ] ,
19351958 [ AS_IF ( [ test x"$unix_or_win32" = "xwin32" \
19361959 && test "$host_vendor-$host_os" != "$build_vendor-$build_os" ] ,
0 commit comments