diff mbox

[config] --enable-languages

Message ID 8234b541-9f75-2c88-5473-bedbbde8a2a6@acm.org
State New
Headers show

Commit Message

Nathan Sidwell May 19, 2017, 4:59 p.m. UTC
--enable-languages=all confused me, because as RichardB said, 'it really 
means default'.  So this patch does 2 things
1) allow --enable-languages=default to mean what =all does now.
2) change =all to mean all available languages.
2.1) jit is included in =all if -enable-host-shared is given.  If you 
don't you get a warning that JIT's not included.

If you're used to saying =all, then you'll get more languages with this 
patch than you used to.

ok?

nathan

Comments

Mike Stump May 19, 2017, 8:06 p.m. UTC | #1
On May 19, 2017, at 9:59 AM, Nathan Sidwell <nathan@acm.org> wrote:
> 
> --enable-languages=all confused me, because as RichardB said, 'it really means default'.  So this patch does 2 things
> 1) allow --enable-languages=default to mean what =all does now.
> 2) change =all to mean all available languages.
> 2.1) jit is included in =all if -enable-host-shared is given.  If you don't you get a warning that JIT's not included.
> 
> If you're used to saying =all, then you'll get more languages with this patch than you used to.
> 
> ok?

Can't approve the patch, but I'd endorse it.  I think it is easier to explain.
Richard Biener May 24, 2017, 1:41 p.m. UTC | #2
On Fri, May 19, 2017 at 6:59 PM, Nathan Sidwell <nathan@acm.org> wrote:
> --enable-languages=all confused me, because as RichardB said, 'it really
> means default'.  So this patch does 2 things
> 1) allow --enable-languages=default to mean what =all does now.
> 2) change =all to mean all available languages.
> 2.1) jit is included in =all if -enable-host-shared is given.  If you don't
> you get a warning that JIT's not included.
>
> If you're used to saying =all, then you'll get more languages with this
> patch than you used to.
>
> ok?

Ok.  Did you check =all works with/without a host Ada compiler installed?
(warning but not including ada in the without case?)

Richard.

> nathan
> --
> Nathan Sidwell
Martin Sebor May 24, 2017, 7:42 p.m. UTC | #3
On 05/19/2017 10:59 AM, Nathan Sidwell wrote:
> --enable-languages=all confused me, because as RichardB said, 'it really
> means default'.  So this patch does 2 things
> 1) allow --enable-languages=default to mean what =all does now.
> 2) change =all to mean all available languages.
> 2.1) jit is included in =all if -enable-host-shared is given.  If you
> don't you get a warning that JIT's not included.
>
> If you're used to saying =all, then you'll get more languages with this
> patch than you used to.
>
> ok?

FWIW, it took me a few broken bootstraps before I remembered that
all didn't actually mean all but just some.  I've since trained
myself to spell out all the languages explicitly (in addition to
typing all just to be safe) but I'm happy to see that I wasn't
the only one shaking his head at the confusing misnomer.  Thanks
for fixing it!

Martin
diff mbox

Patch

2017-05-19  Nathan Sidwell  <nathan@acm.org>

	* configure.ac: Add --enable-languages=default to mean default and
	make --enable-languages=all mean all supported languages.
	* configure: Regenerated.
	gcc/
	* doc/invoke.texi (--enable-languages): Update documentation.

Index: configure.ac
===================================================================
--- configure.ac	(revision 248286)
+++ configure.ac	(working copy)
@@ -1766,6 +1766,13 @@  AC_ARG_ENABLE(linker-plugin-flags,
   extra_linker_plugin_flags=)
 AC_SUBST(extra_linker_plugin_flags)
 
+# Enable --enable-host-shared.
+# Checked early to determine whether jit is an 'all' language
+AC_ARG_ENABLE(host-shared,
+[AS_HELP_STRING([--enable-host-shared],
+		[build host code as shared libraries])],
+[host_shared=$enableval], [host_shared=no])
+AC_SUBST(host_shared)
 
 # By default, C and C++ are the only stage 1 languages.
 stage1_languages=,c,
@@ -1784,7 +1791,7 @@  if test -d ${srcdir}/gcc; then
       enable_languages="${LANGUAGES}"
         echo configure.ac: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
     else
-      enable_languages=all
+      enable_languages=default
     fi
   else
     if test x"${enable_languages}" = x ||
@@ -1836,6 +1843,7 @@  if test -d ${srcdir}/gcc; then
         for other in ${lang_requires} ${lang_requires_boot_languages}; do
           case ,${enable_languages}, in
 	    *,$other,*) ;;
+	    *,default,*) ;;
 	    *,all,*) ;;
 	    *,$language,*)
 	      echo " \`$other' language required by \`$language'; enabling" 1>&2
@@ -1847,6 +1855,7 @@  if test -d ${srcdir}/gcc; then
 	  if test "$other" != "c"; then
 	    case ,${enable_stage1_languages}, in
 	      *,$other,*) ;;
+	      *,default,*) ;;
 	      *,all,*) ;;
 	      *)
 		case ,${enable_languages}, in
@@ -1884,7 +1893,7 @@  if test -d ${srcdir}/gcc; then
     esac
   fi
 
-  missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e s/,c,/,/ `
+  missing_languages=`echo ",$enable_languages," | sed -e s/,default,/,/ -e s/,all,/,/ -e s/,c,/,/ `
   potential_languages=,c,
 
   enabled_target_libs=
@@ -1916,21 +1925,27 @@  if test -d ${srcdir}/gcc; then
 	fi
 
         add_this_lang=no
-        case ,${enable_languages}, in
-          *,${language},*)
-            # Language was explicitly selected; include it
-	    # unless it is C, which is enabled by default.
-	    if test "$language" != "c"; then
+        # C is always enabled, so no need to add it again
+        if test "$language" != "c"; then
+          case ,${enable_languages}, in
+            *,${language},*)
+              # Language was explicitly selected; include it
 	      add_this_lang=yes
-	    fi
-            ;;
-          *,all,*)
-            # 'all' was selected, select it if it is a default language
-	    if test "$language" != "c"; then
+              ;;
+	    *,all,*)
+	      # All languages are enabled
+	      if test "$language:$host_shared" = "jit:no" ; then
+	        AC_MSG_WARN([not enabling language "jit" as --enable-host-shared not specified])
+	      else
+	        add_this_lang=yes
+	      fi
+              ;;
+            *,default,*)
+              # 'default' was selected, select it if it is a default language
 	      add_this_lang=${build_by_default}
-	    fi
-            ;;
-        esac
+              ;;
+          esac
+        fi
 
         # Disable languages that need other directories if these aren't available.
 	for i in $subdir_requires; do
@@ -1959,6 +1974,8 @@  if test -d ${srcdir}/gcc; then
             ;;
         esac
 
+        # Disable jit if -enable-host-shared not specified
+
 	# Disable a language that is unsupported by the target.
 	case " $unsupported_languages " in
 	  *" $language "*)
@@ -3478,13 +3495,6 @@  fi
 
 AC_SUBST(stage2_werror_flag)
 
-# Enable --enable-host-shared.
-AC_ARG_ENABLE(host-shared,
-[AS_HELP_STRING([--enable-host-shared],
-		[build host code as shared libraries])],
-[host_shared=$enableval], [host_shared=no])
-AC_SUBST(host_shared)
-
 # PR jit/64780: Require the user to explicitly specify
 # --enable-host-shared if the jit is enabled, hinting
 # that they might want to do a separate configure/build of
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi	(revision 248286)
+++ gcc/doc/install.texi	(working copy)
@@ -1621,14 +1621,17 @@  their runtime libraries should be built.
 grep ^language= */config-lang.in
 @end smallexample
 Currently, you can use any of the following:
-@code{all}, @code{ada}, @code{c}, @code{c++}, @code{fortran},
+@code{all}, @code{default}, @code{ada}, @code{c}, @code{c++}, @code{fortran},
 @code{go}, @code{jit}, @code{lto}, @code{objc}, @code{obj-c++}.
 Building the Ada compiler has special requirements, see below.
-If you do not pass this flag, or specify the option @code{all}, then all
+If you do not pass this flag, or specify the option @code{default}, then the
 default languages available in the @file{gcc} sub-tree will be configured.
 Ada, Go, Jit, and Objective-C++ are not default languages.  LTO is not a
 default language, but is built by default because @option{--enable-lto} is
-enabled by default.  The other languages are default languages.
+enabled by default.  The other languages are default languages.  If
+@code{all} is specified, then all available languages are built.  An
+exception is @code{jit} language, which requires
+@option{--enable-host-shared} to be included with @code{all}.
 
 @item --enable-stage1-languages=@var{lang1},@var{lang2},@dots{}
 Specify that a particular subset of compilers and their runtime
Index: configure
===================================================================
--- configure	(revision 248286)
+++ configure	(working copy)
@@ -556,7 +556,6 @@  enable_option_checking=no
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 compare_exclusions
-host_shared
 stage2_werror_flag
 stage1_checking
 stage1_cflags
@@ -645,6 +644,7 @@  get_gcc_base_ver
 extra_host_zlib_configure_flags
 extra_host_libiberty_configure_flags
 stage1_languages
+host_shared
 extra_linker_plugin_flags
 extra_linker_plugin_configure_flags
 islinc
@@ -781,6 +781,7 @@  enable_isl_version_check
 enable_lto
 enable_linker_plugin_configure_flags
 enable_linker_plugin_flags
+enable_host_shared
 enable_stage1_languages
 enable_objc_gc
 with_target_bdw_gc
@@ -796,7 +797,6 @@  with_build_time_tools
 enable_maintainer_mode
 enable_stage1_checking
 enable_werror
-enable_host_shared
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1498,6 +1498,7 @@  Optional Features:
   --enable-linker-plugin-flags=FLAGS
                           additional flags for configuring and building linker
                           plugins [none]
+  --enable-host-shared    build host code as shared libraries
   --enable-stage1-languages[=all]
                           choose additional languages to build during stage1.
                           Mostly useful for compiler development
@@ -1515,7 +1516,6 @@  Optional Features:
                           choose additional checking for stage1 of the
                           compiler
   --enable-werror         enable -Werror in bootstrap stage2 and later
-  --enable-host-shared    build host code as shared libraries
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -6090,6 +6090,16 @@  fi
 
 
 
+# Enable --enable-host-shared.
+# Checked early to determine whether jit is an 'all' language
+# Check whether --enable-host-shared was given.
+if test "${enable_host_shared+set}" = set; then :
+  enableval=$enable_host_shared; host_shared=$enableval
+else
+  host_shared=no
+fi
+
+
 
 # By default, C and C++ are the only stage 1 languages.
 stage1_languages=,c,
@@ -6108,7 +6118,7 @@  if test -d ${srcdir}/gcc; then
       enable_languages="${LANGUAGES}"
         echo configure.ac: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
     else
-      enable_languages=all
+      enable_languages=default
     fi
   else
     if test x"${enable_languages}" = x ||
@@ -6160,6 +6170,7 @@  if test -d ${srcdir}/gcc; then
         for other in ${lang_requires} ${lang_requires_boot_languages}; do
           case ,${enable_languages}, in
 	    *,$other,*) ;;
+	    *,default,*) ;;
 	    *,all,*) ;;
 	    *,$language,*)
 	      echo " \`$other' language required by \`$language'; enabling" 1>&2
@@ -6171,6 +6182,7 @@  if test -d ${srcdir}/gcc; then
 	  if test "$other" != "c"; then
 	    case ,${enable_stage1_languages}, in
 	      *,$other,*) ;;
+	      *,default,*) ;;
 	      *,all,*) ;;
 	      *)
 		case ,${enable_languages}, in
@@ -6208,7 +6220,7 @@  if test -d ${srcdir}/gcc; then
     esac
   fi
 
-  missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e s/,c,/,/ `
+  missing_languages=`echo ",$enable_languages," | sed -e s/,default,/,/ -e s/,all,/,/ -e s/,c,/,/ `
   potential_languages=,c,
 
   enabled_target_libs=
@@ -6240,21 +6252,28 @@  if test -d ${srcdir}/gcc; then
 	fi
 
         add_this_lang=no
-        case ,${enable_languages}, in
-          *,${language},*)
-            # Language was explicitly selected; include it
-	    # unless it is C, which is enabled by default.
-	    if test "$language" != "c"; then
+        # C is always enabled, so no need to add it again
+        if test "$language" != "c"; then
+          case ,${enable_languages}, in
+            *,${language},*)
+              # Language was explicitly selected; include it
 	      add_this_lang=yes
-	    fi
-            ;;
-          *,all,*)
-            # 'all' was selected, select it if it is a default language
-	    if test "$language" != "c"; then
+              ;;
+	    *,all,*)
+	      # All languages are enabled
+	      if test "$language:$host_shared" = "jit:no" ; then
+	        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not enabling language \"jit\" as --enable-host-shared not specified" >&5
+$as_echo "$as_me: WARNING: not enabling language \"jit\" as --enable-host-shared not specified" >&2;}
+	      else
+	        add_this_lang=yes
+	      fi
+              ;;
+            *,default,*)
+              # 'default' was selected, select it if it is a default language
 	      add_this_lang=${build_by_default}
-	    fi
-            ;;
-        esac
+              ;;
+          esac
+        fi
 
         # Disable languages that need other directories if these aren't available.
 	for i in $subdir_requires; do
@@ -6283,6 +6302,8 @@  if test -d ${srcdir}/gcc; then
             ;;
         esac
 
+        # Disable jit if -enable-host-shared not specified
+
 	# Disable a language that is unsupported by the target.
 	case " $unsupported_languages " in
 	  *" $language "*)
@@ -14604,16 +14625,6 @@  if test -d ${srcdir}/gcc && test x"`cat
 fi
 
 
-
-# Enable --enable-host-shared.
-# Check whether --enable-host-shared was given.
-if test "${enable_host_shared+set}" = set; then :
-  enableval=$enable_host_shared; host_shared=$enableval
-else
-  host_shared=no
-fi
-
-
 
 # PR jit/64780: Require the user to explicitly specify
 # --enable-host-shared if the jit is enabled, hinting