Skip to content

Commit 55f46c9

Browse files
committed
Fix srcdir handling in AWK configure script.
Pass srcdir to the AWK script. Look in srcdir when generating config files.
1 parent ea140e1 commit 55f46c9

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

Tools/configure/transpiler/pyconf.awk

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,7 @@ function pyconf_parse_args( i, arg, key, val, opt_key, eq_pos, config_args) {
16001600
# --prefix, --exec-prefix, --bindir, etc.
16011601
} else if (key == "srcdir") {
16021602
_pyconf_srcdir = val
1603+
pyconf__srcdir_arg = val
16031604
} else if (key == "help" || key == "h") {
16041605
_pyconf_help_requested = 1
16051606
} else {
@@ -1796,12 +1797,18 @@ function _pyconf_write_pyconfig_h( f, inf, line, name, val, indent, rest, out
17961797
close(outf)
17971798
}
17981799

1799-
function _pyconf_process_config_files( i, inf, outf, outdir, saved_abs_srcdir, saved_abs_builddir, slash_pos) {
1800+
function _pyconf_process_config_files( i, inf, outf, outdir, saved_abs_srcdir, saved_abs_builddir, slash_pos, sd) {
1801+
# Determine srcdir: prefer the transpiled pyconf_srcdir (set by
1802+
# u_setup_source_dirs), fall back to _pyconf_srcdir (from --srcdir arg).
1803+
sd = _pyconf_srcdir
1804+
if (pyconf_srcdir != "" && pyconf_srcdir != ".")
1805+
sd = pyconf_srcdir
18001806
for (i = 1; i <= _pyconf_config_file_count; i++) {
18011807
outf = CONFIG_FILES[i]
1802-
inf = outf ".in"
1803-
if (inf == "")
1804-
continue
1808+
if (sd != "" && sd != ".")
1809+
inf = sd "/" outf ".in"
1810+
else
1811+
inf = outf ".in"
18051812
# Skip if template does not exist (mirrors pyconf.py behaviour)
18061813
if (system("test -f " _shell_quote(inf)) != 0) {
18071814
pyconf_warn("config file template not found: " inf)

configure

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure-new

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,7 @@ function pyconf_parse_args( i, arg, key, val, opt_key, eq_pos, config_args) {
16111611
# --prefix, --exec-prefix, --bindir, etc.
16121612
} else if (key == "srcdir") {
16131613
_pyconf_srcdir = val
1614+
pyconf__srcdir_arg = val
16141615
} else if (key == "help" || key == "h") {
16151616
_pyconf_help_requested = 1
16161617
} else {
@@ -1807,12 +1808,18 @@ function _pyconf_write_pyconfig_h( f, inf, line, name, val, indent, rest, out
18071808
close(outf)
18081809
}
18091810

1810-
function _pyconf_process_config_files( i, inf, outf, outdir, saved_abs_srcdir, saved_abs_builddir, slash_pos) {
1811+
function _pyconf_process_config_files( i, inf, outf, outdir, saved_abs_srcdir, saved_abs_builddir, slash_pos, sd) {
1812+
# Determine srcdir: prefer the transpiled pyconf_srcdir (set by
1813+
# u_setup_source_dirs), fall back to _pyconf_srcdir (from --srcdir arg).
1814+
sd = _pyconf_srcdir
1815+
if (pyconf_srcdir != "" && pyconf_srcdir != ".")
1816+
sd = pyconf_srcdir
18111817
for (i = 1; i <= _pyconf_config_file_count; i++) {
18121818
outf = CONFIG_FILES[i]
1813-
inf = outf ".in"
1814-
if (inf == "")
1815-
continue
1819+
if (sd != "" && sd != ".")
1820+
inf = sd "/" outf ".in"
1821+
else
1822+
inf = outf ".in"
18161823
# Skip if template does not exist (mirrors pyconf.py behaviour)
18171824
if (system("test -f " _shell_quote(inf)) != 0) {
18181825
pyconf_warn("config file template not found: " inf)

0 commit comments

Comments
 (0)