[PATCH v3] a68: add --enable-algol68-posix-prelude

Mohammad-Reza Nabipoor mnabipoor@gnu.org
Sat Nov 8 15:26:31 GMT 2025


This configure option controls the inclusion of POSIX prelude in Algol68
runtime. By default it is not included in non-POSIX systems.

Thanks to Pietro Monteiro for demonstrating how to handle unsupported
platforms.

Signed-off-by: Mohammad-Reza Nabipoor <mnabipoor@gnu.org>

libga68/ChangeLog

	* configure.ac: Add --enable-algol68-posix-prelude option.
	* configure.tgt: New file to check POSIX prelude support.
	* Makefile.am: Make inclusion of `ga68-posix.c' conditional.
	* configure: Regenerate.
	* Makefile.in: Likewise.
	* config.h.in: Likewise.

gcc/ChangeLog

	* configure.ac: Add --enable-algol68-posix-prelude option.
	* algol68/a68-parser-prelude.cc: Make POSIX prelude available
	conditionally.
	* algol68/a68-low-posix.cc: Likewise.
	* algol68/a68-low-prelude.cc: Likewise.
	* configure: Regenerate.
	* config.h.in: Likewise.
---

Hi Jose.

Thanks for the review.

On Fri, 07 Nov 2025 17:52:39 +0100, Jose E. Marchesi wrote:
> I think nothing here justifies the dragging of longlong.m4 to
> aclocal.m4, so I wonder, are you using an unpatched autoconf 2.69 and
> 1.15 to regenerate?

It was a puzzle for me, too, but I thought it should be fine :D
I was using automake 1.15.1, but I re-compiled it again and it worked as
expected without dragging of longlong.m4!
Something was degraded in my setup, and re-installing fixed it.


Other requested changes:
  - I changed // comment to /**/ ones.
  - Changed `enable_algol68_posix_prelude' to have `default` as default value.
  - Used `"x$enable_algol68_posix_prelude"' consistently.
  - Changed `GNU Algol' to `GNU Algol 68' in options' help.


Regards,
Mohammad-Reza


 gcc/algol68/a68-low-posix.cc      |  4 +++
 gcc/algol68/a68-low-prelude.cc    |  4 +++
 gcc/algol68/a68-parser-prelude.cc |  6 ++++
 gcc/config.in                     |  6 ++++
 gcc/configure                     | 32 +++++++++++++++++++--
 gcc/configure.ac                  | 21 ++++++++++++++
 libga68/Makefile.am               |  5 +++-
 libga68/Makefile.in               | 33 ++++++++++------------
 libga68/config.h.in               |  3 ++
 libga68/configure                 | 46 +++++++++++++++++++++++++++++--
 libga68/configure.ac              | 23 ++++++++++++++++
 libga68/configure.tgt             | 33 ++++++++++++++++++++++
 12 files changed, 193 insertions(+), 23 deletions(-)
 create mode 100644 libga68/configure.tgt

diff --git a/gcc/algol68/a68-low-posix.cc b/gcc/algol68/a68-low-posix.cc
index fd30677757c..068f9d772a6 100644
--- a/gcc/algol68/a68-low-posix.cc
+++ b/gcc/algol68/a68-low-posix.cc
@@ -42,6 +42,8 @@
 
 #include "a68.h"
 
+#ifdef ENABLE_A68_POSIX_PRELUDE
+
 /* Set the exit status of the running process, to be returned to the OS upon
    exit.  */
 
@@ -551,3 +553,5 @@ a68_posix_gets (void)
   return fold_build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (gets_fndecl)),
 		      gets_fndecl);
 }
+
+#endif /* ifdef ENABLE_A68_POSIX_PRELUDE */
diff --git a/gcc/algol68/a68-low-prelude.cc b/gcc/algol68/a68-low-prelude.cc
index 727dfd4e8ea..c3e6faf749c 100644
--- a/gcc/algol68/a68-low-prelude.cc
+++ b/gcc/algol68/a68-low-prelude.cc
@@ -1902,6 +1902,8 @@ a68_lower_longlongrandom (NODE_T *p ATTRIBUTE_UNUSED, LOW_CTX_T ctx ATTRIBUTE_UN
 
 /********* POSIX prelude.  ***************/
 
+#ifdef ENABLE_A68_POSIX_PRELUDE
+
 tree
 a68_lower_setexitstatus (NODE_T *p, LOW_CTX_T ctx ATTRIBUTE_UNUSED)
 {
@@ -2160,3 +2162,5 @@ a68_lower_posixfgets (NODE_T *p, LOW_CTX_T ctx ATTRIBUTE_UNUSED)
     SET_EXPR_LOCATION (t, a68_get_node_location (p));
   return t;
 }
+
+#endif /* ifdef ENABLE_A68_POSIX_PRELUDE */
diff --git a/gcc/algol68/a68-parser-prelude.cc b/gcc/algol68/a68-parser-prelude.cc
index 6af51f37b31..2c2b2c8e13b 100644
--- a/gcc/algol68/a68-parser-prelude.cc
+++ b/gcc/algol68/a68-parser-prelude.cc
@@ -1365,6 +1365,8 @@ gnu_prelude (void)
 
 /* POSIX prelude.  */
 
+#ifdef ENABLE_A68_POSIX_PRELUDE
+
 static void
 posix_prelude (void)
 {
@@ -1429,6 +1431,8 @@ posix_prelude (void)
   a68_idf (A68_EXT, "fgets", m, a68_lower_posixfgets);
 }
 
+#endif /* ifdef ENABLE_A68_POSIX_PRELUDE */
+
 /* Transput.  */
 
 static void
@@ -1488,7 +1492,9 @@ a68_make_standard_environ (void)
   if (!OPTION_STRICT (&A68_JOB))
     {
       gnu_prelude ();
+#ifdef ENABLE_A68_POSIX_PRELUDE
       posix_prelude ();
+#endif
     }
   stand_transput ();
 }
diff --git a/gcc/config.in b/gcc/config.in
index 0c634dfc538..efdeb352faa 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -119,6 +119,12 @@
 #endif
 
 
+/* Define if inclusion of POSIX prelude is expected */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_A68_POSIX_PRELUDE
+#endif
+
+
 /* Define 0/1 if static analyzer feature is enabled. */
 #ifndef USED_FOR_TARGET
 #undef ENABLE_ANALYZER
diff --git a/gcc/configure b/gcc/configure
index 301a7720f31..7536b2c3b31 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -998,6 +998,7 @@ enable_tls
 enable_vtable_verify
 enable_analyzer
 enable_objc_gc
+enable_algol68_posix_prelude
 with_dwarf2
 enable_shared
 enable_gcov
@@ -1745,6 +1746,9 @@ Optional Features:
   --disable-analyzer      disable -fanalyzer static analyzer
   --enable-objc-gc        enable the use of Boehm's garbage collector with the
                           GNU Objective-C runtime
+  --enable-algol68-posix-prelude
+                          enable inclusion of POSIX prelude as part of GNU
+                          Algol 68 runtime
   --disable-shared        don't provide a shared libgcc
   --disable-gcov          don't provide libgcov and related host tools
   --enable-languages=LIST specify which front-ends to build
@@ -8104,6 +8108,30 @@ else
 fi
 
 
+# Check whether --enable-algol68-posix-prelude was given.
+if test "${enable_algol68_posix_prelude+set}" = set; then :
+  enableval=$enable_algol68_posix_prelude; case "$enableval" in
+  yes) enable_algol68_posix_prelude=yes ;;
+  no) enable_algol68_posix_prelude=no;;
+  *) as_fn_error $? "bad value $enableval for --enable-algol68-posix-prelude" "$LINENO" 5 ;;
+esac
+else
+  enable_algol68_posix_prelude=default
+fi
+
+
+if test "x$enable_algol68_posix_prelude" = xdefault; then
+  unset LIBGA68_POSIXPRED_SUPPORTED
+  . "${srcdir}/../libga68/configure.tgt"
+  enable_algol68_posix_prelude=$LIBGA68_POSIXPRED_SUPPORTED
+fi
+
+if test "x$enable_algol68_posix_prelude" = xyes; then
+
+$as_echo "#define ENABLE_A68_POSIX_PRELUDE 1" >>confdefs.h
+
+fi
+
 
 # Check whether --with-dwarf2 was given.
 if test "${with_dwarf2+set}" = set; then :
@@ -21886,7 +21914,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21889 "configure"
+#line 21917 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -21992,7 +22020,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21995 "configure"
+#line 22023 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 41430c5b475..2cb76c7443c 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1014,6 +1014,27 @@ else
 fi,
 objc_boehm_gc='')
 
+AC_ARG_ENABLE(algol68-posix-prelude,
+[AS_HELP_STRING([--enable-algol68-posix-prelude],
+                [enable inclusion of POSIX prelude as part of GNU Algol 68
+                 runtime])],
+[case "$enableval" in
+  yes) enable_algol68_posix_prelude=yes ;;
+  no) enable_algol68_posix_prelude=no;;
+  *) AC_MSG_ERROR([bad value $enableval for --enable-algol68-posix-prelude]) ;;
+esac], [enable_algol68_posix_prelude=default])
+
+if test "x$enable_algol68_posix_prelude" = xdefault; then
+  unset LIBGA68_POSIXPRED_SUPPORTED
+  . "${srcdir}/../libga68/configure.tgt"
+  enable_algol68_posix_prelude=$LIBGA68_POSIXPRED_SUPPORTED
+fi
+
+if test "x$enable_algol68_posix_prelude" = xyes; then
+  AC_DEFINE([ENABLE_A68_POSIX_PRELUDE], [1],
+            [Define if inclusion of POSIX prelude is expected])
+fi
+
 AC_ARG_WITH(dwarf2,
 [AS_HELP_STRING([--with-dwarf2], [force the default debug format to be DWARF 2 (or later)])],
 dwarf2="$with_dwarf2",
diff --git a/libga68/Makefile.am b/libga68/Makefile.am
index accdd910d8d..7422d551c93 100644
--- a/libga68/Makefile.am
+++ b/libga68/Makefile.am
@@ -104,7 +104,6 @@ toolexeclib_LTLIBRARIES = libga68.la
 
 libga68_la_SOURCES = libga68.c \
                      ga68-unistr.c \
-                     ga68-posix.c \
                      ga68-alloc.c \
                      ga68-error.c \
                      ga68-standenv.c \
@@ -116,6 +115,10 @@ libga68_la_LDFLAGS = -version-info $(libga68_VERSION) \
 libga68_la_DEPENDENCIES = libga68.spec
 libga68_la_LIBADD = $(LIBGA68_BOEHM_GC_LIBS)
 
+if ENABLE_A68_POSIX_PRELUDE
+libga68_la_SOURCES += ga68-posix.c
+endif
+
 # target overrides
 -include $(tmake_file)
 
diff --git a/libga68/Makefile.in b/libga68/Makefile.in
index efba8b8ee11..e4ca16eb329 100644
--- a/libga68/Makefile.in
+++ b/libga68/Makefile.in
@@ -114,6 +114,7 @@ host_triplet = @host@
 target_triplet = @target@
 @ENABLE_DARWIN_AT_RPATH_TRUE@am__append_1 = -Wc,-nodefaultrpaths \
 @ENABLE_DARWIN_AT_RPATH_TRUE@	-Wl,-rpath,@loader_path
+@ENABLE_A68_POSIX_PRELUDE_TRUE@am__append_2 = ga68-posix.c
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
@@ -168,10 +169,12 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
 	"$(DESTDIR)$(toolexeclibdir)"
 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
+@ENABLE_A68_POSIX_PRELUDE_TRUE@am__objects_1 =  \
+@ENABLE_A68_POSIX_PRELUDE_TRUE@	libga68_la-ga68-posix.lo
 am_libga68_la_OBJECTS = libga68_la-libga68.lo \
-	libga68_la-ga68-unistr.lo libga68_la-ga68-posix.lo \
-	libga68_la-ga68-alloc.lo libga68_la-ga68-error.lo \
-	libga68_la-ga68-standenv.lo
+	libga68_la-ga68-unistr.lo libga68_la-ga68-alloc.lo \
+	libga68_la-ga68-error.lo libga68_la-ga68-standenv.lo \
+	$(am__objects_1)
 libga68_la_OBJECTS = $(am_libga68_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -452,14 +455,8 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)
 gcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc
 toolexeclib_DATA = libga68.spec
 toolexeclib_LTLIBRARIES = libga68.la
-libga68_la_SOURCES = libga68.c \
-                     ga68-unistr.c \
-                     ga68-posix.c \
-                     ga68-alloc.c \
-                     ga68-error.c \
-                     ga68-standenv.c \
-                     ga68.h
-
+libga68_la_SOURCES = libga68.c ga68-unistr.c ga68-alloc.c ga68-error.c \
+	ga68-standenv.c ga68.h $(am__append_2)
 libga68_la_LIBTOOLFLAGS = 
 libga68_la_CFLAGS = $(LIBGA68_GCFLAGS) $(LIBGA68_BOEHM_GC_INCLUDES)
 libga68_la_LDFLAGS = -version-info $(libga68_VERSION) \
@@ -616,13 +613,6 @@ libga68_la-ga68-unistr.lo: ga68-unistr.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libga68_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libga68_la_CFLAGS) $(CFLAGS) -c -o libga68_la-ga68-unistr.lo `test -f 'ga68-unistr.c' || echo '$(srcdir)/'`ga68-unistr.c
 
-libga68_la-ga68-posix.lo: ga68-posix.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libga68_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libga68_la_CFLAGS) $(CFLAGS) -MT libga68_la-ga68-posix.lo -MD -MP -MF $(DEPDIR)/libga68_la-ga68-posix.Tpo -c -o libga68_la-ga68-posix.lo `test -f 'ga68-posix.c' || echo '$(srcdir)/'`ga68-posix.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libga68_la-ga68-posix.Tpo $(DEPDIR)/libga68_la-ga68-posix.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='ga68-posix.c' object='libga68_la-ga68-posix.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libga68_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libga68_la_CFLAGS) $(CFLAGS) -c -o libga68_la-ga68-posix.lo `test -f 'ga68-posix.c' || echo '$(srcdir)/'`ga68-posix.c
-
 libga68_la-ga68-alloc.lo: ga68-alloc.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libga68_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libga68_la_CFLAGS) $(CFLAGS) -MT libga68_la-ga68-alloc.lo -MD -MP -MF $(DEPDIR)/libga68_la-ga68-alloc.Tpo -c -o libga68_la-ga68-alloc.lo `test -f 'ga68-alloc.c' || echo '$(srcdir)/'`ga68-alloc.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libga68_la-ga68-alloc.Tpo $(DEPDIR)/libga68_la-ga68-alloc.Plo
@@ -644,6 +634,13 @@ libga68_la-ga68-standenv.lo: ga68-standenv.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libga68_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libga68_la_CFLAGS) $(CFLAGS) -c -o libga68_la-ga68-standenv.lo `test -f 'ga68-standenv.c' || echo '$(srcdir)/'`ga68-standenv.c
 
+libga68_la-ga68-posix.lo: ga68-posix.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libga68_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libga68_la_CFLAGS) $(CFLAGS) -MT libga68_la-ga68-posix.lo -MD -MP -MF $(DEPDIR)/libga68_la-ga68-posix.Tpo -c -o libga68_la-ga68-posix.lo `test -f 'ga68-posix.c' || echo '$(srcdir)/'`ga68-posix.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libga68_la-ga68-posix.Tpo $(DEPDIR)/libga68_la-ga68-posix.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='ga68-posix.c' object='libga68_la-ga68-posix.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libga68_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libga68_la_CFLAGS) $(CFLAGS) -c -o libga68_la-ga68-posix.lo `test -f 'ga68-posix.c' || echo '$(srcdir)/'`ga68-posix.c
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
diff --git a/libga68/config.h.in b/libga68/config.h.in
index 06421c483d9..11861f91739 100644
--- a/libga68/config.h.in
+++ b/libga68/config.h.in
@@ -1,5 +1,8 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Define if inclusion of POSIX prelude is expected */
+#undef ENABLE_A68_POSIX_PRELUDE
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
diff --git a/libga68/configure b/libga68/configure
index 328b22c5402..efd319bb2e3 100755
--- a/libga68/configure
+++ b/libga68/configure
@@ -638,6 +638,8 @@ LIBGA68_BOEHM_GC_LIBS
 LIBGA68_BOEHM_GC_INCLUDES
 LIBGA68_GCFLAGS
 extra_darwin_ldflags_libga68
+ENABLE_A68_POSIX_PRELUDE_FALSE
+ENABLE_A68_POSIX_PRELUDE_TRUE
 libga68_VERSION
 SPEC_LIBGA68_DEPS
 get_gcc_base_ver
@@ -797,6 +799,7 @@ with_gnu_ld
 enable_libtool_lock
 enable_darwin_at_rpath
 with_gcc_major_version_only
+enable_algol68_posix_prelude
 enable_algol68_gc
 with_target_bdw_gc
 with_target_bdw_gc_include
@@ -1449,6 +1452,9 @@ Optional Features:
   --enable-darwin-at-rpath
                           install libraries with @rpath/library-name, requires
                           rpaths to be added to executables
+  --enable-algol68-posix-prelude
+                          enable inclusion of POSIX prelude as part of GNU
+                          Algol 68 runtime
   --enable-algol68-gc     enable use of Boehm's garbage collector with the GNU
                           Algol runtime
 
@@ -12375,7 +12381,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12378 "configure"
+#line 12384 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12481,7 +12487,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12484 "configure"
+#line 12490 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12886,6 +12892,38 @@ SPEC_LIBGA68_DEPS="$LIBS"
 libga68_VERSION=1:0:0
 
 
+# Check whether --enable-algol68-posix-prelude was given.
+if test "${enable_algol68_posix_prelude+set}" = set; then :
+  enableval=$enable_algol68_posix_prelude; case "$enableval" in
+  yes) enable_algol68_posix_prelude=yes ;;
+  no) enable_algol68_posix_prelude=no;;
+  *) as_fn_error $? "bad value $enableval for --enable-algol68-posix-prelude" "$LINENO" 5 ;;
+esac
+else
+  enable_algol68_posix_prelude=default
+fi
+
+
+if test "x$enable_algol68_posix_prelude" = xdefault; then
+  unset LIBGA68_POSIXPRED_SUPPORTED
+  . "${srcdir}/configure.tgt"
+  enable_algol68_posix_prelude=$LIBGA68_POSIXPRED_SUPPORTED
+fi
+
+ if test "x$enable_algol68_posix_prelude" = xyes; then
+  ENABLE_A68_POSIX_PRELUDE_TRUE=
+  ENABLE_A68_POSIX_PRELUDE_FALSE='#'
+else
+  ENABLE_A68_POSIX_PRELUDE_TRUE='#'
+  ENABLE_A68_POSIX_PRELUDE_FALSE=
+fi
+
+if test "x$enable_algol68_posix_prelude" = xyes; then
+
+$as_echo "#define ENABLE_A68_POSIX_PRELUDE 1" >>confdefs.h
+
+fi
+
 # The Boehm GC
 
 # Check whether --enable-algol68-gc was given.
@@ -13259,6 +13297,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 "${ENABLE_A68_POSIX_PRELUDE_TRUE}" && test -z "${ENABLE_A68_POSIX_PRELUDE_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_A68_POSIX_PRELUDE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
diff --git a/libga68/configure.ac b/libga68/configure.ac
index 5adf132932d..b0a7618eb29 100644
--- a/libga68/configure.ac
+++ b/libga68/configure.ac
@@ -180,6 +180,29 @@ AC_SUBST(SPEC_LIBGA68_DEPS)
 libga68_VERSION=1:0:0
 AC_SUBST(libga68_VERSION)
 
+AC_ARG_ENABLE(algol68-posix-prelude,
+[AS_HELP_STRING([--enable-algol68-posix-prelude],
+                [enable inclusion of POSIX prelude as part of GNU Algol 68
+                 runtime])],
+[case "$enableval" in
+  yes) enable_algol68_posix_prelude=yes ;;
+  no) enable_algol68_posix_prelude=no;;
+  *) AC_MSG_ERROR([bad value $enableval for --enable-algol68-posix-prelude]) ;;
+esac], [enable_algol68_posix_prelude=default])
+
+if test "x$enable_algol68_posix_prelude" = xdefault; then
+  unset LIBGA68_POSIXPRED_SUPPORTED
+  . "${srcdir}/configure.tgt"
+  enable_algol68_posix_prelude=$LIBGA68_POSIXPRED_SUPPORTED
+fi
+
+AM_CONDITIONAL([ENABLE_A68_POSIX_PRELUDE],
+               [test "x$enable_algol68_posix_prelude" = xyes])
+if test "x$enable_algol68_posix_prelude" = xyes; then
+  AC_DEFINE([ENABLE_A68_POSIX_PRELUDE], [1],
+            [Define if inclusion of POSIX prelude is expected])
+fi
+
 # The Boehm GC
 
 AC_ARG_ENABLE(algol68-gc,
diff --git a/libga68/configure.tgt b/libga68/configure.tgt
new file mode 100644
index 00000000000..d2f0bf4b699
--- /dev/null
+++ b/libga68/configure.tgt
@@ -0,0 +1,33 @@
+# -*- shell-script -*-
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# This is the target specific configuration file.  This is invoked by the
+# autoconf generated configure script.  Putting it in a separate shell file
+# lets us skip running autoconf when modifying target specific information.
+
+# Enable Algol68 POSIX prelude only on supported systems.
+# You can override this with --enable-algol68-posix-prelude.
+LIBGA68_POSIXPRED_SUPPORTED=no
+case "${target}" in
+*-*-linux*    | *-*-gnu*     | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu | \
+*-*-netbsd*   | *-*-freebsd* | *-*-openbsd*   | *-*-dragonfly* | \
+*-*-solaris2* | *-*-hpux11*  | *-*-darwin*    | *-*-aix*)
+  LIBGA68_POSIXPRED_SUPPORTED=yes
+  ;;
+*)
+  ;;
+esac
-- 
2.51.2



More information about the Algol68 mailing list