Skip to content

m4: fix Python 3.13/3.14 detection and empty version string crash#26

Open
blshkv wants to merge 2 commits into
pst-format:mainfrom
blshkv:fix-python3-14-detection
Open

m4: fix Python 3.13/3.14 detection and empty version string crash#26
blshkv wants to merge 2 commits into
pst-format:mainfrom
blshkv:fix-python3-14-detection

Conversation

@blshkv

@blshkv blshkv commented May 28, 2026

Copy link
Copy Markdown

Summary

  • Add local m4/ax_python.m4 with python3.13/python3.14 added to the binary search list, and distutils replaced with sysconfig
  • Add local m4/ax_python_devel.m4 with a guard in vtup() against an empty version string
  • Add local m4/ax_boost_python.m4 so AX_BOOST_PYTHON is available to aclocal

Details

Fix 1: Python 3.13/3.14 not detected (ax_python.m4)

The for python in ... loop stopped at python3.12, so Python 3.13+ was never found. PYTHON_INCLUDE_DIR stayed empty, causing:

fatal error: pyconfig.h: No such file or directory

Fix 2: distutils removed in Python 3.12+ (ax_python.m4)

The header path was obtained via:

from distutils.sysconfig import *; print(get_config_var('CONFINCLUDEPY'))

distutils was removed in Python 3.12. Replaced with:

import sysconfig; print(sysconfig.get_config_var('CONFINCLUDEPY') or sysconfig.get_path('include'))

Fix 3: vtup() crashes on empty version string (ax_python_devel.m4)

AX_PYTHON_DEVEL is called with >= '$PYTHON_VERSION'. If ax_python_bin is plain python (no version suffix), cut -c7- produces an empty string. vtup('') then calls int('') which raises ValueError.

 def vtup(self, s):
+    if not s.strip(): return ()
     return tuple(map(int, s.strip().replace("rc", ".").split(".")))

Fix 4: AX_BOOST_PYTHON not found (ax_boost_python.m4)

Without a local copy of ax_boost_python.m4 in m4/, aclocal fails to include it and configure exits with:

./configure: line NNNNN: AX_BOOST_PYTHON: command not found

Closes #25

🤖 Generated with Claude Code

blshkv and others added 2 commits May 28, 2026 10:03
Add local copies of ax_python.m4 and ax_python_devel.m4 to m4/ so
they override the system autoconf-archive versions.

Two fixes:

1. ax_python.m4: extend the Python binary search list to include
   python3.13 and python3.14. Without this, configure fails to detect
   Python 3.13+ and PYTHON_INCLUDE_DIR stays empty, causing:
     fatal error: pyconfig.h: No such file or directory

2. ax_python_devel.m4: guard vtup() against an empty version string.
   AX_PYTHON_DEVEL is called with ">= '$PYTHON_VERSION'" where
   PYTHON_VERSION can be empty if the detected binary is plain
   "python" with no version suffix. vtup() then calls int('') which
   raises ValueError. Return () for an empty string so the comparison
   always succeeds.

Fixes: pst-format#25

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without a local copy of ax_boost_python.m4 in m4/, aclocal fails to
include it and configure exits with:
  ./configure: line NNNNN: AX_BOOST_PYTHON: command not found

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Python 3.10+ not detected: ax_python.m4 version list stops at 3.12, ax_python_devel.m4 crashes on empty version string

1 participant