bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sub-configures: problems with duplicate removal and passing 'precious' v


From: Gary Funck
Subject: sub-configures: problems with duplicate removal and passing 'precious' variables
Date: Tue, 17 Feb 2004 23:29:40 -0800

[Originally sent this to the autoconf list, but since there
are appear to be bugs in the configure script, am reposting it here.]


(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

Desscription:

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 '--' and the '_alias' suffix should be dropped from the
parameter name. 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'/\1/`
    [...]

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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]