for  ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR libgcj/44341
	* configure.ac: Remap --with-target-* to --with-* for target
	libraries.  Fix alignment of help messages.
	* config/cloog.m4: Likewise.
	* configure: Rebuilt.

Index: configure.ac
===================================================================
--- configure.ac.orig	2011-01-13 05:35:32.431944554 -0200
+++ configure.ac	2011-01-13 07:23:06.398942274 -0200
@@ -385,7 +385,7 @@ case "${ENABLE_GOLD}" in
 esac
 
 AC_ARG_ENABLE(ld,
-[[  --enable-ld[=ARG]     build ld [ARG={default,yes,no}]]],
+[[  --enable-ld[=ARG]       build ld [ARG={default,yes,no}]]],
 ENABLE_LD=$enableval,
 ENABLE_LD=yes)
 
@@ -1334,12 +1334,14 @@ have_gmp=no
 
 # Specify a location for mpc
 # check for this first so it ends up on the link line before mpfr.
-AC_ARG_WITH(mpc, [  --with-mpc=PATH        specify prefix directory for installed MPC package.
+AC_ARG_WITH(mpc, [  --with-mpc=PATH         specify prefix directory for installed MPC package.
                           Equivalent to --with-mpc-include=PATH/include
                           plus --with-mpc-lib=PATH/lib])
 AC_ARG_WITH(mpc-include, [  --with-mpc-include=PATH
                           specify directory for installed MPC include files])
-AC_ARG_WITH(mpc-lib, [  --with-mpc-lib=PATH    specify directory for the installed MPC library])
+AC_ARG_WITH(mpc-lib, [  --with-mpc-lib=PATH     specify directory for the installed MPC library])
+AC_ARG_WITH(target-mpc,
+		     [  --with-target-mpc*      same as above, but for target rather than host])
 
 if test "x$with_mpc" != x; then
   gmplibs="-L$with_mpc/lib $gmplibs"
@@ -1373,6 +1375,8 @@ AC_ARG_WITH(mpfr, [  --with-mpfr=PATH   
 AC_ARG_WITH(mpfr-include, [  --with-mpfr-include=PATH
                           specify directory for installed MPFR include files])
 AC_ARG_WITH(mpfr-lib, [  --with-mpfr-lib=PATH    specify directory for the installed MPFR library])
+AC_ARG_WITH(target-mpfr,
+		     [  --with-target-mpfr*     same as above, but for target rather than host])
 
 if test "x$with_mpfr" != x; then
   gmplibs="-L$with_mpfr/lib $gmplibs"
@@ -1405,6 +1409,8 @@ AC_ARG_WITH(gmp, [  --with-gmp=PATH     
                           plus --with-gmp-lib=PATH/lib])
 AC_ARG_WITH(gmp-include, [  --with-gmp-include=PATH specify directory for installed GMP include files])
 AC_ARG_WITH(gmp-lib, [  --with-gmp-lib=PATH     specify directory for the installed GMP library])
+AC_ARG_WITH(target-gmp,
+		     [  --with-target-gmp*      same as above, but for target rather than host])
 
 
 if test "x$with_gmp" != x; then
@@ -1558,7 +1564,7 @@ AC_SUBST(stage1_ldflags)
 
 # Libraries to use for stage1 or when not bootstrapping.
 AC_ARG_WITH(stage1-libs,
-[  -with-stage1-libs=LIBS      Libraries for stage1],
+[  --with-stage1-libs=LIBS  Libraries for stage1],
 [if test "$withval" = "no" -o "$withval" = "yes"; then
    stage1_libs=
  else
@@ -1570,7 +1576,7 @@ AC_SUBST(stage1_libs)
 # Libraries to use for stage2 and later builds.  This defaults to the
 # argument passed to --with-host-libstdcxx.
 AC_ARG_WITH(boot-libs,
-[  --with-boot-libs=LIBS     Libraries for stage2 and later],
+[  --with-boot-libs=LIBS   Libraries for stage2 and later],
 [if test "$withval" = "no" -o "$withval" = "yes"; then
    poststage1_libs=
  else
@@ -1605,6 +1611,8 @@ AC_ARG_WITH(ppl, [  --with-ppl=PATH     
                           plus --with-ppl-lib=PATH/lib])
 AC_ARG_WITH(ppl-include, [  --with-ppl-include=PATH Specify directory for installed PPL include files])
 AC_ARG_WITH(ppl-lib, [  --with-ppl-lib=PATH     Specify the directory for the installed PPL library])
+AC_ARG_WITH(target-ppl,
+		     [  --with-target-ppl*      same as above, but for target rather than host])
 
 case $with_ppl in 
   no)
@@ -2674,7 +2682,7 @@ esac
 AC_MSG_CHECKING(for default BUILD_CONFIG)
 
 AC_ARG_WITH([build-config],
-  [--with-build-config='NAME NAME2...'
+  [  --with-build-config='NAME NAME2...'
                           Use config/NAME.mk build configuration],
   [case $with_build_config in
    yes) with_build_config= ;;
@@ -2815,6 +2823,7 @@ AC_SUBST_FILE(serialization_dependencies
 # Also strip program-prefix, program-suffix, and program-transform-name,
 # so that we can pass down a consistent program-transform-name.
 baseargs=
+tbaseargs=
 keep_next=no
 skip_next=no
 eval "set -- $ac_configure_args"
@@ -2830,6 +2839,7 @@ do
 	ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     baseargs="$baseargs '$ac_arg'"
+    tbaseargs="$tbaseargs '$ac_arg'"
     keep_next=no
     continue
   fi
@@ -2851,11 +2861,51 @@ do
       ;;
   esac
 
+  skip_targ=no
+  case $ac_arg in
+  --with-target-* | --without-target-*)
+    ;;
+
+changequote(,)
+  --with-* | --without-*)
+    libopt=`echo "$ac_arg" | sed -e 's,^--[^-_]*[-_],,' -e 's,=.*$,,'`
+
+    case $libopt in
+    *[-_]include)
+      lib=`echo "$libopt" | sed 's,[-_]include$,,'`
+      ;;
+    *[-_]lib)
+      lib=`echo "$libopt" | sed 's,[-_]lib$,,'`
+      ;;
+    *)
+      lib=$libopt
+      ;;
+    esac
+changequote([,])
+
+    case $lib in
+    mpc | mpfr | gmp | ppl | cloog)
+      # If we're processing --with-$lib, --with-$lib-include or
+      # --with-$lib-lib, for one of the libs above, and target is
+      # different from host, or options such as --with-target-$lib,
+      # --with-target-$lib-include or --with-target-$lib-lib were
+      # passed to configure, don't pass the current argument to any
+      # target library's configure.
+      if test x$is_cross_compiler = xyes ||
+	 eval test "X\${with_target_${lib}+set}\${with_target_${lib}_include+set}\${with_target_${lib}_lib+set}" != X; then
+        skip_targ=yes
+      fi
+      ;;
+    esac
+    ;;
+  esac
+
   case "$ac_arg" in
     --cache-file=/dev/null | \
     -cache-file=/dev/null )
       # Handled here to avoid the test to skip args below.
       baseargs="$baseargs '$ac_arg'"
+      tbaseargs="$tbaseargs '$ac_arg'"
       # Assert: $separate_arg should always be no.
       keep_next=$separate_arg
       ;;
@@ -2879,6 +2929,21 @@ do
       skip_next=$separate_arg
       continue
       ;;
+    --enable-target-* | \
+    --disable-target-* | \
+    --with-target-* | \
+    --without-target-*)
+      # A target option.  Add it, but edit out "-target" from the
+      # argument passed to configure the target library.
+      case $ac_arg in
+	*\'*)
+	  ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+      esac
+      baseargs="$baseargs '$ac_arg'"
+      ac_targ=`echo "$ac_arg" | sed 's,-target,,'`
+      tbaseargs="$tbaseargs '$ac_targ'"
+      keep_next=$separate_arg
+      ;;
     -*)
       # An option.  Add it.
       case $ac_arg in
@@ -2886,6 +2951,9 @@ do
 	  ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
       esac
       baseargs="$baseargs '$ac_arg'"
+      if test X"$skip_targ" = Xno; then
+        tbaseargs="$tbaseargs '$ac_arg'"
+      fi
       keep_next=$separate_arg
       ;;
     *)
@@ -2912,10 +2980,13 @@ EOF_SED
 gcc_transform_name=`cat conftestsed.out`
 rm -f conftestsed.out
 baseargs="$baseargs --program-transform-name='${gcc_transform_name}'"
+tbaseargs="$tbaseargs --program-transform-name='${gcc_transform_name}'"
 if test "$silent" = yes; then
   baseargs="$baseargs --silent"
+  tbaseargs="$tbaseargs --silent"
 fi
 baseargs="$baseargs --disable-option-checking"
+tbaseargs="$tbaseargs --disable-option-checking"
 
 # Record and document user additions to sub configure arguments.
 AC_ARG_VAR([build_configargs],
@@ -2944,7 +3015,7 @@ esac
 # This seems to be due to autoconf 2.5x stupidity.
 host_configargs="$host_configargs --cache-file=./config.cache ${extra_host_args} ${baseargs}"
 
-target_configargs="$target_configargs ${baseargs}"
+target_configargs="$target_configargs ${tbaseargs}"
 
 # Passing a --with-cross-host argument lets the target libraries know
 # whether they are being built with a cross-compiler or being built
@@ -3315,7 +3386,7 @@ AC_SUBST(COMPILER_NM_FOR_TARGET)
 
 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
 AC_ARG_ENABLE(maintainer-mode,
-[  --enable-maintainer-mode enable make rules and dependencies not useful
+[  --enable-maintainer-mode   enable make rules and dependencies not useful
                           (and sometimes confusing) to the casual installer],
       USE_MAINTAINER_MODE=$enableval,
       USE_MAINTAINER_MODE=no)
Index: configure
===================================================================
--- configure.orig	2011-01-13 05:35:32.785940585 -0200
+++ configure	2011-01-13 07:23:25.221938105 -0200
@@ -750,14 +750,17 @@ enable_build_with_cxx
 with_mpc
 with_mpc_include
 with_mpc_lib
+with_target_mpc
 with_mpfr_dir
 with_mpfr
 with_mpfr_include
 with_mpfr_lib
+with_target_mpfr
 with_gmp_dir
 with_gmp
 with_gmp_include
 with_gmp_lib
+with_target_gmp
 with_host_libstdcxx
 with_stage1_ldflags
 with_stage1_libs
@@ -766,10 +769,12 @@ with_boot_ldflags
 with_ppl
 with_ppl_include
 with_ppl_lib
+with_target_ppl
 enable_ppl_version_check
 with_cloog
 with_cloog_include
 with_cloog_lib
+with_target_cloog
 enable_cloog_backend
 enable_cloog_version_check
 enable_lto
@@ -1454,7 +1459,7 @@ Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
-  --enable-ld[=ARG]     build ld [ARG={default,yes,no}]
+  --enable-ld[=ARG]       build ld [ARG={default,yes,no}]
   --disable-libquadmath   do not build libquadmath directory
   --disable-libquadmath-support
                           disable libquadmath support for Fortran
@@ -1477,7 +1482,7 @@ Optional Features:
                           force sequential configuration of
                           sub-packages for the host, target or build
                           machine, or all sub-packages
-  --enable-maintainer-mode enable make rules and dependencies not useful
+  --enable-maintainer-mode   enable make rules and dependencies not useful
                           (and sometimes confusing) to the casual installer
   --enable-stage1-checking[=all]   choose additional checking for stage1
                           of the compiler
@@ -1487,12 +1492,13 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-build-libsubdir=DIR  Directory where to find libraries for build system
-  --with-mpc=PATH        specify prefix directory for installed MPC package.
+  --with-mpc=PATH         specify prefix directory for installed MPC package.
                           Equivalent to --with-mpc-include=PATH/include
                           plus --with-mpc-lib=PATH/lib
   --with-mpc-include=PATH
                           specify directory for installed MPC include files
-  --with-mpc-lib=PATH    specify directory for the installed MPC library
+  --with-mpc-lib=PATH     specify directory for the installed MPC library
+  --with-target-mpc*      same as above, but for target rather than host
   --with-mpfr-dir=PATH    this option has been REMOVED
   --with-mpfr=PATH        specify prefix directory for installed MPFR package.
                           Equivalent to --with-mpfr-include=PATH/include
@@ -1500,23 +1506,26 @@ Optional Packages:
   --with-mpfr-include=PATH
                           specify directory for installed MPFR include files
   --with-mpfr-lib=PATH    specify directory for the installed MPFR library
+  --with-target-mpfr*     same as above, but for target rather than host
   --with-gmp-dir=PATH     this option has been REMOVED
   --with-gmp=PATH         specify prefix directory for the installed GMP package.
                           Equivalent to --with-gmp-include=PATH/include
                           plus --with-gmp-lib=PATH/lib
   --with-gmp-include=PATH specify directory for installed GMP include files
   --with-gmp-lib=PATH     specify directory for the installed GMP library
+  --with-target-gmp*      same as above, but for target rather than host
   --with-host-libstdcxx=L Use linker arguments L to link with libstdc++
                           when linking with PPL
   --with-stage1-ldflags=FLAGS Linker flags for stage1
-  -with-stage1-libs=LIBS      Libraries for stage1
-  --with-boot-libs=LIBS     Libraries for stage2 and later
+  --with-stage1-libs=LIBS  Libraries for stage1
+  --with-boot-libs=LIBS   Libraries for stage2 and later
   --with-boot-ldflags=FLAGS Linker flags for stage2 and later
   --with-ppl=PATH         Specify prefix directory for the installed PPL package
                           Equivalent to --with-ppl-include=PATH/include
                           plus --with-ppl-lib=PATH/lib
   --with-ppl-include=PATH Specify directory for installed PPL include files
   --with-ppl-lib=PATH     Specify the directory for the installed PPL library
+  --with-target-ppl*      same as above, but for target rather than host
   --with-cloog=PATH       Specify prefix directory for the installed CLooG-PPL
                           package. Equivalent to
                           --with-cloog-include=PATH/include plus
@@ -1525,11 +1534,12 @@ Optional Packages:
                           Specify directory for installed CLooG include files
   --with-cloog-lib=PATH   Specify the directory for the installed CLooG
                           library
+  --with-target-cloog*    same as above, but for target rather than host
   --with-build-sysroot=SYSROOT
                           use sysroot as the system root during the build
   --with-debug-prefix-map='A=B C=D ...'
                              map A to B, C to D ... in debug information
---with-build-config='NAME NAME2...'
+  --with-build-config='NAME NAME2...'
                           Use config/NAME.mk build configuration
   --with-build-time-tools=PATH
                           use given path to find target tools during the build
@@ -5218,6 +5228,12 @@ if test "${with_mpc_lib+set}" = set; the
 fi
 
 
+# Check whether --with-target-mpc was given.
+if test "${with_target_mpc+set}" = set; then :
+  withval=$with_target_mpc;
+fi
+
+
 if test "x$with_mpc" != x; then
   gmplibs="-L$with_mpc/lib $gmplibs"
   gmpinc="-I$with_mpc/include $gmpinc"
@@ -5267,6 +5283,12 @@ if test "${with_mpfr_lib+set}" = set; th
 fi
 
 
+# Check whether --with-target-mpfr was given.
+if test "${with_target_mpfr+set}" = set; then :
+  withval=$with_target_mpfr;
+fi
+
+
 if test "x$with_mpfr" != x; then
   gmplibs="-L$with_mpfr/lib $gmplibs"
   gmpinc="-I$with_mpfr/include $gmpinc"
@@ -5316,6 +5338,12 @@ if test "${with_gmp_lib+set}" = set; the
 fi
 
 
+# Check whether --with-target-gmp was given.
+if test "${with_target_gmp+set}" = set; then :
+  withval=$with_target_gmp;
+fi
+
+
 
 if test "x$with_gmp" != x; then
   gmplibs="-L$with_gmp/lib $gmplibs"
@@ -5675,6 +5703,12 @@ if test "${with_ppl_lib+set}" = set; the
 fi
 
 
+# Check whether --with-target-ppl was given.
+if test "${with_target_ppl+set}" = set; then :
+  withval=$with_target_ppl;
+fi
+
+
 case $with_ppl in
   no)
     ppllibs=
@@ -5764,6 +5798,12 @@ if test "${with_cloog_lib+set}" = set; t
 fi
 
 
+# Check whether --with-target-cloog was given.
+if test "${with_target_cloog+set}" = set; then :
+  withval=$with_target_cloog;
+fi
+
+
   # Check whether --enable-cloog-backend was given.
 if test "${enable_cloog_backend+set}" = set; then :
   enableval=$enable_cloog_backend;  if   test "x${enableval}" = "xisl"; then
@@ -7304,6 +7344,7 @@ serialization_dependencies=serdep.tmp
 # Also strip program-prefix, program-suffix, and program-transform-name,
 # so that we can pass down a consistent program-transform-name.
 baseargs=
+tbaseargs=
 keep_next=no
 skip_next=no
 eval "set -- $ac_configure_args"
@@ -7319,6 +7360,7 @@ do
 	ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     baseargs="$baseargs '$ac_arg'"
+    tbaseargs="$tbaseargs '$ac_arg'"
     keep_next=no
     continue
   fi
@@ -7340,11 +7382,51 @@ do
       ;;
   esac
 
+  skip_targ=no
+  case $ac_arg in
+  --with-target-* | --without-target-*)
+    ;;
+
+
+  --with-* | --without-*)
+    libopt=`echo "$ac_arg" | sed -e 's,^--[^-_]*[-_],,' -e 's,=.*$,,'`
+
+    case $libopt in
+    *[-_]include)
+      lib=`echo "$libopt" | sed 's,[-_]include$,,'`
+      ;;
+    *[-_]lib)
+      lib=`echo "$libopt" | sed 's,[-_]lib$,,'`
+      ;;
+    *)
+      lib=$libopt
+      ;;
+    esac
+
+
+    case $lib in
+    mpc | mpfr | gmp | ppl | cloog)
+      # If we're processing --with-$lib, --with-$lib-include or
+      # --with-$lib-lib, for one of the libs above, and target is
+      # different from host, or options such as --with-target-$lib,
+      # --with-target-$lib-include or --with-target-$lib-lib were
+      # passed to configure, don't pass the current argument to any
+      # target library's configure.
+      if test x$is_cross_compiler = xyes ||
+	 eval test "X\${with_target_${lib}+set}\${with_target_${lib}_include+set}\${with_target_${lib}_lib+set}" != X; then
+        skip_targ=yes
+      fi
+      ;;
+    esac
+    ;;
+  esac
+
   case "$ac_arg" in
     --cache-file=/dev/null | \
     -cache-file=/dev/null )
       # Handled here to avoid the test to skip args below.
       baseargs="$baseargs '$ac_arg'"
+      tbaseargs="$tbaseargs '$ac_arg'"
       # Assert: $separate_arg should always be no.
       keep_next=$separate_arg
       ;;
@@ -7368,6 +7450,21 @@ do
       skip_next=$separate_arg
       continue
       ;;
+    --enable-target-* | \
+    --disable-target-* | \
+    --with-target-* | \
+    --without-target-*)
+      # A target option.  Add it, but edit out "-target" from the
+      # argument passed to configure the target library.
+      case $ac_arg in
+	*\'*)
+	  ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+      esac
+      baseargs="$baseargs '$ac_arg'"
+      ac_targ=`echo "$ac_arg" | sed 's,-target,,'`
+      tbaseargs="$tbaseargs '$ac_targ'"
+      keep_next=$separate_arg
+      ;;
     -*)
       # An option.  Add it.
       case $ac_arg in
@@ -7375,6 +7472,9 @@ do
 	  ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
       esac
       baseargs="$baseargs '$ac_arg'"
+      if test X"$skip_targ" = Xno; then
+        tbaseargs="$tbaseargs '$ac_arg'"
+      fi
       keep_next=$separate_arg
       ;;
     *)
@@ -7401,10 +7501,13 @@ EOF_SED
 gcc_transform_name=`cat conftestsed.out`
 rm -f conftestsed.out
 baseargs="$baseargs --program-transform-name='${gcc_transform_name}'"
+tbaseargs="$tbaseargs --program-transform-name='${gcc_transform_name}'"
 if test "$silent" = yes; then
   baseargs="$baseargs --silent"
+  tbaseargs="$tbaseargs --silent"
 fi
 baseargs="$baseargs --disable-option-checking"
+tbaseargs="$tbaseargs --disable-option-checking"
 
 # Record and document user additions to sub configure arguments.
 
@@ -7430,7 +7533,7 @@ esac
 # This seems to be due to autoconf 2.5x stupidity.
 host_configargs="$host_configargs --cache-file=./config.cache ${extra_host_args} ${baseargs}"
 
-target_configargs="$target_configargs ${baseargs}"
+target_configargs="$target_configargs ${tbaseargs}"
 
 # Passing a --with-cross-host argument lets the target libraries know
 # whether they are being built with a cross-compiler or being built
Index: config/cloog.m4
===================================================================
--- config/cloog.m4.orig	2011-01-13 06:55:29.114938373 -0200
+++ config/cloog.m4	2011-01-13 07:22:45.736938960 -0200
@@ -36,6 +36,10 @@ AC_DEFUN([CLOOG_INIT_FLAGS],
     [AS_HELP_STRING(
       [--with-cloog-lib=PATH],
       [Specify the directory for the installed CLooG library])])
+  AC_ARG_WITH([target-cloog],
+    [AS_HELP_STRING(
+      [--with-target-cloog*],
+      [same as above, but for target rather than host])])
 
   AC_ARG_ENABLE(cloog-backend,
     [AS_HELP_STRING(
