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.

Ok for trunk?

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2025-04-08  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        libgcobol:
        * configure.ac: Handle --enable-libgcobol.
        Let it override LIBGCOBOL_SUPPORTED.
        * configure: Regenerate.

# HG changeset patch
# Parent  8f74fa645e6abe23c5084a2f2b0b05c3a34e3e0a
libgcobol: Heed --enable-libgcobol

diff --git a/libgcobol/configure b/libgcobol/configure
--- 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
@@ -3721,6 +3723,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.
@@ -11796,7 +11808,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11799 "configure"
+#line 11811 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11902,7 +11914,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11905 "configure"
+#line 11917 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16793,6 +16805,14 @@ cat >>confdefs.h <<_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
 # -----------------
@@ -16885,7 +16905,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
--- 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 supp
     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