From 2179e02450ae6945b04740fa8c67e98140d2859b Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Sat, 10 Jun 2023 22:23:42 +0200
Subject: [PATCH] libgfortran: remove support for --enable-intermodule

libgfortran/

	PR libfortran/109373
	* configure.ac: Remove support for --enable-intermodule
	* Makefile.am: Remove onestep path.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
---
 libgfortran/Makefile.am  | 33 +-------------------------------
 libgfortran/Makefile.in  | 41 ++++++----------------------------------
 libgfortran/configure    | 38 ++-----------------------------------
 libgfortran/configure.ac | 13 -------------
 4 files changed, 9 insertions(+), 116 deletions(-)

diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 454ad12e701..9fab07c9a50 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -1120,40 +1120,9 @@ ieee_arithmetic.mod: ieee_arithmetic.lo
 BUILT_SOURCES=$(gfor_built_src) $(gfor_built_specific_src) \
 	$(gfor_built_specific2_src) $(gfor_misc_specifics)
 
-prereq_SRC = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \
+libgfortran_la_SOURCES = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \
 	$(gfor_helper_src) $(gfor_ieee_src) $(gfor_io_headers) $(gfor_specific_src)
 
-if onestep
-# dummy sources for libtool
-BUILT_SOURCES+=libgfortran_c.c libgfortran_f.f90
-libgfortran_c.c libgfortran_f.f90 libgfortran_F.F90:
-	echo > $@
-# overrides for libtool perusing the dummy sources
-libgfortran_c.o: $(filter %.c,$(prereq_SRC))
-	$(COMPILE) -c $^ -o $@ -combine
-
-libgfortran_c.lo: $(filter %.c,$(prereq_SRC))
-	$(LTCOMPILE) -c -o $@ $^ -combine
-
-#libgfortran_f.o: $(filter %.f %.f90,$(prereq_SRC))
-#	$(FCCOMPILE) -c $^ -o $@ -combine
-
-#libgfortran_f.lo: $(filter %.f %.f90,$(prereq_SRC))
-#	$(LTFCCOMPILE) -c -o $@ $^ -combine
-# not currently used:
-#libgfortran_F.o: $(filter %.F %.F90,$(prereq_SRC))
-#	$(PPFCCOMPILE) -c $^ -o $@ -combine
-#
-#libgfortran_F.lo: 
-#	$(LTPPFCCOMPILE) -c -o $@ $^ -combine
-
-libgfortran_la_SOURCES = libgfortran_c.c $(filter-out %.c,$(prereq_SRC))
-
-else
-libgfortran_la_SOURCES = $(prereq_SRC)
-
-endif
-
 I_M4_DEPS=m4/iparm.m4 m4/mtype.m4
 I_M4_DEPS0=$(I_M4_DEPS) m4/iforeach.m4
 I_M4_DEPS1=$(I_M4_DEPS) m4/ifunction.m4
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index 23df0761096..e8627f9a4bc 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -155,9 +155,6 @@ target_triplet = @target@
 @LIBGFOR_MINIMAL_FALSE@runtime/pause.c \
 @LIBGFOR_MINIMAL_FALSE@runtime/stop.c
 
-
-# dummy sources for libtool
-@onestep_TRUE@am__append_7 = libgfortran_c.c libgfortran_f.f90
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
@@ -481,11 +478,9 @@ am__objects_62 = _sign_i4.lo _sign_i8.lo _sign_i16.lo _sign_r4.lo \
 am__objects_63 = misc_specifics.lo
 am__objects_64 = $(am__objects_61) $(am__objects_62) $(am__objects_63) \
 	dprod_r8.lo f2c_specifics.lo random_init.lo
-am__objects_65 = $(am__objects_3) $(am__objects_53) $(am__objects_55) \
-	$(am__objects_58) $(am__objects_59) $(am__objects_60) \
-	$(am__objects_64)
-@onestep_FALSE@am_libgfortran_la_OBJECTS = $(am__objects_65)
-@onestep_TRUE@am_libgfortran_la_OBJECTS = libgfortran_c.lo
+am_libgfortran_la_OBJECTS = $(am__objects_3) $(am__objects_53) \
+	$(am__objects_55) $(am__objects_58) $(am__objects_59) \
+	$(am__objects_60) $(am__objects_64)
 libgfortran_la_OBJECTS = $(am_libgfortran_la_OBJECTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -715,7 +710,6 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 multi_basedir = @multi_basedir@
 oldincludedir = @oldincludedir@
-onestep = @onestep@
 pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -1652,25 +1646,11 @@ intrinsics/f2c_specifics.F90 \
 intrinsics/random_init.f90
 
 BUILT_SOURCES = $(gfor_built_src) $(gfor_built_specific_src) \
-	$(gfor_built_specific2_src) $(gfor_misc_specifics) \
-	$(am__append_7)
-prereq_SRC = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \
-	$(gfor_helper_src) $(gfor_ieee_src) $(gfor_io_headers) $(gfor_specific_src)
+	$(gfor_built_specific2_src) $(gfor_misc_specifics)
 
-@onestep_FALSE@libgfortran_la_SOURCES = $(prereq_SRC)
-
-#libgfortran_f.o: $(filter %.f %.f90,$(prereq_SRC))
-#	$(FCCOMPILE) -c $^ -o $@ -combine
+libgfortran_la_SOURCES = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \
+	$(gfor_helper_src) $(gfor_ieee_src) $(gfor_io_headers) $(gfor_specific_src)
 
-#libgfortran_f.lo: $(filter %.f %.f90,$(prereq_SRC))
-#	$(LTFCCOMPILE) -c -o $@ $^ -combine
-# not currently used:
-#libgfortran_F.o: $(filter %.F %.F90,$(prereq_SRC))
-#	$(PPFCCOMPILE) -c $^ -o $@ -combine
-#
-#libgfortran_F.lo: 
-#	$(LTPPFCCOMPILE) -c -o $@ $^ -combine
-@onestep_TRUE@libgfortran_la_SOURCES = libgfortran_c.c $(filter-out %.c,$(prereq_SRC))
 I_M4_DEPS = m4/iparm.m4 m4/mtype.m4
 I_M4_DEPS0 = $(I_M4_DEPS) m4/iforeach.m4
 I_M4_DEPS1 = $(I_M4_DEPS) m4/ifunction.m4
@@ -2047,7 +2027,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_contiguous.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ishftc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kill.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgfortran_c.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/link.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list_read.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock.Plo@am__quote@
@@ -7665,14 +7644,6 @@ ieee_exceptions.mod: ieee_exceptions.lo
 	:
 ieee_arithmetic.mod: ieee_arithmetic.lo
 	:
-@onestep_TRUE@libgfortran_c.c libgfortran_f.f90 libgfortran_F.F90:
-@onestep_TRUE@	echo > $@
-# overrides for libtool perusing the dummy sources
-@onestep_TRUE@libgfortran_c.o: $(filter %.c,$(prereq_SRC))
-@onestep_TRUE@	$(COMPILE) -c $^ -o $@ -combine
-
-@onestep_TRUE@libgfortran_c.lo: $(filter %.c,$(prereq_SRC))
-@onestep_TRUE@	$(LTCOMPILE) -c -o $@ $^ -combine
 
 kinds.h: $(srcdir)/mk-kinds-h.sh
 	$(SHELL) $(srcdir)/mk-kinds-h.sh '@LIBGOMP_CHECKED_INT_KINDS@' \
diff --git a/libgfortran/configure b/libgfortran/configure
index d7c3a5e27a0..1cde8e8f025 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -755,9 +755,6 @@ host_os
 host_vendor
 host_cpu
 host
-onestep
-onestep_FALSE
-onestep_TRUE
 target_subdir
 host_subdir
 build_subdir
@@ -809,7 +806,6 @@ ac_user_opts='
 enable_option_checking
 with_build_libsubdir
 enable_version_specific_runtime_libs
-enable_intermodule
 enable_silent_rules
 enable_maintainer_mode
 enable_multilib
@@ -1460,7 +1456,6 @@ Optional Features:
   --enable-version-specific-runtime-libs
                           specify that runtime libraries should be installed
                           in a compiler-specific directory
-  --enable-intermodule    build the library in one step
   --enable-silent-rules   less verbose build output (undo: "make V=1")
   --disable-silent-rules  verbose build output (undo: "make V=0")
   --enable-maintainer-mode
@@ -2881,31 +2876,6 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $version_specific_libs" >&5
 $as_echo "$version_specific_libs" >&6; }
 
-# Build with intermodule optimisations
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-intermodule" >&5
-$as_echo_n "checking for --enable-intermodule... " >&6; }
-# Check whether --enable-intermodule was given.
-if test "${enable_intermodule+set}" = set; then :
-  enableval=$enable_intermodule; case "$enable_intermodule" in
-  yes) onestep="-onestep";;
-    *) onestep="";;
-esac
-else
-  onestep=""
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_intermodule" >&5
-$as_echo "$enable_intermodule" >&6; }
- if test x$onestep = x-onestep; then
-  onestep_TRUE=
-  onestep_FALSE='#'
-else
-  onestep_TRUE='#'
-  onestep_FALSE=
-fi
-
-
-
 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
 #
 # You will slowly go insane if you do not grok the following fact:  when
@@ -12791,7 +12761,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12794 "configure"
+#line 12764 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12897,7 +12867,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12900 "configure"
+#line 12870 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -31537,10 +31507,6 @@ LIBOBJS=$ac_libobjs
 LTLIBOBJS=$ac_ltlibobjs
 
 
-if test -z "${onestep_TRUE}" && test -z "${onestep_FALSE}"; then
-  as_fn_error $? "conditional \"onestep\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
 $as_echo_n "checking that generated files are newer than configure... " >&6; }
    if test -n "$am_sleep_pid"; then
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 07b9a48a19f..8bd2af966c8 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -21,19 +21,6 @@ AS_HELP_STRING([--enable-version-specific-runtime-libs],
 [version_specific_libs=no])
 AC_MSG_RESULT($version_specific_libs)
 
-# Build with intermodule optimisations
-AC_MSG_CHECKING([for --enable-intermodule])
-AC_ARG_ENABLE(intermodule,
-AS_HELP_STRING([--enable-intermodule],[build the library in one step]),
-[case "$enable_intermodule" in
-  yes) onestep="-onestep";;
-    *) onestep="";;
-esac],
-[onestep=""])
-AC_MSG_RESULT($enable_intermodule)
-AM_CONDITIONAL(onestep,[test x$onestep = x-onestep])
-AC_SUBST(onestep)
-
 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
 #
 # You will slowly go insane if you do not grok the following fact:  when
-- 
2.34.1

