--- /dev/null
+From: =?utf-8?q?St=C3=A9phane_Glondu?= <glondu@debian.org>
+Date: Wed, 8 Feb 2023 08:45:00 +0100
+Subject: Filter out -f{debug,file}-prefix-map= from ocamlc_cflags and mkexe
+
+Bug-Debian: https://bugs.debian.org/1030785
+Forwarded: not-needed
+---
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 9ac019f..a449246 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -43,7 +43,7 @@ libraries_man_section=3
+ # at the moment they are not taken into account on Windows, because
+ # flexlink, which is used to build executables on this platform, can
+ # not handle them.
+-mkexe="\$(CC) \$(OC_CFLAGS) \$(CFLAGS) \$(OC_LDFLAGS) \$(LDFLAGS)"
++mkexe="\$(CC) \$(OC_CFLAGS) \$(filter-out -fdebug-prefix-map=% -ffile-prefix-map=%,\$(CFLAGS)) \$(OC_LDFLAGS) \$(LDFLAGS)"
+
+ # Flags for building executable files with debugging symbols
+ mkexedebugflag="-g"
+@@ -1952,7 +1952,7 @@ AS_IF([test x"$DEFAULT_STRING" = "xunsafe"],
+
+ oc_cflags="$common_cflags $internal_cflags"
+ oc_cppflags="$common_cppflags $internal_cppflags"
+-ocamlc_cflags="$common_cflags $sharedlib_cflags \$(CFLAGS)"
++ocamlc_cflags="$common_cflags $sharedlib_cflags \$(filter-out -fdebug-prefix-map=% -ffile-prefix-map=%,\$(CFLAGS))"
+ ocamlc_cppflags="$common_cppflags \$(CPPFLAGS)"
+ cclibs="$cclibs $mathlib"
+