diff -Nurd -x'*~' emacs-23.4.orig/configure emacs-23.4/configure
--- emacs-23.4.orig/configure	2012-01-19 10:01:37.000000000 -0500
+++ emacs-23.4/configure	2015-01-22 00:58:05.000000000 -0500
@@ -2466,7 +2466,7 @@
 etcdir='${datadir}/emacs/${version}/etc'
 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
 docdir='${datadir}/emacs/${version}/etc'
-gamedir='${localstatedir}/games/emacs'
+gamedir='${localstatedir}/games/emacs23'
 
 gameuser=games
 
@@ -3165,12 +3165,6 @@
     opsys=darwin
     # Define CPP as follows to make autoconf work correctly.
     CPP="${CC-cc} -E -no-cpp-precomp"
-    # Use fink packages if available.
-    if test -d /sw/include && test -d /sw/lib; then
-      GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
-      CPP="${CPP} ${GCC_TEST_OPTIONS}"
-      NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
-    fi
   ;;
 
   ## HP 9000 series 700 and 800, running HP/UX
@@ -8074,7 +8068,7 @@
 HAVE_GTK=no
 if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
   GLIB_REQUIRED=2.6
-  GTK_REQUIRED=2.6
+  GTK_REQUIRED=2.17.9
   GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
 
 
@@ -10187,9 +10181,9 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ungif_EGifPutExtensionLast" >&5
 $as_echo "$ac_cv_lib_ungif_EGifPutExtensionLast" >&6; }
-if test "x$ac_cv_lib_ungif_EGifPutExtensionLast" = x""yes; then :
+#if test "x$ac_cv_lib_ungif_EGifPutExtensionLast" = x""yes; then :
   HAVE_GIF=yes
-fi
+#fi
 
 
     if test "$HAVE_GIF" = yes; then
diff -Nurd -x'*~' emacs-23.4.orig/fix-info emacs-23.4/fix-info
--- emacs-23.4.orig/fix-info	1969-12-31 19:00:00.000000000 -0500
+++ emacs-23.4/fix-info	2015-01-22 00:58:05.000000000 -0500
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+THE_INFO_PREFIX=$1
+
+for file in ada-mode auth autotype calc ccmode cl dbus dired-x \
+           ebrowse ediff efaq eintr elisp emacs emacs-mime epa erc \
+           eshell eudc flymake forms gnus idlwave info mairix-el \
+           message mh-e newsticker nxml-mode org pcl-cvs pgg rcirc \
+           reftex remember sasl sc ses sieve smtpmail speedbar tramp \
+           url vip viper widget woman
+do
+    ./mangle-info ${THE_INFO_PREFIX}/${file}
+done
\ No newline at end of file
diff -Nurd -x'*~' emacs-23.4.orig/lib-src/Makefile.in emacs-23.4/lib-src/Makefile.in
--- emacs-23.4.orig/lib-src/Makefile.in	2012-01-11 07:35:01.000000000 -0500
+++ emacs-23.4/lib-src/Makefile.in	2015-01-22 00:58:05.000000000 -0500
@@ -307,13 +307,6 @@
 	umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${gamedir}; \
 	touch $(DESTDIR)${gamedir}/snake-scores; \
 	touch $(DESTDIR)${gamedir}/tetris-scores
-/* If the following commands fail, that is not a big deal.
-   update-game-score will detect at runtime that it is not setuid,
-   and handle things accordingly. */
-	-if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
-	  chown ${gameuser} $(DESTDIR)${gamedir}; \
-	  chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
-	fi
         if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
              != `(cd ${srcdir} && /bin/pwd)` ]; then \
 	  for file in ${SCRIPTS}; do \
diff -Nurd -x'*~' emacs-23.4.orig/lisp/startup.el emacs-23.4/lisp/startup.el
--- emacs-23.4.orig/lisp/startup.el	2012-01-11 07:35:01.000000000 -0500
+++ emacs-23.4/lisp/startup.el	2015-01-22 00:58:05.000000000 -0500
@@ -375,6 +375,10 @@
 
 (defvar normal-top-level-add-subdirs-inode-list nil)
 
+(defconst fink-emacs-flavor 'emacs23
+  "A symbol representing the particular fink flavor of emacs running.
+Something like 'emacs20, 'xemacs20, etc.")
+
 (defvar no-blinking-cursor nil)
 
 (defvar default-frame-background-mode)
@@ -955,9 +959,19 @@
     ;; be loaded from site-run-file and wants to test if -q was given
     ;; should check init-file-user instead, since that is already set.
     ;; See cus-edit.el for an example.
-    (if site-run-file
-	(load site-run-file t t))
-
+    ;; (if site-run-file                                                       
+    ;;     (load site-run-file t t))                                           
+                                                                               
+    ;; Fink version of site-start.                                           
+    (if site-run-file                                                          
+ 	(progn                                                                 
+ 	  ;; Load all the fink package snippets.                             
+ 	  ;; It's in here because we want -q to kill it too.                   
+ 	  (if (load "fink-startup" t t nil)                                  
+ 	      (fink-startup fink-emacs-flavor))                            
+ 	  ;; Now the normal site file...                                       
+ 	  (load site-run-file t t nil)))
+    
     ;; Sites should not disable this.  Only individuals should disable
     ;; the startup screen.
     (setq inhibit-startup-screen nil)
diff -Nurd -x'*~' emacs-23.4.orig/mangle-info emacs-23.4/mangle-info
--- emacs-23.4.orig/mangle-info	1969-12-31 19:00:00.000000000 -0500
+++ emacs-23.4/mangle-info	2015-01-22 00:58:05.000000000 -0500
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -w -i
+
+use English;
+use strict;
+
+$RS = undef;
+
+my $prefix = "emacs-23";
+
+my $x = <>;
+if(!($x =~ m/^(\s*START-INFO-DIR-ENTRY\s+\*\s*[^:]+:\s*)\(([^\)]+)\)/mo)) {
+  die "Couldn't find START-INFO-DIR-ENTRY.";
+}
+   
+print ${PREMATCH};
+print "$1($prefix/$2)";
+print ${POSTMATCH};
+
diff -Nurd -x'*~' emacs-23.4.orig/src/Makefile.in emacs-23.4/src/Makefile.in
--- emacs-23.4.orig/src/Makefile.in	2012-01-12 05:27:54.000000000 -0500
+++ emacs-23.4/src/Makefile.in	2015-01-22 00:58:05.000000000 -0500
@@ -269,7 +269,7 @@
 
 /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
    since it may have -I options that should override those two.  */
-ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS}
+ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SYSTEM_TEMACS @XFT_CFLAGS@ @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM ${DEPFLAGS}
 ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@
 
 .SUFFIXES: .m
diff -Nurd emacs-23.4.orig/src/emacs.c emacs-23.4/src/emacs.c
--- emacs-23.4.orig/src/emacs.c	2012-01-11 07:35:01.000000000 -0500
+++ emacs-23.4/src/emacs.c	2023-10-04 11:18:10.000000000 -0400
@@ -149,6 +149,10 @@
   on subsequent starts.  */
 int initialized;
 
+#ifdef DARWIN_OS
+extern void unexec_init_emacs_zone (void);
+#endif
+
 #ifdef DOUG_LEA_MALLOC
 /* Preserves a pointer to the memory allocated that copies that
    static data inside glibc's malloc.  */
@@ -2250,6 +2254,8 @@
 
 #ifndef CANNOT_DUMP
 
+#include "unexec.h"
+
 #ifdef HAVE_SHM
 
 DEFUN ("dump-emacs-data", Fdump_emacs_data, Sdump_emacs_data, 1, 1, 0,
diff -Nurd -x'*~' emacs-23.4.orig/src/image.c emacs-23.4/src/image.c
--- emacs-23.4.orig/src/image.c	2012-01-11 07:35:01.000000000 -0500
+++ emacs-23.4/src/image.c	2015-01-22 00:57:46.000000000 -0500
@@ -7270,10 +7270,10 @@
 
 #else
 
-#define fn_DGifCloseFile	DGifCloseFile
+#define fn_DGifCloseFile(a)	DGifCloseFile(a,NULL)
 #define fn_DGifSlurp		DGifSlurp
-#define fn_DGifOpen		DGifOpen
-#define fn_DGifOpenFileName	DGifOpenFileName
+#define fn_DGifOpen(a,b)	DGifOpen(a,b,NULL)
+#define fn_DGifOpenFileName(a)	DGifOpenFileName(a,NULL)
 
 #endif /* HAVE_NTGUI */
 
diff -Nurd emacs-23.4.orig/src/process.c emacs-23.4/src/process.c
--- emacs-23.4.orig/src/process.c	2012-01-11 07:35:01.000000000 -0500
+++ emacs-23.4/src/process.c	2023-10-04 11:11:28.000000000 -0400
@@ -45,6 +45,7 @@
 #ifdef STDC_HEADERS
 #include <stdlib.h>
 #endif
+#include <util.h>
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
diff -Nurd emacs-23.4.orig/src/regex.c emacs-23.4/src/regex.c
--- emacs-23.4.orig/src/regex.c	2012-01-11 07:35:01.000000000 -0500
+++ emacs-23.4/src/regex.c	2023-10-04 11:07:48.000000000 -0400
@@ -35,6 +35,8 @@
   #pragma alloca
 #endif
 
+#include <unistd.h>
+
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
diff -Nurd emacs-23.4.orig/src/sysdep.c emacs-23.4/src/sysdep.c
--- emacs-23.4.orig/src/sysdep.c	2012-01-11 07:35:01.000000000 -0500
+++ emacs-23.4/src/sysdep.c	2023-10-04 11:10:57.000000000 -0400
@@ -168,6 +168,9 @@
 #define LPASS8 0
 #endif
 
+/* Declare here, including term.h is problematic on some systems.  */
+extern void tputs (const char *, int, int (*)(int));
+
 static const int baud_convert[] =
   {
     0, 50, 75, 110, 135, 150, 200, 300, 600, 1200,
diff -Nurd emacs-23.4.orig/src/term.c emacs-23.4/src/term.c
--- emacs-23.4.orig/src/term.c	2012-01-11 07:35:01.000000000 -0500
+++ emacs-23.4/src/term.c	2023-10-04 11:04:45.000000000 -0400
@@ -26,6 +26,7 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/file.h>
+#include <sys/ioctl.h>
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
diff -Nurd emacs-23.4.orig/src/unexec.h emacs-23.4/src/unexec.h
--- emacs-23.4.orig/src/unexec.h	1969-12-31 19:00:00.000000000 -0500
+++ emacs-23.4/src/unexec.h	2023-10-04 16:39:01.000000000 -0400
@@ -0,0 +1,2 @@
+void unexec (char *outfile, char *infile, void *start_data, void *start_bss,
+	     void *entry_address);
diff -Nurd emacs-23.4.orig/src/unexmacosx.c emacs-23.4/src/unexmacosx.c
--- emacs-23.4.orig/src/unexmacosx.c	2012-01-11 07:35:01.000000000 -0500
+++ emacs-23.4/src/unexmacosx.c	2023-10-04 11:30:24.000000000 -0400
@@ -88,6 +88,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include "unexec.h"
 #include <fcntl.h>
 #include <stdarg.h>
 #include <sys/types.h>
