diff mbox

Review of --enable-gold=both patch

Message ID 4CDEEEEB.2000905@ubuntu.com
State New
Headers show

Commit Message

Matthias Klose Nov. 13, 2010, 8:02 p.m. UTC
On 11.11.2010 09:37, Paolo Bonzini wrote:
> On 11/11/2010 01:08 AM, Matthias Klose wrote:
>> + if test x${default_ld} = xgold; then
>> + AC_MSG_ERROR([either gold or ld can be the default ld])
>> + fi
>
> If you test for x${ENABLE_GOLD} = xdefault, the default_ld variable can go away.

no. ENABLE_GOLD is set to yes in the case statement above. The error message 
would even trigger if gold is enabled but not the default.

>> + no)
>> + if test x${ENABLE_GOLD} != xyes; then
>> + AC_MSG_ERROR([gold must be enabled to disable ld])
>> + fi
>
> I think this is not necessary, you can disable both packages. This would have
> the same effect as --without-gnu-ld. Please conditionalize the message on
> $use_gnu_ld != no and make it a warning rather than an error.
>
> Ok with this fixed.

made it a warning. Kept the condition. Having $use_gnu_ld != no still prints the 
warning for --enable-gold --disable-ld.

   Matthias

Comments

Paolo Bonzini Nov. 13, 2010, 8:48 p.m. UTC | #1
> made it a warning. Kept the condition. Having $use_gnu_ld != no still
> prints the warning for --enable-gold --disable-ld.

Toplevel bits are okay.

Paolo
diff mbox

Patch

toplevel

2010-11-13  Matthias Klose  <doko@ubuntu.com>

	* configure.ac: For --enable-gold, handle value `default' instead of
	`both*'.   New configure option --{en,dis}able-ld.

ld/

2010-11-13  Matthias Klose  <doko@ubuntu.com>

	* configure.in: For --enable-gold, handle value `default' instead of 
	`both*'.  Always install ld as ld.bfd, install as ld if gold is
	not the default.

gold/

2010-11-13  Matthias Klose  <doko@ubuntu.com>

	* configure.ac: For --enable-gold, handle value `default' instead of
	`both*'. Always install ld as ld.gold, install as ld if gold is
	the default.


--- binutils-2.20.90.20101105.orig/configure.ac
+++ binutils-2.20.90.20101105/configure.ac
@@ -321,19 +321,27 @@ 
   yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
 esac
 
-# Handle --enable-gold.
-#   --enable-gold		Build only gold
-#   --disable-gold [default]	Build only ld
-#   --enable-gold=both		Build both gold and ld, ld is default
-#   --enable-gold=both/ld	Same
-#   --enable-gold=both/gold	Build both gold and ld, gold is default, ld is renamed ld.bfd
+# Handle --enable-gold, --enable-ld.
+# --disable-gold [--enable-ld]
+#     Build only ld.  Default option.
+# --enable-gold[=default] [--enable-ld]
+#     Build both gold and ld.  Install gold as "ld.gold" and "ld",
+#     install ld as "ld.bfd".
+# --enable-gold[=default] --disable-ld
+#     Build only gold, which is then installed as both "ld.gold" and "ld".
+# --enable-gold --enable-ld=default
+#     Build both gold (installed as "gold") and ld (installed as "ld").
+#     In other words, ld is default
+# --enable-gold=default --enable-ld=default
+#     Error.
 
+default_ld=
 AC_ARG_ENABLE(gold,
-[[  --enable-gold[=ARG]     build gold [ARG={both}[/{gold,ld}]]]],
+[[  --enable-gold[=ARG]     build gold [ARG={default,yes,no}]]],
 ENABLE_GOLD=$enableval,
 ENABLE_GOLD=no)
-  case "${ENABLE_GOLD}" in
-  yes|both|both/gold|both/ld)
+case "${ENABLE_GOLD}" in
+  yes|default)
     # Check for ELF target.
     is_elf=no
     case "${target}" in
@@ -353,14 +361,10 @@ 
       # Check for target supported by gold.
       case "${target}" in
         i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
-	  case "${ENABLE_GOLD}" in 
-	  both*)
-            configdirs="$configdirs gold"
-	    ;;
-	  *)
-            configdirs=`echo " ${configdirs} " | sed -e 's/ ld / gold /'`
-	    ;;
-	  esac
+	  configdirs="$configdirs gold"
+	  if test x${ENABLE_GOLD} = xdefault; then
+	    default_ld=gold
+	  fi
 	  ENABLE_GOLD=yes
           ;;
       esac
@@ -371,7 +375,31 @@ 
   *)
     AC_MSG_ERROR([invalid --enable-gold argument])
     ;;
-  esac
+esac
+
+AC_ARG_ENABLE(ld,
+[[  --enable-ld[=ARG]     build ld [ARG={default,yes,no}]]],
+ENABLE_LD=$enableval,
+ENABLE_LD=yes)
+
+case "${ENABLE_LD}" in
+  default)
+    if test x${default_ld} != xgold; then
+      AC_MSG_ERROR([either gold or ld can be the default ld])
+    fi
+    ;;
+  yes)
+    ;;
+  no)
+    if test x${ENABLE_GOLD} != xyes; then
+      AC_MSG_WARN([neither ld nor gold are enabled])
+    fi
+    configdirs=`echo " ${configdirs} " | sed -e 's/ ld / /'`
+    ;;
+  *)
+    AC_MSG_ERROR([invalid --enable-ld argument])
+    ;;
+esac
 
 # Configure extra directories which are host specific
 
--- binutils-2.20.90.20101105.orig/ld/configure.in
+++ binutils-2.20.90.20101105/ld/configure.in
@@ -73,13 +73,13 @@ 
 dnl "install_as_default" is set to false if gold is the default linker.
 dnl "installed_linker" is the installed BFD linker name.
 AC_ARG_ENABLE(gold,
-[[  --enable-gold[=ARG]     build gold [ARG={both}[/{gold,ld}]]]],
+[[  --enable-gold[=ARG]     build gold [ARG={default,yes,no}]]],
 [case "${enableval}" in 
- yes|both/gold)
+ default)
    install_as_default=no
    installed_linker=ld.bfd
    ;;
- both|both/ld)
+ yes|no)
    install_as_default=yes
    installed_linker=ld.bfd
    ;;
@@ -87,8 +87,8 @@ 
    AC_MSG_ERROR([invalid --enable-gold argument])
    ;;
  esac],
-[install_as_default=ld
- installed_linker=ld])
+[install_as_default=yes
+ installed_linker=ld.bfd])
 AC_SUBST(install_as_default)
 AC_SUBST(installed_linker)
 
--- binutils-2.20.90.20101105.orig/gold/configure.ac
+++ binutils-2.20.90.20101105/gold/configure.ac
@@ -41,27 +41,33 @@ 
 dnl "install_as_default" is true if the linker to be installed as the
 dnl default linker, ld.
 dnl "installed_linker" is the installed gold linker name.
-AC_ARG_ENABLE(gold,
-[[  --enable-gold[=ARG]     build gold [ARG={both}[/{gold,ld}]]]],
+
+default_ld=
+AC_ARG_ENABLE(ld,
+[[  --enable-ld[=ARG]     build ld [ARG={default,yes,no}]]],
 [case "${enableval}" in 
- yes)
-   install_as_default=gold
-   installed_linker=ld
-   ;;
- both/gold)
-   install_as_default=yes
+  default)
+    default_ld=ld.bfd
+    ;;
+esac])
+
+AC_ARG_ENABLE(gold,
+[[  --enable-gold[=ARG]     build gold [ARG={default,yes,no}]]],
+[case "${enableval}" in
+ yes|default)
+   if test x${default_ld} = x; then
+     install_as_default=yes
+   fi
    installed_linker=ld.gold
    ;;
- both|both/ld)
-   install_as_default=no
-   installed_linker=ld.gold
+ no)
    ;;
  *)
    AC_MSG_ERROR([invalid --enable-gold argument])
    ;;
  esac],
-[install_as_default=gold
- installed_linker=ld])
+[install_as_default=no
+ installed_linker=ld.gold])
 AC_SUBST(install_as_default)
 AC_SUBST(installed_linker)