From 3f6c37965671369a3b3f5f969a935d63e6879cd0 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Fri, 9 Sep 2022 16:28:27 +0100 Subject: [PATCH] Fix MKEXE_VIA_CC --- Makefile.config.in | 4 +++- configure | 11 ++++++++--- configure.ac | 10 +++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Makefile.config.in b/Makefile.config.in index d6e54edd3950..be4669540f17 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -83,6 +83,7 @@ AS_HAS_DEBUG_PREFIX_MAP=@as_has_debug_prefix_map@ # our own symbols): OC_LDFLAGS=@oc_ldflags@ OC_DLL_LDFLAGS=@oc_dll_ldflags@ +OC_EXE_LDFLAGS=@oc_exe_ldflags@ LDFLAGS?=@LDFLAGS@ @@ -219,7 +220,8 @@ MKEXE=@mkexe@ MKDLL=@mkdll@ MKMAINDLL=@mkmaindll@ MKEXEDEBUGFLAG=@mkexedebugflag@ -MKEXE_VIA_CC=$(CC) $(OC_CFLAGS) $(CFLAGS) @mkexe_via_cc_ldflags@ +MKEXE_VIA_CC=\ + $(CC) $(OC_EXE_LDFLAGS) $(OC_CFLAGS) $(CFLAGS) @mkexe_via_cc_ldflags@ RUNTIMED=@debug_runtime@ INSTRUMENTED_RUNTIME=@instrumented_runtime@ diff --git a/configure b/configure index 7010d6e3428a..d2cf5c8c9180 100755 --- a/configure +++ b/configure @@ -827,6 +827,7 @@ ocamlc_cppflags ocamlc_cflags nativecclibs bytecclibs +oc_exe_ldflags oc_dll_ldflags oc_ldflags oc_cppflags @@ -2831,6 +2832,7 @@ ocamlc_cflags="" ocamlc_cppflags="" oc_ldflags="" oc_dll_ldflags="" +oc_exe_ldflags="" # The C# compiler and its flags CSC="" @@ -2982,6 +2984,7 @@ OCAML_VERSION_SHORT=5.1 + # TODO: rename this variable @@ -13410,7 +13413,8 @@ else fi mkexe_cflags='' mkexe_ldflags_prefix='-link ' - mkexe_extra_flags='-link -municode' + oc_exe_ldflags='-municode' + mkexe_extra_flags="$mkexe_ldflags_prefix$oc_exe_ldflags" SO="dll" ;; #( *,*-pc-windows) : toolchain=msvc @@ -13425,7 +13429,8 @@ fi mkexe_cflags='' mkexe_ldflags_prefix='-link ' mkexe_via_cc_ldflags_prefix='/link ' - mkexe_extra_flags='-link /ENTRY:wmainCRTStartup' + oc_exe_ldflags='/ENTRY:wmainCRTStartup' + mkexe_extra_flags="$mkexe_ldflags_prefix$oc_exe_ldflags" mkexedebugflag='' ;; #( *,x86_64-*-linux*) : $as_echo "#define HAS_ARCH_CODE32 1" >>confdefs.h @@ -18377,7 +18382,7 @@ unset ac_cv_header_flexdll_h # $mkdll - the full linking command for DLLs # $mkdll_exp: same as above but expanded # $mkmaindll - the full linking command for main program in DLL -# $oc_ldflags and $oc_dll_ldflags are handled as $(OC_LDFLAGS) and +# $oc_ldflags $oc_dll_ldflags are handled as $(OC_LDFLAGS) and # $(OC_DLL_LDFLAGS) and can be overidden in the build. diff --git a/configure.ac b/configure.ac index 122ba2e7b1be..66f6ba4b1648 100644 --- a/configure.ac +++ b/configure.ac @@ -52,6 +52,7 @@ ocamlc_cflags="" ocamlc_cppflags="" oc_ldflags="" oc_dll_ldflags="" +oc_exe_ldflags="" # The C# compiler and its flags CSC="" @@ -135,6 +136,7 @@ AC_SUBST([oc_cflags]) AC_SUBST([oc_cppflags]) AC_SUBST([oc_ldflags]) AC_SUBST([oc_dll_ldflags]) +AC_SUBST([oc_exe_ldflags]) AC_SUBST([bytecclibs]) AC_SUBST([nativecclibs]) AC_SUBST([ocamlc_cflags]) @@ -918,7 +920,8 @@ AS_CASE([$cc_basename,$host], [mkexe_cmd="$mkexe_cmd_exp"]) mkexe_cflags='' mkexe_ldflags_prefix='-link ' - mkexe_extra_flags='-link -municode' + oc_exe_ldflags='-municode' + mkexe_extra_flags="$mkexe_ldflags_prefix$oc_exe_ldflags" SO="dll"], [*,*-pc-windows], [toolchain=msvc @@ -931,7 +934,8 @@ AS_CASE([$cc_basename,$host], mkexe_cflags='' mkexe_ldflags_prefix='-link ' mkexe_via_cc_ldflags_prefix='/link ' - mkexe_extra_flags='-link /ENTRY:wmainCRTStartup' + oc_exe_ldflags='/ENTRY:wmainCRTStartup' + mkexe_extra_flags="$mkexe_ldflags_prefix$oc_exe_ldflags" mkexedebugflag=''], [*,x86_64-*-linux*], AC_DEFINE([HAS_ARCH_CODE32], [1]), @@ -2247,7 +2251,7 @@ AC_CONFIG_COMMANDS_PRE([ # $mkdll - the full linking command for DLLs # $mkdll_exp: same as above but expanded # $mkmaindll - the full linking command for main program in DLL -# $oc_ldflags and $oc_dll_ldflags are handled as $(OC_LDFLAGS) and +# $oc_ldflags $oc_dll_ldflags are handled as $(OC_LDFLAGS) and # $(OC_DLL_LDFLAGS) and can be overidden in the build. AC_CONFIG_COMMANDS_PRE([ # Construct $mkexe