> On 10 Apr 2025, at 17:36, Jakub Jelinek <ja...@redhat.com> wrote:
>
> On Wed, Apr 09, 2025 at 02:22:16PM +0200, Rainer Orth wrote:
>>> Here is what I'm testing as an incremental fix, so far OK on x86_64-darwin
>>> and powerpcle64 (GLIBC 2.34) .. others in progress. Does it help the
>>> Solaris cases?
>>
>> I'll give it a try. Here's what I have (I believe it's more readable in
>> some cases), but as I said something's not right yet (probably something
>> very stupid).
>
> Yes, most importantly
>
>> #if !defined (HAVE_STRFROMF128)
>> -# if !USE_QUADMATH
>> +static int
>> +strfromf128 (char *s, size_t n, const char *f, long double v)
>
> this long double should have been GCOB_FP128.
>
> Anyway, I think there should be consistency in what we use, so like
> libgcobol-fp.h specifies, IEEE quad long double should have highest
> priority, then _Float128 with *f128 APIs, then libquadmath.
> And when we decide to use say long double, we shouldn't mix that with
> strfromf128/strtof128.
>
> Additionally, given that the *l vs. *f128 vs. *q API decision is done
> solely in libgcobol and not in the compiler (which is different from
> the Fortran case where compiled code emits say sinq or sinf128 calls),
> I think libgcobol.spec should only have -lquadmath in any form only in
> the case when using libquadmath for everything. In the Fortran case
> it is for backwards compatibility purposes, if something has been
> compiled with older gfortran which used say sinq and link is done by
> gfortran which has been configured against new glibc with *f128, linking
> would fail otherwise.
>
> So, here is an updated patch based on your patch, so far briefly
> tested on x86_64 with recent glibc (i.e. with the *f128 APIs).
makes sense to me - and builds and tests on x86_64-darwin (which needs
libquadmath) without issue.
Iain
>
> 2025-04-10 Jakub Jelinek <ja...@redhat.com>
> Rainer Orth <r...@cebitec.uni-bielefeld.de>
>
> PR cobol/119244
> * acinclude.m4 (LIBGCOBOL_CHECK_FLOAT128): Ensure
> libgcob_cv_have_float128 is not yes on targets with IEEE quad
> long double. Don't check for --as-needed nor set LIBQUADSPEC
> on targets which USE_IEC_60559.
> * libgcobol-fp.h (FP128_FMT, strtofp128, strfromfp128): Define.
> * intrinsic.cc (strtof128): Don't redefine.
> (WEIRD_TRANSCENDENT_RETURN_VALUE): Use GCOB_FP128_LITERAL macro.
> (__gg__numval_f): Use strtofp128 instead of strtof128.
> * libgcobol.cc (strtof128): Don't redefine.
> (format_for_display_internal): Use strfromfp128 instead of
> strfromf128 or quadmath_snprintf and use FP128_FMT in the format
> string.
> (get_float128, __gg__compare_2, __gg__move, __gg__move_literala):
> Use strtofp128 instead of strtof128.
> * configure: Regenerate.
>
> --- libgcobol/acinclude.m4.jj 2025-04-10 17:14:36.535278015 +0200
> +++ libgcobol/acinclude.m4 2025-04-10 17:33:56.012347476 +0200
> @@ -44,6 +44,10 @@ AC_DEFUN([LIBGCOBOL_CHECK_FLOAT128], [
> AC_CACHE_CHECK([whether we have a usable _Float128 type],
> libgcob_cv_have_float128, [
> GCC_TRY_COMPILE_OR_LINK([
> +#if __LDBL_MANT_DIG__ == 113 && __LDBL_MIN_EXP__ == -16381
> +#error "long double is IEEE quad, no need for libquadmath"
> +#endif
> +
> _Float128 foo (_Float128 x)
> {
> _Complex _Float128 z1, z2;
> @@ -90,32 +94,22 @@ AC_DEFUN([LIBGCOBOL_CHECK_FLOAT128], [
> fi
> AC_DEFINE(HAVE_FLOAT128, 1, [Define if target has usable _Float128 and
> __float128 types.])
>
> - dnl Check whether -Wl,--as-needed resp. -Wl,-zignore is supported
> - dnl
> - dnl Turn warnings into error to avoid testsuite breakage. So enable
> - dnl AC_LANG_WERROR, but there's currently (autoconf 2.64) no way to turn
> - dnl it off again. As a workaround, save and restore werror flag like
> - dnl AC_PATH_XTRA.
> - dnl Cf. http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01889.html
> -
> ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag=$ac_[]_AC_LANG_ABBREV[]_werror_flag
> - AC_CACHE_CHECK([whether --as-needed/-z ignore works],
> - [libgcob_cv_have_as_needed],
> - [
> - # Test for native Solaris options first.
> - # No whitespace after -z to pass it through -Wl.
> - libgcob_cv_as_needed_option="-zignore"
> - libgcob_cv_no_as_needed_option="-zrecord"
> - save_LDFLAGS="$LDFLAGS"
> - LDFLAGS="$LDFLAGS -Wl,$libgcob_cv_as_needed_option -lm
> -Wl,$libgcob_cv_no_as_needed_option"
> - libgcob_cv_have_as_needed=no
> - AC_LANG_WERROR
> - AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
> - [libgcob_cv_have_as_needed=yes],
> - [libgcob_cv_have_as_needed=no])
> - LDFLAGS="$save_LDFLAGS"
> - if test "x$libgcob_cv_have_as_needed" = xno; then
> - libgcob_cv_as_needed_option="--as-needed"
> - libgcob_cv_no_as_needed_option="--no-as-needed"
> + if test "x$USE_IEC_60559" != xyes; then
> + dnl Check whether -Wl,--as-needed resp. -Wl,-zignore is supported
> + dnl
> + dnl Turn warnings into error to avoid testsuite breakage. So enable
> + dnl AC_LANG_WERROR, but there's currently (autoconf 2.64) no way to
> turn
> + dnl it off again. As a workaround, save and restore werror flag like
> + dnl AC_PATH_XTRA.
> + dnl Cf. http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01889.html
> +
> ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag=$ac_[]_AC_LANG_ABBREV[]_werror_flag
> + AC_CACHE_CHECK([whether --as-needed/-z ignore works],
> + [libgcob_cv_have_as_needed],
> + [
> + # Test for native Solaris options first.
> + # No whitespace after -z to pass it through -Wl.
> + libgcob_cv_as_needed_option="-zignore"
> + libgcob_cv_no_as_needed_option="-zrecord"
> save_LDFLAGS="$LDFLAGS"
> LDFLAGS="$LDFLAGS -Wl,$libgcob_cv_as_needed_option -lm
> -Wl,$libgcob_cv_no_as_needed_option"
> libgcob_cv_have_as_needed=no
> @@ -124,45 +118,51 @@ AC_DEFUN([LIBGCOBOL_CHECK_FLOAT128], [
> [libgcob_cv_have_as_needed=yes],
> [libgcob_cv_have_as_needed=no])
> LDFLAGS="$save_LDFLAGS"
> - fi
> -
> ac_[]_AC_LANG_ABBREV[]_werror_flag=$ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag
> - ])
> -
> - dnl Determine -Bstatic ... -Bdynamic etc. support from gfortran -###
> stderr.
> - touch conftest1.$ac_objext conftest2.$ac_objext
> - LQUADMATH=-lquadmath
> - $CXX -static-libgcobol -### -o conftest \
> - conftest1.$ac_objext -lgcobol conftest2.$ac_objext 2>&1 >/dev/null \
> - | grep "conftest1.$ac_objext.*conftest2.$ac_objext" > conftest.cmd
> - if grep "conftest1.$ac_objext.* -Bstatic -lgcobol -Bdynamic
> .*conftest2.$ac_objext" \
> - conftest.cmd >/dev/null 2>&1; then
> - LQUADMATH="%{static-libquadmath:-Bstatic} -lquadmath
> %{static-libquadmath:-Bdynamic}"
> - elif grep "conftest1.$ac_objext.* -bstatic -lgcobol -bdynamic
> .*conftest2.$ac_objext" \
> - conftest.cmd >/dev/null 2>&1; then
> - LQUADMATH="%{static-libquadmath:-bstatic} -lquadmath
> %{static-libquadmath:-bdynamic}"
> - elif grep "conftest1.$ac_objext.* -aarchive_shared -lgcobol -adefault
> .*conftest2.$ac_objext" \
> - conftest.cmd >/dev/null 2>&1; then
> - LQUADMATH="%{static-libquadmath:-aarchive_shared} -lquadmath
> %{static-libquadmath:-adefault}"
> - elif grep "conftest1.$ac_objext.*libgcobol.a .*conftest2.$ac_objext" \
> + if test "x$libgcob_cv_have_as_needed" = xno; then
> + libgcob_cv_as_needed_option="--as-needed"
> + libgcob_cv_no_as_needed_option="--no-as-needed"
> + save_LDFLAGS="$LDFLAGS"
> + LDFLAGS="$LDFLAGS -Wl,$libgcob_cv_as_needed_option -lm
> -Wl,$libgcob_cv_no_as_needed_option"
> + libgcob_cv_have_as_needed=no
> + AC_LANG_WERROR
> + AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
> + [libgcob_cv_have_as_needed=yes],
> + [libgcob_cv_have_as_needed=no])
> + LDFLAGS="$save_LDFLAGS"
> + fi
> +
> ac_[]_AC_LANG_ABBREV[]_werror_flag=$ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag
> + ])
> +
> + dnl Determine -Bstatic ... -Bdynamic etc. support from gfortran -###
> stderr.
> + touch conftest1.$ac_objext conftest2.$ac_objext
> + LQUADMATH=-lquadmath
> + $CXX -static-libgcobol -### -o conftest \
> + conftest1.$ac_objext -lgcobol conftest2.$ac_objext 2>&1 >/dev/null \
> + | grep "conftest1.$ac_objext.*conftest2.$ac_objext" > conftest.cmd
> + if grep "conftest1.$ac_objext.* -Bstatic -lgcobol -Bdynamic
> .*conftest2.$ac_objext" \
> + conftest.cmd >/dev/null 2>&1; then
> + LQUADMATH="%{static-libquadmath:-Bstatic} -lquadmath
> %{static-libquadmath:-Bdynamic}"
> + elif grep "conftest1.$ac_objext.* -bstatic -lgcobol -bdynamic
> .*conftest2.$ac_objext" \
> + conftest.cmd >/dev/null 2>&1; then
> + LQUADMATH="%{static-libquadmath:-bstatic} -lquadmath
> %{static-libquadmath:-bdynamic}"
> + elif grep "conftest1.$ac_objext.* -aarchive_shared -lgcobol -adefault
> .*conftest2.$ac_objext" \
> + conftest.cmd >/dev/null 2>&1; then
> + LQUADMATH="%{static-libquadmath:-aarchive_shared} -lquadmath
> %{static-libquadmath:-adefault}"
> + elif grep "conftest1.$ac_objext.*libgcobol.a .*conftest2.$ac_objext" \
> conftest.cmd >/dev/null 2>&1; then
> - LQUADMATH="%{static-libquadmath:libquadmath.a%s;:-lquadmath}"
> - fi
> - rm -f conftest1.$ac_objext conftest2.$ac_objext conftest conftest.cmd
> + LQUADMATH="%{static-libquadmath:libquadmath.a%s;:-lquadmath}"
> + fi
> + rm -f conftest1.$ac_objext conftest2.$ac_objext conftest conftest.cmd
>
> - dnl For static libgcobol linkage, depend on libquadmath only if needed.
> - dnl If using *f128 APIs from libc/libm, depend on libquadmath only if
> needed
> - dnl even for dynamic libgcobol linkage, and don't link libgcobol against
> - dnl -lquadmath.
> - if test "x$libgcob_cv_have_as_needed" = xyes; then
> - if test "x$USE_IEC_60559" = xyes; then
> - LIBQUADSPEC="$libgcob_cv_as_needed_option $LQUADMATH
> $libgcob_cv_no_as_needed_option"
> + if test "x$libgcob_cv_have_as_needed" = xyes; then
> + if test "x$USE_IEC_60559" = xyes; then
> + LIBQUADSPEC="$libgcob_cv_as_needed_option $LQUADMATH
> $libgcob_cv_no_as_needed_option"
> + else
> + LIBQUADSPEC="%{static-libgcobol:$libgcob_cv_as_needed_option}
> $LQUADMATH %{static-libgcobol:$libgcob_cv_no_as_needed_option}"
> + fi
> else
> - LIBQUADSPEC="%{static-libgcobol:$libgcob_cv_as_needed_option}
> $LQUADMATH %{static-libgcobol:$libgcob_cv_no_as_needed_option}"
> + LIBQUADSPEC="$LQUADMATH"
> fi
> - else
> - LIBQUADSPEC="$LQUADMATH"
> - fi
> - if test "x$USE_IEC_60559" != xyes; then
> if test -f ../libquadmath/libquadmath.la; then
> LIBQUADLIB=../libquadmath/libquadmath.la
> LIBQUADLIB_DEP=../libquadmath/libquadmath.la
> --- libgcobol/libgcobol-fp.h.jj 2025-04-10 17:14:36.586277313 +0200
> +++ libgcobol/libgcobol-fp.h 2025-04-10 18:18:20.368674022 +0200
> @@ -28,17 +28,26 @@ see the files COPYING3 and COPYING.RUNTI
> # define GCOB_FP128 long double
> # define GCOB_FP128_LITERAL(lit) (lit ## l)
> # define FP128_FUNC(funcname) funcname ## l
> +# define FP128_FMT "L"
> +# define strtofp128(nptr, endptr) strtold(nptr, endptr)
> +# define strfromfp128(str, n, format, fp) snprintf(str, n, format, fp)
> #elif __FLT128_MANT_DIG__ == 113 && __FLT128_MIN_EXP__ == -16381 \
> && defined(USE_IEC_60559)
> // Use _Float128, f128 suffix on calls, f128 or F128 suffix on literals
> # define GCOB_FP128 _Float128
> # define GCOB_FP128_LITERAL(lit) (lit ## f128)
> # define FP128_FUNC(funcname) funcname ## f128
> +# define FP128_FMT ""
> +# define strtofp128(nptr, endptr) strtof128(nptr, endptr)
> +# define strfromfp128(str, n, format, fp) strfromf128(str, n, format, fp)
> #elif __FLT128_MANT_DIG__ == 113 && __FLT128_MIN_EXP__ == -16381
> // Use __float128, q suffix on calls, q or Q suffix on literals
> # define GCOB_FP128 __float128
> # define GCOB_FP128_LITERAL(lit) (lit ## q)
> # define FP128_FUNC(funcname) funcname ## q
> +# define FP128_FMT "Q"
> +# define strtofp128(nptr, endptr) strtoflt128(nptr, endptr)
> +# define strfromfp128(str, n, format, fp) quadmath_snprintf(str, n, format,
> fp)
> #else
> # error "libgcobol requires 128b floating point"
> #endif
> --- libgcobol/intrinsic.cc.jj 2025-04-10 17:14:36.586277313 +0200
> +++ libgcobol/intrinsic.cc 2025-04-10 18:29:58.142064132 +0200
> @@ -55,19 +55,11 @@
> #include "charmaps.h"
>
>
> -#if !defined (HAVE_STRTOF128)
> -# if USE_QUADMATH
> -# define strtof128 strtoflt128
> -# else
> -# error "no available string to float 128"
> -# endif
> -#endif
> -
> #pragma GCC diagnostic ignored "-Wformat-truncation"
>
> #define JD_OF_1601_01_02 2305812.5
>
> -#define WEIRD_TRANSCENDENT_RETURN_VALUE (0.0Q)
> +#define WEIRD_TRANSCENDENT_RETURN_VALUE GCOB_FP128_LITERAL (0.0)
> #define NO_RDIGITS (0)
>
> struct cobol_tm
> @@ -5016,7 +5008,7 @@ __gg__numval_f( cblc_field_t *dest,
> }
> }
> *p++ = '\0';
> - value = strtof128(ach, NULL);
> + value = strtofp128(ach, NULL);
> }
> __gg__float128_to_field(dest,
> value,
> --- libgcobol/libgcobol.cc.jj 2025-04-10 17:14:36.591277244 +0200
> +++ libgcobol/libgcobol.cc 2025-04-10 18:17:29.393376065 +0200
> @@ -93,20 +93,6 @@ strfromf64 (char *s, size_t n, const cha
> # endif
> #endif
>
> -#if !defined (HAVE_STRFROMF128)
> -# if !USE_QUADMATH
> -# error "no available float 128 to string"
> -# endif
> -#endif
> -
> -#if !defined (HAVE_STRTOF128)
> -# if USE_QUADMATH
> -# define strtof128 strtoflt128
> -# else
> -# error "no available string to float 128"
> -# endif
> -#endif
> -
> // This couldn't be defined in symbols.h because it conflicts with a LEVEL66
> // in parse.h
> #define LEVEL66 (66)
> @@ -3265,11 +3251,7 @@ format_for_display_internal(char **dest,
> // on a 16-bit boundary.
> GCOB_FP128 floatval;
> memcpy(&floatval, actual_location, 16);
> -#if !defined (HAVE_STRFROMF128) && USE_QUADMATH
> - quadmath_snprintf(ach, sizeof(ach), "%.36QE", floatval);
> -#else
> - strfromf128(ach, sizeof(ach), "%.36E", floatval);
> -#endif
> + strfromfp128(ach, sizeof(ach), "%.36" FP128_FMT "E", floatval);
> char *p = strchr(ach, 'E');
> if( !p )
> {
> @@ -3291,13 +3273,8 @@ format_for_display_internal(char **dest,
>
> int precision = 36 - exp;
> char achFormat[24];
> -#if !defined (HAVE_STRFROMF128) && USE_QUADMATH
> - sprintf(achFormat, "%%.%dQf", precision);
> - quadmath_snprintf(ach, sizeof(ach), achFormat, floatval);
> -#else
> - sprintf(achFormat, "%%.%df", precision);
> - strfromf128(ach, sizeof(ach), achFormat, floatval);
> -#endif
> + sprintf(achFormat, "%%.%d" FP128_FMT "f", precision);
> + strfromfp128(ach, sizeof(ach), achFormat, floatval);
> }
> __gg__remove_trailing_zeroes(ach);
> __gg__realloc_if_necessary(dest, dest_size, strlen(ach)+1);
> @@ -3536,7 +3513,7 @@ get_float128( cblc_field_t *field,
> {
> if( __gg__decimal_point == '.' )
> {
> - retval = strtof128(field->initial, NULL);
> + retval = strtofp128(field->initial, NULL);
> }
> else
> {
> @@ -3554,7 +3531,7 @@ get_float128( cblc_field_t *field,
> {
> *p = '.';
> }
> - retval = strtof128(buffer, NULL);
> + retval = strtofp128(buffer, NULL);
> }
> }
> else
> @@ -4251,7 +4228,7 @@ __gg__compare_2(cblc_field_t *left_side,
> //_Float128 left_value = *(_Float128 *)left_location;
> GCOB_FP128 left_value;
> memcpy(&left_value, left_location, 16);
> - GCOB_FP128 right_value = strtof128(buffer, NULL);
> + GCOB_FP128 right_value = strtofp128(buffer, NULL);
> retval = 0;
> retval = left_value < right_value ? -1 : retval;
> retval = left_value > right_value ? 1 : retval;
> @@ -6001,8 +5978,8 @@ __gg__move( cblc_field_t *fdest,
> }
> case 16:
> {
> - //*(_Float128 *)(fdest->data+dest_offset) = strtof128(ach,
> NULL);
> - GCOB_FP128 t = strtof128(ach, NULL);
> + //*(_Float128 *)(fdest->data+dest_offset) = strtofp128(ach,
> NULL);
> + GCOB_FP128 t = strtofp128(ach, NULL);
> memcpy(fdest->data+dest_offset, &t, 16);
> break;
> }
> @@ -6171,7 +6148,7 @@ __gg__move_literala(cblc_field_t *field,
> }
> case 16:
> {
> - GCOB_FP128 t = strtof128(ach, NULL);
> + GCOB_FP128 t = strtofp128(ach, NULL);
> memcpy(field->data+field_offset, &t, 16);
> break;
> }
> --- libgcobol/configure.jj 2025-04-10 17:14:36.554277754 +0200
> +++ libgcobol/configure 2025-04-10 17:34:21.897992410 +0200
> @@ -17172,6 +17172,10 @@ else
> cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> /* end confdefs.h. */
>
> +#if __LDBL_MANT_DIG__ == 113 && __LDBL_MIN_EXP__ == -16381
> +#error "long double is IEEE quad, no need for libquadmath"
> +#endif
> +
> _Float128 foo (_Float128 x)
> {
> _Complex _Float128 z1, z2;
> @@ -17225,6 +17229,10 @@ fi
> cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> /* end confdefs.h. */
>
> +#if __LDBL_MANT_DIG__ == 113 && __LDBL_MIN_EXP__ == -16381
> +#error "long double is IEEE quad, no need for libquadmath"
> +#endif
> +
> _Float128 foo (_Float128 x)
> {
> _Complex _Float128 z1, z2;
> @@ -17296,23 +17304,24 @@ $as_echo "#define USE_QUADMATH 1" >>conf
> $as_echo "#define HAVE_FLOAT128 1" >>confdefs.h
>
>
> - ac_xsave_cxx_werror_flag=$ac_cxx_werror_flag
> - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether --as-needed/-z
> ignore works" >&5
> + if test "x$USE_IEC_60559" != xyes; then
> +
> ac_xsave_cxx_werror_flag=$ac_cxx_werror_flag
> + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether
> --as-needed/-z ignore works" >&5
> $as_echo_n "checking whether --as-needed/-z ignore works... " >&6; }
> if ${libgcob_cv_have_as_needed+:} false; then :
> $as_echo_n "(cached) " >&6
> else
>
> - # Test for native Solaris options first.
> - # No whitespace after -z to pass it through -Wl.
> - libgcob_cv_as_needed_option="-zignore"
> - libgcob_cv_no_as_needed_option="-zrecord"
> - save_LDFLAGS="$LDFLAGS"
> - LDFLAGS="$LDFLAGS -Wl,$libgcob_cv_as_needed_option -lm
> -Wl,$libgcob_cv_no_as_needed_option"
> - libgcob_cv_have_as_needed=no
> + # Test for native Solaris options first.
> + # No whitespace after -z to pass it through -Wl.
> + libgcob_cv_as_needed_option="-zignore"
> + libgcob_cv_no_as_needed_option="-zrecord"
> + save_LDFLAGS="$LDFLAGS"
> + LDFLAGS="$LDFLAGS -Wl,$libgcob_cv_as_needed_option -lm
> -Wl,$libgcob_cv_no_as_needed_option"
> + libgcob_cv_have_as_needed=no
>
> ac_cxx_werror_flag=yes
> - if test x$gcc_no_link = xyes; then
> + if test x$gcc_no_link = xyes; then
> as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES."
> "$LINENO" 5
> fi
> cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> @@ -17333,16 +17342,16 @@ else
> fi
> rm -f core conftest.err conftest.$ac_objext \
> conftest$ac_exeext conftest.$ac_ext
> - LDFLAGS="$save_LDFLAGS"
> - if test "x$libgcob_cv_have_as_needed" = xno; then
> - libgcob_cv_as_needed_option="--as-needed"
> - libgcob_cv_no_as_needed_option="--no-as-needed"
> - save_LDFLAGS="$LDFLAGS"
> - LDFLAGS="$LDFLAGS -Wl,$libgcob_cv_as_needed_option -lm
> -Wl,$libgcob_cv_no_as_needed_option"
> - libgcob_cv_have_as_needed=no
> + LDFLAGS="$save_LDFLAGS"
> + if test "x$libgcob_cv_have_as_needed" = xno; then
> + libgcob_cv_as_needed_option="--as-needed"
> + libgcob_cv_no_as_needed_option="--no-as-needed"
> + save_LDFLAGS="$LDFLAGS"
> + LDFLAGS="$LDFLAGS -Wl,$libgcob_cv_as_needed_option -lm
> -Wl,$libgcob_cv_no_as_needed_option"
> + libgcob_cv_have_as_needed=no
>
> ac_cxx_werror_flag=yes
> - if test x$gcc_no_link = xyes; then
> + if test x$gcc_no_link = xyes; then
> as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES."
> "$LINENO" 5
> fi
> cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> @@ -17363,44 +17372,43 @@ else
> fi
> rm -f core conftest.err conftest.$ac_objext \
> conftest$ac_exeext conftest.$ac_ext
> - LDFLAGS="$save_LDFLAGS"
> - fi
> - ac_cxx_werror_flag=$ac_xsave_cxx_werror_flag
> + LDFLAGS="$save_LDFLAGS"
> + fi
> + ac_cxx_werror_flag=$ac_xsave_cxx_werror_flag
>
> fi
> { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcob_cv_have_as_needed"
> >&5
> $as_echo "$libgcob_cv_have_as_needed" >&6; }
>
> - touch conftest1.$ac_objext conftest2.$ac_objext
> - LQUADMATH=-lquadmath
> - $CXX -static-libgcobol -### -o conftest \
> - conftest1.$ac_objext -lgcobol conftest2.$ac_objext 2>&1 >/dev/null \
> - | grep "conftest1.$ac_objext.*conftest2.$ac_objext" > conftest.cmd
> - if grep "conftest1.$ac_objext.* -Bstatic -lgcobol -Bdynamic
> .*conftest2.$ac_objext" \
> - conftest.cmd >/dev/null 2>&1; then
> - LQUADMATH="%{static-libquadmath:-Bstatic} -lquadmath
> %{static-libquadmath:-Bdynamic}"
> - elif grep "conftest1.$ac_objext.* -bstatic -lgcobol -bdynamic
> .*conftest2.$ac_objext" \
> - conftest.cmd >/dev/null 2>&1; then
> - LQUADMATH="%{static-libquadmath:-bstatic} -lquadmath
> %{static-libquadmath:-bdynamic}"
> - elif grep "conftest1.$ac_objext.* -aarchive_shared -lgcobol -adefault
> .*conftest2.$ac_objext" \
> - conftest.cmd >/dev/null 2>&1; then
> - LQUADMATH="%{static-libquadmath:-aarchive_shared} -lquadmath
> %{static-libquadmath:-adefault}"
> - elif grep "conftest1.$ac_objext.*libgcobol.a .*conftest2.$ac_objext" \
> + touch conftest1.$ac_objext conftest2.$ac_objext
> + LQUADMATH=-lquadmath
> + $CXX -static-libgcobol -### -o conftest \
> + conftest1.$ac_objext -lgcobol conftest2.$ac_objext 2>&1 >/dev/null \
> + | grep "conftest1.$ac_objext.*conftest2.$ac_objext" > conftest.cmd
> + if grep "conftest1.$ac_objext.* -Bstatic -lgcobol -Bdynamic
> .*conftest2.$ac_objext" \
> + conftest.cmd >/dev/null 2>&1; then
> + LQUADMATH="%{static-libquadmath:-Bstatic} -lquadmath
> %{static-libquadmath:-Bdynamic}"
> + elif grep "conftest1.$ac_objext.* -bstatic -lgcobol -bdynamic
> .*conftest2.$ac_objext" \
> + conftest.cmd >/dev/null 2>&1; then
> + LQUADMATH="%{static-libquadmath:-bstatic} -lquadmath
> %{static-libquadmath:-bdynamic}"
> + elif grep "conftest1.$ac_objext.* -aarchive_shared -lgcobol -adefault
> .*conftest2.$ac_objext" \
> + conftest.cmd >/dev/null 2>&1; then
> + LQUADMATH="%{static-libquadmath:-aarchive_shared} -lquadmath
> %{static-libquadmath:-adefault}"
> + elif grep "conftest1.$ac_objext.*libgcobol.a .*conftest2.$ac_objext" \
> conftest.cmd >/dev/null 2>&1; then
> - LQUADMATH="%{static-libquadmath:libquadmath.a%s;:-lquadmath}"
> - fi
> - rm -f conftest1.$ac_objext conftest2.$ac_objext conftest conftest.cmd
> + LQUADMATH="%{static-libquadmath:libquadmath.a%s;:-lquadmath}"
> + fi
> + rm -f conftest1.$ac_objext conftest2.$ac_objext conftest conftest.cmd
>
> - if test "x$libgcob_cv_have_as_needed" = xyes; then
> - if test "x$USE_IEC_60559" = xyes; then
> - LIBQUADSPEC="$libgcob_cv_as_needed_option $LQUADMATH
> $libgcob_cv_no_as_needed_option"
> + if test "x$libgcob_cv_have_as_needed" = xyes; then
> + if test "x$USE_IEC_60559" = xyes; then
> + LIBQUADSPEC="$libgcob_cv_as_needed_option $LQUADMATH
> $libgcob_cv_no_as_needed_option"
> + else
> + LIBQUADSPEC="%{static-libgcobol:$libgcob_cv_as_needed_option}
> $LQUADMATH %{static-libgcobol:$libgcob_cv_no_as_needed_option}"
> + fi
> else
> - LIBQUADSPEC="%{static-libgcobol:$libgcob_cv_as_needed_option}
> $LQUADMATH %{static-libgcobol:$libgcob_cv_no_as_needed_option}"
> + LIBQUADSPEC="$LQUADMATH"
> fi
> - else
> - LIBQUADSPEC="$LQUADMATH"
> - fi
> - if test "x$USE_IEC_60559" != xyes; then
> if test -f ../libquadmath/libquadmath.la; then
> LIBQUADLIB=../libquadmath/libquadmath.la
> LIBQUADLIB_DEP=../libquadmath/libquadmath.la
>
> Jakub
>