classification
Title: Missing definition in configure.ac causing autoreconf to create damaged configure script
Type: compile error Stage: resolved
Components: Build Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, congma, eschwartz, vstinner
Priority: normal Keywords: patch

Created on 2021-03-24 14:52 by congma, last changed 2021-04-11 22:23 by eschwartz. This issue is now closed.

Files
File name Uploaded Description Edit
0001-configure-use-m4-forbidden-patterns-to-ensure-autore.patch eschwartz, 2021-04-11 22:23
Pull Requests
URL Status Linked Edit
PR 25016 merged christian.heimes, 2021-03-24 15:57
PR 25034 merged christian.heimes, 2021-03-27 13:51
PR 25035 merged christian.heimes, 2021-03-27 13:53
Messages (11)
msg389463 - (view) Author: Cong Ma (congma) * Date: 2021-03-24 14:52
The problem
-----------

In the repository, the definition for ``AX_CHECK_COMPILE_FLAG`` in Python's ``configure.ac`` file is missing. If ``autoreconf`` is run, an invalid ``configure`` script is generated. The following is the behaviour of running ``autoreconf`` followed by ``configure``:

```
# In cpython repository top-level directory
$ autoreconf
$ mkdir build
$ cd build
$ ../configure  # <- using newly generated configure script
[... omitted ...]
checking for --enable-optimizations... no
../configure: line 6498: syntax error near unexpected token `-fno-semantic-interposition,'
../configure: line 6498: `      AX_CHECK_COMPILE_FLAG(-fno-semantic-interposition,'
```


The solution
------------

It appears a file was missing in the m4/ directory. The file matches this one from the Autoconf Archive:

https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html

Simply adding the correct m4 file to m4/ should make ``autoreconf`` work.
msg389465 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-03-24 15:11
> If ``autoreconf`` is run, ...

I never used autoreconf. If you don't run it, ./configure works fine.

I only use "autoconf" and "autoheader".

$ ./configure --enable-optimizations --enable-shared
(...)
$ grep semantic Makefile
CONFIGURE_CFLAGS_NODIST= -fno-semantic-interposition -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden
CONFIGURE_LDFLAGS_NODIST= -fno-semantic-interposition
msg389466 - (view) Author: Cong Ma (congma) * Date: 2021-03-24 15:15
From the configure.ac file:

> dnl ***********************************************
> dnl * Please run autoreconf to test your changes! *
> dnl ***********************************************

I take it to mean "if configure.ac is changed, run autoreconf first", and that's what I did. Could you let me know what is the intended way to modify configure.ac and have it take effect?
msg389467 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-03-24 15:16
Ah, maybe the configure.ac comment should be updated to suggest running "autoconf" instead ;-)
msg389472 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-03-24 15:40
The extra macros are provided by optional packages. On Fedora and Debian/Ubuntu the package is called autoconf-archive.
msg389481 - (view) Author: Cong Ma (congma) * Date: 2021-03-24 18:07
> The extra macros are provided by optional packages. On Fedora and Debian/Ubuntu the package is called autoconf-archive.

Thank you very much. This (and the patch) is clearing things up for me a lot. At first I thought I was supposed to copy the m4 files over from the autoconf archive into the m4 directory under the repo.
msg389600 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-03-27 13:44
New changeset 5d6e8c1c1a5f667cdce99cb3c563ac922198678d by Christian Heimes in branch 'master':
bpo-43617: Check autoconf-archive package in configure.ac (GH-25016)
https://github.com/python/cpython/commit/5d6e8c1c1a5f667cdce99cb3c563ac922198678d
msg389619 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-03-27 21:47
New changeset 064bc07f241dceec2fc577cbf5c31fa6d63fe320 by Christian Heimes in branch '3.9':
[3.9] bpo-43617: Check autoconf-archive package in configure.ac (GH-25016) (GH-25034)
https://github.com/python/cpython/commit/064bc07f241dceec2fc577cbf5c31fa6d63fe320
msg389620 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-03-27 21:47
New changeset e516290976626cf8535b88a14b1b34e37f88a78a by Christian Heimes in branch '3.8':
[3.8] bpo-43617: Check autoconf-archive package in configure.ac (GH-25016) (GH-25035)
https://github.com/python/cpython/commit/e516290976626cf8535b88a14b1b34e37f88a78a
msg389622 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-03-27 21:48
Thanks for the bug report! I ran into the issue a couple of weeks ago on one machine that had autoconf but not the archive package installed.
msg390803 - (view) Author: Eli Schwartz (eschwartz) Date: 2021-04-11 22:23
Hmm, I've seen this accomplished elsewhere using m4_pattern_forbid, which would make autoreconf fail with the following message:

```
configure.ac:17: error: possibly undefined macro: AX_C_FLOAT_WORDS_BIGENDIAN
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:5586: error: possibly undefined macro: AX_CHECK_OPENSSL
autoreconf: error: /usr/bin/autoconf failed with exit status: 1
```

Example patch attached.
History
Date User Action Args
2021-04-11 22:23:03eschwartzsetfiles: + 0001-configure-use-m4-forbidden-patterns-to-ensure-autore.patch
nosy: + eschwartz
messages: + msg390803

2021-03-27 21:48:36christian.heimessetstatus: open -> closed
versions: + Python 3.8, Python 3.9, Python 3.10
messages: + msg389622

resolution: fixed
stage: patch review -> resolved
2021-03-27 21:47:18christian.heimessetmessages: + msg389620
2021-03-27 21:47:09christian.heimessetmessages: + msg389619
2021-03-27 13:53:30christian.heimessetpull_requests: + pull_request23783
2021-03-27 13:51:03christian.heimessetpull_requests: + pull_request23782
2021-03-27 13:44:13christian.heimessetmessages: + msg389600
2021-03-24 18:07:06congmasetmessages: + msg389481
2021-03-24 15:57:44christian.heimessetkeywords: + patch
stage: patch review
pull_requests: + pull_request23771
2021-03-24 15:40:02christian.heimessetnosy: + christian.heimes
messages: + msg389472
2021-03-24 15:16:12vstinnersetmessages: + msg389467
2021-03-24 15:15:33congmasetmessages: + msg389466
2021-03-24 15:11:34vstinnersetnosy: + vstinner
messages: + msg389465
2021-03-24 14:53:34congmasettype: compile error
2021-03-24 14:52:18congmacreate