Commit graph

10 commits

Author SHA1 Message Date
Iain Sandoe
95f10974a9 libgcobol: Allow libgcobol to use libquadmath [PR119244].
Many of the changes are mechanical:
 1. 'GCOB_FP128' in place of _Float128.
 2. Using FP128_FUNC to represent the spelling of intrinsics.
 3. Using GCOB_FP128_LITERAL() to choose the suffix for literals.

This allows for:
  __float128 and 'q' as the suffix when libquadmath is configured.
   _Float128 / 'f128' when IEC-60559 is available in libc
 long double / 'l' when long double is ieee753 128b.

Add libquadmath to libgcobol.spec and its dependencies  where the
platform needs it.

	PR cobol/119244

libgcobol/ChangeLog:

	* Makefile.am: Add support for libquadmath.
	* Makefile.in: Regenerate.
	* acinclude.m4: Add support for libquadmath.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Configure libquadmath support.
	* gmath.cc: Use GCOB_FP128 to represent the configured
	128b floating point type.  Use FP128_FUNC to represent
	the naming of intrinsics in the configure 128b floating
	point type. Render literals with GCOB_FP128_LITERAL.
	* intrinsic.cc: Likewise.
	* libgcobol.cc: Likewise.
	* libgcobol.h: Likewise.
	* libgcobol-fp.h: New file.
	* gfileio.cc: Include libgcobol-fp.h.
	* libgcobol.spec.in: Add libquadmath configure output.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-10 11:05:07 +01:00
Iain Sandoe
63f7285e76 cobol, driver, libgcobol: Add support for libgcobol.spec.
Ads support for using a library spec file (e.g. to include the
target requirements for non-standard libraries - or even libm
which we can now configure at the target side).

gcc/cobol/ChangeLog:

	* gcobolspec.cc (SPEC_FILE): New.
	(lang_specific_driver): Make the 'need libgcobol' flag global
	so that the prelink callback can use it. Libm use is now handled
	via the library spec.
	(lang_specific_pre_link): Include libgcobol.spec where needed.

libgcobol/ChangeLog:

	* Makefile.am: Add libgcobol.spec and dependency.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Add libgcobol.spec handling.
	* libgcobol.spec.in: New file.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-05 14:24:33 +01:00
Iain Sandoe
b90364ee1c libgcobol: C++-ify the configuration steps.
Currently, the library is configured as if it was written in C, however
all the sources are C++, so update to use C++ as the configure language
(and check the CXX instead of CC).

Reorder the configuration steps so that we setup the tools and environment
before carrying out tests.

Remove unused configuration machinery.

Also we configured extra ld flags but never used them. There is no need
to make these extra_ldflags darwin-specific, additions could be required
by other hosts.

libgcobol/ChangeLog:

	* aclocal.m4: Regenerate.
	* config.h.in: Regenerate.
	* Makefile.am: Use the configured LIBS and extra_ldflags.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Shift configure to use c++. Order tests for tools
	and environment before other tests.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-05 14:22:53 +01:00
Iain Sandoe
8f1f35f1cb libgcobol: Check if the target needs libm.
Use the libtool config check and $(LIBM).

libgcobol/ChangeLog:

	* Makefile.am: Use $(LIBM) to add the math lib when
	it is needed.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check if the target wants libm.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-04 19:38:16 +01:00
Iain Sandoe
b6aafe9a5b libgcobol: Provide fallbacks for C32 strfromf32/64 functions.
strfrom{f,d,l,fN) are all C23 and might not be available in general.
This uses snprintf() to provide fall-backs where the libc does not
yet have support.

libgcobol/ChangeLog:

	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check for availability of strfromf32 and
	strfromf64.
	* libgcobol.cc (strfromf32, strfromf64): New.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-03 14:33:59 +01:00
Iain Sandoe
66a41a0a96 libgcobol: Only use random_r if it is available [PR119295]
We do not have a replacement at the moment, so fall back to using
regular random and friends.

	PR cobol/119295

libgcobol/ChangeLog:

	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Configure random_r and friends
	* intrinsic.cc (__gg__random): Use random_r when available.
	(__gg__random_next): Likewise.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-03 14:33:27 +01:00
Iain Sandoe
4f68873e0d libgcobol: Add configure checks for iconv.
Some targets might need to add libraries to get iconv support.

libgcobol/ChangeLog:

	* Makefile.am: Use LIBICONV.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check for iconv support.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-20 19:50:51 +00:00
Richard Biener
ddcb471e76 cobol/119281 - make sure $(gcc_version) is set for libgcobol install
When using --enable-version-specific-runtime-libs at least it's
required that $(gcc_version) is set to be able to expand
toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'

The following fixes this by adjusting configure.ac to call GCC_BASE_VER
and Makefile.am to include a definition for gcc_version.

libgcobol/
	* Makefile.am: Define gcc_version.
	* configure.ac: Execute GCC_BASE_VER.
	* Makefile.in: Regenerated.
	* configure: Likewise.
2025-03-14 13:32:15 +01:00
Jakub Jelinek
09c2a0ab94 cobol: Fix up libgcobol configure [PR119216]
Sorry, seems I've screwed up the earlier libgcobol/configure.tgt change.
Looking in more detail, the way e.g. libsanitizer/configure.tgt works is
that it is sourced twice, once at toplevel and there it just sets
UNSUPPORTED=1 for fully unsupported triplets, and then inside of
libsanitizer/configure where it decides to include or not include the
various sublibraries depending on the *_SUPPORTED flags.

So, the following patch attempts to do the same for libgcobol as well.

The BIULD_LIBGCOBOL automake conditional was unused, this patch guards it
on LIBGCOBOL_SUPPORTED as well and guards with it
toolexeclib_LTLIBRARIES  = libgcobol.la

Also, AM_CFLAGS has been changed to AM_CXXFLAGS as there are just C++
sources in the library.

2025-03-11  Jakub Jelinek  <jakub@redhat.com>

	PR cobol/119216
	* configure.ac: Check for UNSUPPORTED set by libgcobol/configure.tgt
	rather than LIBGCOBOL_SUPPORTED.
	* configure: Regenerate.
libgcobol/
	* configure.tgt: On fully unsupported targets set UNSUPPORTED=1.
	* configure.ac: Add AC_CHECK_SIZEOF([void *]), source in
	configure.tgt and set BUILD_LIBGCOBOL also based on
	LIBGCOBOL_SUPPORTED.
	* Makefile.am (toolexeclib_LTLIBRARIES): Conditionalize on
	BUILD_LIBGCOBOL.
	(AM_CFLAGS): Rename to ...
	(AM_CXXFLAGS): ... this.
	(%.lo: %.cc): Use $(AM_CXXFLAGS) rather than $(AM_CFLAGS).
	* configure: Regenerate.
	* Makefile.in: Regenerate.
2025-03-11 14:36:53 +01:00
James K. Lowden
a075418727 COBOL: libgcobol
libgcobol/
	* Makefile.am: New file.
	* Makefile.in: Autogenerate.
	* acinclude.m4: Likewise.
	* aclocal.m4: Likewise.
	* configure.ac: New file.
	* configure: Autogenerate.
	* configure.tgt: New file.
	* README: New file.
	* charmaps.cc: New file.
	* config.h.in: New file.
	* constants.cc: New file.
	* gfileio.cc: New file.
	* gmath.cc: New file.
	* io.cc: New file.
	* valconv.cc: New file.
	* charmaps.h: New file.
	* common-defs.h: New file.
	* ec.h: New file.
	* exceptl.h: New file.
	* gcobolio.h: New file.
	* gfileio.h: New file.
	* gmath.h: New file.
	* io.h: New file.
	* libgcobol.h: New file.
	* valconv.h: New file.
	* libgcobol.cc: New file.
	* intrinsic.cc: New file.
2025-03-11 07:48:15 +01:00