This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH to avoid building unwanted langs/compilers (was: Re: No new 4th PATCH yet)


On Thu, 29 October 1998, 00:12:25, law@cygnus.com wrote:

 > 
 >   In message <13878.58616.348287.67694@slsvhmt>you write:
 >   > I'm somewhat confused.  When I posted my 1st patch, everybody
 >   > complained to use a new argument to configure and let the configure
 >   > script enable/disable the appropriate stuff in the Makefiles. The
 >   > 2nd patch was actually only a small correction of the 1st one.
 >   > The 3rd one then tried to simply avoid doing stuff for languages
 >   > whose compilers weren't configured/built.
 >   > 
 >   > Now, you sound to me like ``let $(LANGUAGES) decide, what to
 >   > build, and then let the language's runtime libdirs Makefiles
 >   > decide at build-time, if anything at all ought to be done''.
 >   > Is that right?
 > You must have mis-understood me.
 > 
 >   > I'm asking, because I have a patch waiting in my outgoing queue, which
 >   > considers the comments I received after I sent the 3rd patch.  So,
 >   > what do we want to do now:
 >   > 
 >   >   1. Let the various configure{,.in} scripts munge the generated
 >   >      Makefiles to provide proper targets for the actually built
 >   >      compilers.
 >   > 
 >   > or
 >   > 
 >   >   2. Continue using $(LANGUAGES) (as we used to in the last years!),
 >   >      and fix the various Makefile.in's in the language's runtime
 >   >      libdirs to not do anything if the particular compiler isn't
 >   >      available.
 > 2.
 > 
 > Or, have the have the language runtime configure code not configure
 > the runtime subdir if the compiler had not been built.  Ie, libf2c/configure
 > would peek in <objdir>/gcc to see if f771 was present.  If it was, then it
 > would proceed normally.  If f771 was not present, then the configure script
 > would exit with zero status without even writing a Makefile.
 > 
 > Consider a library configure script that wants to actually run the target
 > compiler -- if it wasn't built, then the configure script is going to
 > choke.

OK, this  is the 4th  (and my  final)  attempt to  implement a way "to
avoid, that compilers and runtime libraries  will be built, although I
never intend to use them".

Since the logic   behind the new patch  remains  nearly the  same  (NO
"dummy" Makefile is created, though!), the rationale as I described in
my   email "3rd PATCH   to pre-select languages   to be built" remains
mostly valid. I'm quoting it here again with minor parts rewritten:

On Fri, 23 October 1998, 12:28:12, manfred@s-direktnet.de wrote:

 > The rationale behind this patch is this:
 > 
 > 1. From the user's point of view:
 > 
 >    When configure'ing the whole egcs package, add
 > 
 > 	--enable-languages=lang1,lang2,...
 > 
 >    or define the environment variable
 > 
 >         LANGUAGES="lang1 lang2 ..."
 > 
 >    if you intend to build lang1, lang2 and lang...  If neither is defined,
 >    all languages available in the gcc sub-tree will be configure'd.
 >    Re-defining LANGUAGES when calling "make bootstrap" *does not* work
 >    anymore, as those language sub-directories might not have been
 >    configure'd!
 > 
 >    "make bootstrap" will then build only the configure'd compiler passes.
 > 
 >    Each language's runtime configure script will determine, if the necessary
 >    compiler pass has been built, and if not, *nothing* is done.
 > 
 > 2. From the developer's point of view:
 > 
 >    Adding a new language to gcc is pretty much transparent; simply create
 >    the various <lang>/{Make,config}-lang.in files as usual.
 > 
 >    Each runtime sub-directory's (such as "libf2c") configure script
 >    has to append some shell script code, which determines if the
 >    particular compiler has been built, and, if not, creates a
 >    "dummy" Makefile instead of the autoconfiscated one.  Similar
 >    things need to be done for those dirs, which are not already
 >    autoconf aware (e.g. libio and libstdc++).

Replace the last paragraph with the following:

    Each runtime sub-directory's (such as "libf2c") configure.in script
    has to use some code similar to the one quoted here:

# If the language specific compiler does not exist, but the "gcc" directory does,
# we do not build anything. Note, $r is set by the top-level Makefile.
compiler_name=f771
rm -f skip-this-dir
AC_MSG_CHECKING(if compiler $compiler_name has been built)
AC_CACHE_VAL(f77_cv_compiler_exists,
        [f77_cv_compiler_exists=yes
        if test -n "$r"; then
                if test -d "$r"/gcc; then
                        if test -f "$r"/gcc/$compiler_name; then
                                true
                        else
                                f77_cv_compiler_exists=no
                                echo "rm -f config.cache config.log multilib.out" > skip-this-dir
                        fi
                fi
        fi
        ])
AC_MSG_RESULT($f77_cv_compiler_exists)
if test x$f77_cv_compiler_exists = xno
then
        rm -f Makefile conftest* confdefs* core
        exit 0
fi

    This code determines, if the particular compiler in question has been
    built during "make bootstrap"; if it hasn't, a small shell script
    "skip-this-dir" is created, which should contain all cleanup actions,
    which are necessary to actually cleanup everything the top-level
    Makefile doesn't know about.  Those configure.in scripts, that
    have not been already autoconfiscated (e.g. libio and libstdc++),
    have to provide similar code.

Independent of this patch'es future, I'll be uploading

  <ftp://egcs.cygnus.com/pub/egcs/infrastructure/libg++-2.8.1.2a-19981114.tar.gz>

today, which contains a  similar patch (besides other  stuff - see  my
separate announcement).

I've  omitted the patch for  gcc's, libchill's, libf2c's and libobjc's
configure files; if  you  want to test/use  my  patch, remember you'll
have to regenerate them using a recent version of "autoconf"!

Keep on hacking... and tell me what you think about the patch below.

manfred


./ChangeLog:

1998-11-13  Manfred Hollstein  <manfred@s-direktnet.de>

	* configure (skip-this-dir): Add handling for new shell script, which
	might be created by a sub-directory's configure to indicate, this particular
	directory is "unwanted".
	* Makefile.in ($(CONFIGURE_TARGET_MODULES)): Likewise.

./gcc/ChangeLog:

1998-11-13  Manfred Hollstein  <manfred@s-direktnet.de>

	* configure.in (enable_languages): Add new configuration parameter
	"--enable-languages=lang1,lang2,...".
	(${srcdir}/*/config-lang.in): Change handling to configure only
	those directories, that the user might have enabled; default to
	"all" existing languages.
	* configure: Regenerate.

./libchill/ChangeLog:

1998-11-13  Manfred Hollstein  <manfred@s-direktnet.de>

	* configure.in (compiler_name): Add check to detect if this
	language's compiler has been built.
	* configure: Regenerate.

./libf2c/ChangeLog:

1998-11-13  Manfred Hollstein  <manfred@s-direktnet.de>

	* configure.in (compiler_name): Add check to detect if this
	language's compiler has been built.
	* configure: Regenerate.

./libio/ChangeLog:

1998-11-13  Manfred Hollstein  <manfred@s-direktnet.de>

	* configure.in (compiler_name): Add check to detect if this
	language's compiler has been built.

./libobjc/ChangeLog:

1998-11-13  Manfred Hollstein  <manfred@s-direktnet.de>

	* configure.in (compiler_name): Add check to detect if this
	language's compiler has been built.
	* configure: Regenerate.

./libstdc++/ChangeLog:

1998-11-13  Manfred Hollstein  <manfred@s-direktnet.de>

	* configure.in (compiler_name): Add check to detect if this
	language's compiler has been built.

diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981113.orig/Makefile.in egcs-19981113/Makefile.in
--- egcs-19981113.orig/Makefile.in	Sat Oct 17 10:58:47 1998
+++ egcs-19981113/Makefile.in	Sat Nov 14 13:15:00 1998
@@ -1294,15 +1293,22 @@ $(CONFIGURE_TARGET_MODULES):
 	      libsrcdir="$$s/$${dir}"; \
 	    fi; \
 	    if [ -f $${libsrcdir}/configure ] ; then \
-	      rm -f no-such-file; \
+	      rm -f no-such-file skip-this-dir; \
 	      CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
 		$(CONFIG_ARGUMENTS) $${srcdiroption} \
 		--with-target-subdir="$(TARGET_SUBDIR)"; \
 	    else \
-	      rm -f no-such-file; \
+	      rm -f no-such-file skip-this-dir; \
 	      CONFIG_SITE=no-such-file $(SHELL) $$s/configure \
 		$(CONFIG_ARGUMENTS) $${srcdiroption} \
 		--with-target-subdir="$(TARGET_SUBDIR)"; \
+	    fi; \
+	    if [ -f skip-this-dir ] ; then \
+	      sh skip-this-dir; \
+	      rm -f skip-this-dir; \
+	      cd ..; rmdir $${dir} || true; \
+	    else \
+	      true; \
 	    fi; \
 	  else \
 	    true; \
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981113.orig/configure egcs-19981113/configure
--- egcs-19981113.orig/configure	Fri Nov 13 12:53:36 1998
+++ egcs-19981113/configure	Sat Nov 14 09:00:05 1998
@@ -677,7 +677,23 @@ fi
 
 ### do common part of configure.in
 
+# If the language specific compiler does not exist, but the "gcc" directory does,
+# we will skip this directory; in this case the sub-directory's common part
+# of configure.in will create a small shell script "skip-this-dir" containing
+# commands to completely clean up any temporary or created files.
+
 . ${tmpfile}.com
+
+if test -f skip-this-dir; then
+	# Perform the same cleanup as the trap handler, minus the "exit 1" of course,
+	# and reset the trap handler.
+	trap 0
+	rm -f Makefile* ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
+	# Execute the final clean-up actions
+	${config_shell} skip-this-dir
+	# and stop configuring this directory.
+	exit 0
+fi
 
 # some sanity checks on configure.in
 case "${srctrigger}" in
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981113.orig/gcc/configure.in egcs-19981113/gcc/configure.in
--- egcs-19981113.orig/gcc/configure.in	Fri Nov 13 12:47:27 1998
+++ egcs-19981113/gcc/configure.in	Sat Nov 14 09:00:06 1998
@@ -3824,6 +3824,16 @@ fi
 AC_MSG_RESULT($gcc_cv_as_subsections)
 
 # Figure out what language subdirectories are present.
+# Look if the user specified --enable-languages="..."; if not, use
+# the environment variable $LANGUAGES if defined. $LANGUAGES might
+# go away some day.
+if test x"${enable_languages+set}" != xset; then
+	if test x"${LANGUAGES+set}" = xset; then
+		enable_languages="`echo ${LANGUAGES} | tr ' ' ','`"
+	else
+		enable_languages=all
+	fi
+fi
 subdirs=
 for lang in ${srcdir}/*/config-lang.in ..
 do
@@ -3832,13 +3842,39 @@ do
 	# The odd quoting in the next line works around
 	# an apparent bug in bash 1.12 on linux.
 changequote(,)dnl
-	${srcdir}/ada/config-lang.in)
-	  if test x$gnat = xyes ; then
-		subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
-	  fi
-	;;
 	${srcdir}/[*]/config-lang.in) ;;
-	*) subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`" ;;
+	*)
+	  lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ 	]*\).*$,\1,p' $lang`
+	  if test "x$lang_alias" = x
+	  then
+		echo "$lang doesn't set \$language." 1>&2
+		exit 1
+	  fi
+	  if test x"${enable_languages}" = xall; then
+	  	add_this_lang=yes
+	  else
+		case "${enable_languages}" in
+		    ${lang_alias} | "${lang_alias},"* | *",${lang_alias},"* | *",${lang_alias}" )
+			add_this_lang=yes
+			;;
+		    * )
+			add_this_lang=no
+			;;
+		esac
+	  fi
+	  if test x"${add_this_lang}" = xyes; then
+		case $lang in
+		    ${srcdir}/ada/config-lang.in)
+			if test x$gnat = xyes ; then
+				subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
+			fi
+			;;
+		    *)
+			subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`"
+			;;
+		esac
+	  fi
+	  ;;
 changequote([,])dnl
 	esac
 done
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981113.orig/libchill/configure.in egcs-19981113/libchill/configure.in
--- egcs-19981113.orig/libchill/configure.in	Fri Oct 23 12:34:13 1998
+++ egcs-19981113/libchill/configure.in	Sat Nov 14 09:00:06 1998
@@ -34,6 +34,31 @@ dnl This is needed for a multilibbed bui
 dnl that install-sh and config.sub get found.
 AC_CONFIG_AUX_DIR($topsrcdir)
 
+# If the language specific compiler does not exist, but the "gcc" directory does,
+# we do not build anything. Note, $r is set by the top-level Makefile.
+compiler_name=cc1chill
+rm -f skip-this-dir
+AC_MSG_CHECKING(if compiler $compiler_name has been built)
+AC_CACHE_VAL(chill_cv_compiler_exists,
+	[chill_cv_compiler_exists=yes
+	if test -n "$r"; then
+		if test -d "$r"/gcc; then
+			if test -f "$r"/gcc/$compiler_name; then
+				true
+			else
+				chill_cv_compiler_exists=no
+				echo "rm -f config.cache config.log multilib.out" > skip-this-dir
+			fi
+		fi
+	fi
+	])
+AC_MSG_RESULT($chill_cv_compiler_exists)
+if test x$chill_cv_compiler_exists = xno
+then
+	rm -f Makefile conftest* confdefs* core
+	exit 0
+fi
+
 dnl Checks for programs.
 # For chill we'll set CC to point at the built gcc, but this will get it into
 # the makefiles
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981113.orig/libf2c/configure.in egcs-19981113/libf2c/configure.in
--- egcs-19981113.orig/libf2c/configure.in	Sun Oct 25 07:39:26 1998
+++ egcs-19981113/libf2c/configure.in	Sat Nov 14 09:00:07 1998
@@ -34,6 +34,31 @@ dnl This is needed for a multilibbed bui
 dnl that install-sh and config.sub get found.
 AC_CONFIG_AUX_DIR($topsrcdir)
 
+# If the language specific compiler does not exist, but the "gcc" directory does,
+# we do not build anything. Note, $r is set by the top-level Makefile.
+compiler_name=f771
+rm -f skip-this-dir
+AC_MSG_CHECKING(if compiler $compiler_name has been built)
+AC_CACHE_VAL(f77_cv_compiler_exists,
+	[f77_cv_compiler_exists=yes
+	if test -n "$r"; then
+		if test -d "$r"/gcc; then
+			if test -f "$r"/gcc/$compiler_name; then
+				true
+			else
+				f77_cv_compiler_exists=no
+				echo "rm -f config.cache config.log multilib.out" > skip-this-dir
+			fi
+		fi
+	fi
+	])
+AC_MSG_RESULT($f77_cv_compiler_exists)
+if test x$f77_cv_compiler_exists = xno
+then
+	rm -f Makefile conftest* confdefs* core
+	exit 0
+fi
+
 dnl Checks for programs.
 # For g77 we'll set CC to point at the built gcc, but this will get it into
 # the makefiles
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981113.orig/libio/configure.in egcs-19981113/libio/configure.in
--- egcs-19981113.orig/libio/configure.in	Wed Sep  9 20:16:35 1998
+++ egcs-19981113/libio/configure.in	Sat Nov 14 09:00:07 1998
@@ -2,6 +2,20 @@
 # necessary for a configure script to process the program in
 # this directory.  For more information, look at ../configure.
 
+# If the language specific compiler does not exist, but the "gcc" directory does,
+# we do not build anything. Note, $r is set by the top-level Makefile.
+compiler_name=cc1plus
+rm -f skip-this-dir
+if test -n "$r"; then
+  if test -d "$r"/gcc; then
+    if test -f "$r"/gcc/$compiler_name; then
+      true
+    else
+      echo "rm -f multilib.out" > skip-this-dir
+    fi
+  fi
+fi
+
 if [ "${srcdir}" = "." ] ; then
   if [ "${with_target_subdir}" != "." ] ; then
     topsrcdir=${with_multisrctop}../..
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981113.orig/libobjc/configure.in egcs-19981113/libobjc/configure.in
--- egcs-19981113.orig/libobjc/configure.in	Fri Oct 23 12:34:14 1998
+++ egcs-19981113/libobjc/configure.in	Sat Nov 14 09:00:07 1998
@@ -35,6 +35,31 @@ dnl This is needed for a multilibbed bui
 dnl that install-sh and config.sub get found.
 AC_CONFIG_AUX_DIR($topsrcdir)
 
+# If the language specific compiler does not exist, but the "gcc" directory does,
+# we do not build anything. Note, $r is set by the top-level Makefile.
+compiler_name=cc1obj
+rm -f skip-this-dir
+AC_MSG_CHECKING(if compiler $compiler_name has been built)
+AC_CACHE_VAL(objc_cv_compiler_exists,
+	[objc_cv_compiler_exists=yes
+	if test -n "$r"; then
+		if test -d "$r"/gcc; then
+			if test -f "$r"/gcc/$compiler_name; then
+				true
+			else
+				objc_cv_compiler_exists=no
+				echo "rm -f config.cache config.log multilib.out" > skip-this-dir
+			fi
+		fi
+	fi
+	])
+AC_MSG_RESULT($objc_cv_compiler_exists)
+if test x$objc_cv_compiler_exists = xno
+then
+	rm -f Makefile conftest* confdefs* core
+	exit 0
+fi
+
 dnl Checks for programs.
 # For ObjC we'll set CC to point at the built gcc, but this will get it into
 # the makefiles
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981113.orig/libstdc++/configure.in egcs-19981113/libstdc++/configure.in
--- egcs-19981113.orig/libstdc++/configure.in	Wed Sep  9 20:16:35 1998
+++ egcs-19981113/libstdc++/configure.in	Sat Nov 14 09:00:07 1998
@@ -2,6 +2,20 @@
 # necessary for a configure script to process the program in
 # this directory.  For more information, look at ../configure.
 
+# If the language specific compiler does not exist, but the "gcc" directory does,
+# we do not build anything. Note, $r is set by the top-level Makefile.
+compiler_name=cc1plus
+rm -f skip-this-dir
+if test -n "$r"; then
+  if test -d "$r"/gcc; then
+    if test -f "$r"/gcc/$compiler_name; then
+      true
+    else
+      echo "rm -f multilib.out" > skip-this-dir
+    fi
+  fi
+fi
+
 if [ "${srcdir}" = "." ] ; then
   if [ "${with_target_subdir}" != "." ] ; then
     topsrcdir=${with_multisrctop}../..


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]