>From 5d53920602e234e4d99ae2d502e662ee3699978e 4 Oct 2024 12:01:22 -0400 From: "James K. Lowden" <jklow...@symas.com> Date: Sat 15 Feb 2025 12:50:52 PM EST Subject: [PATCH] Add 'cobol' to 17 files
ChangeLog * Makefile.def: Add libgcobol module and cobol language. * Makefile.in: Add libgcobol module and cobol language. * configure: Regenerate. * configure.ac: Add libgcobol module and cobol language. gcc/ChangeLog * common.opt: New file. * dwarf2out.cc: Add cobol language. gcc/cobol/ChangeLog * LICENSE: New file. * Make-lang.in: New file. * config-lang.in: New file. * lang.opt: New file. * lang.opt.urls: New file. libgcobol/ChangeLog * Makefile.in: New file. * acinclude.m4: New file. * aclocal.m4: New file. * configure.ac: New file. * configure.tgt: New file. maintainer-scripts/ChangeLog * update_web_docs_git: Add libgcobol module and cobol language. --- Makefile.def | ++++++- Makefile.in | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- configure | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- configure.ac | ++++++++++++++++++++++++++++++++++++++++++++++++- gcc/cobol/LICENSE | +++++++++++++++++++++++++++++- gcc/cobol/Make-lang.in | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- gcc/cobol/config-lang.in | ++++++++++++++++++++++++++++++++++++++- gcc/cobol/lang.opt | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- gcc/cobol/lang.opt.urls | +++++++++++++++++++++++++++++- gcc/common.opt | ++++- gcc/dwarf2out.cc | +++++- libgcobol/Makefile.in | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- libgcobol/acinclude.m4 | ++++++++++++++++++++++++++- libgcobol/aclocal.m4 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- libgcobol/configure.ac | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- libgcobol/configure.tgt | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- maintainer-scripts/update_web_docs_git | +++++++++++++++++++++++++++++ 17 files changed, 2244 insertions(+), 22 deletions(-) diff --git a/Makefile.def b/Makefile.def index 19954e7d731..1192e852c7a 100644 --- a/Makefile.def +++ b/Makefile.def @@ -209,6 +209,7 @@ target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; }; target_modules = { module= libitm; lib_path=.libs; }; target_modules = { module= libatomic; bootstrap=true; lib_path=.libs; }; target_modules = { module= libgrust; }; +target_modules = { module= libgcobol; }; // These are (some of) the make targets to be done in each subdirectory. // Not all; these are the ones which don't have special options. @@ -324,6 +325,7 @@ flags_to_pass = { flag= CXXFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= DLLTOOL_FOR_TARGET ; }; flags_to_pass = { flag= DSYMUTIL_FOR_TARGET ; }; flags_to_pass = { flag= FLAGS_FOR_TARGET ; }; +flags_to_pass = { flag= GCOBOL_FOR_TARGET ; }; flags_to_pass = { flag= GFORTRAN_FOR_TARGET ; }; flags_to_pass = { flag= GOC_FOR_TARGET ; }; flags_to_pass = { flag= GOCFLAGS_FOR_TARGET ; }; @@ -655,6 +657,7 @@ lang_env_dependencies = { module=libgcc; no_gcc=true; no_c=true; }; // built newlib on some targets (e.g. Cygwin). It still needs // a dependency on libgcc for native targets to configure. lang_env_dependencies = { module=libiberty; no_c=true; }; +lang_env_dependencies = { module=libgcobol; cxx=true; }; dependencies = { module=configure-target-fastjar; on=configure-target-zlib; }; dependencies = { module=all-target-fastjar; on=all-target-zlib; }; @@ -690,6 +693,7 @@ dependencies = { module=install-target-libvtv; on=install-target-libgcc; }; dependencies = { module=install-target-libitm; on=install-target-libgcc; }; dependencies = { module=install-target-libobjc; on=install-target-libgcc; }; dependencies = { module=install-target-libstdc++-v3; on=install-target-libgcc; }; +dependencies = { module=install-target-libgcobol; on=install-target-libstdc++-v3; }; // Target modules in the 'src' repository. lang_env_dependencies = { module=libtermcap; }; @@ -727,6 +731,8 @@ languages = { language=d; gcc-check-target=check-d; lib-check-target=check-target-libphobos; }; languages = { language=jit; gcc-check-target=check-jit; }; languages = { language=rust; gcc-check-target=check-rust; }; +languages = { language=cobol; gcc-check-target=check-cobol; + lib-check-target=check-target-libgcobol; }; // Toplevel bootstrap bootstrap_stage = { id=1 ; }; diff --git a/Makefile.in b/Makefile.in index 966d6045496..bd59dc81c4e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -896,6 +896,7 @@ BASE_FLAGS_TO_PASS = \ "DLLTOOL_FOR_TARGET=$(DLLTOOL_FOR_TARGET)" \ "DSYMUTIL_FOR_TARGET=$(DSYMUTIL_FOR_TARGET)" \ "FLAGS_FOR_TARGET=$(FLAGS_FOR_TARGET)" \ + "GCOBOL_FOR_TARGET=$(GCOBOL_FOR_TARGET)" \ "GFORTRAN_FOR_TARGET=$(GFORTRAN_FOR_TARGET)" \ "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \ "GOCFLAGS_FOR_TARGET=$(GOCFLAGS_FOR_TARGET)" \ @@ -1162,7 +1163,8 @@ configure-target: \ maybe-configure-target-libgomp \ maybe-configure-target-libitm \ maybe-configure-target-libatomic \ - maybe-configure-target-libgrust + maybe-configure-target-libgrust \ + maybe-configure-target-libgcobol # The target built for a native non-bootstrap build. .PHONY: all @@ -1366,6 +1368,7 @@ all-target: maybe-all-target-libitm all-target: maybe-all-target-libatomic @endif target-libatomic-no-bootstrap all-target: maybe-all-target-libgrust +all-target: maybe-all-target-libgcobol # Do a target for all the subdirectories. A ``make do-X'' will do a # ``make X'' in all subdirectories (because, in general, there is a @@ -1464,6 +1467,7 @@ info-target: maybe-info-target-libgomp info-target: maybe-info-target-libitm info-target: maybe-info-target-libatomic info-target: maybe-info-target-libgrust +info-target: maybe-info-target-libgcobol .PHONY: do-dvi do-dvi: @@ -1557,6 +1561,7 @@ dvi-target: maybe-dvi-target-libgomp dvi-target: maybe-dvi-target-libitm dvi-target: maybe-dvi-target-libatomic dvi-target: maybe-dvi-target-libgrust +dvi-target: maybe-dvi-target-libgcobol .PHONY: do-pdf do-pdf: @@ -1650,6 +1655,7 @@ pdf-target: maybe-pdf-target-libgomp pdf-target: maybe-pdf-target-libitm pdf-target: maybe-pdf-target-libatomic pdf-target: maybe-pdf-target-libgrust +pdf-target: maybe-pdf-target-libgcobol .PHONY: do-html do-html: @@ -1743,6 +1749,7 @@ html-target: maybe-html-target-libgomp html-target: maybe-html-target-libitm html-target: maybe-html-target-libatomic html-target: maybe-html-target-libgrust +html-target: maybe-html-target-libgcobol .PHONY: do-TAGS do-TAGS: @@ -1836,6 +1843,7 @@ TAGS-target: maybe-TAGS-target-libgomp TAGS-target: maybe-TAGS-target-libitm TAGS-target: maybe-TAGS-target-libatomic TAGS-target: maybe-TAGS-target-libgrust +TAGS-target: maybe-TAGS-target-libgcobol .PHONY: do-install-info do-install-info: @@ -1929,6 +1937,7 @@ install-info-target: maybe-install-info-target-libgomp install-info-target: maybe-install-info-target-libitm install-info-target: maybe-install-info-target-libatomic install-info-target: maybe-install-info-target-libgrust +install-info-target: maybe-install-info-target-libgcobol .PHONY: do-install-dvi do-install-dvi: @@ -2022,6 +2031,7 @@ install-dvi-target: maybe-install-dvi-target-libgomp install-dvi-target: maybe-install-dvi-target-libitm install-dvi-target: maybe-install-dvi-target-libatomic install-dvi-target: maybe-install-dvi-target-libgrust +install-dvi-target: maybe-install-dvi-target-libgcobol .PHONY: do-install-pdf do-install-pdf: @@ -2115,6 +2125,7 @@ install-pdf-target: maybe-install-pdf-target-libgomp install-pdf-target: maybe-install-pdf-target-libitm install-pdf-target: maybe-install-pdf-target-libatomic install-pdf-target: maybe-install-pdf-target-libgrust +install-pdf-target: maybe-install-pdf-target-libgcobol .PHONY: do-install-html do-install-html: @@ -2208,6 +2219,7 @@ install-html-target: maybe-install-html-target-libgomp install-html-target: maybe-install-html-target-libitm install-html-target: maybe-install-html-target-libatomic install-html-target: maybe-install-html-target-libgrust +install-html-target: maybe-install-html-target-libgcobol .PHONY: do-installcheck do-installcheck: @@ -2301,6 +2313,7 @@ installcheck-target: maybe-installcheck-target-libgomp installcheck-target: maybe-installcheck-target-libitm installcheck-target: maybe-installcheck-target-libatomic installcheck-target: maybe-installcheck-target-libgrust +installcheck-target: maybe-installcheck-target-libgcobol .PHONY: do-mostlyclean do-mostlyclean: @@ -2394,6 +2407,7 @@ mostlyclean-target: maybe-mostlyclean-target-libgomp mostlyclean-target: maybe-mostlyclean-target-libitm mostlyclean-target: maybe-mostlyclean-target-libatomic mostlyclean-target: maybe-mostlyclean-target-libgrust +mostlyclean-target: maybe-mostlyclean-target-libgcobol .PHONY: do-clean do-clean: @@ -2487,6 +2501,7 @@ clean-target: maybe-clean-target-libgomp clean-target: maybe-clean-target-libitm clean-target: maybe-clean-target-libatomic clean-target: maybe-clean-target-libgrust +clean-target: maybe-clean-target-libgcobol .PHONY: do-distclean do-distclean: @@ -2580,6 +2595,7 @@ distclean-target: maybe-distclean-target-libgomp distclean-target: maybe-distclean-target-libitm distclean-target: maybe-distclean-target-libatomic distclean-target: maybe-distclean-target-libgrust +distclean-target: maybe-distclean-target-libgcobol .PHONY: do-maintainer-clean do-maintainer-clean: @@ -2673,6 +2689,7 @@ maintainer-clean-target: maybe-maintainer-clean-target-libgomp maintainer-clean-target: maybe-maintainer-clean-target-libitm maintainer-clean-target: maybe-maintainer-clean-target-libatomic maintainer-clean-target: maybe-maintainer-clean-target-libgrust +maintainer-clean-target: maybe-maintainer-clean-target-libgcobol # Here are the targets which correspond to the do-X targets. @@ -2823,7 +2840,8 @@ check-target: \ maybe-check-target-libgomp \ maybe-check-target-libitm \ maybe-check-target-libatomic \ - maybe-check-target-libgrust + maybe-check-target-libgrust \ + maybe-check-target-libgcobol do-check: @: $(MAKE); $(unstage) @@ -3020,7 +3038,8 @@ install-target: \ maybe-install-target-libgomp \ maybe-install-target-libitm \ maybe-install-target-libatomic \ - maybe-install-target-libgrust + maybe-install-target-libgrust \ + maybe-install-target-libgcobol uninstall: @echo "the uninstall target is not supported in this tree" @@ -3133,7 +3152,8 @@ install-strip-target: \ maybe-install-strip-target-libgomp \ maybe-install-strip-target-libitm \ maybe-install-strip-target-libatomic \ - maybe-install-strip-target-libgrust + maybe-install-strip-target-libgrust \ + maybe-install-strip-target-libgcobol ### other supporting targets @@ -63688,6 +63708,491 @@ maintainer-clean-target-libgrust: + + +.PHONY: configure-target-libgcobol maybe-configure-target-libgcobol +maybe-configure-target-libgcobol: +@if gcc-bootstrap +configure-target-libgcobol: stage_current +@endif gcc-bootstrap +@if target-libgcobol +maybe-configure-target-libgcobol: configure-target-libgcobol +configure-target-libgcobol: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + echo "Checking multilib configuration for libgcobol..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgcobol; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libgcobol/multilib.tmp 2> /dev/null; \ + if test -r $(TARGET_SUBDIR)/libgcobol/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libgcobol/multilib.tmp $(TARGET_SUBDIR)/libgcobol/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libgcobol/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libgcobol/Makefile; \ + mv $(TARGET_SUBDIR)/libgcobol/multilib.tmp $(TARGET_SUBDIR)/libgcobol/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libgcobol/multilib.tmp $(TARGET_SUBDIR)/libgcobol/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libgcobol/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgcobol; \ + $(NORMAL_TARGET_EXPORTS) \ + echo Configuring in $(TARGET_SUBDIR)/libgcobol; \ + cd "$(TARGET_SUBDIR)/libgcobol" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libgcobol/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=libgcobol; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) \ + $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \ + --target=${target_alias} \ + || exit 1 +@endif target-libgcobol + + + + + +.PHONY: all-target-libgcobol maybe-all-target-libgcobol +maybe-all-target-libgcobol: +@if gcc-bootstrap +all-target-libgcobol: stage_current +@endif gcc-bootstrap +@if target-libgcobol +TARGET-target-libgcobol=all +maybe-all-target-libgcobol: all-target-libgcobol +all-target-libgcobol: configure-target-libgcobol + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) \ + $(TARGET-target-libgcobol)) +@endif target-libgcobol + + + + + +.PHONY: check-target-libgcobol maybe-check-target-libgcobol +maybe-check-target-libgcobol: +@if target-libgcobol +maybe-check-target-libgcobol: check-target-libgcobol + +check-target-libgcobol: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + +@endif target-libgcobol + +.PHONY: install-target-libgcobol maybe-install-target-libgcobol +maybe-install-target-libgcobol: +@if target-libgcobol +maybe-install-target-libgcobol: install-target-libgcobol + +install-target-libgcobol: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libgcobol + +.PHONY: install-strip-target-libgcobol maybe-install-strip-target-libgcobol +maybe-install-strip-target-libgcobol: +@if target-libgcobol +maybe-install-strip-target-libgcobol: install-strip-target-libgcobol + +install-strip-target-libgcobol: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) install-strip) + +@endif target-libgcobol + +# Other targets (info, dvi, pdf, etc.) + +.PHONY: maybe-info-target-libgcobol info-target-libgcobol +maybe-info-target-libgcobol: +@if target-libgcobol +maybe-info-target-libgcobol: info-target-libgcobol + +info-target-libgcobol: \ + configure-target-libgcobol + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + info) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-dvi-target-libgcobol dvi-target-libgcobol +maybe-dvi-target-libgcobol: +@if target-libgcobol +maybe-dvi-target-libgcobol: dvi-target-libgcobol + +dvi-target-libgcobol: \ + configure-target-libgcobol + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + dvi) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-pdf-target-libgcobol pdf-target-libgcobol +maybe-pdf-target-libgcobol: +@if target-libgcobol +maybe-pdf-target-libgcobol: pdf-target-libgcobol + +pdf-target-libgcobol: \ + configure-target-libgcobol + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing pdf in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + pdf) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-html-target-libgcobol html-target-libgcobol +maybe-html-target-libgcobol: +@if target-libgcobol +maybe-html-target-libgcobol: html-target-libgcobol + +html-target-libgcobol: \ + configure-target-libgcobol + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + html) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-TAGS-target-libgcobol TAGS-target-libgcobol +maybe-TAGS-target-libgcobol: +@if target-libgcobol +maybe-TAGS-target-libgcobol: TAGS-target-libgcobol + +TAGS-target-libgcobol: \ + configure-target-libgcobol + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + TAGS) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-install-info-target-libgcobol install-info-target-libgcobol +maybe-install-info-target-libgcobol: +@if target-libgcobol +maybe-install-info-target-libgcobol: install-info-target-libgcobol + +install-info-target-libgcobol: \ + configure-target-libgcobol \ + info-target-libgcobol + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-info) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-install-dvi-target-libgcobol install-dvi-target-libgcobol +maybe-install-dvi-target-libgcobol: +@if target-libgcobol +maybe-install-dvi-target-libgcobol: install-dvi-target-libgcobol + +install-dvi-target-libgcobol: \ + configure-target-libgcobol \ + dvi-target-libgcobol + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-dvi in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-dvi) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-install-pdf-target-libgcobol install-pdf-target-libgcobol +maybe-install-pdf-target-libgcobol: +@if target-libgcobol +maybe-install-pdf-target-libgcobol: install-pdf-target-libgcobol + +install-pdf-target-libgcobol: \ + configure-target-libgcobol \ + pdf-target-libgcobol + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-pdf in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-pdf) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-install-html-target-libgcobol install-html-target-libgcobol +maybe-install-html-target-libgcobol: +@if target-libgcobol +maybe-install-html-target-libgcobol: install-html-target-libgcobol + +install-html-target-libgcobol: \ + configure-target-libgcobol \ + html-target-libgcobol + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-html) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-installcheck-target-libgcobol installcheck-target-libgcobol +maybe-installcheck-target-libgcobol: +@if target-libgcobol +maybe-installcheck-target-libgcobol: installcheck-target-libgcobol + +installcheck-target-libgcobol: \ + configure-target-libgcobol + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + installcheck) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-mostlyclean-target-libgcobol mostlyclean-target-libgcobol +maybe-mostlyclean-target-libgcobol: +@if target-libgcobol +maybe-mostlyclean-target-libgcobol: mostlyclean-target-libgcobol + +mostlyclean-target-libgcobol: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + mostlyclean) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-clean-target-libgcobol clean-target-libgcobol +maybe-clean-target-libgcobol: +@if target-libgcobol +maybe-clean-target-libgcobol: clean-target-libgcobol + +clean-target-libgcobol: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + clean) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-distclean-target-libgcobol distclean-target-libgcobol +maybe-distclean-target-libgcobol: +@if target-libgcobol +maybe-distclean-target-libgcobol: distclean-target-libgcobol + +distclean-target-libgcobol: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + distclean) \ + || exit 1 + +@endif target-libgcobol + +.PHONY: maybe-maintainer-clean-target-libgcobol maintainer-clean-target-libgcobol +maybe-maintainer-clean-target-libgcobol: +@if target-libgcobol +maybe-maintainer-clean-target-libgcobol: maintainer-clean-target-libgcobol + +maintainer-clean-target-libgcobol: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcobol/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libgcobol"; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcobol && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libgcobol + + + @if target-libgomp .PHONY: check-target-libgomp-c++ check-target-libgomp-c++: @@ -63822,6 +64327,14 @@ check-gcc-rust: gcc-site.exp (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-rust); check-rust: check-gcc-rust +.PHONY: check-gcc-cobol check-cobol +check-gcc-cobol: gcc-site.exp + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-cobol); +check-cobol: check-gcc-cobol check-target-libgcobol + # The gcc part of install-no-fixedincludes, which relies on an intimate # knowledge of how a number of gcc internal targets (inter)operate. Delegate. @@ -67383,6 +67896,7 @@ configure-stagefeedback-target-libatomic: maybe-all-stagefeedback-gcc configure-stageautoprofile-target-libatomic: maybe-all-stageautoprofile-gcc configure-stageautofeedback-target-libatomic: maybe-all-stageautofeedback-gcc configure-target-libgrust: stage_last +configure-target-libgcobol: stage_last @endif gcc-bootstrap @if gcc-no-bootstrap @@ -67410,6 +67924,7 @@ configure-target-libgomp: maybe-all-gcc configure-target-libitm: maybe-all-gcc configure-target-libatomic: maybe-all-gcc configure-target-libgrust: maybe-all-gcc +configure-target-libgcobol: maybe-all-gcc @endif gcc-no-bootstrap @@ -68654,6 +69169,7 @@ install-target-libvtv: maybe-install-target-libgcc install-target-libitm: maybe-install-target-libgcc install-target-libobjc: maybe-install-target-libgcc install-target-libstdc++-v3: maybe-install-target-libgcc +install-target-libgcobol: maybe-install-target-libstdc++-v3 all-target-libgloss: maybe-all-target-newlib all-target-winsup: maybe-all-target-libtermcap configure-target-libgfortran: maybe-all-target-libquadmath @@ -68873,6 +69389,7 @@ configure-target-libgomp: maybe-all-target-libgcc configure-target-libitm: maybe-all-target-libgcc configure-target-libatomic: maybe-all-target-libgcc configure-target-libgrust: maybe-all-target-libgcc +configure-target-libgcobol: maybe-all-target-libgcc @endif gcc-no-bootstrap @@ -68923,6 +69440,9 @@ configure-target-libatomic: maybe-all-target-newlib maybe-all-target-libgloss configure-target-libgrust: maybe-all-target-newlib maybe-all-target-libgloss +configure-target-libgcobol: maybe-all-target-newlib maybe-all-target-libgloss +configure-target-libgcobol: maybe-all-target-libstdc++-v3 + CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@ GDB_TK = @GDB_TK@ diff --git a/configure b/configure index 4ae8e1242af..bd1903f3583 100755 --- a/configure +++ b/configure @@ -776,6 +776,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -951,6 +952,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -1203,6 +1205,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1340,7 +1351,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1500,6 +1511,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -2863,6 +2875,7 @@ target_libraries="target-libgcc \ target-libgfortran \ target-libffi \ target-libobjc \ + target-libgcobol \ target-libada \ target-libgm2 \ target-libgo \ @@ -3512,6 +3525,26 @@ $as_echo "yes" >&6; } fi fi +# Disable libgcobol on unsupported systems. +# For testing, you can override this with --enable-libgcobol. +if test -d ${srcdir}/libgcobol; then + if test x$enable_libgcobol = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgcobol support" >&5 +$as_echo_n "checking for libgcobol support... " >&6; } + if (srcdir=${srcdir}/libgcobol; \ + . ${srcdir}/configure.tgt; \ + test "$LIBGCOBOL_SUPPORTED" != "yes") + then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + noconfigdirs="$noconfigdirs target-libgcobol" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fi + fi +fi + # Disable Fortran for some systems. case "${target}" in mmix-*-*) @@ -10213,6 +10246,36 @@ fi stage1_languages=`echo "$stage1_languages" | sed -e "s/^,//" -e "s/,$//"` new_enable_languages=`echo "$new_enable_languages" | sed -e "s/^,//" -e "s/,$//"` +# It's early days for COBOL, and it is known to compile on only some host and +# target systems. We remove COBOL from other builds with a warning. + +cobol_is_okay_host="no" +cobol_is_okay_target="no" + +case "${host}" in + x86_64-*-*) + cobol_is_okay_host="yes" + ;; + aarch64-*-*) + cobol_is_okay_host="yes" + ;; +esac +case "${target}" in + x86_64-*-*) + cobol_is_okay_target="yes" + ;; + aarch64-*-*) + cobol_is_okay_target="yes" + ;; +esac + +if test "$cobol_is_okay_host" = "no" || test "$cobol_is_okay_target" = "no"; then + if echo "${new_enable_languages}" | grep "cobol" >/dev/null 2>&1; then + echo "WARNING: cobol is not available on this host or target" + new_enable_languages=`echo "${new_enable_languages}" | sed s/,cobol//g` + fi +fi + if test "x$missing_languages" != x; then as_fn_error $? " The following requested languages could not be built: ${missing_languages} diff --git a/configure.ac b/configure.ac index 9a72b2311bd..f521fd410ec 100644 --- a/configure.ac +++ b/configure.ac @@ -161,6 +161,7 @@ target_libraries="target-libgcc \ target-libgfortran \ target-libffi \ target-libobjc \ + target-libgcobol \ target-libada \ target-libgm2 \ target-libgo \ @@ -735,6 +736,23 @@ if test -d ${srcdir}/libphobos; then fi fi +# Disable libgcobol on unsupported systems. +# For testing, you can override this with --enable-libgcobol. +if test -d ${srcdir}/libgcobol; then + if test x$enable_libgcobol = x; then + AC_MSG_CHECKING([for libgcobol support]) + if (srcdir=${srcdir}/libgcobol; \ + . ${srcdir}/configure.tgt; \ + test "$LIBGCOBOL_SUPPORTED" != "yes") + then + AC_MSG_RESULT([no]) + noconfigdirs="$noconfigdirs target-libgcobol" + else + AC_MSG_RESULT([yes]) + fi + fi +fi + # Disable Fortran for some systems. case "${target}" in mmix-*-*) @@ -2525,6 +2543,36 @@ directories, to avoid imposing the performance cost of missing_languages=`echo "$missing_languages" | sed -e "s/^,//" -e "s/,$//"` stage1_languages=`echo "$stage1_languages" | sed -e "s/^,//" -e "s/,$//"` new_enable_languages=`echo "$new_enable_languages" | sed -e "s/^,//" -e "s/,$//"` + +# It's early days for COBOL, and it is known to compile on only some host and +# target systems. We remove COBOL from other builds with a warning. + +cobol_is_okay_host="no" +cobol_is_okay_target="no" + +case "${host}" in + x86_64-*-*) + cobol_is_okay_host="yes" + ;; + aarch64-*-*) + cobol_is_okay_host="yes" + ;; +esac +case "${target}" in + x86_64-*-*) + cobol_is_okay_target="yes" + ;; + aarch64-*-*) + cobol_is_okay_target="yes" + ;; +esac + +if test "$cobol_is_okay_host" = "no" || test "$cobol_is_okay_target" = "no"; then + if echo "${new_enable_languages}" | grep "cobol" >/dev/null 2>&1; then + echo "WARNING: cobol is not available on this host or target" + new_enable_languages=`echo "${new_enable_languages}" | sed s/,cobol//g` + fi +fi if test "x$missing_languages" != x; then AC_MSG_ERROR([ diff --git a/gcc/cobol/LICENSE b/gcc/cobol/LICENSE new file mode 100644 index 00000000000..266a56a8345 --- /dev/null +++ b/gcc/cobol/LICENSE @@ -0,0 +1,29 @@ +######################################################################### +# +# Copyright (c) 2021-2024 Symas Corporation +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the Symas Corporation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in new file mode 100644 index 00000000000..7e60abe8d9b --- /dev/null +++ b/gcc/cobol/Make-lang.in @@ -0,0 +1,361 @@ +# Top level -*- makefile -*- fragment for Cobol +# Copyright (C) 2021-2024 Free Software Foundation, Inc. + +# This file is part of GCC. + +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. + +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# This file provides the language dependent support in the main Makefile. +# Each language makefile fragment must provide the following targets: +# +# foo.all.cross, foo.start.encap, foo.rest.encap, +# foo.install-common, foo.install-man, foo.install-info, foo.install-pdf, +# foo.install-html, foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall, +# foo.mostlyclean, foo.clean, foo.distclean, +# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4 +# +# where `foo' is the name of the language. +# +# It should also provide rules for: +# +# - making any compiler driver (eg: g++) +# - the compiler proper (eg: cc1plus) +# - define the names for selecting the language in LANGUAGES. + +gcobol_INSTALL_NAME := $(shell echo gcobol|sed '$(program_transform_name)') +gcobol_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcobol|sed '$(program_transform_name)') + +cobol: cobol1$(exeext) +.PHONY: cobol + +BINCLUDE ?= ./gcc +LIB_INCLUDE ?= $(srcdir)/../libgcobol +LIB_SOURCE ?= $(srcdir)/../libgcobol + +# +# At this point, as of 2022-10-21, CPPFLAGS is an empty string and can be +# altered. CFLAGS and CXXFLAGS are being established upstream, and thus +# cannot, at this point, be changed. +# +CPPFLAGS = \ + -std=c++17 \ + $(MAX_ERRORS) \ + -Iinclude \ + -I$(BINCLUDE) \ + -I$(LIB_INCLUDE) \ + -Wno-cpp \ + -Wno-missing-field-initializers \ + -DEXEC_LIB=\"$(PREFIX)/$(libdir)\" \ + $(END) + +YFLAGS = -Werror -Wmidrule-values -Wno-yacc \ + --debug --verbose + +LFLAGS = -d -Ca + +# +# These are the object files for creating the cobol1.exe compiler: +# +cobol1_OBJS = \ + cobol/cdf.o \ + cobol/cdf-copy.o \ + cobol/cobol1.o \ + cobol/convert.o \ + cobol/except.o \ + cobol/genutil.o \ + cobol/genapi.o \ + cobol/genmath.o \ + cobol/gengen.o \ + cobol/lexio.o \ + cobol/parse.o \ + cobol/scan.o \ + cobol/structs.o \ + cobol/symbols.o \ + cobol/symfind.o \ + cobol/util.o \ + cobol/charmaps-dupe.o \ + cobol/valconv-dupe.o \ + $(END) + +# +# There is source code in libgcobol/charmaps.cc and libgcobol/valconv.cc +# that needs to be compiled into both libgcobol and cobol1. The following +# recipes make copies of those two source code files from libgcobol to here in +# the gcc/cobol build tree. This avoids the nightmare of one file appearing in +# more than one place. +# +$(srcdir)/cobol/charmaps-dupe.cc: $(LIB_SOURCE)/charmaps.cc + echo "// DO NOT EDIT THIS FILE. It was copied from the libgcobol directory." > $@ + tail -n +2 $< >> $@ + +$(srcdir)/cobol/valconv-dupe.cc: $(LIB_SOURCE)/valconv.cc + echo "// DO NOT EDIT THIS FILE. It was copied from the libgcobol directory." > $@ + tail -n +2 $< >> $@ + +# +# These are the object files for creating the gcobol.exe "driver" +# +GCOBOL_D_OBJS = $(GCC_OBJS) cobol/gcobolspec.o + +# +# These get combined to provide a dependency relationship that ensures all +# of the "generated-files" are generated before we need them. See the root +# Makefile.in code that looks like this: +# ALL_HOST_FRONTEND_OBJS = $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS)) +# +cobol_OBJS = \ + $(cobol1_OBJS) \ + cobol/gcobolspec.o \ + $(END) + +# +# Frankly, I can't figure out what this does: +# +CFLAGS-cobol/gcobolspec.o += $(DRIVER_DEFINES) + +# +# This controls the build of the gcobol.exe "driver" +# +gcobol$(exeext): \ + $(GCOBOL_D_OBJS) \ + $(EXTRA_GCC_OBJS) \ + libcommon-target.a \ + $(LIBDEPS) + +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ + $(GCOBOL_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ + $(EXTRA_GCC_LIBS) $(LIBS) + +# +# These control the build of the cobol1.exe source-to-GENERIC converter +# + +# First, files needed for parsing: + +cobol/parse.c: cobol/parse.y + $(BISON) -o $@ $(YFLAGS) \ + --defines=cobol/parse.h \ + --report-file=cobol/parser.out $< + +cobol/cdf.c: cobol/cdf.y + $(BISON) -o $@ $(YFLAGS) \ + --defines=cobol/cdf.h --report-file=cobol/cdf.out $< + +# See "Trailing context is getting confused with trailing optional patterns" +# in Flex manual. We suppress those messages, as a convenience. +FLEX_WARNING = warning, dangerous trailing context + +cobol/scan.c: cobol/scan.l + $(FLEX) -o$@ $(LFLAGS) $< >$@~ 2>&1 + awk '! /$(FLEX_WARNING)/ {print > "/dev/stderr"; nerr++} \ + END {print "$(FLEX):", NR, "messages" > "/dev/stderr"; \ + exit nerr}' $@~ + @rm $@~ + + +# To establish prerequisites for parse.o, cdf.o, and scan.o, +# 1. capture the "make -n" output +# 2. eliminate compiler options, leaving only preprocessor options (-D and -I) +# 3. add -E -MM +# +# The below lists of include files for the the generated files is +# postprocessed: the files are one per line, used "realpath +# --relative-to=$PWD" to rationalize them, and sorted. We include +# parse.c in the list for scan.o because that's the one make(1) knows about. + +cobol/cdf.o: cobol/cdf.c \ + $(srcdir)/cobol/cbldiag.h \ + $(srcdir)/cobol/cdfval.h \ + $(srcdir)/cobol/copybook.h \ + $(srcdir)/cobol/exceptg.h \ + $(srcdir)/cobol/symbols.h \ + $(srcdir)/cobol/util.h \ + $(srcdir)/../libgcobol/common-defs.h \ + $(srcdir)/../libgcobol/ec.h \ + $(srcdir)/../libgcobol/exceptl.h + +cobol/parse.o: cobol/parse.c \ + $(srcdir)/cobol/cbldiag.h \ + $(srcdir)/cobol/cdfval.h \ + $(srcdir)/cobol/cobol-system.h \ + $(srcdir)/cobol/exceptg.h \ + $(srcdir)/cobol/genapi.h \ + $(srcdir)/cobol/inspect.h \ + $(srcdir)/cobol/parse_ante.h \ + $(srcdir)/cobol/parse_util.h \ + $(srcdir)/cobol/symbols.h \ + $(srcdir)/cobol/util.h \ + $(srcdir)/hwint.h \ + $(srcdir)/system.h \ + $(srcdir)/../include/ansidecl.h \ + $(srcdir)/../include/filenames.h \ + $(srcdir)/../include/hashtab.h \ + $(srcdir)/../include/libiberty.h \ + $(srcdir)/../include/safe-ctype.h \ + $(srcdir)/../libgcobol/common-defs.h \ + $(srcdir)/../libgcobol/ec.h \ + $(srcdir)/../libgcobol/exceptl.h \ + $(srcdir)/../libgcobol/io.h \ + auto-host.h \ + config.h + +cobol/scan.o: cobol/scan.c \ + $(srcdir)/cobol/cbldiag.h \ + $(srcdir)/cobol/cdfval.h \ + $(srcdir)/cobol/cobol-system.h \ + $(srcdir)/cobol/copybook.h \ + $(srcdir)/cobol/dts.h \ + $(srcdir)/cobol/exceptg.h \ + $(srcdir)/cobol/inspect.h \ + $(srcdir)/cobol/lexio.h \ + $(srcdir)/cobol/scan_ante.h \ + $(srcdir)/cobol/scan_post.h \ + $(srcdir)/cobol/symbols.h \ + $(srcdir)/cobol/util.h \ + $(srcdir)/hwint.h \ + $(srcdir)/system.h \ + $(srcdir)/../include/ansidecl.h \ + $(srcdir)/../include/filenames.h \ + $(srcdir)/../include/hashtab.h \ + $(srcdir)/../include/libiberty.h \ + $(srcdir)/../include/safe-ctype.h \ + $(srcdir)/../libgcobol/common-defs.h \ + $(srcdir)/../libgcobol/ec.h \ + $(srcdir)/../libgcobol/exceptl.h \ + $(srcdir)/../libgcobol/io.h \ + auto-host.h \ + config.h \ + cobol/cdf.c \ + cobol/parse.c + +# +# The src<foo> targets are executed if +# ?--enable-generated-files-in-srcdir? was specified as a configure +# option. +# +# srcextra copies generated dependencies into the source +# directory. This is used for files such as Flex/Bison output: files +# that are not version-controlled but should be included in any +# release tarballs. +# +# Although versioned snapshots require Flex to be installed, they do +# not require Bison. Release tarballs always include Flex/Bison +# output, and do not require those tools to be installed. +# +cobol.srcextra: cobol/parse.c cobol/cdf.c cobol/scan.c + ln -f $^ cobol/parse.h cobol/cdf.h $(srcdir)/cobol/ + + +# And the cobol1.exe front end + +cobol1$(exeext): $(cobol1_OBJS) $(BACKEND) $(LIBDEPS) attribs.o + +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) attribs.o -o $@ \ + $(cobol1_OBJS) $(BACKEND) $(LIBS) $(BACKENDLIBS) + +# FIXME +cobol.all.cross: + +cobol.start.encap: gcobol$(exeext) + +cobol.rest.encap: + +cobol.install-common: installdirs + $(INSTALL_PROGRAM) gcobol$(exeext) $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) cobol1$(exeext) $(DESTDIR)$(libexecsubdir)/ + $(INSTALL) -m 755 $(srcdir)/cobol/gcobc $(DESTDIR)$(bindir)/ + mkdir -p $(DESTDIR)$(datadir)/gcobol/udf + $(INSTALL_DATA) $(srcdir)/cobol/udf/* $(DESTDIR)$(datadir)/gcobol/udf/ + +cobol.install-man: installdirs + $(INSTALL_DATA) $(srcdir)/cobol/gcobol.1 $(DESTDIR)$(man1dir)/ + $(INSTALL_DATA) $(srcdir)/cobol/gcobol.3 $(DESTDIR)$(man3dir)/ + +cobol.install-info: + +cobol.install-pdf: installdirs gcobol.pdf gcobol-io.pdf + mkdir -p $(DESTDIR)$(datadir)/gcobol/pdf + $(INSTALL_DATA) gcobol.pdf gcobol-io.pdf $(DESTDIR)$(pdfdir)/ + +cobol.install-plugin: + +cobol.install-html: installdirs gcobol.html gcobol-io.html + $(INSTALL_DATA) gcobol.html gcobol-io.html $(DESTDIR)$(htmldir)/ + +cobol.info: +cobol.srcinfo: + +cobol.dvi: +cobol.srcdvi: + +cobol.pdf: gcobol.pdf gcobol-io.pdf +cobol.srcpdf: gcobol.pdf gcobol-io.pdf + ln $^ $(srcdir)/cobol/ + +gcobol.pdf: $(srcdir)/cobol/gcobol.1 + groff -mdoc -T pdf $^ > $@~ + @mv $@~ $@ +gcobol-io.pdf: $(srcdir)/cobol/gcobol.3 + groff -mdoc -T pdf $^ > $@~ + @mv $@~ $@ + +cobol.html: gcobol.html gcobol-io.html +cobol.srchtml: gcobol.html gcobol-io.html + ln $^ $(srcdir)/cobol/ + +gcobol.html: $(srcdir)/cobol/gcobol.1 + mandoc -T html $^ > $@~ + @mv $@~ $@ +gcobol-io.html: $(srcdir)/cobol/gcobol.3 + mandoc -T html $^ > $@~ + @mv $@~ $@ + +# "make uninstall" is not expected to work. It's not clear how to name +# the installed location of the cobol1 compiler. +cobol.uninstall: + rm -rf $(DESTDIR)$(bindir)/$(gcobol_INSTALL_NAME)$(exeext) \ + $(DESTDIR)$(bindir)/gcobc \ + $(DESTDIR)$(datadir)/gcobol/ \ + $(DESTDIR)$(man1dir)/gcobol.1 \ + $(DESTDIR)$(man3dir)/gcobol.3 + +cobol.man: +cobol.srcman: + +cobol.mostlyclean: + +cobol.clean: \ + rm -fr gcobol cobol1 cobol/* \ + ../*/libgcobol/* \ + $(srcdir)/cobol/charmaps-dupe.cc \ + $(srcdir)/cobol/valconv-dupe.cc + +cobol.distclean: + +cobol.maintainer-clean: + +# The main makefile has already created stage?/cobol. +cobol.stage1: stage1-start + -mv cobol/*$(objext) stage1/cobol +cobol.stage2: stage2-start + -mv cobol/*$(objext) stage2/cobol +cobol.stage3: stage3-start + -mv cobol/*$(objext) stage3/cobol +cobol.stage4: stage4-start + -mv cobol/*$(objext) stage4/cobol +cobol.stageprofile: stageprofile-start + -mv cobol/*$(objext) stageprofile/cobol +cobol.stagefeedback: stagefeedback-start + -mv cobol/*$(objext) stagefeedback/cobol + +selftest-cobol: diff --git a/gcc/cobol/config-lang.in b/gcc/cobol/config-lang.in new file mode 100644 index 00000000000..ef35dcd58be --- /dev/null +++ b/gcc/cobol/config-lang.in @@ -0,0 +1,38 @@ +# Copyright (C) 2004-2025 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Configure looks for the existence of this file to auto-config each language. +# We define several parameters used by configure: +# +# language - name of language as it would appear in $(LANGUAGES) +# compilers - value to add to $(COMPILERS) +# diff_excludes - files to ignore when building diffs between two versions. + +language="cobol" + +compilers="cobol1\$(exeext)" + +target_libs="target-libgcobol" + +# Files that should be scanned by gengtype.c to generate the garbage +# collection tables. + +gtfiles="\$(srcdir)/cobol/cobol1.cc" + +# Do not build by default +build_by_default="no" diff --git a/gcc/cobol/lang.opt b/gcc/cobol/lang.opt new file mode 100644 index 00000000000..1739dd9fdf3 --- /dev/null +++ b/gcc/cobol/lang.opt @@ -0,0 +1,144 @@ +; lang.opt -- Options for the gcc Cobol front end. + +; Copyright (C) 2021-2024 Free Software Foundation, Inc. +; +; This file is part of GCC. +; +; GCC is free software; you can redistribute it and/or modify it under +; the terms of the GNU General Public License as published by the Free +; Software Foundation; either version 3, or (at your option) any later +; version. +; +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY +; WARRANTY; without even the implied warranty of MERCHANTABILITY or +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +; for more details. +; +; You should have received a copy of the GNU General Public License +; along with GCC; see the file COPYING3. If not see +; <http://www.gnu.org/licenses/>. + +; See the GCC internals manual for a description of this file's format. + +; Please try to keep this file in ASCII collating order. + +Language +Cobol + +D +Cobol Joined Separate +; Documented in c.opt + +E +Cobol +; Documented in c.opt + +I +Cobol Joined Separate +;; -I <dir> Add copybook search directory +; Documented in c.opt + +dialect +Cobol Joined Separate Enum(dialect_type) EnumBitSet Var(cobol_dialect) +Accept COBOL constructs used by non-ISO compilers + +Enum +Name(dialect_type) Type(int) UnknownError(Unrecognized COBOL dialect name: %qs) + +EnumValue +Enum(dialect_type) String(gcc) Value(0x04) Canonical + +EnumValue +Enum(dialect_type) String(ibm) Value(0x01) + +EnumValue +Enum(dialect_type) String(mf) Value(0x02) + +EnumValue +Enum(dialect_type) String(gnu) Value(0x04) + +fcobol-exceptions +Cobol Joined Separate Var(cobol_exceptions) +-fcobol-exceptions=<n> Enable some exceptions by default + +copyext +Cobol Joined Separate Var(cobol_copyext) Init(0) +Define alternative implicit copybook filename extension + +fdefaultbyte +Cobol RejectNegative Joined Separate UInteger Var(cobol_default_byte) +Set Working-Storage data items to the supplied value + +fflex-debug +Cobol Var(yy_flex_debug, 1) Init(0) +Enable Cobol lex debugging + +ffixed-form +Cobol RejectNegative +Assume that the source file is fixed form. + +fsyntax-only +Cobol RejectNegative +; Documented in c.opt + +ffree-form +Cobol RejectNegative +Assume that the source file is free form. + +findicator-column +Cobol RejectNegative Joined Separate UInteger Var(indicator_column) Init(0) IntegerRange(0, 8) +-findicator-column=<n> Column after which Region A begins + +finternal-ebcdic +Cobol Var(cobol_ebcdic, 1) Init(0) +-finternal-ebcdic Internal processing is in EBCDIC Code Page 1140 + +fmax-errors +Cobol Joined Separate +; Documented in C + +fstatic-call +Cobol Var(cobol_static_call, 1) Init(1) +Enable/disable static linkage for CALL literals + +ftrace-debug +Cobol Var(cobol_trace_debug, 1) Init(0) +Enable Cobol parser debugging + +fyacc-debug +Cobol Var(yy_debug, 1) Init(0) +Enable Cobol yacc debugging + +preprocess +Cobol Joined Separate Var(cobol_preprocess) +preprocess <source_filter> before compiling + +iprefix +Cobol Joined Separate +; Documented in C + +include +Cobol Joined Separate Var(cobol_include) +; Documented in C + +isysroot +Cobol Joined Separate +; Documented in C + +isystem +Cobol Joined Separate +; Documented in C + +main +Cobol +-main The first program-id in the next source file is called by a generated main() entry point + +main= +Cobol Joined Var(cobol_main_string) +-main=<source_file> source_file/PROGRAM-ID is called by the generated main() + +nomain +Cobol +-nomain No main() function is created from COBOL source files + +; This comment is to ensure we retain the blank line above. diff --git a/gcc/cobol/lang.opt.urls b/gcc/cobol/lang.opt.urls new file mode 100644 index 00000000000..a0e1f1944fe --- /dev/null +++ b/gcc/cobol/lang.opt.urls @@ -0,0 +1,29 @@ +; Autogenerated by regenerate-opt-urls.py from gcc/cobol/lang.opt and generated HTML + +D +UrlSuffix(gcc/Preprocessor-Options.html#index-D-1) + +; skipping UrlSuffix for 'E' due to multiple URLs: +; duplicate: 'gcc/Link-Options.html#index-E-1' +; duplicate: 'gcc/Overall-Options.html#index-E' + +I +UrlSuffix(gcc/Directory-Options.html#index-I) LangUrlSuffix_D(gdc/Directory-Options.html#index-I) + +fsyntax-only +UrlSuffix(gcc/Warning-Options.html#index-fsyntax-only) LangUrlSuffix_D(gdc/Warnings.html#index-fno-syntax-only) + +fmax-errors +UrlSuffix(gcc/Warning-Options.html#index-fmax-errors) LangUrlSuffix_D(gdc/Warnings.html#index-fmax-errors) + +iprefix +UrlSuffix(gcc/Directory-Options.html#index-iprefix) LangUrlSuffix_D(gdc/Directory-Options.html#index-iprefix) + +include +UrlSuffix(gcc/Preprocessor-Options.html#index-include) + +isysroot +UrlSuffix(gcc/Directory-Options.html#index-isysroot) + +isystem +UrlSuffix(gcc/Directory-Options.html#index-isystem) diff --git a/gcc/common.opt b/gcc/common.opt index 4c2560a0632..c533ca331b8 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -3892,6 +3892,10 @@ static-libgfortran Driver ; Documented for Fortran, but always accepted by driver. +static-libgcobol +Driver +; Documented for COBOL, but always accepted by driver. + static-libgm2 Driver ; Documented for Modula-2, but always accepted by driver. diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 43884f206c0..accbf73d821 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -25448,6 +25448,8 @@ gen_compile_unit_die (const char *filename) } else if (strcmp (language_string, "GNU F77") == 0) language = DW_LANG_Fortran77; + else if (strcmp (language_string, "Cobol") == 0) + language = DW_LANG_Cobol85; else if (strcmp (language_string, "GNU Modula-2") == 0) language = DW_LANG_Modula2; else if (dwarf_version >= 3 || !dwarf_strict) @@ -25504,6 +25506,9 @@ gen_compile_unit_die (const char *filename) lowercases everything. */ add_AT_unsigned (die, DW_AT_identifier_case, DW_ID_down_case); break; + case DW_LANG_Cobol85: + add_AT_unsigned (die, DW_AT_identifier_case, DW_ID_case_insensitive); + break; default: /* The default DW_ID_case_sensitive doesn't need to be specified. */ break; diff --git a/libgcobol/Makefile.in b/libgcobol/Makefile.in new file mode 100644 index 00000000000..a9c35deff44 --- /dev/null +++ b/libgcobol/Makefile.in @@ -0,0 +1,296 @@ +# Makefile for the GCOBOL runtime library. + +# Copyright (C) 2021-2024 Free Software Foundation, Inc. +# Modifications made by the Symas Corporation, 2022 + +# This file is part of GCC. + +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. + +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# This was cribbed from the libchill, libiberty, libstdc++, and +# libobjc Makefile.in files. Some of this stuff may be unnecessary. + +SHELL = @SHELL@ +MAKEOVERRIDES= + +#### Start of system configuration section. #### + +srcdir = @glibcpp_srcdir@ +VPATH = @glibcpp_srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +target_noncanonical = @target_noncanonical@ +gcc_version := $(shell @get_gcc_base_ver@ $(srcdir)/../gcc/BASE-VER) +host_subdir = @host_subdir@ +top_srcdir = @top_srcdir@ +multi_basedir = @multi_basedir@ +toolexecdir = @toolexecdir@ +# Toolexecdir is used only by toolexeclibdir + +#toolexeclibdir = @toolexeclibdir@ +toolexeclibdir = @libdir@ + +includedirname = @includedirname@ +libsuffix = @libsuffix@ + +lt_host_flags = @lt_host_flags@ +extra_ldflags_libgcobol = @extra_ldflags_libgcobol@ + +top_builddir = . + +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +install_sh = @install_sh@ +libdir = $(exec_prefix)/lib +libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version) + +# Multilib support variables. +MULTISRCTOP = +MULTIBUILDTOP = +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +# Not configured per top-level version, since that doesn't get passed +# down at configure time, but overrridden by the top-level install +# target. +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +install_sh_PROGRAM = $(install_sh) -c + +AR = @AR@ +AR_FLAGS = rc + +RANLIB = @RANLIB@ + +ifeq ("$(USER)","bob") + MAX_ERRORS := -fmax-errors=1 +endif + +CC = @CC@ +CFLAGS = @CFLAGS@ +XCFLAGS = @XCFLAGS@ +WARN_CFLAGS = -W -Wall -Wwrite-strings # -Wstrict-prototypes +ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) \ + $(XCFLAGS) $(CFLAGS) $(WARN_CFLAGS) $(MAX_ERRORS)\ + -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing -fexceptions + + +# Libtool +# The following strings describe the version of the COBOL library +# begin compiled and compatibility issues. +# Please refer to Libtool documentation about how to manage these +# numbers. +LIBGCOBOL_VERSION = @VERSION@ +LIBTOOL = @LIBTOOL@ $(LIBTOOLFLAGS) +LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile +LIBTOOL_LINK = $(LIBTOOL) --mode=link +LIBTOOL_INSTALL = $(LIBTOOL) --mode=install +LIBTOOL_CLEAN = $(LIBTOOL) --mode=clean +#LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall + +GCOBOL_HFILES=$(wildcard *.h) + +VERSION_SUFFIX = $(shell echo $(LIBGCOBOL_VERSION) | tr ':' '.' ) + +INCLUDES = \ + $(END) + +## +## The list of header/source files +## + +# User-visible header files, from the gcobol/ directory +GCOBOL_H = \ + $(END) + +# C source files to compile +C_SOURCE_FILES = \ + charmaps.cc \ + constants.cc \ + gfileio.cc \ + gmath.cc \ + intrinsic.cc \ + io.cc \ + libgcobol.cc \ + valconv.cc \ + $(END) + +# Object files to link (when the library is linked with no GC (Garbage +# Collection)) +OBJS = \ + $(patsubst %.c,%.lo,$(C_SOURCE_FILES)) \ + $(patsubst %.cc,%.lo,$(C_SOURCE_FILES)) + + +# $(OBJS) : $(GCOBOL_HFILES) + +## +## The rules to build +## + +# Flags to pass to a recursive make. +FLAGS_TO_PASS = \ + "AR=$(AR)" \ + "AR_FLAGS=$(AR_FLAGS)" \ + "CC=$(CC)" \ + "CXX=$(CXX)" \ + "CFLAGS=$(CFLAGS)" \ + "DESTDIR=$(DESTDIR)" \ + "LIBCFLAGS=$(LIBCFLAGS)" \ + "EXTRA_OFILES=$(EXTRA_OFILES)" \ + "HDEFINES=$(HDEFINES)" \ + "INSTALL=$(INSTALL)" \ + "INSTALL_DATA=$(INSTALL_DATA)" \ + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ + "LDFLAGS=$(LDFLAGS)" \ + "LIBTOOL=$(LIBTOOL)" \ + "LOADLIBES=$(LOADLIBES)" \ + "PICFLAG=$(PICFLAG)" \ + "RANLIB=$(RANLIB)" \ + "SHELL=$(SHELL)" \ + "prefix=$(prefix)" \ + "exec_prefix=$(exec_prefix)" \ + "libdir=$(libdir)" \ + "libsubdir=$(libsubdir)" \ + "tooldir=$(tooldir)" + +ifeq "$(MULTISUBDIR)" "/32" +# suppress 32-bit builds until such time as the host and target executables +# no longer require __int128 variables +$(info Suppressing the 32-bit build because of lack of support for __int128 variables) +BUILDIT = +else +BUILDIT = libgcobol$(libsuffix).la +endif + +# The 'all' rule must be the first one so that it is executed if +# nothing is specified on the command-line. +all: $(BUILDIT) + : $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all + +.SUFFIXES: +.SUFFIXES: .c .lo .cc + +%.lo: %.c + $(LIBTOOL_COMPILE) $(CC) -c -o $@ \ + $(ALL_CFLAGS) $(INCLUDES) $< + +%.lo: %.cc + $(LIBTOOL_COMPILE) $(CXX) -c -o $@ \ + $(INCLUDES) $(ALL_CFLAGS) $< + +charmaps.lo : $(GCOBOL_HFILES) +constants.lo : $(GCOBOL_HFILES) +gfileio.lo : $(GCOBOL_HFILES) +gmath.lo : $(GCOBOL_HFILES) +intrinsic.lo : $(GCOBOL_HFILES) +io.lo : $(GCOBOL_HFILES) +libgcobol.lo : $(GCOBOL_HFILES) +valconv.lo : $(GCOBOL_HFILES) + +# These files have separate rules because they require special +# compiler flags. + +doc: info dvi pdf html + +# No install-html or install-pdf support +.PHONY: install-html install-pdf install-info +install-html: +install-pdf: +install-info: + +LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) + +libgcobol$(libsuffix).la: $(OBJS) + $(LIBTOOL_LINK) $(CXX) -o $@ $(OBJS) \ + -Wc,-shared-libgcc -rpath $(toolexeclibdir) \ + -version-info $(LIBGCOBOL_VERSION) $(extra_ldflags_libgcobol) \ + $(LTLDFLAGS) + +info: +dvi: +pdf: +html: + +Makefile: Makefile.in config.status + $(SHELL) config.status + +config.status: configure + rm -f config.cache + CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \ + CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck + +AUTOCONF = autoconf + +install: install-libs install-headers + +install-libs: installdirs + $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(toolexeclibdir) + $(LIBTOOL_INSTALL) $(INSTALL) libgcobol$(libsuffix).la $(DESTDIR)$(toolexeclibdir); + $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@" + @-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir) + +# Copy Objective-C headers to installation include directory. +install-headers: + $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/gcobol + for file in $(GCOBOL_H); do \ + realfile=$(srcdir)/objc/$${file}; \ + $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/gcobol; \ + done + +check uninstall install-strip dist installcheck installdirs: + +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +# This is a little ham-handed, but after struggling for a while to +# do it "correctly", I lost interest + strip -s $(DESTDIR)$(toolexeclibdir)/libgcobol.so.$(VERSION_SUFFIX) + +mostlyclean: + -$(LIBTOOL_CLEAN) rm -f libgcobol$(libsuffix).la *.lo + -rm -f runtime-info.h tmp-runtime.s *.o *.lo libgcobol* xforward \ + fflags *.aux *.cp *.dvi *.pdf *.fn *.info *.ky *.log *.pg \ + *.toc *.tp *.vr *.html libobj.exp + @$(MULTICLEAN) multi-clean DO=mostlyclean + +clean: mostlyclean + rm -f config.log + @$(MULTICLEAN) multi-clean DO=clean + +distclean: clean + @$(MULTICLEAN) multi-clean DO=distclean + rm -f config.cache config.status Makefile configure + +maintainer-clean realclean: distclean + +.PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \ + install-strip dist installcheck installdirs + +# Don't export variables to the environment, in order not to confuse +# configure. +.NOEXPORT: diff --git a/libgcobol/acinclude.m4 b/libgcobol/acinclude.m4 new file mode 100644 index 00000000000..be3d0136bb1 --- /dev/null +++ b/libgcobol/acinclude.m4 @@ -0,0 +1,26 @@ +dnl Copyright (C) 2021-2024 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(../config/acx.m4) +m4_include(../config/no-executables.m4) +m4_include(../config/enable.m4) +m4_include(../config/tls.m4) +m4_include(../config/bitfields.m4) + +m4_include(../libtool.m4) +dnl The lines below arrange for aclocal not to bring an installed +dnl libtool.m4 into aclocal.m4, while still arranging for automake to +dnl add a definition of LIBTOOL to Makefile.in. +ifelse(yes,no,[ +AC_DEFUN([AM_PROG_LIBTOOL],) +AC_DEFUN([AC_LIBTOOL_DLOPEN],) +AC_DEFUN([AC_LIBLTDL_CONVENIENCE],) +AC_SUBST(LIBTOOL) +]) diff --git a/libgcobol/aclocal.m4 b/libgcobol/aclocal.m4 new file mode 100644 index 00000000000..9ac0f645b52 --- /dev/null +++ b/libgcobol/aclocal.m4 @@ -0,0 +1,157 @@ +# generated automatically by aclocal 1.15.1 -*- Autoconf -*- + +# Copyright (C) 1996-2017 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2006-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +m4_include([../ltoptions.m4]) +m4_include([../ltsugar.m4]) +m4_include([../ltversion.m4]) +m4_include([../lt~obsolete.m4]) +m4_include([../config/cet.m4]) +m4_include([../config/lthostflags.m4]) +m4_include([../config/multi.m4]) +m4_include([../config/override.m4]) +m4_include([../config/toolexeclibdir.m4]) +m4_include([acinclude.m4]) diff --git a/libgcobol/configure.ac b/libgcobol/configure.ac new file mode 100644 index 00000000000..1e8dafc287b --- /dev/null +++ b/libgcobol/configure.ac @@ -0,0 +1,421 @@ +# Process this file with autoconf to produce a configure script. +# Copyright (C) 2021-2024 Free Software Foundation, Inc. +# Originally contributed by Dave Love (d.l...@dl.ac.uk). +# +#This file is part of GCC. +# +#GCC is free software; you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation; either version 3, or (at your option) +#any later version. +# +#GCC is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with GCC; see the file COPYING3. If not see +#<http://www.gnu.org/licenses/>. + +AC_INIT(package-unused, version-unused,, libgcobol) +GCC_TOPLEV_SUBDIRS + +# We need the following definitions because AC_PROG_LIBTOOL relies on them +PACKAGE=libgcobol +# Version is pulled out to make it a bit easier to change using sed. +VERSION=4:0:0 +AC_SUBST(VERSION) + +# This works around the fact that libtool configuration may change LD +# for this particular configuration, but some shells, instead of +# keeping the changes in LD private, export them just because LD is +# exported. +ORIGINAL_LD_FOR_MULTILIBS=$LD + +. ${srcdir}/configure.tgt + +# ------- +# Options +# ------- + +# We use these options to decide which functions to include. +AC_ARG_WITH(target-subdir, +[ --with-target-subdir=SUBDIR + configuring in a subdirectory]) +AC_ARG_WITH(cross-host, +[ --with-cross-host=HOST configuring with a cross compiler]) + +AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) +AC_ARG_ENABLE(version-specific-runtime-libs, +[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ], +[case "$enableval" in + yes) version_specific_libs=yes ;; + no) version_specific_libs=no ;; + *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; + esac], +[version_specific_libs=no]) +AC_MSG_RESULT($version_specific_libs) + +# ----------- +# Directories +# ----------- + +# Find the rest of the source tree framework. +AM_ENABLE_MULTILIB(, ..) + +AC_CANONICAL_SYSTEM +ACX_NONCANONICAL_TARGET + +# Export source directory. +# These need to be absolute paths, yet at the same time need to +# canonicalize only relative paths, because then amd will not unmount +# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd. +case $srcdir in + [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;; + *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;; +esac +AC_SUBST(glibcpp_srcdir) + +GCC_WITH_TOOLEXECLIBDIR + +# Calculate toolexeclibdir +# Also toolexecdir, though it's only used in toolexeclibdir +case ${version_specific_libs} in + yes) + # Need the gcc compiler version to know where to install libraries + # and header files if --enable-version-specific-runtime-libs option + # is selected. + toolexecdir='$(libdir)/gcc/$(target_noncanonical)' + toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' + ;; + no) + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + # Install a library built with a cross compiler in tooldir, not libdir. + toolexecdir='$(exec_prefix)/$(target_noncanonical)' + case ${with_toolexeclibdir} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_toolexeclibdir} + ;; + esac + else + toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' + toolexeclibdir='$(libdir)' + fi + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in + .) ;; # Avoid trailing /. + *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; + esac + ;; +esac +AC_SUBST(toolexecdir) +AC_SUBST(toolexeclibdir) + +# Figure out if we want to name the include directory and the +# library name changes differently. +includedirname=include +libsuffix= +case "${host}" in + *-darwin*) + # Darwin is the only target so far that needs a different include directory. + includedirname=include-gnu-runtime + libsuffix=-gnu + ;; +esac +AC_SUBST(includedirname) +AC_SUBST(libsuffix) + +AC_CONFIG_HEADERS(config.h) + +# -------- +# Programs +# -------- + +GCC_NO_EXECUTABLES + +# We must force CC to /not/ be a precious variable; otherwise +# the wrong, non-multilib-adjusted value will be used in multilibs. +# As a side effect, we have to subst CFLAGS ourselves. +m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) +m4_define([_AC_ARG_VAR_PRECIOUS],[]) +AC_PROG_CC +m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) + +# extra LD Flags which are required for targets +ACX_LT_HOST_FLAGS +case "${host}" in + *-darwin*) + # Darwin needs -single_module when linking libgcobol + extra_ldflags_libgcobol='$(lt_host_flags) -Wl,-single_module' + ;; + *-cygwin*|*-mingw*) + # Tell libtool to build DLLs on Windows + extra_ldflags_libgcobol='$(lt_host_flags)' + ;; +esac +AC_SUBST(extra_ldflags_libgcobol) + +# Add CET specific flags if CET is enabled +GCC_CET_FLAGS(CET_FLAGS) +XCFLAGS="$XCFLAGS $CET_FLAGS" + +AC_SUBST(CFLAGS) +AC_SUBST(XCFLAGS) + +AC_CHECK_TOOL(AS, as) +AC_CHECK_TOOL(AR, ar) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_PROG_INSTALL + +AM_MAINTAINER_MODE + +# Enable Win32 DLL on MS Windows - FIXME +AC_LIBTOOL_WIN32_DLL + +AC_PROG_LIBTOOL + +AM_PROG_CC_C_O + +AC_PROG_MAKE_SET + +# ------- +# Headers +# ------- + +# Sanity check for the cross-compilation case: +AC_CHECK_HEADER(stdio.h,:, + [AC_MSG_ERROR([Can't find stdio.h. +You must have a usable C system for the target already installed, at least +including headers and, preferably, the library, before you can configure +the Objective C runtime system. If necessary, install gcc now with +\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=gcobol'.])]) + +AC_HEADER_STDC + +AC_CHECK_HEADERS(sched.h) + +# ----------------- +# __int128 support +# ----------------- + +AC_CACHE_CHECK([whether __int128 is supported], [libgcobol_cv_have_int128], + [GCC_TRY_COMPILE_OR_LINK([ + __int128 foo (__int128 ) + { + __int128 aaa; + return (__int128) aaa; + } + + __int128 bar (__int128 ) + { + __int128 aaa; + return (__int128) aaa; + } + ],[ + foo (1); + bar (1); + ],[ + libgcobol_cv_have_int128=yes + ],[ + libgcobol_cv_have_int128=no +])]) +# The following conditional is useful when this creates a Makefile.am file that +# is subsequently processed into a Makefile.in file. At the present time, +# however the libgcobol build uses a hardcoded Makefile.in file. +AM_CONDITIONAL(BUILD_LIBGCOBOL, [test "x$libgcobol_cv_have_int128" = xyes]) + +# ----------- +# Miscellanea +# ----------- + +# Check if we have thread-local storage +GCC_CHECK_TLS + +gt_BITFIELD_TYPE_MATTERS + +# ----------- +# boehm-gc +# ----------- + +AC_ARG_ENABLE(gcobol-gc, +[AS_HELP_STRING([--enable-gcobol-gc], + [enable use of Boehm's garbage collector with the + GNU Objective-C runtime])],,enable_gcobol_gc=no) +AC_ARG_WITH([target-bdw-gc], +[AS_HELP_STRING([--with-target-bdw-gc=PATHLIST], + [specify prefix directory for installed bdw-gc package. + Equivalent to --with-target-bdw-gc-include=PATH/include + plus --with-target-bdw-gc-lib=PATH/lib])]) +AC_ARG_WITH([target-bdw-gc-include], +[AS_HELP_STRING([--with-target-bdw-gc-include=PATHLIST], + [specify directories for installed bdw-gc include files])]) +AC_ARG_WITH([target-bdw-gc-lib], +[AS_HELP_STRING([--with-target-bdw-gc-lib=PATHLIST], + [specify directories for installed bdw-gc library])]) + +case "$enable_gcobol_gc" in +no) + use_bdw_gc=no + ;; +*) + AC_MSG_CHECKING([for bdw garbage collector]) + if test "x$with_target_bdw_gc$with_target_bdw_gc_include$with_target_bdw_gc_lib" = x; then + dnl no bdw-gw options, assuming bdw-gc in default locations + BDW_GC_CFLAGS= + BDW_GC_LIBS="-lgc" + else + dnl bdw-gw options passed by configure flags + if test "x$with_target_bdw_gc_include" = x && test "x$with_target_bdw_gc_lib" != x; then + AC_MSG_ERROR([found --with-target-bdw-gc-lib but --with-target-bdw-gc-include missing]) + elif test "x$with_target_bdw_gc_include" != x && test "x$with_target_bdw_gc_lib" = x; then + AC_MSG_ERROR([found --with-target-bdw-gc-include but --with-target-bdw-gc-lib missing]) + else + AC_MSG_RESULT([using paths configured with --with-target-bdw-gc options]) + fi + mldir=`${CC-gcc} --print-multi-directory 2>/dev/null` + bdw_val= + if test "x$with_target_bdw_gc" != x; then + for i in `echo $with_target_bdw_gc | tr ',' ' '`; do + case "$i" in + *=*) sd=${i%%=*}; d=${i#*=} ;; + *) sd=.; d=$i ;; + esac + if test "$mldir" = "$sd"; then + bdw_val=$d + fi + done + if test "x$bdw_val" = x; then + AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc]) + fi + bdw_inc_dir="$bdw_val/include" + bdw_lib_dir="$bdw_val/lib" + fi + bdw_val= + if test "x$with_target_bdw_gc_include" != x; then + for i in `echo $with_target_bdw_gc_include | tr ',' ' '`; do + case "$i" in + *=*) sd=${i%%=*}; d=${i#*=} ;; + *) sd=.; d=$i; fallback=$i ;; + esac + if test "$mldir" = "$sd"; then + bdw_val=$d + fi + done + if test "x$bdw_val" = x && test "x$bdw_inc_dir" = x && test "x$fallback" != x; then + bdw_inc_dir="$fallback" + elif test "x$bdw_val" = x; then + AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc-include]) + else + bdw_inc_dir="$bdw_val" + fi + fi + bdw_val= + if test "x$with_target_bdw_gc_lib" != x; then + for i in `echo $with_target_bdw_gc_lib | tr ',' ' '`; do + case "$i" in + *=*) sd=${i%%=*}; d=${i#*=} ;; + *) sd=.; d=$i ;; + esac + if test "$mldir" = "$sd"; then + bdw_val=$d + fi + done + if test "x$bdw_val" = x; then + AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc-lib]) + fi + bdw_lib_dir="$bdw_val" + fi + if test "x$bdw_inc_dir" = x; then + AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc-include]) + fi + if test "x$bdw_lib_dir" = x; then + AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc-lib]) + fi + BDW_GC_CFLAGS="-I$bdw_inc_dir" + if test -f $bdw_lib_dir/libgc.la; then + BDW_GC_LIBS="$bdw_lib_dir/libgc.la" + else + BDW_GC_LIBS="-L$bdw_lib_dir -lgc" + fi + AC_MSG_RESULT([found]) + fi + + case "$BDW_GC_LIBS" in + *libgc.la) + use_bdw_gc=yes + ;; + *) + AC_MSG_CHECKING([for system boehm-gc]) + save_CFLAGS=$CFLAGS + save_LIBS=$LIBS + CFLAGS="$CFLAGS $BDW_GC_CFLAGS" + LIBS="$LIBS $BDW_GC_LIBS" + dnl the link test is not good enough for ARM32 multilib detection, + dnl first check to link, then to run + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([#include <gc/gc.h>],[GC_init()])], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <gc/gc.h> + int main() { + GC_init(); + return 0; + } + ]])], + [system_bdw_gc_found=yes], + [system_bdw_gc_found=no], + dnl assume no system boehm-gc for cross builds ... + [system_bdw_gc_found=no] + ) + ], + [system_bdw_gc_found=no]) + CFLAGS=$save_CFLAGS + LIBS=$save_LIBS + if test x$enable_gcobol_gc = xauto && test x$system_bdw_gc_found = xno; then + AC_MSG_WARN([system bdw-gc not found, not building libgcobol_gc]) + use_bdw_gc=no + elif test x$enable_gcobol_gc = xyes && test x$system_bdw_gc_found = xno; then + AC_MSG_ERROR([system bdw-gc required but not found]) + else + use_bdw_gc=yes + AC_MSG_RESULT([found]) + fi + esac +esac + +if test "$use_bdw_gc" = no; then + OBJC_GCFLAGS='' + OBJC_BOEHM_GC='' + OBJC_BOEHM_GC_INCLUDES='' + OBJC_BOEHM_GC_LIBS='' +else + OBJC_GCFLAGS='-DOBJC_WITH_GC=1' + OBJC_BOEHM_GC='libgcobol_gc$(libsuffix).la' + OBJC_BOEHM_GC_INCLUDES=$BDW_GC_CFLAGS + OBJC_BOEHM_GC_LIBS=$BDW_GC_LIBS +fi +AC_SUBST(OBJC_GCFLAGS) +AC_SUBST(OBJC_BOEHM_GC) +AC_SUBST(OBJC_BOEHM_GC_INCLUDES) +AC_SUBST(OBJC_BOEHM_GC_LIBS) + +# Determine what GCC version number to use in filesystem paths. +GCC_BASE_VER + +# ------ +# Output +# ------ + +if test ${multilib} = yes; then + multilib_arg="--enable-multilib" +else + multilib_arg= +fi + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/libgcobol/configure.tgt b/libgcobol/configure.tgt new file mode 100644 index 00000000000..717b28ea915 --- /dev/null +++ b/libgcobol/configure.tgt @@ -0,0 +1,63 @@ +# -*- shell-script -*- +# Copyright (C) 2024 Free Software Foundation, Inc. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# This is the target specific configuration file. This is invoked by the +# autoconf generated configure script. Putting it in a separate shell file +# lets us skip running autoconf when modifying target specific information. + +# Disable the libphobos or libdruntime components on untested or known +# broken systems. More targets shall be added after testing. + +case "${target}" in + *-linux*) + # checked Linux targets not yet working: + # armel armhf i386 s390x + case "${target}" in + aarch64*-*-linux*) + LIBGCOBOL_SUPPORTED=yes + ;; + loongarch*-*-linux*) + LIBGCOBOL_SUPPORTED=yes + ;; + mips*-*-linux*) + LIBGCOBOL_SUPPORTED=yes + ;; + power*-*-linux*) + LIBGCOBOL_SUPPORTED=yes + ;; + riscv*-*-linux*) + LIBGCOBOL_SUPPORTED=yes + ;; + x86_64-*-linux*) + LIBGCOBOL_SUPPORTED=yes + ;; + arm*-linux*|hppa*-linux*|i?86-*-linux*|s390*-*-linux*) + # checked with Debian builds + LIBGCOBOL_SUPPORTED=no + ;; + *) + LIBGCOBOL_SUPPORTED=no + ;; + esac + ;; + *-gnu) + LIBGCOBOL_SUPPORTED=yes + ;; + *) + LIBGCOBOL_SUPPORTED=no + ;; +esac diff --git a/maintainer-scripts/update_web_docs_git b/maintainer-scripts/update_web_docs_git index 8ff34f86f65..8b3f9ba9ae8 100755 --- a/maintainer-scripts/update_web_docs_git +++ b/maintainer-scripts/update_web_docs_git @@ -143,6 +143,7 @@ rm -rf gcc/.git # not .texi files (Makefile, .rst and .png), and the jit docs use # include directives to pull in content from jit/jit-common.h and # Similar considerations apply for libgdiagnostics. +# Preserve the cobol man pages, which are converted to HTML and PDF. find gcc -type f \( -name '*.texi' \ -o -path gcc/gcc/doc/install.texi2html \ -o -path gcc/gcc/doc/include/texinfo.tex \ @@ -155,6 +156,7 @@ find gcc -type f \( -name '*.texi' \ -o -path "gcc/gcc/testsuite/jit.dg/*" \ -o -path "gcc/gcc/doc/libgdiagnostics/*" \ -o -path "gcc/gcc/testsuite/libgdiagnostics.dg/*" \ + -o -path "gcc/gcc/cobol/gcobol*[13]" \ -o -print0 \) | xargs -0 rm -f # Build a tarball of the sources. @@ -200,6 +202,33 @@ for file in $MANUALS; do fi done +# +# The COBOL FE maintains man pages. Convert them to HTML and PDF. +# +mdoc2pdf_html() { + input="$1" + d="${input%/*}" + pdf="$d/$2" + html="$d/$3" + groff -mdoc -T pdf "$input" > "${pdf}~" + mv "${pdf}~" "${pdf}" + mandoc -T html "$filename" > "${html}~" + mv "${html}~" "${html}" +} + +find . -name gcobol.[13] | + while read filename + do + case ${filename##*.} in + 1) + mdoc2pdf_html "$filename" gcobol.pdf gcobol.html + ;; + 3) + mdoc2pdf_html "$filename" gcobol_io.pdf gcobol_io.html + ;; + esac + done + # jit and libgdiagnostics are a special-case, using Sphinx rather than texinfo. # Specifically, they need Sphinx 3.0 or later. #