https://gcc.gnu.org/g:8421bc54111b98956cbcef4d970ed89387d806c2
commit r16-9944-g8421bc54111b98956cbcef4d970ed89387d806c2 Author: Gaius Mulley <[email protected]> Date: Thu Nov 12 13:51:59 2026 +0000 modula2: Add missing Python declarations to AM_MAKEFLAGS in libm2min/Makefile.am This fixup patch adds the missing PYTHON and HAVE_PYTHON_INTERPRETER declarations to libgm2/libm2min/Makefile.am and regenerates libgm2/configure. libgm2/ChangeLog: * configure: Regenerate. * libm2min/Makefile.am (AM_MAKEFLAGS): Add the missing PYTHON and HAVE_PYTHON_INTERPRETER declarations. * libm2min/Makefile.in: Rebuilt. Signed-off-by: Gaius Mulley <[email protected]> Diff: --- libgm2/configure | 230 +++++++++++++++++++++++++++++++++++++++++++- libgm2/libm2min/Makefile.am | 5 +- libgm2/libm2min/Makefile.in | 4 +- 3 files changed, 234 insertions(+), 5 deletions(-) diff --git a/libgm2/configure b/libgm2/configure index 7799d3987e01..aa3e998d5996 100755 --- a/libgm2/configure +++ b/libgm2/configure @@ -647,8 +647,14 @@ BUILD_PIMLIB_FALSE BUILD_PIMLIB_TRUE GM2_FOR_TARGET CC_FOR_BUILD +PICFLAG enable_static enable_shared +HAVE_PYTHON_INTERPRETER_FALSE +HAVE_PYTHON_INTERPRETER_TRUE +ax_python_interpreter_found +PYTHON +PYTHON_VERSION ENABLE_DARWIN_AT_RPATH_FALSE ENABLE_DARWIN_AT_RPATH_TRUE OTOOL64 @@ -832,7 +838,8 @@ CPP CXX CXXFLAGS CCC -CXXCPP' +CXXCPP +PYTHON_VERSION' # Initialize some variables set by options. @@ -1507,6 +1514,10 @@ Some influential environment variables: CXXCPP C++ preprocessor CCAS assembler compiler command (defaults to CC) CCASFLAGS assembler compiler flags (defaults to CFLAGS) + PYTHON_VERSION + The installed Python version to use, for example '2.3'. This + string will be appended to the Python interpreter canonical + name. Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -15243,7 +15254,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 15246 "configure" +#line 15257 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15349,7 +15360,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 15352 "configure" +#line 15363 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18692,6 +18703,132 @@ else fi + # Default to no. + ax_python_interpreter_found=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking do we have a Python interpreter" >&5 +$as_echo_n "checking do we have a Python interpreter... " >&6; } + # + # Allow the use of a (user set) custom python version + # + + for version in $PYTHON_VERSION 3 2 ""; do + # Extract the first word of "python[$version]", so it can be a program name with args. +set dummy python$version; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PYTHON in + [\\/]* | ?:[\\/]*) + ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PYTHON=$ac_cv_path_PYTHON +if test -n "$PYTHON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 +$as_echo "$PYTHON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test -z "$PYTHON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + # Note: omitted the test for Python version < 2.1.0. + # + # If the macro parameter ``version'' is set, honour it. + # A Python shim class, VPy, is used to implement correct version comparisons via + # string expressions, since e.g. a naive textual ">= 2.7.3" won't work for + # Python 2.7.10 (the ".1" being evaluated as less than ".3"). + if test -n ">= '3.0'"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether internal python version string is >= '3.0'" >&5 +$as_echo_n "checking whether internal python version string is >= '3.0'... " >&6; } + cat << EOF > ax_python_interpreter_vpy.py +class VPy: + def vtup(self, s): + return tuple(map(int, s.strip().replace("rc", ".").split("."))) + def __init__(self): + import sys + self.vpy = tuple(sys.version_info)[:3] + def __eq__(self, s): + return self.vpy == self.vtup(s) + def __ne__(self, s): + return self.vpy != self.vtup(s) + def __lt__(self, s): + return self.vpy < self.vtup(s) + def __gt__(self, s): + return self.vpy > self.vtup(s) + def __le__(self, s): + return self.vpy <= self.vtup(s) + def __ge__(self, s): + return self.vpy >= self.vtup(s) +EOF + ac_supports_python_ver=`$PYTHON -c """import ax_python_interpreter_vpy; \ + ver = ax_python_interpreter_vpy.VPy(); \ + print (ver >= '3.0') """` + rm -rf ax_python_interpreter_vpy*.py* __pycache__/ax_python_interpreter_vpy*.py* + if test "$ac_supports_python_ver" = "True"; then + # Found correct version, now break from the loop. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + PYTHON_VERSION=$version + ax_python_interpreter_found=yes + break + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PYTHON_VERSION="" + fi + fi + fi + done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking result of having a Python >= '3.0' interpreter" >&5 +$as_echo_n "checking result of having a Python >= '3.0' interpreter... " >&6; } + if test "$ax_python_interpreter_found" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, all done." >&5 +$as_echo "yes, all done." >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PYTHON_VERSION="" + fi + # + # all done! + # + + if test x$ax_python_interpreter_found = xyes; then + HAVE_PYTHON_INTERPRETER_TRUE= + HAVE_PYTHON_INTERPRETER_FALSE='#' +else + HAVE_PYTHON_INTERPRETER_TRUE='#' + HAVE_PYTHON_INTERPRETER_FALSE= +fi + @@ -19409,6 +19546,89 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +case "${host}" in + # PIC is the default on some targets or must not be used. + *-*-darwin*) + # For darwin, common symbols are not allowed in MH_DYLIB files + case "${CFLAGS}" in + # If we are using a compiler supporting mdynamic-no-pic + # and the option has been tested as safe to add, then cancel + # it here, since the code generated is incompatible with shared + # libs. + *-mdynamic-no-pic*) PICFLAG='-fno-common -mno-dynamic-no-pic' ;; + *) PICFLAG=-fno-common ;; + esac + ;; + alpha*-dec-osf5*) + # PIC is the default. + ;; + hppa*64*-*-hpux*) + # PIC is the default for 64-bit PA HP-UX. + ;; + i[34567]86-*-cygwin* | x86_64-*-cygwin*) + ;; + i[34567]86-*-mingw* | x86_64-*-mingw*) + ;; + i[34567]86-*-interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + i[34567]86-*-nto-qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + PICFLAG='-fPIC -shared' + ;; + i[34567]86-pc-msdosdjgpp*) + # DJGPP does not support shared libraries at all. + ;; + ia64*-*-hpux*) + # On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + PICFLAG=-fPIC + ;; + loongarch*-*-*) + PICFLAG=-fpic + ;; + mips-sgi-irix6*) + # PIC is the default. + ;; + rs6000-ibm-aix* | powerpc-ibm-aix*) + # All AIX code is PIC. + ;; + + # Some targets support both -fPIC and -fpic, but prefer the latter. + # FIXME: Why? + i[34567]86-*-* | x86_64-*-*) + PICFLAG=-fpic + ;; + # FIXME: Override -fPIC default in libgcc only? + sh-*-linux* | sh[2346lbe]*-*-linux*) + PICFLAG=-fpic + ;; + sh*-*-netbsd*) + PICFLAG=-fpic + ;; + # Default to -fPIC unless specified otherwise. + *) + PICFLAG=-fPIC + ;; +esac + +# If the user explicitly uses -fpic/-fPIC, keep that. +case "${CFLAGS}" in + *-fpic*) + PICFLAG=-fpic + ;; + *-fPIC*) + PICFLAG=-fPIC + ;; +esac + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking m2 front end checking c library for access" >&5 @@ -23315,6 +23535,10 @@ if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_PYTHON_INTERPRETER_TRUE}" && test -z "${HAVE_PYTHON_INTERPRETER_FALSE}"; then + as_fn_error $? "conditional \"HAVE_PYTHON_INTERPRETER\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${BUILD_PIMLIB_TRUE}" && test -z "${BUILD_PIMLIB_FALSE}"; then as_fn_error $? "conditional \"BUILD_PIMLIB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/libgm2/libm2min/Makefile.am b/libgm2/libm2min/Makefile.am index bd64fff97fa6..5471d6326310 100644 --- a/libgm2/libm2min/Makefile.am +++ b/libgm2/libm2min/Makefile.am @@ -89,7 +89,10 @@ AM_MAKEFLAGS = \ "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ "DESTDIR=$(DESTDIR)" \ "WERROR=$(WERROR)" \ - "TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" + "TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \ + "PYTHON=$(PYTHON)" \ + "HAVE_PYTHON_INTERPRETER=$(HAVE_PYTHON_INTERPRETER)" + # Subdir rules rely on $(FLAGS_TO_PASS) FLAGS_TO_PASS = $(AM_MAKEFLAGS) diff --git a/libgm2/libm2min/Makefile.in b/libgm2/libm2min/Makefile.in index 4b09474c955f..1a9adde94ba4 100644 --- a/libgm2/libm2min/Makefile.in +++ b/libgm2/libm2min/Makefile.in @@ -440,7 +440,9 @@ AM_MAKEFLAGS = \ "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ "DESTDIR=$(DESTDIR)" \ "WERROR=$(WERROR)" \ - "TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" + "TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)" \ + "PYTHON=$(PYTHON)" \ + "HAVE_PYTHON_INTERPRETER=$(HAVE_PYTHON_INTERPRETER)" # Subdir rules rely on $(FLAGS_TO_PASS)
