# HG changeset patch
# User t_mrc-ct@sourceforge.jp
# Date 1351693020 -32400
# Branch GECKO1709esr_2013091117_RELBRANCH
# Node ID 2b29c291e3d70a515c09bcf31a0c41509a1fb43b
# Parent  e1cc8e9a7ace0f9e85cfb07f718660e4016ad5d3
minimal change to build (with v17 fix)

diff --git a/configure.in b/configure.in
--- a/configure.in
+++ b/configure.in
@@ -1300,17 +1300,17 @@
       INTEL_ARCHITECTURE=1
 esac
 
 dnl ========================================================
 dnl GNU specific defaults
 dnl ========================================================
 if test "$GNU_CC"; then
     # FIXME: Let us build with strict aliasing. bug 414641.
-    CFLAGS="$CFLAGS -fno-strict-aliasing"
+    CFLAGS="$CFLAGS -fno-strict-aliasing -fno-exceptions"
     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
     DSO_LDOPTS='-shared'
     if test "$GCC_USE_GNU_LD"; then
         # Don't allow undefined symbols in libraries
         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
     fi
     WARNINGS_AS_ERRORS='-Werror'
@@ -4140,44 +4140,65 @@
 MOZ_ARG_WITH_STRING(system-jpeg,
 [  --with-system-jpeg[=PFX]
                           Use system libjpeg [installed at prefix PFX]],
     JPEG_DIR=$withval)
 
 _SAVE_CFLAGS=$CFLAGS
 _SAVE_LDFLAGS=$LDFLAGS
 _SAVE_LIBS=$LIBS
+
+dnl === TenFourFox issue 51
+if test -z "$MOZ_SYSTEM_JPEG" -a "${JPEG_DIR}" = "yes"; then
+        echo "Using OS X native libjpeg"
+        JPEG_DIR="/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/Resources"
+        CFLAGS="-I${topsrcdir}/mozilla/jpeg-imageio $CFLAGS"
+        LDFLAGS="-L${JPEG_DIR} $LDFLAGS"
+        AC_CHECK_LIB(JPEG, _cg_jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-L/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/Resources -lJPEG" JPEG_CFLAGS="-I${topsrcdir}/mozilla/jpeg-imageio"], MOZ_NATIVE_JPEG=)
+else
+
 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
 fi
 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
     MOZ_NATIVE_JPEG=
 else
     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
 fi
 
+fi
+
 if test "$MOZ_NATIVE_JPEG" = 1; then
     AC_TRY_COMPILE([ #include <stdio.h>
                      #include <sys/types.h>
                      #include <jpeglib.h> ],
                    [ #if JPEG_LIB_VERSION < $MOZJPEG
                      #error "Insufficient JPEG library version ($MOZJPEG required)."
                      #endif ],
                    MOZ_NATIVE_JPEG=1,
                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
 fi 
 CFLAGS=$_SAVE_CFLAGS
 LDFLAGS=$_SAVE_LDFLAGS
 LIBS=$_SAVE_LIBS
 
+dnl === TenFourFox issue 51
+if test "$MOZ_NATIVE_JPEG" = 1 -a "${JPEG_DIR}" = "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework/Resources"; then
+ MOZ_JPEG_CFLAGS="-I${topsrcdir}/mozilla/jpeg-imageio"
+ MOZ_JPEG_LIBS="-L${JPEG_DIR} ${MOZ_JPEG_LIBS}"
+else
+
 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
 fi
+
+fi
+
 fi # SKIP_LIBRARY_CHECKS
 
 dnl system ZLIB support
 dnl ========================================================
 
 MOZ_ZLIB_CHECK([1.2.3])
 
 if test "$MOZ_NATIVE_ZLIB" != 1; then
@@ -5451,17 +5472,18 @@
 dnl ========================================================
 MOZ_ARG_HEADER(Debugging and Optimizations)
 
 dnl ========================================================
 dnl = Disable building with debug info.
 dnl = Debugging is OFF by default
 dnl ========================================================
 if test -z "$MOZ_DEBUG_FLAGS"; then
-  MOZ_DEBUG_FLAGS="-g"
+dnl There is no circumstance under which we build with regular symbols now.
+  MOZ_DEBUG_FLAGS="-gdwarf-2"
 fi
 
 MOZ_ARG_ENABLE_STRING(debug,
 [  --enable-debug[=DBG]    Enable building with developer debug info
                            (using compiler flags DBG)],
 [ if test "$enableval" != "no"; then
     MOZ_DEBUG=1
     if test -n "$enableval" -a "$enableval" != "yes"; then
diff --git a/mailnews/compose/src/nsMsgAppleDouble.h b/mailnews/compose/src/nsMsgAppleDouble.h
--- a/mailnews/compose/src/nsMsgAppleDouble.h
+++ b/mailnews/compose/src/nsMsgAppleDouble.h
@@ -46,16 +46,25 @@
 { 
 	kInit, 
 	kDoingHeaderPortion, 
 	kDoneHeaderPortion, 
 	kDoingDataPortion, 
 	kDoneDataPortion 
 };
 
+/* FSIORefNum not named before 10.5 */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
+#if __LP64__
+typedef int	FSIORefNum;
+#else
+typedef SInt16	FSIORefNum;
+#endif /* __LP64__ */
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1050 */
+
 typedef struct _appledouble_encode_object 
 {
     char    fname[256];
     FSIORefNum fileId;				/* the id for the open file (data/resource fork) */
 
 	int 	state;
 	int		text_file_type;		/* if the file has a text file type with it.	*/
 	char	*boundary;			/* the boundary string.							*/
diff --git a/mailnews/import/eudora/src/nsEudoraMac.cpp b/mailnews/import/eudora/src/nsEudoraMac.cpp
--- a/mailnews/import/eudora/src/nsEudoraMac.cpp
+++ b/mailnews/import/eudora/src/nsEudoraMac.cpp
@@ -494,16 +494,21 @@
   if (CreateTocFromResource(pMailFile, ppTOCFile))
   {
     *pDeleteToc = true;
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
+// ResourceIndex not named before 10.5
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
+typedef SInt16	ResourceIndex;
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1050 */
+
 // GetIndString isn't supported on 64-bit Mac OS X
 // This code is emulation for GetIndString.
 static StringPtr GetStringFromHandle(Handle aResource,
                                      ResourceIndex aId)
 {
   if (!aResource)
     return nullptr;
 
