https://gcc.gnu.org/g:9c8bb50ab9896924a95af78c345c301c36224fb6

commit r16-7016-g9c8bb50ab9896924a95af78c345c301c36224fb6
Author: Jose E. Marchesi <[email protected]>
Date:   Sat Jan 24 17:47:41 2026 +0100

    a68: document libgc minimum version and feature-check GC_is_init_called [PR 
algol68/123733]
    
    Signed-off-by: Jose E. Marchesi <[email protected]>
    
    gcc/algol68/ChangeLog
    
            PR algol68/123733
            * README: Mention minimum version of libgc.
    
    libga68/ChangeLog
    
            PR algol68/123733
            * configure.ac: Check for GC_is_init_called in libgc.
            * configure: Regenerate.

Diff:
---
 gcc/algol68/README   |  8 ++++++++
 libga68/configure    | 11 ++++++-----
 libga68/configure.ac |  9 ++++++---
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/gcc/algol68/README b/gcc/algol68/README
index 9d1595ad8d8c..5e9660b6ec01 100644
--- a/gcc/algol68/README
+++ b/gcc/algol68/README
@@ -26,6 +26,14 @@ The compiler proper is called `a681'.
 Programs built by this compiler make use of the libga68 run-time
 library.
 
+Dependencies
+============
+
+The Algol 68 run-time relies on the Boehm-Demers-Weiser conservative
+garbage collector libgc, version 7.6.2 or later.  If for whatever
+reason a recent enough of libgc is not available for some target then
+you can configure GCC with --disable-algol68-gc.
+
 Building
 ========
 
diff --git a/libga68/configure b/libga68/configure
index fb14f39eb2b3..01dc61e2d592 100755
--- a/libga68/configure
+++ b/libga68/configure
@@ -13660,7 +13660,7 @@ GC_init()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 
-        if test "$cross_compiling" = yes; then :
+                        if test "$cross_compiling" = yes; then :
             system_bdw_gc_found=no
 
 else
@@ -13669,7 +13669,8 @@ else
 
           #include <gc/gc.h>
           int main() {
-            GC_init();
+            if (!GC_is_init_called ())
+               GC_init();
             return 0;
           }
 
@@ -13692,11 +13693,11 @@ rm -f core conftest.err conftest.$ac_objext \
     CFLAGS=$save_CFLAGS
     LIBS=$save_LIBS
     if test x$enable_algol68_gc = xauto && test x$system_bdw_gc_found = xno; 
then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: system bdw-gc not 
found, building libga68 with no GC support" >&5
-$as_echo "$as_me: WARNING: system bdw-gc not found, building libga68 with no 
GC support" >&2;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usable system bdw-gc 
not found, building libga68 with no GC support" >&5
+$as_echo "$as_me: WARNING: usable system bdw-gc not found, building libga68 
with no GC support" >&2;}
       use_bdw_gc=no
     elif test x$enable_algol68_gc = xyes && test x$system_bdw_gc_found = xno; 
then
-      as_fn_error $? "system bdw-gc required but not found" "$LINENO" 5
+      as_fn_error $? "usable system bdw-gc required but not found" "$LINENO" 5
     else
       use_bdw_gc=yes
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
diff --git a/libga68/configure.ac b/libga68/configure.ac
index 244ca1d8cb23..96b23f4a89bc 100644
--- a/libga68/configure.ac
+++ b/libga68/configure.ac
@@ -356,10 +356,13 @@ no)
     AC_LINK_IFELSE(
       [AC_LANG_PROGRAM([#include <gc/gc.h>],[GC_init()])],
       [
+        dnl Make sure to include GC_is_init_called and any other
+        dnl feature that may require a "recent" libgc.
         AC_RUN_IFELSE([AC_LANG_SOURCE([[
           #include <gc/gc.h>
           int main() {
-            GC_init();
+            if (!GC_is_init_called ())
+               GC_init();
             return 0;
           }
           ]])],
@@ -373,10 +376,10 @@ no)
     CFLAGS=$save_CFLAGS
     LIBS=$save_LIBS
     if test x$enable_algol68_gc = xauto && test x$system_bdw_gc_found = xno; 
then
-      AC_MSG_WARN([system bdw-gc not found, building libga68 with no GC 
support])
+      AC_MSG_WARN([usable system bdw-gc not found, building libga68 with no GC 
support])
       use_bdw_gc=no
     elif test x$enable_algol68_gc = xyes && test x$system_bdw_gc_found = xno; 
then
-      AC_MSG_ERROR([system bdw-gc required but not found])
+      AC_MSG_ERROR([usable system bdw-gc required but not found])
     else
       use_bdw_gc=yes
       AC_MSG_RESULT([found])

Reply via email to