autoconf-patches
[Top][All Lists]
Advanced

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

unreliable detection of universal builds in AC_C_BIGENDIAN


From: Bruno Haible
Subject: unreliable detection of universal builds in AC_C_BIGENDIAN
Date: Thu, 25 Dec 2008 14:06:00 +0100
User-agent: KMail/1.9.9

Hi,

In AC_C_BIGENDIAN there is code like this:

  case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in  #(
    *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;;
  esac

This means, simply by setting 
CPPFLAGS="-I/opt/gnu-arch/i386-apple-darwin/include",
my builds will be treated as universal! Likewise for -L options in LDFLAGS. 
Argh.

Here is a proposed fix:

2008-12-25  Bruno Haible  <address@hidden>

        * lib/autoconf/c.m4 (AC_C_BIGENDIAN): Make detection of options
        indicating a universal build more reliable.

*** lib/autoconf/c.m4.orig      2008-12-25 13:57:49.000000000 +0100
--- lib/autoconf/c.m4   2008-12-25 13:57:32.000000000 +0100
***************
*** 1312,1322 ****
            ]])],
         [
        # Check for potential -arch flags.  It is not universal unless
!       # there are some -arch flags.  Note that *ppc* also matches
!       # ppc64.  This check is also rather less than ideal.
!       case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in  #(
!         *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;;
!       esac])
      if test $ac_cv_c_bigendian = unknown; then
        # See if sys/param.h defines the BYTE_ORDER macro.
        AC_COMPILE_IFELSE(
--- 1313,1332 ----
            ]])],
         [
        # Check for potential -arch flags.  It is not universal unless
!       # there are some -arch flags.
!       ac_prev=
!       for ac_word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do
!         if test -n "$ac_prev"; then
!           case $ac_word in
!             i386 | x86_64 | ppc | ppc64) ac_cv_c_bigendian=universal ;;
!           esac
!           ac_prev=
!         else
!           if test "x$ac_word" = "x-arch"; then
!             ac_prev=arch
!           fi
!         fi
!       done])
      if test $ac_cv_c_bigendian = unknown; then
        # See if sys/param.h defines the BYTE_ORDER macro.
        AC_COMPILE_IFELSE(




reply via email to

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