https://gcc.gnu.org/g:2515b137006a040dddbb7a610a019a257f13022b
commit r16-6444-g2515b137006a040dddbb7a610a019a257f13022b Author: Jose E. Marchesi <[email protected]> Date: Tue Dec 2 10:20:31 2025 +0100 a68: support for Algol 68 code in libga68 and initial transput Most of the standard prelude is implemented in a combination of code lowered by the front-end (standard operators, contants, etc) and functions provided by the libga68 run-time library, to which the former libcalls. Until now, all the support routines in libga68 were written in C. However, many of the transput facilities are better implemented in Algol 68. The Revised Report includes a reference implementation (code listing) of many of the standard routines. This implementation, however, makes use of an "extended" program notation in order to denote certain notions to avoid repetitive code. Therefore this commit includes sppp, a build-time pre-processor written in awk that is only intended to be used internally by the libga68 run-time library. This preprocessor allows us to write code like: proc subwhole = (Number v, int width) string: case v in {iter L {short short} {short} {} {long} {long long}} {iter S {LENG LENG} {LENG} {} {SHORTEN} {SHORTEN SHORTEN}} ({L} int x): begin string s, {L} int n := x; while dig_char ({S} (n MOD {L} 10)) +=: s; n %:= {L} 10; n /= {L} 0 do ~ od; (UPB s > width | width * errorchar | s) end {reti {,}} esac; Resulting in cases for short short int, short int, int, long int and long long int being macro-expanded in the routine's conformance clause. This commit also adds the necessary infrastructure for writing Algol 68 code in the libga68 library, including the ability of having modules exported by libga68. An implementation of some of the transput routines is also provided in standard.a68: whole, fixed, float, string_to_L_real, char_in_string, L_int_width, L_real_width and L_exp_with. The build system changes include the backport of the Automake Algol 68 support, which is in a released version of Automake but not in the version used for GCC, to libga68/m4/autoconf.m4. Signed-off-by: Jose E. Marchesi <[email protected]> ChangeLog * Makefile.def (flags_to_pass): Rename GA68, GA68FLAGS, GA68_FOR_TARGET, GA68FLAGS_FOR_TARGET to A68, A68FLAGS, A68_FOR_TARGET and A68FLAGS_FOR_TARGET. * Makefile.tpl: Use A68, A68FLAGS, A68_FOR_BUILD and A68_FOR_TARGET rather than GA68, GA68FLAGS, GA68_FOR_BUILD and GA68_FOR_TARGET. * Makefile.in: Regenerate. * configure.ac: Set A68_FOR_BUILD rather than GA68_FOR_BUILD, and invoke ACX_PROG_A68 rather than ACX_PROG_GA68. Subst A68_FOR_BUILD rather than GA68_FOR_BUILD. Subst A68 and A68FLAGS rather than GA68 and GA68FLAGS. Set A68_FOR_TARGET rather than GA68_FOR_TARGET. * configure: Regenerate. * config-ml.in: Handle A68FLAGS and define A68 in sub-configures. config/ChangeLog * acx.m4: Define ACX_PROG_A68 rather than ACX_PROG_GA68. (ACX_PROG_A68): Set A68 rather than GA68. gcc/algol68/ChangeLog * a68-lang.cc (a68_init_options): Add an entry to A68_MODULE_FILES to map module Transput to the basename ga68. gcc/testsuite/ChangeLog * algol68/execute/char-in-string-1.a68: New test. libga68/ChangeLog * m4/autoconf.m4: New file. * configure.ac: Expand AC_PROG_A68. * configure: Regenerate. * Makefile.am: Add rules to build Algol 68 sources and to build the transput module. * Makefile.in: Regenerate. * acinclude.m4: Include m4/autoconf.m4. * sppp.awk: New file. * transput.a68.in: Likewise. Diff: --- Makefile.def | 8 +- Makefile.in | 42 ++-- Makefile.tpl | 34 +-- config-ml.in | 18 +- config/acx.m4 | 4 +- configure | 152 +++++------ configure.ac | 18 +- gcc/algol68/a68-lang.cc | 4 +- gcc/testsuite/algol68/execute/char-in-string-1.a68 | 5 + libga68/Makefile.am | 20 +- libga68/Makefile.in | 37 ++- libga68/acinclude.m4 | 12 + libga68/configure | 232 ++++++++++++++++- libga68/configure.ac | 1 + libga68/m4/autoconf.m4 | 131 ++++++++++ libga68/sppp.awk | 94 +++++++ libga68/transput.a68.in | 279 +++++++++++++++++++++ 17 files changed, 947 insertions(+), 144 deletions(-) diff --git a/Makefile.def b/Makefile.def index 627121e87bc8..cde69c9c9f76 100644 --- a/Makefile.def +++ b/Makefile.def @@ -314,8 +314,8 @@ flags_to_pass = { flag= GNATBIND ; }; flags_to_pass = { flag= GNATMAKE ; }; flags_to_pass = { flag= GDC ; }; flags_to_pass = { flag= GDCFLAGS ; }; -flags_to_pass = { flag= GA68 ; }; -flags_to_pass = { flag= GA68FLAGS ; }; +flags_to_pass = { flag= A68 ; }; +flags_to_pass = { flag= A68FLAGS ; }; // Target tools flags_to_pass = { flag= AR_FOR_TARGET ; }; @@ -332,8 +332,8 @@ flags_to_pass = { flag= GOC_FOR_TARGET ; }; flags_to_pass = { flag= GOCFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= GDC_FOR_TARGET ; }; flags_to_pass = { flag= GDCFLAGS_FOR_TARGET ; }; -flags_to_pass = { flag= GA68_FOR_TARGET ; }; -flags_to_pass = { flag= GA68FLAGS_FOR_TARGET ; }; +flags_to_pass = { flag= A68_FOR_TARGET ; }; +flags_to_pass = { flag= A68FLAGS_FOR_TARGET ; }; flags_to_pass = { flag= GM2_FOR_TARGET ; }; flags_to_pass = { flag= GM2FLAGS_FOR_TARGET ; }; flags_to_pass = { flag= LD_FOR_TARGET ; }; diff --git a/Makefile.in b/Makefile.in index ef49d3a4c032..ae0892e79337 100644 --- a/Makefile.in +++ b/Makefile.in @@ -160,8 +160,8 @@ BUILD_EXPORTS = \ CXX="$(CXX_FOR_BUILD)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ - GA68="$(GA68_FOR_BUILD)"; export GA68; \ - GA68FLAGS="$(GA68FLAGS_FOR_BUILD)"; export GA68FLAGS; \ + A68="$(A68_FOR_BUILD)"; export A68; \ + A68FLAGS="$(A68FLAGS_FOR_BUILD)"; export A68FLAGS; \ GOC="$(GOC_FOR_BUILD)"; export GOC; \ GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \ GDC="$(GDC_FOR_BUILD)"; export GDC; \ @@ -205,7 +205,7 @@ HOST_EXPORTS = \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \ - GA68="$(GA68)"; export GA68; \ + A68="$(A68)"; export A68; \ GOC="$(GOC)"; export GOC; \ GDC="$(GDC)"; export GDC; \ GM2="$(GM2)"; export GM2; \ @@ -281,11 +281,11 @@ POSTSTAGE1_HOST_EXPORTS = \ CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \ $(POSTSTAGE1_CXX_EXPORT) \ $(LTO_EXPORTS) \ - GA68="$$r/$(HOST_SUBDIR)/prev-gcc/ga68$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ - -B$(build_tooldir)/bin/ $(GA68FLAGS_FOR_TARGET) \ + A68="$$r/$(HOST_SUBDIR)/prev-gcc/ga68$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ + -B$(build_tooldir)/bin/ $(A68FLAGS_FOR_TARGET) \ -B$$r/prev-$(TARGET_SUBDIR)/libga68/.libs"; \ - export GA68; \ - GA68_FOR_BUILD="$$GA68"; export GA68_FOR_BUILD; \ + export A68; \ + A68_FOR_BUILD="$$A68"; export A68_FOR_BUILD; \ GDC="$$r/$(HOST_SUBDIR)/prev-gcc/gdc$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ -B$(build_tooldir)/bin/ $(GDCFLAGS_FOR_TARGET) \ -B$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime/gcc \ @@ -318,7 +318,7 @@ BASE_TARGET_EXPORTS = \ CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \ - GA68="$(GA68_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GA68; \ + A68="$(A68_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export A68; \ GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \ GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \ GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \ @@ -389,7 +389,7 @@ CXX_FOR_BUILD = @CXX_FOR_BUILD@ DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@ DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@ GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@ -GA68_FOR_BUILD = @GA68_FOR_BUILD@ +A68_FOR_BUILD = @A68_FOR_BUILD@ GOC_FOR_BUILD = @GOC_FOR_BUILD@ GDC_FOR_BUILD = @GDC_FOR_BUILD@ GM2_FOR_BUILD = @GM2_FOR_BUILD@ @@ -453,7 +453,7 @@ STRIP = @STRIP@ WINDRES = @WINDRES@ WINDMC = @WINDMC@ -GA68 = @GA68@ +A68 = @A68@ GDC = @GDC@ GNATBIND = @GNATBIND@ GNATMAKE = @GNATMAKE@ @@ -464,7 +464,7 @@ LIBCFLAGS = $(CFLAGS) CXXFLAGS = @CXXFLAGS@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates GOCFLAGS = $(CFLAGS) -GA68FLAGS = @GA68FLAGS@ +A68FLAGS = @A68FLAGS@ GDCFLAGS = @GDCFLAGS@ GM2FLAGS = $(CFLAGS) @@ -690,7 +690,7 @@ CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@ -GA68_FOR_TARGET=$(STAGE_CC_WRAPPER) @GA68_FOR_TARGET@ +A68_FOR_TARGET=$(STAGE_CC_WRAPPER) @A68_FOR_TARGET@ GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@ GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@ DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ @@ -720,7 +720,7 @@ LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@ GM2FLAGS_FOR_TARGET = -O2 -g GOCFLAGS_FOR_TARGET = -O2 -g -GA68FLAGS_FOR_TARGET = -O2 -g +A68FLAGS_FOR_TARGET = -O2 -g GDCFLAGS_FOR_TARGET = -O2 -g FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ @@ -907,8 +907,8 @@ BASE_FLAGS_TO_PASS = \ "GNATMAKE=$(GNATMAKE)" \ "GDC=$(GDC)" \ "GDCFLAGS=$(GDCFLAGS)" \ - "GA68=$(GA68)" \ - "GA68FLAGS=$(GA68FLAGS)" \ + "A68=$(A68)" \ + "A68FLAGS=$(A68FLAGS)" \ "AR_FOR_TARGET=$(AR_FOR_TARGET)" \ "AS_FOR_TARGET=$(AS_FOR_TARGET)" \ "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ @@ -923,8 +923,8 @@ BASE_FLAGS_TO_PASS = \ "GOCFLAGS_FOR_TARGET=$(GOCFLAGS_FOR_TARGET)" \ "GDC_FOR_TARGET=$(GDC_FOR_TARGET)" \ "GDCFLAGS_FOR_TARGET=$(GDCFLAGS_FOR_TARGET)" \ - "GA68_FOR_TARGET=$(GA68_FOR_TARGET)" \ - "GA68FLAGS_FOR_TARGET=$(GA68FLAGS_FOR_TARGET)" \ + "A68_FOR_TARGET=$(A68_FOR_TARGET)" \ + "A68FLAGS_FOR_TARGET=$(A68FLAGS_FOR_TARGET)" \ "GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \ "GM2FLAGS_FOR_TARGET=$(GM2FLAGS_FOR_TARGET)" \ "LD_FOR_TARGET=$(LD_FOR_TARGET)" \ @@ -999,7 +999,7 @@ EXTRA_HOST_FLAGS = \ 'DSYMUTIL=$(DSYMUTIL)' \ 'GFORTRAN=$(GFORTRAN)' \ 'GOC=$(GOC)' \ - 'GA68=$(GA68)' \ + 'A68=$(A68)' \ 'GDC=$(GDC)' \ 'GM2=$(GM2)' \ 'LD=$(LD)' \ @@ -1028,7 +1028,7 @@ STAGE1_FLAGS_TO_PASS = \ POSTSTAGE1_FLAGS_TO_PASS = \ CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \ CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \ - GA68="$${GA68}" GA68_FOR_BUILD="$${GA68_FOR_BUILD}" \ + A68="$${A68}" A68_FOR_BUILD="$${A68_FOR_BUILD}" \ GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \ GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \ GNATBIND="$${GNATBIND}" \ @@ -1064,8 +1064,8 @@ EXTRA_TARGET_FLAGS = \ 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \ - 'GA68=$$(GA68_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ - 'GA68FLAGS=$$(GA68FLAGS_FOR_TARGET)' \ + 'A68=$$(A68_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ + 'A68FLAGS=$$(A68FLAGS_FOR_TARGET)' \ 'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \ 'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ diff --git a/Makefile.tpl b/Makefile.tpl index 362a21b2aff1..7e8016416619 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -163,8 +163,8 @@ BUILD_EXPORTS = \ CXX="$(CXX_FOR_BUILD)"; export CXX; \ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ - GA68="$(GA68_FOR_BUILD)"; export GA68; \ - GA68FLAGS="$(GA68FLAGS_FOR_BUILD)"; export GA68FLAGS; \ + A68="$(A68_FOR_BUILD)"; export A68; \ + A68FLAGS="$(A68FLAGS_FOR_BUILD)"; export A68FLAGS; \ GOC="$(GOC_FOR_BUILD)"; export GOC; \ GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \ GDC="$(GDC_FOR_BUILD)"; export GDC; \ @@ -208,7 +208,7 @@ HOST_EXPORTS = \ CXX="$(CXX)"; export CXX; \ CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \ - GA68="$(GA68)"; export GA68; \ + A68="$(A68)"; export A68; \ GOC="$(GOC)"; export GOC; \ GDC="$(GDC)"; export GDC; \ GM2="$(GM2)"; export GM2; \ @@ -284,11 +284,11 @@ POSTSTAGE1_HOST_EXPORTS = \ CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \ $(POSTSTAGE1_CXX_EXPORT) \ $(LTO_EXPORTS) \ - GA68="$$r/$(HOST_SUBDIR)/prev-gcc/ga68$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ - -B$(build_tooldir)/bin/ $(GA68FLAGS_FOR_TARGET) \ + A68="$$r/$(HOST_SUBDIR)/prev-gcc/ga68$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ + -B$(build_tooldir)/bin/ $(A68FLAGS_FOR_TARGET) \ -B$$r/prev-$(TARGET_SUBDIR)/libga68/.libs"; \ - export GA68; \ - GA68_FOR_BUILD="$$GA68"; export GA68_FOR_BUILD; \ + export A68; \ + A68_FOR_BUILD="$$A68"; export A68_FOR_BUILD; \ GDC="$$r/$(HOST_SUBDIR)/prev-gcc/gdc$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ -B$(build_tooldir)/bin/ $(GDCFLAGS_FOR_TARGET) \ -B$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime/gcc \ @@ -321,7 +321,7 @@ BASE_TARGET_EXPORTS = \ CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \ - GA68="$(GA68_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GA68; \ + A68="$(A68_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export A68; \ GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \ GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \ GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \ @@ -392,7 +392,7 @@ CXX_FOR_BUILD = @CXX_FOR_BUILD@ DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@ DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@ GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@ -GA68_FOR_BUILD = @GA68_FOR_BUILD@ +A68_FOR_BUILD = @A68_FOR_BUILD@ GOC_FOR_BUILD = @GOC_FOR_BUILD@ GDC_FOR_BUILD = @GDC_FOR_BUILD@ GM2_FOR_BUILD = @GM2_FOR_BUILD@ @@ -456,7 +456,7 @@ STRIP = @STRIP@ WINDRES = @WINDRES@ WINDMC = @WINDMC@ -GA68 = @GA68@ +A68 = @A68@ GDC = @GDC@ GNATBIND = @GNATBIND@ GNATMAKE = @GNATMAKE@ @@ -467,7 +467,7 @@ LIBCFLAGS = $(CFLAGS) CXXFLAGS = @CXXFLAGS@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates GOCFLAGS = $(CFLAGS) -GA68FLAGS = @GA68FLAGS@ +A68FLAGS = @A68FLAGS@ GDCFLAGS = @GDCFLAGS@ GM2FLAGS = $(CFLAGS) @@ -613,7 +613,7 @@ CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@ -GA68_FOR_TARGET=$(STAGE_CC_WRAPPER) @GA68_FOR_TARGET@ +A68_FOR_TARGET=$(STAGE_CC_WRAPPER) @A68_FOR_TARGET@ GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@ GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@ DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ @@ -643,7 +643,7 @@ LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@ GM2FLAGS_FOR_TARGET = -O2 -g GOCFLAGS_FOR_TARGET = -O2 -g -GA68FLAGS_FOR_TARGET = -O2 -g +A68FLAGS_FOR_TARGET = -O2 -g GDCFLAGS_FOR_TARGET = -O2 -g FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ @@ -748,7 +748,7 @@ EXTRA_HOST_FLAGS = \ 'DSYMUTIL=$(DSYMUTIL)' \ 'GFORTRAN=$(GFORTRAN)' \ 'GOC=$(GOC)' \ - 'GA68=$(GA68)' \ + 'A68=$(A68)' \ 'GDC=$(GDC)' \ 'GM2=$(GM2)' \ 'LD=$(LD)' \ @@ -777,7 +777,7 @@ STAGE1_FLAGS_TO_PASS = \ POSTSTAGE1_FLAGS_TO_PASS = \ CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \ CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \ - GA68="$${GA68}" GA68_FOR_BUILD="$${GA68_FOR_BUILD}" \ + A68="$${A68}" A68_FOR_BUILD="$${A68_FOR_BUILD}" \ GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \ GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \ GNATBIND="$${GNATBIND}" \ @@ -813,8 +813,8 @@ EXTRA_TARGET_FLAGS = \ 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \ - 'GA68=$$(GA68_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ - 'GA68FLAGS=$$(GA68FLAGS_FOR_TARGET)' \ + 'A68=$$(A68_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ + 'A68FLAGS=$$(A68FLAGS_FOR_TARGET)' \ 'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \ 'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ diff --git a/config-ml.in b/config-ml.in index a0f384f5c819..9cdcae1191da 100644 --- a/config-ml.in +++ b/config-ml.in @@ -528,6 +528,7 @@ multi-do: exec_prefix="$(exec_prefix)" \ GOCFLAGS="$(GOCFLAGS) $${flags}" \ GDCFLAGS="$(GDCFLAGS) $${flags}" \ + A68FLAGS="$(A68FLAGS) $${flags}" \ CXXFLAGS="$(CXXFLAGS) $${flags}" \ LIBCFLAGS="$(LIBCFLAGS) $${flags}" \ LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \ @@ -759,7 +760,7 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then break fi done - ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GFORTRAN="${GFORTRAN_}$flags" GOC="${GOC_}$flags" GDC="${GDC_}$flags"' + ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GFORTRAN="${GFORTRAN_}$flags" GOC="${GOC_}$flags" GDC="${GDC_}$flags" A68="${A68_}$flags"' if [ "${with_target_subdir}" = "." ]; then CC_=$CC' ' @@ -768,6 +769,7 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then GFORTRAN_=$GFORTRAN' ' GOC_=$GOC' ' GDC_=$GDC' ' + A68_=$A68' ' else # Create a regular expression that matches any string as long # as ML_POPDIR. @@ -857,6 +859,20 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then esac done + A68_= + for arg in ${A68}; do + case $arg in + -[BIL]"${ML_POPDIR}"/*) + A68_="${A68_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; + "${ML_POPDIR}"/*) + A68_="${A68_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; + -B*/lib/) + A68_="${A68_}${arg}${multi_osdir} ${arg} " ;; + *) + A68_="${A68_}${arg} " ;; + esac + done + if test "x${LD_LIBRARY_PATH+set}" = xset; then LD_LIBRARY_PATH_= for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do diff --git a/config/acx.m4 b/config/acx.m4 index 4e0c64172e6c..7304d7b82adb 100644 --- a/config/acx.m4 +++ b/config/acx.m4 @@ -435,10 +435,10 @@ else fi]) # Test for Algol 68 -AC_DEFUN([ACX_PROG_GA68], +AC_DEFUN([ACX_PROG_A68], [AC_REQUIRE([AC_CHECK_TOOL_PREFIX]) AC_REQUIRE([AC_PROG_CC]) -AC_CHECK_TOOL(GA68, ga68, no)]) +AC_CHECK_TOOL(A68, ga68, no)]) # Test for D. AC_DEFUN([ACX_PROG_GDC], diff --git a/configure b/configure index 5a2e9547b07d..d4e11d4cec3c 100755 --- a/configure +++ b/configure @@ -620,7 +620,7 @@ AR_FOR_TARGET GM2_FOR_TARGET GDC_FOR_TARGET GOC_FOR_TARGET -GA68_FOR_TARGET +A68_FOR_TARGET GFORTRAN_FOR_TARGET GCC_FOR_TARGET CXX_FOR_TARGET @@ -634,7 +634,7 @@ GREP CPP PKG_CONFIG_PATH GDCFLAGS -GA68FLAGS +A68FLAGS READELF OTOOL OBJDUMP @@ -667,7 +667,7 @@ LDFLAGS_FOR_BUILD GNATMAKE_FOR_BUILD GDC_FOR_BUILD GOC_FOR_BUILD -GA68_FOR_BUILD +A68_FOR_BUILD GFORTRAN_FOR_BUILD DSYMUTIL_FOR_BUILD DLLTOOL_FOR_BUILD @@ -731,7 +731,7 @@ HAVE_CXX14 do_compare CARGO GDC -GA68 +A68 GNATMAKE GNATBIND ac_ct_CXX @@ -913,7 +913,7 @@ CC_FOR_TARGET CXX_FOR_TARGET GCC_FOR_TARGET GFORTRAN_FOR_TARGET -GA68_FOR_TARGET +A68_FOR_TARGET GOC_FOR_TARGET GDC_FOR_TARGET GM2_FOR_TARGET @@ -1722,8 +1722,8 @@ Some influential environment variables: GCC for the target GFORTRAN_FOR_TARGET GFORTRAN for the target - GA68_FOR_TARGET - GA68 for the target + A68_FOR_TARGET + A68 for the target GOC_FOR_TARGET GOC for the target GDC_FOR_TARGET @@ -4322,7 +4322,7 @@ if test "${build}" != "${host}" ; then DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool} DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil} GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran} - GA68_FOR_BUILD=${GA68_FOR_BUILD-ga68} + A68_FOR_BUILD=${A68_FOR_BUILD-ga68} GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo} GDC_FOR_BUILD=${GDC_FOR_BUILD-gdc} GNATMAKE_FOR_BUILD=${GNATMAKE_FOR_BUILD-gnatmake} @@ -4339,7 +4339,7 @@ else DLLTOOL_FOR_BUILD="\$(DLLTOOL)" DSYMUTIL_FOR_BUILD="\$(DSYMUTIL)" GFORTRAN_FOR_BUILD="\$(GFORTRAN)" - GA68_FOR_BUILD="\$(GA68)" + A68_FOR_BUILD="\$(A68)" GOC_FOR_BUILD="\$(GOC)" GDC_FOR_BUILD="\$(GDC)" GNATMAKE_FOR_BUILD="\$(GNATMAKE)" @@ -5865,11 +5865,11 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}ga68; 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_prog_GA68+:} false; then : +if ${ac_cv_prog_A68+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$GA68"; then - ac_cv_prog_GA68="$GA68" # Let the user override the test. + if test -n "$A68"; then + ac_cv_prog_A68="$A68" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5878,7 +5878,7 @@ do 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_prog_GA68="${ac_tool_prefix}ga68" + ac_cv_prog_A68="${ac_tool_prefix}ga68" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5888,10 +5888,10 @@ IFS=$as_save_IFS fi fi -GA68=$ac_cv_prog_GA68 -if test -n "$GA68"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GA68" >&5 -$as_echo "$GA68" >&6; } +A68=$ac_cv_prog_A68 +if test -n "$A68"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $A68" >&5 +$as_echo "$A68" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -5899,17 +5899,17 @@ fi fi -if test -z "$ac_cv_prog_GA68"; then - ac_ct_GA68=$GA68 +if test -z "$ac_cv_prog_A68"; then + ac_ct_A68=$A68 # Extract the first word of "ga68", so it can be a program name with args. set dummy ga68; 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_prog_ac_ct_GA68+:} false; then : +if ${ac_cv_prog_ac_ct_A68+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_GA68"; then - ac_cv_prog_ac_ct_GA68="$ac_ct_GA68" # Let the user override the test. + if test -n "$ac_ct_A68"; then + ac_cv_prog_ac_ct_A68="$ac_ct_A68" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5918,7 +5918,7 @@ do 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_prog_ac_ct_GA68="ga68" + ac_cv_prog_ac_ct_A68="ga68" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5928,17 +5928,17 @@ IFS=$as_save_IFS fi fi -ac_ct_GA68=$ac_cv_prog_ac_ct_GA68 -if test -n "$ac_ct_GA68"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_GA68" >&5 -$as_echo "$ac_ct_GA68" >&6; } +ac_ct_A68=$ac_cv_prog_ac_ct_A68 +if test -n "$ac_ct_A68"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_A68" >&5 +$as_echo "$ac_ct_A68" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_GA68" = x; then - GA68="no" + if test "x$ac_ct_A68" = x; then + A68="no" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5946,10 +5946,10 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - GA68=$ac_ct_GA68 + A68=$ac_ct_A68 fi else - GA68="$ac_cv_prog_GA68" + A68="$ac_cv_prog_A68" fi @@ -14479,7 +14479,7 @@ fi -GA68FLAGS=${GA68FLAGS-${CFLAGS}} +A68FLAGS=${A68FLAGS-${CFLAGS}} GDCFLAGS=${GDCFLAGS-${CFLAGS}} @@ -15810,23 +15810,23 @@ fi -if test -n "$GA68_FOR_TARGET"; then - ac_cv_prog_GA68_FOR_TARGET=$GA68_FOR_TARGET -elif test -n "$ac_cv_prog_GA68_FOR_TARGET"; then - GA68_FOR_TARGET=$ac_cv_prog_GA68_FOR_TARGET +if test -n "$A68_FOR_TARGET"; then + ac_cv_prog_A68_FOR_TARGET=$A68_FOR_TARGET +elif test -n "$ac_cv_prog_A68_FOR_TARGET"; then + A68_FOR_TARGET=$ac_cv_prog_A68_FOR_TARGET fi -if test -n "$ac_cv_prog_GA68_FOR_TARGET"; then +if test -n "$ac_cv_prog_A68_FOR_TARGET"; then for ncn_progname in ga68; do # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; 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_prog_GA68_FOR_TARGET+:} false; then : +if ${ac_cv_prog_A68_FOR_TARGET+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$GA68_FOR_TARGET"; then - ac_cv_prog_GA68_FOR_TARGET="$GA68_FOR_TARGET" # Let the user override the test. + if test -n "$A68_FOR_TARGET"; then + ac_cv_prog_A68_FOR_TARGET="$A68_FOR_TARGET" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -15835,7 +15835,7 @@ do 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_prog_GA68_FOR_TARGET="${ncn_progname}" + ac_cv_prog_A68_FOR_TARGET="${ncn_progname}" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -15845,10 +15845,10 @@ IFS=$as_save_IFS fi fi -GA68_FOR_TARGET=$ac_cv_prog_GA68_FOR_TARGET -if test -n "$GA68_FOR_TARGET"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GA68_FOR_TARGET" >&5 -$as_echo "$GA68_FOR_TARGET" >&6; } +A68_FOR_TARGET=$ac_cv_prog_A68_FOR_TARGET +if test -n "$A68_FOR_TARGET"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $A68_FOR_TARGET" >&5 +$as_echo "$A68_FOR_TARGET" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -15858,12 +15858,12 @@ fi done fi -if test -z "$ac_cv_prog_GA68_FOR_TARGET" && test -n "$with_build_time_tools"; then +if test -z "$ac_cv_prog_A68_FOR_TARGET" && test -n "$with_build_time_tools"; then for ncn_progname in ga68; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ncn_progname} in $with_build_time_tools" >&5 $as_echo_n "checking for ${ncn_progname} in $with_build_time_tools... " >&6; } if test -x $with_build_time_tools/${ncn_progname}; then - ac_cv_prog_GA68_FOR_TARGET=$with_build_time_tools/${ncn_progname} + ac_cv_prog_A68_FOR_TARGET=$with_build_time_tools/${ncn_progname} { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } break @@ -15874,18 +15874,18 @@ $as_echo "no" >&6; } done fi -if test -z "$ac_cv_prog_GA68_FOR_TARGET"; then +if test -z "$ac_cv_prog_A68_FOR_TARGET"; then for ncn_progname in ga68; do if test -n "$ncn_target_tool_prefix"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; 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_prog_GA68_FOR_TARGET+:} false; then : +if ${ac_cv_prog_A68_FOR_TARGET+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$GA68_FOR_TARGET"; then - ac_cv_prog_GA68_FOR_TARGET="$GA68_FOR_TARGET" # Let the user override the test. + if test -n "$A68_FOR_TARGET"; then + ac_cv_prog_A68_FOR_TARGET="$A68_FOR_TARGET" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -15894,7 +15894,7 @@ do 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_prog_GA68_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + ac_cv_prog_A68_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -15904,10 +15904,10 @@ IFS=$as_save_IFS fi fi -GA68_FOR_TARGET=$ac_cv_prog_GA68_FOR_TARGET -if test -n "$GA68_FOR_TARGET"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GA68_FOR_TARGET" >&5 -$as_echo "$GA68_FOR_TARGET" >&6; } +A68_FOR_TARGET=$ac_cv_prog_A68_FOR_TARGET +if test -n "$A68_FOR_TARGET"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $A68_FOR_TARGET" >&5 +$as_echo "$A68_FOR_TARGET" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -15915,16 +15915,16 @@ fi fi - if test -z "$ac_cv_prog_GA68_FOR_TARGET" && test $build = $target ; then + if test -z "$ac_cv_prog_A68_FOR_TARGET" && test $build = $target ; then # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; 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_prog_GA68_FOR_TARGET+:} false; then : +if ${ac_cv_prog_A68_FOR_TARGET+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$GA68_FOR_TARGET"; then - ac_cv_prog_GA68_FOR_TARGET="$GA68_FOR_TARGET" # Let the user override the test. + if test -n "$A68_FOR_TARGET"; then + ac_cv_prog_A68_FOR_TARGET="$A68_FOR_TARGET" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -15933,7 +15933,7 @@ do 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_prog_GA68_FOR_TARGET="${ncn_progname}" + ac_cv_prog_A68_FOR_TARGET="${ncn_progname}" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -15943,10 +15943,10 @@ IFS=$as_save_IFS fi fi -GA68_FOR_TARGET=$ac_cv_prog_GA68_FOR_TARGET -if test -n "$GA68_FOR_TARGET"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GA68_FOR_TARGET" >&5 -$as_echo "$GA68_FOR_TARGET" >&6; } +A68_FOR_TARGET=$ac_cv_prog_A68_FOR_TARGET +if test -n "$A68_FOR_TARGET"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $A68_FOR_TARGET" >&5 +$as_echo "$A68_FOR_TARGET" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -15954,19 +15954,19 @@ fi fi - test -n "$ac_cv_prog_GA68_FOR_TARGET" && break + test -n "$ac_cv_prog_A68_FOR_TARGET" && break done fi -if test -z "$ac_cv_prog_GA68_FOR_TARGET" ; then +if test -z "$ac_cv_prog_A68_FOR_TARGET" ; then set dummy ga68 if test $build = $target ; then - GA68_FOR_TARGET="$2" + A68_FOR_TARGET="$2" else - GA68_FOR_TARGET="${ncn_target_tool_prefix}$2" + A68_FOR_TARGET="${ncn_target_tool_prefix}$2" fi else - GA68_FOR_TARGET="$ac_cv_prog_GA68_FOR_TARGET" + A68_FOR_TARGET="$ac_cv_prog_A68_FOR_TARGET" fi @@ -20440,9 +20440,9 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target ga68" >&5 $as_echo_n "checking where to find the target ga68... " >&6; } if test "x${build}" != "x${host}" ; then - if expr "x$GA68_FOR_TARGET" : "x/" > /dev/null; then + if expr "x$A68_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - ac_dir=`dirname $GA68_FOR_TARGET` + ac_dir=`dirname $A68_FOR_TARGET` { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5 $as_echo "pre-installed in $ac_dir" >&6; } else @@ -20462,17 +20462,17 @@ else esac if test $ok = yes; then # An in-tree tool is available and we can use it - GA68_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/ga68 -B$$r/$(HOST_SUBDIR)/gcc/' + A68_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/ga68 -B$$r/$(HOST_SUBDIR)/gcc/' { $as_echo "$as_me:${as_lineno-$LINENO}: result: just compiled" >&5 $as_echo "just compiled" >&6; } - elif expr "x$GA68_FOR_TARGET" : "x/" > /dev/null; then + elif expr "x$A68_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path - ac_dir=`dirname $GA68_FOR_TARGET` + ac_dir=`dirname $A68_FOR_TARGET` { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5 $as_echo "pre-installed in $ac_dir" >&6; } elif test "x$target" = "x$host"; then # We can use an host tool - GA68_FOR_TARGET='$(GA68)' + A68_FOR_TARGET='$(A68)' { $as_echo "$as_me:${as_lineno-$LINENO}: result: host tool" >&5 $as_echo "host tool" >&6; } else diff --git a/configure.ac b/configure.ac index 5f19663289a1..5edd041bf645 100644 --- a/configure.ac +++ b/configure.ac @@ -1457,7 +1457,7 @@ if test "${build}" != "${host}" ; then DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool} DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil} GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran} - GA68_FOR_BUILD=${GA68_FOR_BUILD-ga68} + A68_FOR_BUILD=${A68_FOR_BUILD-ga68} GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo} GDC_FOR_BUILD=${GDC_FOR_BUILD-gdc} GNATMAKE_FOR_BUILD=${GNATMAKE_FOR_BUILD-gnatmake} @@ -1474,7 +1474,7 @@ else DLLTOOL_FOR_BUILD="\$(DLLTOOL)" DSYMUTIL_FOR_BUILD="\$(DSYMUTIL)" GFORTRAN_FOR_BUILD="\$(GFORTRAN)" - GA68_FOR_BUILD="\$(GA68)" + A68_FOR_BUILD="\$(A68)" GOC_FOR_BUILD="\$(GOC)" GDC_FOR_BUILD="\$(GDC)" GNATMAKE_FOR_BUILD="\$(GNATMAKE)" @@ -1528,7 +1528,7 @@ int main() {}])], fi ACX_PROG_GNAT -ACX_PROG_GA68 +ACX_PROG_A68 ACX_PROG_GDC ACX_PROG_CARGO ACX_PROG_CMP_IGNORE_INITIAL @@ -4020,7 +4020,7 @@ AC_SUBST(CXX_FOR_BUILD) AC_SUBST(DLLTOOL_FOR_BUILD) AC_SUBST(DSYMUTIL_FOR_BUILD) AC_SUBST(GFORTRAN_FOR_BUILD) -AC_SUBST(GA68_FOR_BUILD) +AC_SUBST(A68_FOR_BUILD) AC_SUBST(GOC_FOR_BUILD) AC_SUBST(GDC_FOR_BUILD) AC_SUBST(GNATMAKE_FOR_BUILD) @@ -4116,9 +4116,9 @@ AC_SUBST(CC) AC_SUBST(CXX) AC_SUBST(CFLAGS) AC_SUBST(CXXFLAGS) -AC_SUBST(GA68) -AC_SUBST(GA68FLAGS) -GA68FLAGS=${GA68FLAGS-${CFLAGS}} +AC_SUBST(A68) +AC_SUBST(A68FLAGS) +A68FLAGS=${A68FLAGS-${CFLAGS}} AC_SUBST(GDC) AC_SUBST(GDCFLAGS) GDCFLAGS=${GDCFLAGS-${CFLAGS}} @@ -4167,7 +4167,7 @@ NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc) NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx) NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET}) NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran) -NCN_STRICT_CHECK_TARGET_TOOLS(GA68_FOR_TARGET, ga68) +NCN_STRICT_CHECK_TARGET_TOOLS(A68_FOR_TARGET, ga68) NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo) NCN_STRICT_CHECK_TARGET_TOOLS(GDC_FOR_TARGET, gdc) NCN_STRICT_CHECK_TARGET_TOOLS(GM2_FOR_TARGET, gm2) @@ -4219,7 +4219,7 @@ GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN, [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran) GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC, [gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go) -GCC_TARGET_TOOL(ga68, GA68_FOR_TARGET, GA68, +GCC_TARGET_TOOL(ga68, A68_FOR_TARGET, A68, [gcc/ga68 -B$$r/$(HOST_SUBDIR)/gcc/], algol68) GCC_TARGET_TOOL(gdc, GDC_FOR_TARGET, GDC, [gcc/gdc -B$$r/$(HOST_SUBDIR)/gcc/], d) diff --git a/gcc/algol68/a68-lang.cc b/gcc/algol68/a68-lang.cc index 3fa7897d2369..ea794c8bdf83 100644 --- a/gcc/algol68/a68-lang.cc +++ b/gcc/algol68/a68-lang.cc @@ -441,9 +441,11 @@ static void a68_init_options (unsigned int argc ATTRIBUTE_UNUSED, cl_decoded_option *decoded_options ATTRIBUTE_UNUSED) { - /* Create an empty module files map. */ + /* Create an empty module files map and fill in some modules that are + provided by the run-time libga68 library. */ A68_MODULE_FILES = hash_map<nofree_string_hash,const char*>::create_ggc (16); A68_MODULE_FILES->empty (); + A68_MODULE_FILES->put (ggc_strdup ("TRANSPUT"), ggc_strdup ("ga68")); } #undef LANG_HOOKS_INIT_OPTIONS diff --git a/gcc/testsuite/algol68/execute/char-in-string-1.a68 b/gcc/testsuite/algol68/execute/char-in-string-1.a68 new file mode 100644 index 000000000000..5ae821f654d8 --- /dev/null +++ b/gcc/testsuite/algol68/execute/char-in-string-1.a68 @@ -0,0 +1,5 @@ +access Transput +begin int pos; + assert (char_in_string ("o", pos, "foo")); + assert (pos = 2) +end diff --git a/libga68/Makefile.am b/libga68/Makefile.am index 16917554da70..e9341485fde4 100644 --- a/libga68/Makefile.am +++ b/libga68/Makefile.am @@ -134,8 +134,24 @@ libga68_la_LIBTOOLFLAGS = libga68_la_CFLAGS = $(LIBGA68_GCFLAGS) $(LIBGA68_BOEHM_GC_INCLUDES) libga68_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ $(version_arg) $(lt_host_flags) $(extra_darwin_ldflags_libga68) -libga68_la_DEPENDENCIES = libga68.spec $(version_dep) -libga68_la_LIBADD = $(LIBGA68_BOEHM_GC_LIBS) +libga68_la_DEPENDENCIES = libga68.spec $(version_dep) transput.lo +libga68_la_LIBADD = $(LIBGA68_BOEHM_GC_LIBS) transput.lo + +# Rules to build the Algol 68 code in the library. + +LTA68COMPILE = $(LIBTOOL) --tag=A68 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(A68) $(AM_A68FLAGS) + +.a68.o: + $(A68) -o $@ $(A68FLAGS) -c $< + +.a68.lo: + $(LTA68COMPILE) $(A68FLAGS) $(MULTIFLAGS) -c -o $@ $< + +transput.a68 : transput.a68.in + $(AWK) -f $(srcdir)/sppp.awk $< > $@ + +BUILT_SOURCES = transput.a68 # target overrides -include $(tmake_file) diff --git a/libga68/Makefile.in b/libga68/Makefile.in index 0e90927e7079..0bd8323c6517 100644 --- a/libga68/Makefile.in +++ b/libga68/Makefile.in @@ -128,7 +128,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/autoconf.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ @@ -246,6 +246,8 @@ ETAGS = etags CTAGS = ctags CSCOPE = cscope AM_RECURSIVE_TARGETS = cscope +A68 = @A68@ +A68FLAGS = @A68FLAGS@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ @@ -465,8 +467,7 @@ libga68_la_SOURCES = libga68.c \ ga68-posix.c \ ga68-alloc.c \ ga68-error.c \ - ga68-standenv.c \ - ga68.h + ga68-standenv.c libga68_la_LIBTOOLFLAGS = libga68_la_CFLAGS = $(LIBGA68_GCFLAGS) $(LIBGA68_BOEHM_GC_INCLUDES) @@ -474,18 +475,24 @@ libga68_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ $(version_arg) $(lt_host_flags) $(extra_darwin_ldflags_libga68) libga68_la_DEPENDENCIES = libga68.spec $(version_dep) -libga68_la_LIBADD = $(LIBGA68_BOEHM_GC_LIBS) +libga68_la_LIBADD = $(LIBGA68_BOEHM_GC_LIBS) transput.lo + +# Rules to build the Algol 68 code in the library. +LTA68COMPILE = $(LIBTOOL) --tag=A68 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(A68) $(AM_A68FLAGS) + +BUILT_SOURCES = transput.a68 MULTISRCTOP = MULTIBUILDTOP = MULTIDIRS = MULTISUBDIR = MULTIDO = true MULTICLEAN = true -all: config.h +all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .c .lo .o .obj +.SUFFIXES: .a68 .c .lo .o .obj am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/../multilib.am $(am__configure_deps) @@ -741,13 +748,15 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files check-am: all-am -check: check-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(DATA) config.h all-local installdirs: for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done -install: install-am +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -777,6 +786,7 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool clean-local \ @@ -854,7 +864,7 @@ ps-am: uninstall-am: uninstall-toolexeclibDATA \ uninstall-toolexeclibLTLIBRARIES -.MAKE: all install-am install-strip +.MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am all-local am--refresh check \ check-am clean clean-cscope clean-generic clean-libtool \ @@ -884,6 +894,15 @@ uninstall-am: uninstall-toolexeclibDATA \ @LIBGA68_USE_SYMVER_SUN_TRUE@@LIBGA68_USE_SYMVER_TRUE@ $(libga68_la_OBJECTS) $(libga68_la_LIBADD) \ @LIBGA68_USE_SYMVER_SUN_TRUE@@LIBGA68_USE_SYMVER_TRUE@ > $@ || (rm -f $@ ; exit 1) +.a68.o: + $(A68) -o $@ $(A68FLAGS) -c $< + +.a68.lo: + $(LTA68COMPILE) $(A68FLAGS) $(MULTIFLAGS) -c -o $@ $< + +transput.a68 : transput.a68.in + $(AWK) -f $(srcdir)/sppp.awk $< > $@ + # target overrides -include $(tmake_file) diff --git a/libga68/acinclude.m4 b/libga68/acinclude.m4 index 54ada357a683..8ddc1b3cb82a 100644 --- a/libga68/acinclude.m4 +++ b/libga68/acinclude.m4 @@ -1,3 +1,15 @@ +dnl Copyright (C) 2025 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 This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +m4_include([m4/autoconf.m4]) + dnl Check whether the target supports hidden visibility. AC_DEFUN([LIBGA68_CHECK_ATTRIBUTE_VISIBILITY], [ AC_CACHE_CHECK([whether the target supports hidden visibility], diff --git a/libga68/configure b/libga68/configure index 2ccd04ab9409..63c27939e14c 100755 --- a/libga68/configure +++ b/libga68/configure @@ -669,6 +669,8 @@ LIBTOOL RANLIB NM AR +A68FLAGS +A68 am__fastdepCCAS_FALSE am__fastdepCCAS_TRUE CCASDEPMODE @@ -1495,6 +1497,8 @@ Some influential environment variables: CPP C preprocessor CCAS assembler compiler command (defaults to CC) CCASFLAGS assembler compiler flags (defaults to CFLAGS) + A68 Algol 68 compiler command + A68FLAGS Algol 68 compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -5681,6 +5685,230 @@ else fi +ac_ext=a68 +ac_compile='$A68 -c $A68FLAGS conftest.$ac_ext >&5' +ac_link='$A68 -o conftest$ac_exeext $A68FLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=yes +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ga68", so it can be a program name with args. +set dummy ${ac_tool_prefix}ga68; 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_prog_A68+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$A68"; then + ac_cv_prog_A68="$A68" # Let the user override the test. +else +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_prog_A68="${ac_tool_prefix}ga68" + $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 + +fi +fi +A68=$ac_cv_prog_A68 +if test -n "$A68"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $A68" >&5 +$as_echo "$A68" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_A68"; then + ac_ct_A68=$A68 + # Extract the first word of "ga68", so it can be a program name with args. +set dummy ga68; 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_prog_ac_ct_A68+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_A68"; then + ac_cv_prog_ac_ct_A68="$ac_ct_A68" # Let the user override the test. +else +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_prog_ac_ct_A68="ga68" + $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 + +fi +fi +ac_ct_A68=$ac_cv_prog_ac_ct_A68 +if test -n "$ac_ct_A68"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_A68" >&5 +$as_echo "$ac_ct_A68" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_A68" = x; then + A68="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + A68=$ac_ct_A68 + fi +else + A68="$ac_cv_prog_A68" +fi + +if test -z "$A68"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ga68", so it can be a program name with args. +set dummy ${ac_tool_prefix}ga68; 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_prog_A68+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$A68"; then + ac_cv_prog_A68="$A68" # Let the user override the test. +else +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_prog_A68="$ac_tool_prefix}ga68" + $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 + +fi +fi +A68=$ac_cv_prog_A68 +if test -n "$A68"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $A68" >&5 +$as_echo "$A68" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$A68"; then + # Extract the first word of "ga68", so it can be a program name with args. +set dummy ga68; 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_prog_A68+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$A68"; then + ac_cv_prog_A68="$A68" # Let the user override the test. +else + ac_prog_rejected=no +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 + if test "$as_dir/$ac_word$ac_exec_ext" = "false"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_A68="ga68" + $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 + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_A68 + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set A68 to just the basename; use the full file name. + shift + ac_cv_prog_A68="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +A68=$ac_cv_prog_A68 +if test -n "$A68"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $A68" >&5 +$as_echo "$A68" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi + + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for Algol 68 compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +{ { ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler --version >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +A68FLAGS="-g -O2" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + @@ -12601,7 +12829,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12604 "configure" +#line 12832 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12707,7 +12935,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12710 "configure" +#line 12938 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/libga68/configure.ac b/libga68/configure.ac index 1d8a4a95e792..20a903ad8d9e 100644 --- a/libga68/configure.ac +++ b/libga68/configure.ac @@ -138,6 +138,7 @@ m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) m4_define([_AC_ARG_VAR_PRECIOUS],[]) AC_PROG_CC AM_PROG_AS +AC_PROG_A68 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) AC_SUBST(CFLAGS) diff --git a/libga68/m4/autoconf.m4 b/libga68/m4/autoconf.m4 new file mode 100644 index 000000000000..7b85996265c0 --- /dev/null +++ b/libga68/m4/autoconf.m4 @@ -0,0 +1,131 @@ +# +# Minimal autoconf support for the Algol 68 language. +# Adapted from the Algol 68 language support files. +# + +# ------------------- # +# Language selection. +# ------------------- # + +# AC_LANG(A68) +# ------------ +AC_LANG_DEFINE([Algol 68], [a68], [A68], [A68], [], +[ac_ext=a68 +ac_compile='$A68 -c $A68FLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD' +ac_link='$A68 -o conftest$ac_exeext $A68FLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD' +ac_compiler_gnu=yes +]) + +# AC_LANG_A68 +# ----------- +AU_DEFUN([AC_LANG_A68], [AC_LANG(Algol 68)]) + +# ------------------- # +# Producing programs. +# ------------------- # + +# AC_LANG_PROGRAM(Algol 68)([PROLOGUE], [BODY]) +# --------------------------------------------- +m4_define([AC_LANG_PROGRAM(Algol 68)], +[$1 +begin $2 m4_ifnblank([$2],[;]) + skip +end]) + +# _AC_LANG_IO_PROGRAM(Algol 68) +# ----------------------------- +# Produce source that performs I/O. +m4_define([_AC_LANG_IO_PROGRAM(Algol 68)], +[AC_LANG_PROGRAM([], +[if int fd = fcreate ("conftest.out", 8r0777); fd = -1 + then perror ("error creating conftest.out") + elif fclose (fd) = -1 then perror ("error closing conftest.out") + fi +])]) + +# AC_LANG_CALL(Algol 68)(PROLOGUE, FUNCTION) +# ------------------------------------------ +# Avoid conflicting decl of main. +m4_define([AC_LANG_CALL(Algol 68)], +[AC_LANG_PROGRAM([],[])]) + +# AC_LANG_FUNC_LINK_TRY(Algol 68)(FUNCTION) +# ----------------------------------------- +# Try to link a program which calls FUNCTION. +m4_define([AC_LANG_FUNC_LINK_TRY(Algol 68)], +[AC_LANG_PROGRAM([],[])]) + +# AC_LANG_BOOL_COMPILE_TRY(Algol 68)(PROLOGUE, EXPRESSION) +# -------------------------------------------------------- +# Return a program which is valid if EXPRESSION is nonzero. +m4_define([AC_LANG_BOOL_COMPILE_TRY(Algol 68)], +[AC_LANG_PROGRAM([], [@<:@$2@:>@INT test multiple; + 0])]) + +# AC_LANG_INT_SAVE(Algol 68)(PROLOGUE, EXPRESSION) +# ------------------------------------------------ +m4_define([AC_LANG_INT_SAVE(Algol 68)], +[AC_LANG_PROGRAM([ +proc itoa = (int i) string: + begin if i = 0 + then "0" + else int n := ABS i; + string res; + while n /= 0 + do int rem = n %* 10; + res := (REPR (rem > 9 | (rem - 10) + ABS "a" + | rem + ABS "0") + + res); + n %:= 10 + od; + (i < 0 | "-" + res | res) + fi + end; + +int ret := 0; +int fd = fopen ("conftest.val", file o wronly)/ +(fd = -1 | ret := 1; stop); +(fputs (fd, itoa ($2)) = 0 | ret := 1; stop) +])]) + +# ---------------------- # +# Looking for compilers. # +# ---------------------- # + +# AC_LANG_COMPILER(Algol 68) +# -------------------------- +AC_DEFUN([AC_LANG_COMPILER(Algol 68)], +[AC_REQUIRE([AC_PROG_A68])]) + +# AC_PROG_A68 +# ------------ +AN_MAKEVAR([A68], [AC_PROG_A68]) +AN_PROGRAM([ga68], [AC_PROG_A68]) +AC_DEFUN([AC_PROG_A68], +[AC_LANG_PUSH(Algol 68)dnl +AC_ARG_VAR([A68], [Algol 68 compiler command])dnl +AC_ARG_VAR([A68FLAGS], [Algol 68 compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +m4_ifval([$1], + [AC_CHECK_TOOLS(A68, [$1])], +[AC_CHECK_TOOL(A68, ga68) +if test -z "$A68"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(A68, [${ac_tool_prefix}ga68], [$ac_tool_prefix}ga68]) + fi +fi +if test -z "$A68"; then + AC_CHECK_PROG(A68, ga68, ga68, , , false) +fi +]) + +# Provide some information about the compiler. +_AS_ECHO_LOG([checking for _AC_LANG compiler version]) +set X $ac_compile +ac_compiler=$[2] +_AC_DO_LIMIT([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) +m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl +A68FLAGS="-g -O2" +AC_LANG_POP(Algol 68)dnl +])# AC_PROG_A68 diff --git a/libga68/sppp.awk b/libga68/sppp.awk new file mode 100644 index 000000000000..e2701e03b175 --- /dev/null +++ b/libga68/sppp.awk @@ -0,0 +1,94 @@ +# sppp - the Standard Prelude Pre-Processor +# +# Copyright (C) 2025 Jose E. Marchesi +# +# This file 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 of the License, or +# (at your option) any later version. +# +# This program 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 this program; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +function error(msg) +{ + print FILENAME ":" msg | "cat 1>&2" + exit (1) +} + +BEGIN { + num_alternatives = 0 + in_iter = 0 + template = "" +} + +/^[ \t]*\{ Process this file/ { + print "{ This is auto-generated from " FILENAME ". Do not edit. }" + next +} + +/^[ \t]*\{[ \t]*iter[ \t]+/ { + if (match ($0, /[ \t]*\{[ \t]*iter[ \t]+([a-zA-Z_]+)[\t ]*(\{.*\}[ \t]*){1,}[ \t]*\}/, matches) == 0) + error(FNR ": invalid iter") + + iter_name = matches[1] + iter_alts = matches[2] + + # Count and collect alternatives. # + iter_num_alternatives = 0 + while (match (iter_alts, /[ \t]*\{([^\}]*)\}/, matches) > 0) + { + iter_num_alternatives++ + iter_alts = substr (iter_alts, RSTART + RLENGTH) + iter_names[iter_name] = 1 + iterators[iter_name,iter_num_alternatives] = matches[1] + } + + if (in_iter == 1) + { + if (iter_num_alternatives != num_alternatives) + error(FNR ": invalid number of alternatives in iterator") + } + + num_alternatives = iter_num_alternatives + in_iter = 1 + next +} + +/^[ \t]*\{[ \t]*reti/ { + separator = "" + if (match ($0, /[ \t]*\{[ \t]*reti[ \t]+\{([^\}]*)\}/, matches) > 0) + separator = matches[1] + + for (nalt = 1; nalt <= num_alternatives; nalt++) + { + output = template + for (iter_name in iter_names) + { + while (sub ("\\{" iter_name "\\}", iterators[iter_name,nalt], output)) {} + } + printf "%s%s\n", substr (output, 0, length(output) - 1), nalt < num_alternatives ? separator : "" + } + + for (key in iter_names) delete iter_names[key] + for (key in iterators) delete iterators[key] + in_iter = 0; + template = "" + num_alternatives = 0 + next +} + +in_iter == 1 { + template = template $0 "\n" + next +} + +{ + print $0 +} diff --git a/libga68/transput.a68.in b/libga68/transput.a68.in new file mode 100644 index 000000000000..37b804de6555 --- /dev/null +++ b/libga68/transput.a68.in @@ -0,0 +1,279 @@ +{ Process this file with sppp.awk } + +{ transput.a68.in - Standard transput. + + Copyright (C) 2025 Jose E. Marchesi + + 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. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License + and a copy of the GCC Runtime Library Exception along with this + program; see the files COPYING3 and COPYING.RUNTIME respectively. + If not, see <http://www.gnu.org/licenses/>. } + +module Transput = +def + { 10.3.2.1. Conversion routines. } + + mode Number = union ( + {iter L {short short} {short} {} {long} {long long}} + {L} int + {reti {,}} + , + {iter L {} {long} {long long}} + {L} real + {reti {,}} + ); + + pub proc whole = (Number v, int width) string: + case v in + {iter L {short short} {short} {} {long} {long long}} + {iter L_ {short_short_} {short_} {} {long_} {long_long_}} + ({L} int x): + (int length := ABS width - (x < {L} 0 OR width > 0 | 1 | 0), + {L} int n := ABS x; + if width = 0 + then {L} int m := n; length := 0; + while m %:= {L} 10; length +:= 1; m /= {L} 0 + do ~ od + fi; + string s := subwhole (n, length); + if length = 0 OR char_in_string (errorchar, loc int, s) + then ABS width * errorchar + else (x < {L} 0 | "-" |: width > 0 | "+" | "") +=: s; + (width /= 0 | (ABS width - UPB s) * " " +=: s); + s + fi), + ({L} real x): fixed (x, width, 0) + {reti {,}} + esac; + + pub proc fixed = (Number v, int width, after) string: + case v in + {iter L {} {long} {long long}} + ({L} real x): + if int length := ABS width - (x < {L} 0 OR width > 0 | 1 | 0); + after >= 0 AND (length > after OR width = 0) + then {L} real y = ABS x; + if width = 0 + then length := (after = 0 | 1 | 0); + while y + {L} .5 * {L} .1 ** after >= {L} 10 ** length + do length +:= 1 od; + length +:= (after = 0 | 0 | after + 1) + fi; + string s := subfixed (y, length, after); + if ~char_in_string (errorchar, loc int, s) + then (length > UPB s AND y < {L} 1.0 | "0" +=: s); + (x < {L} 0 | "-" |: width > 0 | "+" | "") +=: s; + (width /= 0 | (ABS width - UPB s) * " " +=: s); + s + elif after > 0 + then fixed (v, width, after - 1) + else ABS width * errorchar + fi + else { XXX undefined } skip; ABS width * errorchar + fi, + ({L} int x): fixed ({L} real (x), width, after) + {reti {,}} + esac; + + pub proc float = (Number v, int width, after, exp) string: + case v in + {iter L {} {long} {long long}} + {iter L_ {} {long_} {long_long_}} + ({L} real x): + if int before = ABS width - ABS exp - (after /= 0 | after+1 | 0) - 2; + SIGN before + SIGN after > 0 + then string s, {L} real y := ABS x, int p := 0; + {L_}standardize (y, before, after, p); + s := fixed (SIGN (x * y), SIGN width * (ABS width - ABS exp - 1), + after) + "*^" + whole (p, exp); + if exp = 0 OR char_in_string (errorchar, loc int, s) + then float (x, width, (after /= 0 | after-1 | 0), + (exp > 0 | exp+1 | exp-1)) + else s + fi + else { XXX undefined } skip; ABS width * errorchar + fi, + ({L} int x): float ({L} real (x), width, after, exp) + {reti {,}} + esac; + + { Returns a string of maximum length `width' containing a decimal + representation of the positive integer `v'. } + + proc subwhole = (Number v, int width) string: + case v in + {iter L {short short} {short} {} {long} {long long}} + {iter S {LENG LENG} {LENG} {} {SHORTEN} {SHORTEN SHORTEN}} + ({L} int x): + begin string s, {L} int n := x; + while dig_char ({S} (n MOD {L} 10)) +=: s; + n %:= {L} 10; n /= {L} 0 + do ~ od; + (UPB s > width | width * errorchar | s) + end + {reti {,}} + esac; + + { Returns a string of maximum length `width' containing a rounded + decimal representation of the positive real number `v'; if + `after' is greater than zero, this string contains a decimal + point followed by `after' digits. } + + proc subfixed = (Number v, int width, after) string: + case v in + {iter L {} {long} {long long}} + {iter K {} {LENG} {LENG LENG}} + {iter S {} {SHORTEN} {SHORTEN SHORTEN}} + ({L} real x): + begin string s, int before := 0; + {L} real y := x + {L} .5 * {L} .1 ** after; + proc choosedig = (ref {L} real y) char: + dig_char ((int c := {S} ENTIER (y *:= {L} 10.0); (c > 9 | c := 9); + y -:= {K} c; c)); + while y >= {L} 10.0 ** before do before +:= 1 od; + y /:= {L} 10.0 ** before; + to before do s +:= choosedig (y) od; + (after > 0 | s +:= "."); + to after do s +:= choosedig (y) od; + (UPB s > width | width * errorchar | s) + end + {reti {,}} + esac; + + { Adjusts the value of `y' so that it may be transput according to + the format $ n(before)d, n(after)d $; `p' is set so that y * 10 + ** p is equal to the original value of `y'. } + + {iter L {} {long} {long long}} + {iter L_ {} {long_} {long_long_}} + proc {L_}standardize = (ref {L} real y, int before, after, ref int p) void: + begin + {L} real g = {L} 10.0 ** before; {L} real h = g * {L} .1; + while y >= g do y *:= {L} .1; p +:= 1 od; + (y /= {L} 0.0 | while y < h do y *:= {L} 10.0; p -:= 1 od); + (y + {L} .5 * {L} .1 ** after >= g | y := h; p +:= 1) + end; + {reti} + + proc dig_char = (int x) char: "0123456789abcdef"[x+1]; + + { Returns true if the absolute value of the result is + <= L max int } + + {iter L {short short} {short} {} {long} {long long}} + {iter K {SHORTEN SHORTEN} {SHORTEN} {} {LENG} {LENG LENG}} + {iter L_ {short_short_} {short_} {} {long_} {long_long_}} + proc string_to_{L_}int = (string s, int radix, ref {L} int i) bool: + begin + {L} int lr = {K} radix; bool safe := true; + {L} int n := {L} 0, {L} int m = {L_}max_int % lr; + {L} int m1 = {L_}max_int - m * lr; + for i from 2 to UPB s + while {L} int dig = {K} char_dig (s[i]); + safe := n < m OR n = m AND dig <= m1 + do n := n * lr + dig od; + if safe then i := (s[1] = "+" | n | -n); true else false fi + end; + {reti} + + { Returns true if the absolute value of the result is <= L max + real. } + + {iter L {} {long} {long long}} + {iter K {} {LENG} {LENG LENG}} + {iter S {} {SHORTEN} {SHORTEN SHORTEN}} + {iter L_ {} {long_} {long_long_}} + pub proc string_to_{L_}real = (string s, ref {L} real r) bool: + begin + int e := UPB s + 1; + char_in_string ("^" { XXX unicode 10^ }, e, s); + int p := e; char_in_string (".", p, s); + int j := 1, length := 0, {L} real x := {L} 0.0; + { Skip leading zeroes: } + for i from 2 to e - 1 + while s[i] = "0" OR s[i] = "." OR s[i] = "_." + do j := i od; + for i from j + 1 to e - 1 while length < {L_}real_width + do + if s[i] /= "." + then x := x * {L} 10.0 + {K} char_dig (s[j:=i]); length +:= 1 + fi { all significant digits converted. } + od; + { Set preliminary exponent: } + int exp := (p > j | p - j - 1 | p - j), expart := 0; + { Convert exponent part: } + bool safe := if e < UPB s + then {L} int tmp := {K} expart; + bool b = string_to_{L_}int (s[e+1:], 10, tmp); + expart = {S} tmp; + b + else true + fi; + { Prepare a representation of L max real to compare with the L + real value to be delivered: } + {L} real max_stag := {L_}max_real, int max_exp := 0; + {L_}standardize (max_stag, length, 0, max_exp); exp +:= expart; + if ~safe OR (exp > max_exp OR exp = max_exp AND x > max_stag) + then false + else r := (s[1] = "+" | x | -x) * {L} 10.0 ** exp; true + fi + end; + {reti} + + proc char_dig = (char x) int: + (x = "." | 0 | int i; char_in_string (x,i,"0123456789abcdef"); i-1); + + pub proc char_in_string = (char c, ref int i, string s) bool: + begin bool found := false; + for k from LWB s to UPB s while ~found + do (c = s[k] | i := k; found := true) od; + found + end; + + { The smallest integral value such that `L max int' may be + converted without error using the pattern n(L int width)d } + + {iter L {} {long} {long long}} + {iter L_ {} {long_} {long_long_}} + pub int {L_}int_width = + (int c := 1; while {L} 10 ** (c - 1) < {L} .1 * {L_}max_int do c +:= 1 od; + c); + {reti} + + { The smallest integral value such that different string are + produced by conversion of `1.0' and of `1.0 + L small real' + using the pattern d .n(L real width - 1)d } + + {iter L {} {long} {long long}} + {iter L_ {} {long_} {long_long_}} + {iter S {} {SHORTEN} {SHORTEN SHORTEN}} + pub int {L_}real_width = 1 - {S} ENTIER ({L_}ln ({L_}small_real) / {L_}ln ({L} 10)); + {reti} + + { The smallest integral value such that `L max real' may be + converted without error using the pattern + d .n(L real width - 1)d e n(L exp with)d } + + {iter L {} {long} {long long}} + {iter L_ {} {long_} {long_long_}} + {iter S {} {SHORTEN} {SHORTEN SHORTEN}} + pub int {L_}exp_width = + 1 + {S} ENTIER ({L_}ln ({L_}ln ({L_}max_real) / {L_}ln ({L} 10)) / {L_}ln ({L} 10)); + {reti} + + skip +fed
