Bug 655339 - Work around bug in Apple's egrep on OS X 10.7. r=ted
--- a/configure.in
+++ b/configure.in
@@ -9391,16 +9391,30 @@ HAVE_WCRTOMB
"
AC_CONFIG_HEADER(
netwerk/necko-config.h
xpcom/xpcom-config.h
xpcom/xpcom-private.h
)
+# Hack around an Apple bug that effects the egrep that comes with OS X 10.7.
+# "arch -arch i386 egrep" always uses the 32-bit Intel part of the egrep fat
+# binary, even on 64-bit systems. It should work on OS X 10.4.5 and up. We
+# (apparently) only need this hack when egrep's "pattern" is particularly
+# long (as in the following code). See bug 655339.
+case "$host" in
+x86_64-apple-darwin*)
+ FIXED_EGREP="arch -arch i386 egrep"
+ ;;
+*)
+ FIXED_EGREP="egrep"
+ ;;
+esac
+
# Save the defines header file before autoconf removes it.
# (Do not add AC_DEFINE calls after this line.)
_CONFIG_TMP=confdefs-tmp.h
_CONFIG_DEFS_H=mozilla-config.h
cat > $_CONFIG_TMP <<\EOF
/* List of defines generated by configure. Included with preprocessor flag,
* -include, to avoid long list of -D defines on the compile command-line.
@@ -9414,17 +9428,17 @@ EOF
_EGREP_PATTERN='^#define ('
if test -n "$_NON_GLOBAL_ACDEFINES"; then
for f in $_NON_GLOBAL_ACDEFINES; do
_EGREP_PATTERN="${_EGREP_PATTERN}$f|"
done
fi
_EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
- sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
+ sort confdefs.h | $FIXED_EGREP -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
if test "$?" != 0; then
AC_MSG_ERROR([Error outputting config definitions])
fi
cat >> $_CONFIG_TMP <<\EOF
/* The c99 defining the limit macros (UINT32_MAX for example), says:
@@ -9445,17 +9459,17 @@ EOF
echo ==== $_CONFIG_DEFS_H =================================
cat $_CONFIG_DEFS_H
fi
dnl Probably shouldn't call this manually but we always want the output of DEFS
rm -f confdefs.h.save
mv confdefs.h confdefs.h.save
-egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
+$FIXED_EGREP -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
if test "$?" != 0; then
AC_MSG_ERROR([Error outputting confdefs.h])
fi
AC_OUTPUT_MAKE_DEFS()
MOZ_DEFINES=$DEFS
AC_SUBST(MOZ_DEFINES)
rm -f confdefs.h
mv confdefs.h.save confdefs.h