11diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py
2- index 6ceb4404e74..94b74b5c8b0 100644
2+ index d0a1c081ffe..deb83f275d2 100644
33--- a/Tools/jit/_targets.py
44+++ b/Tools/jit/_targets.py
55@@ -10,6 +10,7 @@
@@ -16,9 +16,9 @@ index 6ceb4404e74..94b74b5c8b0 100644
1616 verbose: bool = False
1717+ cflags: str = ""
1818 known_symbols: dict[str, int] = dataclasses.field(default_factory=dict)
19+ pyconfig_dir: pathlib.Path = pathlib.Path.cwd().resolve()
1920
20- def _get_nop(self) -> bytes:
21- @@ -119,6 +121,7 @@ async def _compile(
21+ @@ -120,6 +122,7 @@ async def _compile(
2222 ) -> _stencils.StencilGroup:
2323 o = tempdir / f"{opname}.o"
2424 args = [
@@ -27,10 +27,10 @@ index 6ceb4404e74..94b74b5c8b0 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 49b08f477db..49a1b11de47 100644
30+ index 1afd0c76bad..96c4cb07593 100644
3131--- a/Tools/jit/build.py
3232+++ b/Tools/jit/build.py
33- @@ -26 ,11 +26 ,15 @@
33+ @@ -39 ,11 +39 ,15 @@
3434 parser.add_argument(
3535 "-v", "--verbose", action="store_true", help="echo commands as they are run"
3636 )
@@ -43,32 +43,32 @@ index 49b08f477db..49a1b11de47 100644
4343 target.force = args.force
4444 target.verbose = args.verbose
4545+ target.cflags = args.with_cflags
46+ target.pyconfig_dir = args.pyconfig_dir
4647 target.build(
47- out,
4848 comment=comment,
4949diff --git a/configure b/configure
50- index c51192f12c8..0dcef7c2617 100755
50+ index 884f8a4b068..2e6740c33d9 100755
5151--- a/configure
5252+++ b/configure
5353@@ -10863,7 +10863,7 @@ then :
5454
5555 else case e in #(
5656 e) as_fn_append CFLAGS_NODIST " $jit_flags"
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)\""
57+ - REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir . "
58+ + REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir . -- with-cflags=\"\$(CONFIGURE_CFLAGS)\""
5959 JIT_STENCILS_H="jit_stencils.h"
6060 if test "x$Py_DEBUG" = xtrue
6161 then :
6262diff --git a/configure.ac b/configure.ac
63- index a7b2f62579b..5998f896a4e 100644
63+ index cf25148bad2..f8bfab7bf96 100644
6464--- a/configure.ac
6565+++ b/configure.ac
6666@@ -2776,7 +2776,7 @@ AS_VAR_IF([jit_flags],
6767 [],
6868 [AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
6969 AS_VAR_SET([REGEN_JIT_COMMAND],
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)\""])
70+ - ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir . "])
71+ + ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir . -- with-cflags=\"\$(CONFIGURE_CFLAGS)\""])
7272 AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
7373 AS_VAR_IF([Py_DEBUG],
7474 [true],
0 commit comments