egcs-1.0.1 configuration bugs

Joseph H. Buehler jhpb@sarto.gaithersburg.md.us
Mon Jan 26 05:10:00 GMT 1998


Jeffrey A Law <law@cygnus.com> writes:

>   > 2. there also seems to be a bug in egcs-1.0.1/gcc/configure:
>   > 
>   > # With stabs
>   > # Check whether --with-stabs or --without-stabs was given.
>   > if test "${with_stabs+set}" = set; then
>   >   withval="$with_stabs"
>   >   stabs=yes
>   > else
>   >   stabs=no
>   > fi
>   > 
>   > This seems to set "stabs" to "yes" if "--with-stabs=no" is given (the
>   > "withval" variable is ignored).  Many other variables get set in the same manner.
> I suspect you're supposed to use --with-stabs or --without-stabs -- ie they
> are not supposed to have a yes/no flag attached with them.

The "--without" code in gcc/configure is broken.  Consider:

  -without-* | --without-*)
    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
    # Reject names that are not valid shell variable names.
    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
    fi
    ac_package=`echo $ac_package| sed 's/-/_/g'`
    eval "with_${ac_package}=no" ;;

This causes specifications like --without-whatever to be turned into a
variable setting like "with_whatever=no".

That would be OK, but there are then a number of checks later on in
gcc/configure that do things like this:

    # With GNU ld
    # Check whether --with-gnu-ld or --without-gnu-ld was given.
    if test "${with_gnu_ld+set}" = set; then
      withval="$with_gnu_ld"
      gnu_ld=yes
    else
      gnu_ld=no
    fi

If --without-gnu-ld is passed, the "if" will always be true, because
--without causes "with_whatever" to be set, causing --without to
really mean --with.  It works the same for a number of parameters,
including --without-stabs.  Taking a glance at configure.in, it looks
like AC_ARG_WITH() is part of the problems.

The case for --disable is similar:

  -disable-* | --disable-*)
    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
    # Reject names that are not valid shell variable names.
    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
    fi
    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
    eval "enable_${ac_feature}=no" ;;

The snippets that test various --enable flags look like they are
written differently, however, so they work properly.

Joe Buehler



More information about the Gcc-bugs mailing list