diff --git a/configure.ac b/configure.ac
index 4ca231065..47a42a957 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,6 +111,7 @@ AC_SUBST([oc_cflags])
 AC_SUBST([oc_cppflags])
 AC_SUBST([oc_ldflags])
 AC_SUBST([oc_dll_ldflags])
+AC_SUBST([MKLIB_LDFLAGS])
 AC_SUBST([bytecclibs])
 AC_SUBST([nativecclibs])
 AC_SUBST([ocamlc_cflags])
@@ -177,6 +178,7 @@ AC_CONFIG_FILES([stdlib/sys.ml])
 AC_CONFIG_FILES([manual/src/version.tex])
 AC_CONFIG_FILES([manual/src/html_processing/src/common.ml])
 AC_CONFIG_FILES([tools/eventlog_metadata])
+AC_CONFIG_FILES([tools/ocamlmklib.ml])
 AC_CONFIG_HEADERS([runtime/caml/m.h])
 AC_CONFIG_HEADERS([runtime/caml/s.h])
 AC_CONFIG_HEADERS([runtime/caml/version.h])
@@ -975,6 +977,10 @@ AS_IF([test x"$enable_shared" != "xno"],
 
 AS_IF([test -z "$mkmaindll"], [mkmaindll=$mksharedlib])
 
+AS_IF([test -z "$OC_LDFLAGS"],
+      [MKLIB_LDFLAGS=""],
+      [MKLIB_LDFLAGS="\"$OC_LDFLAGS\""])
+
 # Configure native dynlink
 
 natdynlink=false
diff --git a/tools/ocamlmklib.ml.in b/tools/ocamlmklib.ml.in
index 0ca7b80f3..80c6c7515 100644
--- a/tools/ocamlmklib.ml.in
+++ b/tools/ocamlmklib.ml.in
@@ -46,7 +46,7 @@ and failsafe = ref false    (* whether to fall back on static build only *)
 and c_libs = ref []         (* libs to pass to mksharedlib and ocamlc -cclib *)
 and c_Lopts = ref []      (* options to pass to mksharedlib and ocamlc -cclib *)
 and c_opts = ref []       (* options to pass to mksharedlib and ocamlc -ccopt *)
-and ld_opts = ref []        (* options to pass only to the linker *)
+and ld_opts = ref [@MKLIB_LDFLAGS@] (* options to pass only to the linker *)
 and ocamlc = ref (compiler_path "ocamlc")
 and ocamlc_opts = ref []    (* options to pass only to ocamlc *)
 and ocamlopt = ref (compiler_path "ocamlopt")
