I think I have found the cause of the bug in autoconf. The problem
was that the build system was not getting detected properly.

Here is an example configure.in that showed the problem.

mo(~/foo)% cat configure.in
AC_INIT(foo.cpp)
AC_PREREQ(2.14)

AC_CANONICAL_HOST
AC_CANONICAL_BUILD
AC_LANG_CPLUSPLUS

if test "$host" != "$build" ; then
  echo "host $host != build $build"
fi

AC_PROG_CXX




When I ran this script it produced the following,
which is fine for a native build.

mo(~/foo)% ./configure 
checking host system type... i686-pc-linux-gnu
checking build system type... i686-pc-linux-gnu
checking for c++... c++

Now when I passed --host, it thought that build
and host were the same.

mo(~/foo)% ./configure --host=i586-cygwin32
checking host system type... i686-pc-linux-gnu
checking build system type... i686-pc-linux-gnu
checking for c++... c++


The bug was in acgeneral.m4. I replaced a "host" with $1 and
switched the order of the tests so that config.guess gets
run when checking host or build types of THINGS.

2000-04-20  Mo DeJong  <[EMAIL PROTECTED]>

        * acgeneral.m4 (AC_CANONICAL_THING):
        Fixed macro so that config.guess is run for both
        AC_CANONICAL_HOST and AC_CANONICAL_BUILD. This
        fixes detection of the diff in host vs build
        so that cross compiling works properly.

Index: acgeneral.m4
===================================================================
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.437
diff -u -r1.437 acgeneral.m4
--- acgeneral.m4        2000/04/13 08:25:12     1.437
+++ acgeneral.m4        2000/04/21 09:17:33
@@ -1807,11 +1807,11 @@
   NONE)
     case $nonopt in
     NONE)
-ifelse([$1], [host],[dnl
+ifelse([$1], [target], [dnl
+      ac_cv_$1_alias=[$]$1_alias ;;],[dnl
       if ac_cv_$1_alias=`$ac_config_guess`; then :
       else AC_MSG_ERROR(cannot guess $1 type; you must specify one)
-      fi ;;],[dnl
-      ac_cv_$1_alias=$host_alias ;;
+      fi ;;
 ])dnl
     *) ac_cv_$1_alias=$nonopt ;;
     esac ;;



Here is the output of my example after the
patch. Whoohoo!

mo(~/foo)% ./configure --host=i586-cygwin32
checking host system type... i586-pc-cygwin32
checking build system type... i686-pc-linux-gnu
host i586-pc-cygwin32 != build i686-pc-linux-gnu
checking for c++... c++


Mo Dejong
Red Hat Inc.

Reply via email to