11diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py
2- index b3b065652e0..d361f57382e 100644
2+ index 6ceb4404e74..94b74b5c8b0 100644
33--- a/Tools/jit/_targets.py
44+++ b/Tools/jit/_targets.py
55@@ -10,6 +10,7 @@
@@ -10,15 +10,15 @@ index b3b065652e0..d361f57382e 100644
1010
1111 import _llvm
1212 import _schema
13- @@ -42 ,6 +43 ,7 @@ class _Target(typing.Generic[_S, _R]):
13+ @@ -46 ,6 +47 ,7 @@ class _Target(typing.Generic[_S, _R]):
1414 stable: bool = False
1515 debug: bool = False
1616 verbose: bool = False
1717+ cflags: str = ""
1818 known_symbols: dict[str, int] = dataclasses.field(default_factory=dict)
1919
2020 def _get_nop(self) -> bytes:
21- @@ -115 ,6 +117 ,7 @@ async def _compile(
21+ @@ -119 ,6 +121 ,7 @@ async def _compile(
2222 ) -> _stencils.StencilGroup:
2323 o = tempdir / f"{opname}.o"
2424 args = [
@@ -27,44 +27,48 @@ index b3b065652e0..d361f57382e 100644
2727 "-DPy_BUILD_CORE_MODULE",
2828 "-D_DEBUG" if self.debug else "-DNDEBUG",
2929diff --git a/Tools/jit/build.py b/Tools/jit/build.py
30- index a8cb0f67c36..663874ad439 100644
30+ index 49b08f477db..49a1b11de47 100644
3131--- a/Tools/jit/build.py
3232+++ b/Tools/jit/build.py
33- @@ -22,7 +22,11 @@
33+ @@ -26,11 +26,15 @@
3434 parser.add_argument(
3535 "-v", "--verbose", action="store_true", help="echo commands as they are run"
3636 )
3737+ parser.add_argument(
3838+ "--with-cflags", help="additional flags to pass to the compiler", default=""
3939+ )
4040 args = parser.parse_args()
41- args.target.debug = args.debug
42- args.target.verbose = args.verbose
43- + args.target.cflags = args.with_cflags
44- args.target.build(pathlib.Path.cwd(), comment=comment, force=args.force)
41+ for target in args.target:
42+ target.debug = args.debug
43+ target.force = args.force
44+ target.verbose = args.verbose
45+ + target.cflags = args.with_cflags
46+ target.build(
47+ out,
48+ comment=comment,
4549diff --git a/configure b/configure
46- index 1b75ddfa26d..3c9e550b5d3 100755
50+ index c51192f12c8..0dcef7c2617 100755
4751--- a/configure
4852+++ b/configure
49- @@ -8399 ,7 +8399 ,7 @@ then :
53+ @@ -10863 ,7 +10863 ,7 @@ then :
5054
5155 else case e in #(
5256 e) as_fn_append CFLAGS_NODIST " $jit_flags"
53- - REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py $host"
54- + REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py $host --with-cflags=\"\$(CONFIGURE_CFLAGS)\""
57+ - REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$ host} "
58+ + REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$ host} --with-cflags=\"\$(CONFIGURE_CFLAGS)\""
5559 JIT_STENCILS_H="jit_stencils.h"
5660 if test "x$Py_DEBUG" = xtrue
5761 then :
5862diff --git a/configure.ac b/configure.ac
59- index c449bb5ebb3..5f9d08a4ee7 100644
63+ index a7b2f62579b..5998f896a4e 100644
6064--- a/configure.ac
6165+++ b/configure.ac
62- @@ -1827 ,7 +1827 ,7 @@ AS_VAR_IF([jit_flags],
66+ @@ -2776 ,7 +2776 ,7 @@ AS_VAR_IF([jit_flags],
6367 [],
6468 [AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
6569 AS_VAR_SET([REGEN_JIT_COMMAND],
66- - ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py $host"])
67- + ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py $host --with-cflags=\"\$(CONFIGURE_CFLAGS)\""])
70+ - ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$ host} "])
71+ + ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$ host} --with-cflags=\"\$(CONFIGURE_CFLAGS)\""])
6872 AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
6973 AS_VAR_IF([Py_DEBUG],
7074 [true],
0 commit comments