cobol, v2: Fix up libgcobol configure [PR119216]
Commit Message
On Tue, Mar 11, 2025 at 01:24:53PM +0100, Jakub Jelinek wrote:
> 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.
>
> Seems to work in quick testing on x86_64-linux (64-bit libgcobol is built
> and installed, 32-bit libgcobol is not built but directory created).
> Ok for trunk?
>
> Though, I admittedly don't know why. Because the BUILD_LIBGCOBOL
> conditional actually isn't used in libgcobol/Makefile.am, I would have
> expected something like
> if BUILD_LIBGCOBOL
> toolexeclib_LTLIBRARIES = libgcobol.la
> endif
It "worked" only because it is unused, had a missing test after &&.
Here is an adjusted patch which also adds the if BUILD_LIBGCOBOL conditional
and also because there are no *.c sources in the library just renames
AM_CFLAGS to AM_CXXFLAGS.
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.
Jakub
Comments
On Tue, 11 Mar 2025, Jakub Jelinek wrote:
> On Tue, Mar 11, 2025 at 01:24:53PM +0100, Jakub Jelinek wrote:
> > 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.
> >
> > Seems to work in quick testing on x86_64-linux (64-bit libgcobol is built
> > and installed, 32-bit libgcobol is not built but directory created).
> > Ok for trunk?
> >
> > Though, I admittedly don't know why. Because the BUILD_LIBGCOBOL
> > conditional actually isn't used in libgcobol/Makefile.am, I would have
> > expected something like
> > if BUILD_LIBGCOBOL
> > toolexeclib_LTLIBRARIES = libgcobol.la
> > endif
>
> It "worked" only because it is unused, had a missing test after &&.
> Here is an adjusted patch which also adds the if BUILD_LIBGCOBOL conditional
> and also because there are no *.c sources in the library just renames
> AM_CFLAGS to AM_CXXFLAGS.
OK.
Thanks,
Richard.
> 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.
>
> --- configure.ac.jj 2025-03-11 11:49:20.656965644 +0100
> +++ configure.ac 2025-03-11 12:51:36.974872317 +0100
> @@ -768,7 +768,7 @@ if test -d ${srcdir}/libgcobol; then
> AC_MSG_CHECKING([for libgcobol support])
> if (srcdir=${srcdir}/libgcobol; \
> . ${srcdir}/configure.tgt; \
> - test "$LIBGCOBOL_SUPPORTED" != "yes")
> + test -n "$UNSUPPORTED")
> then
> AC_MSG_RESULT([no])
> noconfigdirs="$noconfigdirs target-libgcobol"
> --- configure.jj 2025-03-11 11:49:20.655965658 +0100
> +++ configure 2025-03-11 12:52:03.213513543 +0100
> @@ -3546,7 +3546,7 @@ if test -d ${srcdir}/libgcobol; then
> $as_echo_n "checking for libgcobol support... " >&6; }
> if (srcdir=${srcdir}/libgcobol; \
> . ${srcdir}/configure.tgt; \
> - test "$LIBGCOBOL_SUPPORTED" != "yes")
> + test -n "$UNSUPPORTED")
> then
> { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> $as_echo "no" >&6; }
> --- libgcobol/configure.tgt.jj 2025-03-11 11:49:50.652554929 +0100
> +++ libgcobol/configure.tgt 2025-03-11 12:50:22.292893456 +0100
> @@ -39,4 +39,7 @@ case "${target}" in
> LIBGCOBOL_SUPPORTED=yes
> fi
> ;;
> + *)
> + UNSUPPORTED=1
> + ;;
> esac
> --- libgcobol/configure.ac.jj 2025-03-11 09:18:22.133128278 +0100
> +++ libgcobol/configure.ac 2025-03-11 13:57:47.618574222 +0100
> @@ -34,8 +34,6 @@ AM_ENABLE_MULTILIB(, ..)
> # exported.
> ORIGINAL_LD_FOR_MULTILIBS=$LD
>
> -####. ${srcdir}/configure.tgt
> -
> GCC_NO_EXECUTABLES
>
> AC_USE_SYSTEM_EXTENSIONS
> @@ -62,6 +60,12 @@ ACX_NONCANONICAL_HOST
> ACX_NONCANONICAL_TARGET
> GCC_TOPLEV_SUBDIRS
>
> +AC_CHECK_SIZEOF([void *])
> +
> +# Get target configury.
> +unset LIBGCOBOL_SUPPORTED
> +. ${srcdir}/configure.tgt
> +
> # -----------------
> # __int128 support
> # -----------------
> @@ -90,7 +94,7 @@ AC_CACHE_CHECK([whether __int128 is supp
> # 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])
> +AM_CONDITIONAL(BUILD_LIBGCOBOL, [test "x$LIBGCOBOL_SUPPORTED" = xyes && test "x$libgcobol_cv_have_int128" = xyes])
>
> GCC_WITH_TOOLEXECLIBDIR
>
> --- libgcobol/Makefile.am.jj 2025-03-11 12:38:35.804566842 +0100
> +++ libgcobol/Makefile.am 2025-03-11 13:51:22.903824569 +0100
> @@ -22,7 +22,9 @@
> AUTOMAKE_OPTIONS = 1.8 foreign
> ACLOCAL_AMFLAGS = -I .. -I ../config
>
> +if BUILD_LIBGCOBOL
> toolexeclib_LTLIBRARIES = libgcobol.la
> +endif
>
> ##
> ## 2.2.12 Automatic Dependency Tracking
> @@ -48,10 +50,10 @@ libgcobol_la_LINK = $(LIBTOOL) --mode=li
> WARN_CFLAGS = -W -Wall -Wwrite-strings
>
> # not defined: DEFS, MAX_ERRORS, LTLDFLAGS
> -ALL_CFLAGS = -I. -I$(srcdir) $(AM_CPPFLAGS) $(DEFS) \
> +ALL_CXXFLAGS = -I. -I$(srcdir) $(AM_CPPFLAGS) $(DEFS) \
> $(XCFLAGS) $(AM_CXXFLAGS) $(WARN_CFLAGS) $(MAX_ERRORS) \
> -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing
>
> %.lo: %.cc
> $(LIBTOOL) --mode=compile --tag=CXX $(CXX) -c \
> - -o $@ $(INCLUDES) $(ALL_CFLAGS) $<
> + -o $@ $(INCLUDES) $(ALL_CXXFLAGS) $<
> --- libgcobol/configure.jj 2025-03-11 09:18:22.133128278 +0100
> +++ libgcobol/configure 2025-03-11 13:58:17.742161444 +0100
> @@ -1802,6 +1802,189 @@ $as_echo "$ac_res" >&6; }
>
> } # ac_fn_c_check_header_compile
>
> +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
> +# --------------------------------------------
> +# Tries to find the compile-time value of EXPR in a program that includes
> +# INCLUDES, setting VAR accordingly. Returns whether the value could be
> +# computed
> +ac_fn_c_compute_int ()
> +{
> + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
> + if test "$cross_compiling" = yes; then
> + # Depending upon the size, compute the lo and hi bounds.
> +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h. */
> +$4
> +int
> +main ()
> +{
> +static int test_array [1 - 2 * !(($2) >= 0)];
> +test_array [0] = 0;
> +return test_array [0];
> +
> + ;
> + return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> + ac_lo=0 ac_mid=0
> + while :; do
> + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h. */
> +$4
> +int
> +main ()
> +{
> +static int test_array [1 - 2 * !(($2) <= $ac_mid)];
> +test_array [0] = 0;
> +return test_array [0];
> +
> + ;
> + return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> + ac_hi=$ac_mid; break
> +else
> + as_fn_arith $ac_mid + 1 && ac_lo=$as_val
> + if test $ac_lo -le $ac_mid; then
> + ac_lo= ac_hi=
> + break
> + fi
> + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> + done
> +else
> + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h. */
> +$4
> +int
> +main ()
> +{
> +static int test_array [1 - 2 * !(($2) < 0)];
> +test_array [0] = 0;
> +return test_array [0];
> +
> + ;
> + return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> + ac_hi=-1 ac_mid=-1
> + while :; do
> + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h. */
> +$4
> +int
> +main ()
> +{
> +static int test_array [1 - 2 * !(($2) >= $ac_mid)];
> +test_array [0] = 0;
> +return test_array [0];
> +
> + ;
> + return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> + ac_lo=$ac_mid; break
> +else
> + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
> + if test $ac_mid -le $ac_hi; then
> + ac_lo= ac_hi=
> + break
> + fi
> + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> + done
> +else
> + ac_lo= ac_hi=
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +# Binary search between lo and hi bounds.
> +while test "x$ac_lo" != "x$ac_hi"; do
> + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
> + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h. */
> +$4
> +int
> +main ()
> +{
> +static int test_array [1 - 2 * !(($2) <= $ac_mid)];
> +test_array [0] = 0;
> +return test_array [0];
> +
> + ;
> + return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> + ac_hi=$ac_mid
> +else
> + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +done
> +case $ac_lo in #((
> +?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
> +'') ac_retval=1 ;;
> +esac
> + else
> + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h. */
> +$4
> +static long int longval () { return $2; }
> +static unsigned long int ulongval () { return $2; }
> +#include <stdio.h>
> +#include <stdlib.h>
> +int
> +main ()
> +{
> +
> + FILE *f = fopen ("conftest.val", "w");
> + if (! f)
> + return 1;
> + if (($2) < 0)
> + {
> + long int i = longval ();
> + if (i != ($2))
> + return 1;
> + fprintf (f, "%ld", i);
> + }
> + else
> + {
> + unsigned long int i = ulongval ();
> + if (i != ($2))
> + return 1;
> + fprintf (f, "%lu", i);
> + }
> + /* Do not output a trailing newline, as this causes \r\n confusion
> + on some platforms. */
> + return ferror (f) || fclose (f) != 0;
> +
> + ;
> + return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_run "$LINENO"; then :
> + echo >>conftest.val; read $3 <conftest.val; ac_retval=0
> +else
> + ac_retval=1
> +fi
> +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
> + conftest.$ac_objext conftest.beam conftest.$ac_ext
> +rm -f conftest.val
> +
> + fi
> + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
> + as_fn_set_status $ac_retval
> +
> +} # ac_fn_c_compute_int
> +
> # ac_fn_c_try_link LINENO
> # -----------------------
> # Try to link conftest.$ac_ext, and return whether this succeeded.
> @@ -2441,8 +2624,6 @@ ac_config_commands="$ac_config_commands
> # exported.
> ORIGINAL_LD_FOR_MULTILIBS=$LD
>
> -####. ${srcdir}/configure.tgt
> -
>
>
> ac_aux_dir=
> @@ -4773,6 +4954,44 @@ fi
> target_subdir=${target_noncanonical}
>
>
> +# The cast to long int works around a bug in the HP C Compiler
> +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
> +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
> +# This bug is HP SR number 8606223364.
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
> +$as_echo_n "checking size of void *... " >&6; }
> +if ${ac_cv_sizeof_void_p+:} false; then :
> + $as_echo_n "(cached) " >&6
> +else
> + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
> +
> +else
> + if test "$ac_cv_type_void_p" = yes; then
> + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
> +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
> +as_fn_error 77 "cannot compute sizeof (void *)
> +See \`config.log' for more details" "$LINENO" 5; }
> + else
> + ac_cv_sizeof_void_p=0
> + fi
> +fi
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
> +$as_echo "$ac_cv_sizeof_void_p" >&6; }
> +
> +
> +
> +cat >>confdefs.h <<_ACEOF
> +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
> +_ACEOF
> +
> +
> +
> +# Get target configury.
> +unset LIBGCOBOL_SUPPORTED
> +. ${srcdir}/configure.tgt
> +
> # -----------------
> # __int128 support
> # -----------------
> @@ -4867,7 +5086,7 @@ $as_echo "$libgcobol_cv_have_int128" >&6
> # 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.
> - if test "x$libgcobol_cv_have_int128" = xyes; then
> + if test "x$LIBGCOBOL_SUPPORTED" = xyes && test "x$libgcobol_cv_have_int128" = xyes; then
> BUILD_LIBGCOBOL_TRUE=
> BUILD_LIBGCOBOL_FALSE='#'
> else
> @@ -12657,7 +12876,7 @@ else
> lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
> lt_status=$lt_dlunknown
> cat > conftest.$ac_ext <<_LT_EOF
> -#line 12660 "configure"
> +#line 12879 "configure"
> #include "confdefs.h"
>
> #if HAVE_DLFCN_H
> @@ -12763,7 +12982,7 @@ else
> lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
> lt_status=$lt_dlunknown
> cat > conftest.$ac_ext <<_LT_EOF
> -#line 12766 "configure"
> +#line 12985 "configure"
> #include "confdefs.h"
>
> #if HAVE_DLFCN_H
> --- libgcobol/Makefile.in.jj 2025-03-11 12:39:00.455229217 +0100
> +++ libgcobol/Makefile.in 2025-03-11 13:51:30.997714134 +0100
> @@ -168,6 +168,7 @@ libgcobol_la_LIBADD =
> am_libgcobol_la_OBJECTS = charmaps.lo constants.lo gfileio.lo gmath.lo \
> intrinsic.lo io.lo libgcobol.lo valconv.lo
> libgcobol_la_OBJECTS = $(am_libgcobol_la_OBJECTS)
> +@BUILD_LIBGCOBOL_TRUE@am_libgcobol_la_rpath = -rpath $(toolexeclibdir)
> AM_V_P = $(am__v_P_@AM_V@)
> am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
> am__v_P_0 = false
> @@ -402,7 +403,7 @@ top_builddir = @top_builddir@
> top_srcdir = @top_srcdir@
> AUTOMAKE_OPTIONS = 1.8 foreign
> ACLOCAL_AMFLAGS = -I .. -I ../config
> -toolexeclib_LTLIBRARIES = libgcobol.la
> +@BUILD_LIBGCOBOL_TRUE@toolexeclib_LTLIBRARIES = libgcobol.la
> libgcobol_la_SOURCES = \
> charmaps.cc \
> constants.cc \
> @@ -423,7 +424,7 @@ libgcobol_la_LINK = $(LIBTOOL) --mode=li
> WARN_CFLAGS = -W -Wall -Wwrite-strings
>
> # not defined: DEFS, MAX_ERRORS, LTLDFLAGS
> -ALL_CFLAGS = -I. -I$(srcdir) $(AM_CPPFLAGS) $(DEFS) \
> +ALL_CXXFLAGS = -I. -I$(srcdir) $(AM_CPPFLAGS) $(DEFS) \
> $(XCFLAGS) $(AM_CXXFLAGS) $(WARN_CFLAGS) $(MAX_ERRORS) \
> -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing
>
> @@ -517,7 +518,7 @@ clean-toolexeclibLTLIBRARIES:
> }
>
> libgcobol.la: $(libgcobol_la_OBJECTS) $(libgcobol_la_DEPENDENCIES) $(EXTRA_libgcobol_la_DEPENDENCIES)
> - $(AM_V_GEN)$(libgcobol_la_LINK) -rpath $(toolexeclibdir) $(libgcobol_la_OBJECTS) $(libgcobol_la_LIBADD) $(LIBS)
> + $(AM_V_GEN)$(libgcobol_la_LINK) $(am_libgcobol_la_rpath) $(libgcobol_la_OBJECTS) $(libgcobol_la_LIBADD) $(LIBS)
>
> mostlyclean-compile:
> -rm -f *.$(OBJEXT)
> @@ -923,7 +924,7 @@ uninstall-am: uninstall-toolexeclibLTLIB
>
> %.lo: %.cc
> $(LIBTOOL) --mode=compile --tag=CXX $(CXX) -c \
> - -o $@ $(INCLUDES) $(ALL_CFLAGS) $<
> + -o $@ $(INCLUDES) $(ALL_CXXFLAGS) $<
>
> # Tell versions [3.59,3.63) of GNU make to not export all variables.
> # Otherwise a system limit (for SysV at least) may be exceeded.
>
>
> Jakub
>
>
@@ -768,7 +768,7 @@ if test -d ${srcdir}/libgcobol; then
AC_MSG_CHECKING([for libgcobol support])
if (srcdir=${srcdir}/libgcobol; \
. ${srcdir}/configure.tgt; \
- test "$LIBGCOBOL_SUPPORTED" != "yes")
+ test -n "$UNSUPPORTED")
then
AC_MSG_RESULT([no])
noconfigdirs="$noconfigdirs target-libgcobol"
@@ -3546,7 +3546,7 @@ if test -d ${srcdir}/libgcobol; then
$as_echo_n "checking for libgcobol support... " >&6; }
if (srcdir=${srcdir}/libgcobol; \
. ${srcdir}/configure.tgt; \
- test "$LIBGCOBOL_SUPPORTED" != "yes")
+ test -n "$UNSUPPORTED")
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
@@ -39,4 +39,7 @@ case "${target}" in
LIBGCOBOL_SUPPORTED=yes
fi
;;
+ *)
+ UNSUPPORTED=1
+ ;;
esac
@@ -34,8 +34,6 @@ AM_ENABLE_MULTILIB(, ..)
# exported.
ORIGINAL_LD_FOR_MULTILIBS=$LD
-####. ${srcdir}/configure.tgt
-
GCC_NO_EXECUTABLES
AC_USE_SYSTEM_EXTENSIONS
@@ -62,6 +60,12 @@ ACX_NONCANONICAL_HOST
ACX_NONCANONICAL_TARGET
GCC_TOPLEV_SUBDIRS
+AC_CHECK_SIZEOF([void *])
+
+# Get target configury.
+unset LIBGCOBOL_SUPPORTED
+. ${srcdir}/configure.tgt
+
# -----------------
# __int128 support
# -----------------
@@ -90,7 +94,7 @@ AC_CACHE_CHECK([whether __int128 is supp
# 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])
+AM_CONDITIONAL(BUILD_LIBGCOBOL, [test "x$LIBGCOBOL_SUPPORTED" = xyes && test "x$libgcobol_cv_have_int128" = xyes])
GCC_WITH_TOOLEXECLIBDIR
@@ -22,7 +22,9 @@
AUTOMAKE_OPTIONS = 1.8 foreign
ACLOCAL_AMFLAGS = -I .. -I ../config
+if BUILD_LIBGCOBOL
toolexeclib_LTLIBRARIES = libgcobol.la
+endif
##
## 2.2.12 Automatic Dependency Tracking
@@ -48,10 +50,10 @@ libgcobol_la_LINK = $(LIBTOOL) --mode=li
WARN_CFLAGS = -W -Wall -Wwrite-strings
# not defined: DEFS, MAX_ERRORS, LTLDFLAGS
-ALL_CFLAGS = -I. -I$(srcdir) $(AM_CPPFLAGS) $(DEFS) \
+ALL_CXXFLAGS = -I. -I$(srcdir) $(AM_CPPFLAGS) $(DEFS) \
$(XCFLAGS) $(AM_CXXFLAGS) $(WARN_CFLAGS) $(MAX_ERRORS) \
-DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing
%.lo: %.cc
$(LIBTOOL) --mode=compile --tag=CXX $(CXX) -c \
- -o $@ $(INCLUDES) $(ALL_CFLAGS) $<
+ -o $@ $(INCLUDES) $(ALL_CXXFLAGS) $<
@@ -1802,6 +1802,189 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_header_compile
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid; break
+else
+ as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=$ac_mid; break
+else
+ as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid
+else
+ as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (($2) < 0)
+ {
+ long int i = longval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+ ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+ fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+
# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
@@ -2441,8 +2624,6 @@ ac_config_commands="$ac_config_commands
# exported.
ORIGINAL_LD_FOR_MULTILIBS=$LD
-####. ${srcdir}/configure.tgt
-
ac_aux_dir=
@@ -4773,6 +4954,44 @@ fi
target_subdir=${target_noncanonical}
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
+$as_echo_n "checking size of void *... " >&6; }
+if ${ac_cv_sizeof_void_p+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_void_p" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (void *)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_void_p=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
+$as_echo "$ac_cv_sizeof_void_p" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+_ACEOF
+
+
+
+# Get target configury.
+unset LIBGCOBOL_SUPPORTED
+. ${srcdir}/configure.tgt
+
# -----------------
# __int128 support
# -----------------
@@ -4867,7 +5086,7 @@ $as_echo "$libgcobol_cv_have_int128" >&6
# 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.
- if test "x$libgcobol_cv_have_int128" = xyes; then
+ if test "x$LIBGCOBOL_SUPPORTED" = xyes && test "x$libgcobol_cv_have_int128" = xyes; then
BUILD_LIBGCOBOL_TRUE=
BUILD_LIBGCOBOL_FALSE='#'
else
@@ -12657,7 +12876,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12660 "configure"
+#line 12879 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12763,7 +12982,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12766 "configure"
+#line 12985 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -168,6 +168,7 @@ libgcobol_la_LIBADD =
am_libgcobol_la_OBJECTS = charmaps.lo constants.lo gfileio.lo gmath.lo \
intrinsic.lo io.lo libgcobol.lo valconv.lo
libgcobol_la_OBJECTS = $(am_libgcobol_la_OBJECTS)
+@BUILD_LIBGCOBOL_TRUE@am_libgcobol_la_rpath = -rpath $(toolexeclibdir)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@@ -402,7 +403,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = 1.8 foreign
ACLOCAL_AMFLAGS = -I .. -I ../config
-toolexeclib_LTLIBRARIES = libgcobol.la
+@BUILD_LIBGCOBOL_TRUE@toolexeclib_LTLIBRARIES = libgcobol.la
libgcobol_la_SOURCES = \
charmaps.cc \
constants.cc \
@@ -423,7 +424,7 @@ libgcobol_la_LINK = $(LIBTOOL) --mode=li
WARN_CFLAGS = -W -Wall -Wwrite-strings
# not defined: DEFS, MAX_ERRORS, LTLDFLAGS
-ALL_CFLAGS = -I. -I$(srcdir) $(AM_CPPFLAGS) $(DEFS) \
+ALL_CXXFLAGS = -I. -I$(srcdir) $(AM_CPPFLAGS) $(DEFS) \
$(XCFLAGS) $(AM_CXXFLAGS) $(WARN_CFLAGS) $(MAX_ERRORS) \
-DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing
@@ -517,7 +518,7 @@ clean-toolexeclibLTLIBRARIES:
}
libgcobol.la: $(libgcobol_la_OBJECTS) $(libgcobol_la_DEPENDENCIES) $(EXTRA_libgcobol_la_DEPENDENCIES)
- $(AM_V_GEN)$(libgcobol_la_LINK) -rpath $(toolexeclibdir) $(libgcobol_la_OBJECTS) $(libgcobol_la_LIBADD) $(LIBS)
+ $(AM_V_GEN)$(libgcobol_la_LINK) $(am_libgcobol_la_rpath) $(libgcobol_la_OBJECTS) $(libgcobol_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -923,7 +924,7 @@ uninstall-am: uninstall-toolexeclibLTLIB
%.lo: %.cc
$(LIBTOOL) --mode=compile --tag=CXX $(CXX) -c \
- -o $@ $(INCLUDES) $(ALL_CFLAGS) $<
+ -o $@ $(INCLUDES) $(ALL_CXXFLAGS) $<
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.