(autoconf 2.57, distributed with RH 9.0, GNU bash, version 2.05b.0(1)-release (i386-redhat-linux-gnu)) Hello, I'm trying to add an experimental runtime library to GCC. The configure logic needs to select one or more sub-directories of the top-level directory for configuration and subsequent installation depending upon the target platform. I'm building configure using the AC_SUBDIRS() macro, along these lines: if test "$use_smp" = yes; then AC_CONFIG_SUBDIRS(smp) fi if test "$use_cray" = yes; then AC_CONFIG_SUBDIRS(cray) fi if test "$use_berkeley" = yes; then AC_CONFIG_SUBDIRS(upcr) fi For the purposes of testing, I'm running config. as follows (these are the config. args passed from the top-level GCC make: configure \ --cache-file=../config.cache \ --host=i686-pc-linux-gnu \ --build=i686-pc-linux-gnu \ --enable-multilib \ --with-gcc-version-trigger=/upc/gcc-upc/src/gcc/version.c \ --enable-languages=upc \ --prefix=/usr/local/upc \ --srcdir=/upc/gcc-upc/src/libupc \ --with-target-subdir=i686-pc-linux-gnu Here's what happens when ./configure recurses into the sub-directory, 'smp': running /bin/sh '/upc/gcc-upc/src/libupc/smp/configure' --prefix=/usr/local/upc '--cache-file=../config.cache' '--host=i686-pc-linux-gnu' '--build=i686-pc-linux-gnu' '--enable-multilib' '--with-gcc-version-trigger=/upc/gcc-upc/src/gcc/version.c' '--enable-languages=upc' '--prefix=/usr/local/upc' '--srcdir=/upc/gcc-upc/src/libupc' '--with-target-subdir=i686-pc-linux-gnu' 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu' --cache-file=../../config.cache --srcdir=/upc /gcc-upc/src/libupc/smp configure: running /bin/sh '/upc/gcc-upc/src/libupc/smp/configure' --prefix=/usr/local/upc '--cache-file=../config.cache' '--host=i686-pc-linux-gnu' '--build=i686-pc-linux-gnu' '--enable-multilib' '--with-gcc-version-trigger=/upc/gcc-upc/src/gcc/version.c' '--enable-languages=upc' '--prefix=/usr/local/upc' '--srcdir=/upc/gcc-upc/src/libupc' '--with-target-subdir=i686-pc-linux-gnu' 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu' --cache-file=../../config.cache --srcdir=/upc /gcc-upc/src/libupc/smp configure: warning: build_alias=i686-pc-linux-gnu: invalid host type configure: warning: host_alias=i686-pc-linux-gnu: invalid host type configure: error: can only configure for one host and one target at a time configure: error: /bin/sh '/upc/gcc-upc/src/libupc/smp/configure' failed for smp note that the configure script in 'smp' is complaining about build_alias=i686-pc-linux-gnu being passed in as a "host type". That's because build_alias and host_alias aren't prefixed with '--'. Also, note that the initial duplicate --cache_file=.../config.cache' was not removed. And, *all* of the initial args to configure a quoated with '...'. ----- Going through the logic in configure, the initial build_alias and host_alias values are derived from the --build and --host arguments passed into configure: regarding build_alias and host alias, the code that sets them is here: -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; following just build_alias, it is copied into some 'ac' variables: ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias lster on, there is some logic which tries to decide if these 'precious' variables should be passed on to the sub-configure: # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi It's the assignment ac_configure_args="$ac_configure_args '$ac_arg' that leads to 'build_alias=i686-pc-linux-gnu' being passed to the sub-configure. It seems that build_alias should have been passed as '--build=$build_alias", and similarly for host_alias (--host=$host_alias). Something like: if test "$ac_new_set" = set; then $ac_var = `echo $ac_var | sed 's/(.*)_alias'//` [...] but this code needs to change as well, because the args have to begin with '--' case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac This might be rewriten: case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg='--'$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg='--'$ac_var=$ac_new_val ;; esac I didn't try following the code to determine why duplicates were not removed, but it appears this might be due to two problems: (1) over-quoting (see above), and (2) for some reason this pattern isn't doing the intended job: *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.