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

Mohammad-Reza Nabipoor mnabipoor@gnu.org
Wed Nov 5 20:47:54 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.
	* 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.
	* aclocal.m4: Likewise.
---
 gcc/aclocal.m4                    |  98 ++++++++++++++++
 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                     | 181 +++++++++++++++---------------
 gcc/configure.ac                  |  31 +++++
 libga68/Makefile.am               |   5 +-
 libga68/Makefile.in               |  33 +++---
 libga68/config.h.in               |   3 +
 libga68/configure                 |  54 ++++++++-
 libga68/configure.ac              |  33 ++++++
 12 files changed, 345 insertions(+), 113 deletions(-)

diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index e44fc5fb2ab..d9468535b33 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -12,6 +12,104 @@
 # PARTICULAR PURPOSE.
 
 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+# longlong.m4 serial 8
+dnl Copyright (C) 1999-2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_LONG_LONG_INT if 'long long int' works.
+# This fixes a bug in Autoconf 2.60, but can be removed once we
+# assume 2.61 everywhere.
+
+# Note: If the type 'long long int' exists but is only 32 bits large
+# (as on some very old compilers), AC_TYPE_LONG_LONG_INT will not be
+# defined. In this case you can treat 'long long int' like 'long int'.
+
+AC_DEFUN([AC_TYPE_LONG_LONG_INT],
+[
+  AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+	  [[long long int ll = 9223372036854775807ll;
+	    long long int nll = -9223372036854775807LL;
+	    typedef int a[((-9223372036854775807LL < 0
+			    && 0 < 9223372036854775807ll)
+			   ? 1 : -1)];
+	    int i = 63;]],
+	  [[long long int llmax = 9223372036854775807ll;
+	    return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+		    | (llmax / ll) | (llmax % ll));]])],
+       [ac_cv_type_long_long_int=yes],
+       [ac_cv_type_long_long_int=no])])
+  if test $ac_cv_type_long_long_int = yes; then
+    AC_DEFINE([HAVE_LONG_LONG_INT], 1,
+      [Define to 1 if the system has the type `long long int'.])
+  fi
+])
+
+# This macro is obsolescent and should go away soon.
+AC_DEFUN([gl_AC_TYPE_LONG_LONG],
+[
+  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+  ac_cv_type_long_long=$ac_cv_type_long_long_int
+  if test $ac_cv_type_long_long = yes; then
+    AC_DEFINE(HAVE_LONG_LONG, 1,
+      [Define if you have the 'long long' type.])
+  fi
+])
+
+# ulonglong.m4 serial 6
+dnl Copyright (C) 1999-2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
+# This fixes a bug in Autoconf 2.60, but can be removed once we
+# assume 2.61 everywhere.
+
+# Note: If the type 'unsigned long long int' exists but is only 32 bits
+# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
+# will not be defined. In this case you can treat 'unsigned long long int'
+# like 'unsigned long int'.
+
+AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
+[
+  AC_CACHE_CHECK([for unsigned long long int],
+    [ac_cv_type_unsigned_long_long_int],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+	  [[unsigned long long int ull = 18446744073709551615ULL;
+	    typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1
+			   ? 1 : -1)];
+	   int i = 63;]],
+	  [[unsigned long long int ullmax = 18446744073709551615ull;
+	    return (ull << 63 | ull >> 63 | ull << i | ull >> i
+		    | ullmax / ull | ullmax % ull);]])],
+       [ac_cv_type_unsigned_long_long_int=yes],
+       [ac_cv_type_unsigned_long_long_int=no])])
+  if test $ac_cv_type_unsigned_long_long_int = yes; then
+    AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
+      [Define to 1 if the system has the type `unsigned long long int'.])
+  fi
+])
+
+# This macro is obsolescent and should go away soon.
+AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
+[
+  AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
+  ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int
+  if test $ac_cv_type_unsigned_long_long = yes; then
+    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
+      [Define if you have the 'unsigned long long' type.])
+  fi
+])
+
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
 # Copyright (C) 1997-2017 Free Software Foundation, Inc.
diff --git a/gcc/algol68/a68-low-posix.cc b/gcc/algol68/a68-low-posix.cc
index fd30677757c..772521013d0 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..e87aa540fce 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..3a1b3e66f3e 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 // ifdef ENABLE_A68_POSIX_PRELUDE
     }
   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..a33c5771f2f 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 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
@@ -6736,113 +6740,36 @@ _ACEOF
 esac
 
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5
-$as_echo_n "checking for unsigned long long int... " >&6; }
-if ${ac_cv_type_unsigned_long_long_int+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_unsigned_long_long_int=yes
-     if test "x${ac_cv_prog_cc_c99-no}" = xno; then
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-  /* For now, do not test the preprocessor; as of 2007 there are too many
-	 implementations with broken preprocessors.  Perhaps this can
-	 be revisited in 2012.  In the meantime, code should not expect
-	 #if to work with literals wider than 32 bits.  */
-      /* Test literals.  */
-      long long int ll = 9223372036854775807ll;
-      long long int nll = -9223372036854775807LL;
-      unsigned long long int ull = 18446744073709551615ULL;
-      /* Test constant expressions.   */
-      typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
-		     ? 1 : -1)];
-      typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
-		     ? 1 : -1)];
-      int i = 63;
-int
-main ()
-{
-/* Test availability of runtime routines for shift and division.  */
-      long long int llmax = 9223372036854775807ll;
-      unsigned long long int ullmax = 18446744073709551615ull;
-      return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
-	      | (llmax / ll) | (llmax % ll)
-	      | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
-	      | (ullmax / ull) | (ullmax % ull));
-  ;
-  return 0;
-}
-
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-
-else
-  ac_cv_type_unsigned_long_long_int=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-     fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5
-$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; }
-  if test $ac_cv_type_unsigned_long_long_int = yes; then
-
-$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h
-
-  fi
-
-
-
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5
 $as_echo_n "checking for long long int... " >&6; }
 if ${ac_cv_type_long_long_int+:} false; then :
   $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_long_long_int=yes
-      if test "x${ac_cv_prog_cc_c99-no}" = xno; then
-	ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
-	if test $ac_cv_type_long_long_int = yes; then
-	  	  	  	  if test "$cross_compiling" = yes; then :
-  :
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <limits.h>
-		 #ifndef LLONG_MAX
-		 # define HALF \
-			  (1LL << (sizeof (long long int) * CHAR_BIT - 2))
-		 # define LLONG_MAX (HALF - 1 + HALF)
-		 #endif
+long long int ll = 9223372036854775807ll;
+	    long long int nll = -9223372036854775807LL;
+	    typedef int a[((-9223372036854775807LL < 0
+			    && 0 < 9223372036854775807ll)
+			   ? 1 : -1)];
+	    int i = 63;
 int
 main ()
 {
-long long int n = 1;
-		 int i;
-		 for (i = 0; ; i++)
-		   {
-		     long long int m = n << i;
-		     if (m >> i != n)
-		       return 1;
-		     if (LLONG_MAX / 2 < m)
-		       break;
-		   }
-		 return 0;
+long long int llmax = 9223372036854775807ll;
+	    return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+		    | (llmax / ll) | (llmax % ll));
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_cxx_try_run "$LINENO"; then :
-
+if ac_fn_cxx_try_link "$LINENO"; then :
+  ac_cv_type_long_long_int=yes
 else
   ac_cv_type_long_long_int=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-	fi
-      fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5
 $as_echo "$ac_cv_type_long_long_int" >&6; }
@@ -6962,6 +6889,44 @@ _ACEOF
   esac
 
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5
+$as_echo_n "checking for unsigned long long int... " >&6; }
+if ${ac_cv_type_unsigned_long_long_int+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+unsigned long long int ull = 18446744073709551615ULL;
+	    typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1
+			   ? 1 : -1)];
+	   int i = 63;
+int
+main ()
+{
+unsigned long long int ullmax = 18446744073709551615ull;
+	    return (ull << 63 | ull >> 63 | ull << i | ull >> i
+		    | ullmax / ull | ullmax % ull);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  ac_cv_type_unsigned_long_long_int=yes
+else
+  ac_cv_type_unsigned_long_long_int=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5
+$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; }
+  if test $ac_cv_type_unsigned_long_long_int = yes; then
+
+$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h
+
+  fi
+
+
 
   ac_fn_cxx_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" "$ac_includes_default"
 if test "x$ac_cv_type_uintmax_t" = xyes; then :
@@ -8104,6 +8069,38 @@ 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
+fi
+
+
+# Disable Algol68 POSIX prelude on unsupported systems.
+# You can override this with --enable-algol68-posix-prelude.
+# Keep this in-sync with libga68/configure.ac.
+if test x$enable_algol68_posix_prelude = x; then
+  case "${target}" in
+  *-*-linux*    | *-*-gnu*     | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu | \
+  *-*-netbsd*   | *-*-freebsd* | *-*-openbsd*   | *-*-dragonfly* | \
+  *-*-solaris2* | *-*-hpux11*  | *-*-darwin*    | *-*-aix*)
+    enable_algol68_posix_prelude=yes
+    ;;
+  *)
+    enable_algol68_posix_prelude=no
+    ;;
+  esac
+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 +21883,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 21886 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -21992,7 +21989,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 21992 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 41430c5b475..88407774046 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1014,6 +1014,37 @@ 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
+                 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])
+
+# Disable Algol68 POSIX prelude on unsupported systems.
+# You can override this with --enable-algol68-posix-prelude.
+# Keep this in-sync with libga68/configure.ac.
+if test x$enable_algol68_posix_prelude = x; then
+  case "${target}" in
+  *-*-linux*    | *-*-gnu*     | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu | \
+  *-*-netbsd*   | *-*-freebsd* | *-*-openbsd*   | *-*-dragonfly* | \
+  *-*-solaris2* | *-*-hpux11*  | *-*-darwin*    | *-*-aix*)
+    enable_algol68_posix_prelude=yes
+    ;;
+  *)
+    enable_algol68_posix_prelude=no
+    ;;
+  esac
+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..27da367c4bc 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 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,46 @@ 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
+fi
+
+
+# Disable Algol68 POSIX prelude on unsupported systems.
+# You can override this with --enable-algol68-posix-prelude.
+# Keep this in-sync with gcc/configure.ac.
+if test x$enable_algol68_posix_prelude = x; then
+  case "${target}" in
+  *-*-linux*    | *-*-gnu*     | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu | \
+  *-*-netbsd*   | *-*-freebsd* | *-*-openbsd*   | *-*-dragonfly* | \
+  *-*-solaris2* | *-*-hpux11*  | *-*-darwin*    | *-*-aix*)
+    enable_algol68_posix_prelude=yes
+    ;;
+  *)
+    enable_algol68_posix_prelude=no
+    ;;
+  esac
+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 +13305,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..ec3b2a48a63 100644
--- a/libga68/configure.ac
+++ b/libga68/configure.ac
@@ -180,6 +180,39 @@ 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
+                 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])
+
+# Disable Algol68 POSIX prelude on unsupported systems.
+# You can override this with --enable-algol68-posix-prelude.
+# Keep this in-sync with gcc/configure.ac.
+if test x$enable_algol68_posix_prelude = x; then
+  case "${target}" in
+  *-*-linux*    | *-*-gnu*     | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu | \
+  *-*-netbsd*   | *-*-freebsd* | *-*-openbsd*   | *-*-dragonfly* | \
+  *-*-solaris2* | *-*-hpux11*  | *-*-darwin*    | *-*-aix*)
+    enable_algol68_posix_prelude=yes
+    ;;
+  *)
+    enable_algol68_posix_prelude=no
+    ;;
+  esac
+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,
-- 
2.51.2



More information about the Algol68 mailing list