https://gcc.gnu.org/g:fdd2374b87bd9d7f4c201c81875d77acaebb38cd

commit r16-470-gfdd2374b87bd9d7f4c201c81875d77acaebb38cd
Author: Rainer Orth <r...@cebitec.uni-bielefeld.de>
Date:   Thu May 8 09:42:42 2025 +0200

    libgcobol: Heed --enable-libgcobol
    
    If some target isn't listed as supported in configure.tgt,
    --enable-libgcobol cannot override that.  However, that's what should
    happen just like an explicit --enable-languages=cobol forces the
    frontend to be built.
    
    This patch, shamelessly adapted from libphobos, does just that.
    
    Tested on amd64-pc-solaris2.11, sparcv9-sun-solaris2.11, and
    x86_64-pc-linux-gnu.
    
    2025-04-08  Rainer Orth  <r...@cebitec.uni-bielefeld.de>
    
            libgcobol:
            * configure.ac: Handle --enable-libgcobol.
            Let it override LIBGCOBOL_SUPPORTED.
            * configure: Regenerate.

Diff:
---
 libgcobol/configure    | 26 +++++++++++++++++++++++---
 libgcobol/configure.ac | 15 ++++++++++++++-
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/libgcobol/configure b/libgcobol/configure
index 06e7544822cb..5f319eedf538 100755
--- a/libgcobol/configure
+++ b/libgcobol/configure
@@ -788,6 +788,7 @@ enable_option_checking
 enable_multilib
 enable_maintainer_mode
 enable_silent_rules
+enable_libgcobol
 enable_version_specific_runtime_libs
 enable_dependency_tracking
 enable_shared
@@ -1438,6 +1439,7 @@ Optional Features:
                           sometimes confusing) to the casual installer
   --enable-silent-rules   less verbose build output (undo: "make V=1")
   --disable-silent-rules  verbose build output (undo: "make V=0")
+  --enable-libgcobol      Enable libgcobol
   --enable-version-specific-runtime-libs
                           Specify that runtime libraries should be installed
                           in a compiler-specific directory
@@ -3723,6 +3725,16 @@ END
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-libgcobol" >&5
+$as_echo_n "checking for --enable-libgcobol... " >&6; }
+# Check whether --enable-libgcobol was given.
+if test "${enable_libgcobol+set}" = set; then :
+  enableval=$enable_libgcobol;
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_libgcobol" >&5
+$as_echo "$enable_libgcobol" >&6; }
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 
--enable-version-specific-runtime-libs" >&5
 $as_echo_n "checking for --enable-version-specific-runtime-libs... " >&6; }
 # Check whether --enable-version-specific-runtime-libs was given.
@@ -11798,7 +11810,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11801 "configure"
+#line 11813 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11904,7 +11916,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11907 "configure"
+#line 11919 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16795,6 +16807,14 @@ _ACEOF
 unset LIBGCOBOL_SUPPORTED
 . ${srcdir}/configure.tgt
 
+# Decide if it's usable.
+case $LIBGCOBOL_SUPPORTED:$enable_libgcobol in
+*:no)  use_libgcobol=no  ;;
+*:yes) use_libgcobol=yes ;;
+yes:*) use_libgcobol=yes ;;
+*:*)   use_libgcobol=no  ;;
+esac
+
 # -----------------
 # __int128 support
 # -----------------
@@ -16887,7 +16907,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcobol_cv_have_int128" >&5
 $as_echo "$libgcobol_cv_have_int128" >&6; }
 
- if test "x$LIBGCOBOL_SUPPORTED" = xyes && test "x$libgcobol_cv_have_int128" = 
xyes; then
+ if test "x$use_libgcobol" = xyes && test "x$libgcobol_cv_have_int128" = xyes; 
then
   BUILD_LIBGCOBOL_TRUE=
   BUILD_LIBGCOBOL_FALSE='#'
 else
diff --git a/libgcobol/configure.ac b/libgcobol/configure.ac
index e2547637209c..13326960515a 100644
--- a/libgcobol/configure.ac
+++ b/libgcobol/configure.ac
@@ -40,6 +40,11 @@ AM_MAINTAINER_MODE
 
 AM_INIT_AUTOMAKE([1.15.1 no-define foreign no-dist -Wall -Wno-portability])
 
+AC_MSG_CHECKING([for --enable-libgcobol])
+AC_ARG_ENABLE(libgcobol,
+  [AS_HELP_STRING([--enable-libgcobol], [Enable libgcobol])])
+AC_MSG_RESULT($enable_libgcobol)
+
 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
 AC_ARG_ENABLE(version-specific-runtime-libs,
 AS_HELP_STRING([--enable-version-specific-runtime-libs],
@@ -138,6 +143,14 @@ AC_CHECK_SIZEOF([void *])
 unset LIBGCOBOL_SUPPORTED
 . ${srcdir}/configure.tgt
 
+# Decide if it's usable.
+case $LIBGCOBOL_SUPPORTED:$enable_libgcobol in
+*:no)  use_libgcobol=no  ;;
+*:yes) use_libgcobol=yes ;;
+yes:*) use_libgcobol=yes ;;
+*:*)   use_libgcobol=no  ;;
+esac
+
 # -----------------
 # __int128 support
 # -----------------
@@ -164,7 +177,7 @@ AC_CACHE_CHECK([whether __int128 is supported], 
[libgcobol_cv_have_int128],
     libgcobol_cv_have_int128=no
 ])])
 
-AM_CONDITIONAL(BUILD_LIBGCOBOL, [test "x$LIBGCOBOL_SUPPORTED" = xyes && test 
"x$libgcobol_cv_have_int128" = xyes])
+AM_CONDITIONAL(BUILD_LIBGCOBOL, [test "x$use_libgcobol" = xyes && test 
"x$libgcobol_cv_have_int128" = xyes])
 
 # Check if functions are available in libc before adding extra libs.
 AC_SEARCH_LIBS([malloc], [c])

Reply via email to