Fix the AC_C_BIGENDIAN macro on macppc, by using the version of autoconf

2.63. The current version sets ac_cv_c_bigendian to 'universal' on those
machines thinking it's running Mac OS.

ok espie@, todd@, kili@.
This commit is contained in:
matthieu 2009-06-12 19:22:57 +00:00
parent 922e55557c
commit aa2d0e87be
2 changed files with 70 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.1.1.1 2008/08/19 23:52:19 espie Exp $
# $OpenBSD: Makefile,v 1.2 2009/06/12 19:22:57 matthieu Exp $
COMMENT = automatically configure source code on many Un*x platforms
DISTNAME = autoconf-2.62
PKGNAME = ${DISTNAME}
PKGNAME = ${DISTNAME}p0
CATEGORIES = devel
MASTER_SITES = ${MASTER_SITE_GNU:=autoconf/}

View File

@ -0,0 +1,68 @@
$OpenBSD: patch-lib_autoconf_c_m4,v 1.1 2009/06/12 19:22:57 matthieu Exp $
--- lib/autoconf/c.m4.orig Sun Apr 6 01:04:48 2008
+++ lib/autoconf/c.m4 Fri Jun 12 15:28:06 2009
@@ -1399,25 +1399,33 @@ fi
AC_DEFUN([AC_C_BIGENDIAN],
[AH_VERBATIM([WORDS_BIGENDIAN],
[/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
- significant byte first (like Motorola and SPARC, unlike Intel and VAX). */
-#if defined __BIG_ENDIAN__
-# define WORDS_BIGENDIAN 1
-#elif ! defined __LITTLE_ENDIAN__
-# undef WORDS_BIGENDIAN
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
#endif])dnl
AC_CACHE_CHECK([whether byte ordering is bigendian], [ac_cv_c_bigendian],
[ac_cv_c_bigendian=unknown
- m4_ifval(m4_ifdef([AH_HEADER], 1)[$4],
- [# See if __BIG_ENDIAN__ or __LITTLE_ENDIAN__ is defined.
- AC_COMPILE_IFELSE(
+ # See if we're dealing with a universal compiler.
+ AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
- [[#if ! (defined __BIG_ENDIAN__ || defined __LITTLE_ENDIAN__)
- neither is defined;
+ [[#ifndef __APPLE_CC__
+ not a universal capable compiler
#endif
typedef int dummy;
]])],
- [ac_cv_c_bigendian=universal])],
- [AC_DIAGNOSE([obsolete], [AC_C_BIGENDIAN suggests AC_CONFIG_HEADERS])])
+ [
+ # 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(
@@ -1521,7 +1529,17 @@ AC_DEFUN([AC_C_BIGENDIAN],
no)
$2 ;; #(
universal)
- $4 ;; #(
+dnl Note that AC_APPLE_UNIVERSAL_BUILD sorts less than WORDS_BIGENDIAN;
+dnl this is a necessity for proper config header operation. Warn if
+dnl the user did not specify a config header but is relying on the
+dnl default behavior for universal builds.
+ m4_default([$4],
+ [AC_CONFIG_COMMANDS_PRE([m4_ifset([AH_HEADER], [],
+ [AC_DIAGNOSE([obsolete],
+ [AC_C_BIGENDIAN should be used with AC_CONFIG_HEADERS])])])dnl
+ AC_DEFINE([AC_APPLE_UNIVERSAL_BUILD],1,
+ [Define if building universal (internal helper macro)])])
+ ;; #(
*)
m4_default([$3],
[AC_MSG_ERROR([unknown endianness