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]

Disabling target libraries depending on --enable-languages


This patch arranges for the top-level configure to selectively disable
language-specific target libraries depending on the languages selected
in the build tree.  This is accomplished by looking for a definition
of `target_libs' in each language-specific configuration file.  If the
language is enabled, the target libraries listed in target_libs are
added to TARGET_CONFIGDIRS (duplicates are discarded); if the language
is not enabled, the target libraries are added to noconfigdirs, so
that they're removed from TARGET_CONFIGDIRS and `configure' prints a
message indicating that the libraries haven't been configured.  If
target_libs is not defined for some language, the original behavior is
retained.

While I was at it, I've generalized the mechanism that disabled CHILL
by default, so that now it's just a matter of setting
`build_by_default=no' in the language-specific configuration file.

Here's the patch that I'm checking in.  Tested on i686-pc-linux-gnu.

Index: ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* configure.in: Disable language-specific target libraries for
	languages that aren't enabled.

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* configure.in: Simplify language enabling/disabling code.
	* configure: Rebuilt.
	* ch/config-lang.in (target_libs): Set.
	(build_by_default): Set to no.
	* cp/config-lang.in (target_libs): Set.
	* f/config-lang.in (target_libs): Set.
	* java/config-lang.in (target_libs): Set.
	* objc/config-lang.in (target_libs): Set.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/configure.in,v
retrieving revision 1.79
diff -u -p -r1.79 configure.in
--- configure.in 2000/12/11 16:52:42 1.79
+++ configure.in 2000/12/12 17:26:38
@@ -980,6 +980,55 @@ if [ x$with_gnu_as = xno ]; then
   noconfigdirs="$noconfigdirs gas"
 fi
 
+# 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
+else
+	if test x"${enable_languages}" = x; then
+		echo configure.in: --enable-languages needs at least one argument 1>&2
+		exit 1
+	fi
+fi
+subdirs=
+for lang in ${srcdir}/gcc/*/config-lang.in ..
+do
+	case $lang in
+	..) ;;
+	# The odd quoting in the next line works around
+	# an apparent bug in bash 1.12 on linux.
+	${srcdir}/gcc/[*]/config-lang.in) ;;
+	*)
+	  lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ 	]*\).*$,\1,p' $lang`
+	  this_lang_libs=`sed -n -e 's,^target_libs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^target_libs=\([^ 	]*\).*$,\1,p' $lang`
+	  build_by_default=`sed -n -e 's,^build_by_default=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^build_by_default=\([^ 	]*\).*$,\1,p' $lang`
+	  if test "x$lang_alias" = x
+	  then
+		echo "$lang doesn't set \$language." 1>&2
+		exit 1
+	  fi
+	  case ${build_by_default},${enable_languages}, in
+	  *,$lang_alias,*) add_this_lang=yes ;;
+	  no,*) add_this_lang=no ;;
+	  *,all,*) add_this_lang=yes ;;
+	  *) add_this_lang=no ;;
+	  esac
+	  if test x"${add_this_lang}" = xyes; then
+	      eval target_libs='"$target_libs "'\"$this_lang_libs\"
+	  else
+	      eval noconfigdirs='"$noconfigdirs "'\"$this_lang_libs\"
+	  fi
+	  ;;
+	esac
+done
+
+
 # Remove the entries in $skipdirs and $noconfigdirs from $configdirs and
 # $target_configdirs.
 # If we have the source for $noconfigdirs entries, add them to $notsupp.
Index: gcc/configure.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/configure.in,v
retrieving revision 1.466
diff -u -p -r1.466 configure.in
--- gcc/configure.in 2000/12/12 11:53:48 1.466
+++ gcc/configure.in 2000/12/12 17:26:42
@@ -1499,23 +1499,19 @@ changequote(,)dnl
 	${srcdir}/[*]/config-lang.in) ;;
 	*)
 	  lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ 	]*\).*$,\1,p' $lang`
+	  this_lang_libs=`sed -n -e 's,^target_libs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^target_libs=\([^ 	]*\).*$,\1,p' $lang`
+	  build_by_default=`sed -n -e 's,^build_by_default=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^build_by_default=\([^ 	]*\).*$,\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 && test x"${lang_alias}" != xCHILL; 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
+	  case ${build_by_default},${enable_languages}, in
+	  *,$lang_alias,*) add_this_lang=yes ;;
+	  no,*) add_this_lang=no ;;
+	  *,all,*) add_this_lang=yes ;;
+	  *) add_this_lang=no ;;
+	  esac
 	  if test x"${add_this_lang}" = xyes; then
 		case $lang in
 		    ${srcdir}/ada/config-lang.in)
Index: gcc/ch/config-lang.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ch/config-lang.in,v
retrieving revision 1.5
diff -u -p -r1.5 config-lang.in
--- gcc/ch/config-lang.in 2000/06/06 07:23:41 1.5
+++ gcc/ch/config-lang.in 2000/12/12 17:26:42
@@ -1,5 +1,5 @@
 # Top level configure fragment for GNU CHILL.
-#   Copyright (C) 1994 Free Software Foundation, Inc.
+#   Copyright (C) 1994, 2000 Free Software Foundation, Inc.
 
 #This file is part of GNU CC.
 
@@ -36,3 +36,6 @@ diff_excludes="-x -x ch/chill.info*"
 
 outputs=ch/Makefile
 
+target_libs=target-libchill
+
+build_by_default=no
Index: gcc/cp/config-lang.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/config-lang.in,v
retrieving revision 1.7
diff -u -p -r1.7 config-lang.in
--- gcc/cp/config-lang.in 2000/10/27 20:22:27 1.7
+++ gcc/cp/config-lang.in 2000/12/12 17:26:42
@@ -1,5 +1,5 @@
 # Top level configure fragment for GNU C++.
-#   Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
+#   Copyright (C) 1994, 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
 
 #This file is part of GNU CC.
 
@@ -33,3 +33,5 @@ compilers="cc1plus\$(exeext)"
 stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)"
 
 diff_excludes="-x parse.c -x parse.h"
+
+target_libs=${libstdcxx_version}
Index: gcc/f/config-lang.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/f/config-lang.in,v
retrieving revision 1.9
diff -u -p -r1.9 config-lang.in
--- gcc/f/config-lang.in 2000/10/27 20:22:28 1.9
+++ gcc/f/config-lang.in 2000/12/12 17:26:42
@@ -1,5 +1,5 @@
 # Top level configure fragment for GNU FORTRAN.
-#   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+#   Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
 
 #This file is part of GNU Fortran.
 
@@ -33,3 +33,5 @@ compilers="f771\$(exeext)"
 stagestuff="g77\$(exeext) g77-cross\$(exeext) f771\$(exeext)"
 
 diff_excludes="-x f/BUGS -x f/NEWS -x f/INSTALL -x f/intdoc.texi"
+
+target_libs=target-libf2c
Index: gcc/java/config-lang.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/config-lang.in,v
retrieving revision 1.4
diff -u -p -r1.4 config-lang.in
--- gcc/java/config-lang.in 2000/10/27 20:22:28 1.4
+++ gcc/java/config-lang.in 2000/12/12 17:26:42
@@ -1,6 +1,6 @@
 # Top level configure fragment for the GNU compiler for the Java(TM)
 # language.
-#  Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+#  Copyright (C) 1994, 1995, 2000 Free Software Foundation, Inc.
 
 #This file is part of GNU CC.
 
@@ -36,3 +36,5 @@ language="java"
 compilers="jc1\$(exeext) jvgenmain\$(exeext)"
 
 stagestuff="jc1\$(exeext) gcj\$(exeext) jvgenmain\$(exeext) gcjh\$(exeext) jv-scan\$(exeext) jcf-dump\$(exeext)"
+
+target_libs=${libgcj}
Index: gcc/objc/config-lang.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/objc/config-lang.in,v
retrieving revision 1.3
diff -u -p -r1.3 config-lang.in
--- gcc/objc/config-lang.in 1998/12/16 21:21:16 1.3
+++ gcc/objc/config-lang.in 2000/12/12 17:26:43
@@ -1,5 +1,5 @@
 # Top level configure fragment for the GNU Objective-C Runtime Library.
-#   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+#   Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
 
 #This file is part of GNU CC.
 
@@ -33,3 +33,5 @@ compilers="cc1obj\$(exeext)"
 stagestuff=""
 
 diff_excludes="-x objc-parse.c -x objc-parse.y "
+
+target_libs=target-libobjc

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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