diff -Naur emacsen-common-1.4.15-orig/00debian-vars.el emacsen-common-1.4.15/00debian-vars.el
--- emacsen-common-1.4.15-orig/00debian-vars.el	2021-06-01 11:00:11.000000000 -0400
+++ emacsen-common-1.4.15/00debian-vars.el	2021-06-01 11:01:13.000000000 -0400
@@ -1,6 +1,6 @@
-;; 00debian-vars.el
+;; 00fink-vars.el
 ;;
-;; Initialize some emacs variables from debian policy files.
+;; Initialize some emacs variables from fink policy files.
 ;; 
 ;; Copyright (C) 1997, Frederic Lepied <Frederic.Lepied@sugix.frmug.org>
 ;;
@@ -20,7 +20,7 @@
 ;;=============================================================================
 ;; Configuration section.
 ;;=============================================================================
-(defun debian-file->string (name &optional func)
+(defun fink-file->string (name &optional func)
   "Convert a file into a string"
   (interactive "fFile name : ")
   (let ((filename (expand-file-name name)))
@@ -36,7 +36,7 @@
 	(kill-buffer buf)
 	ret))))
 
-(defun debian-clean-mailname ()
+(defun fink-clean-mailname ()
   (while (search-forward "\n" nil t)
     (replace-match "" nil t)))
 
@@ -45,15 +45,15 @@
 ;; policy/ch-binarypkg.html, 3.5 Maintainer scripts, /etc/news/server
 
 (let ((mailname
-       (debian-file->string "/etc/mailname" (function debian-clean-mailname))))
+       (fink-file->string "@PREFIX@/etc/mailname" (function fink-clean-mailname))))
   (if (not mailname)
-      (progn
-	(message "No /etc/mailname. Reverting to default...")
-	(sit-for 3))
+      ;;(progn
+	;;(message "No @PREFIX@/etc/mailname. Reverting to default...")
+	;;(sit-for 3))
     (setq mail-host-address mailname)))
 
 ;; Don't need to check NNTPSERVER for override, gnus does that for us.
-(if (file-readable-p "/etc/news/server")
-    (defvar gnus-nntpserver-file "/etc/news/server"))
+(if (file-readable-p "@PREFIX@/etc/news/server")
+    (defvar gnus-nntpserver-file "@PREFIX@/etc/news/server"))
 
-;;; 00debian-vars.el ends here
+;;; 00fink-vars.el ends here
diff -Naur emacsen-common-1.4.15-orig/debian-startup.el emacsen-common-1.4.15/debian-startup.el
--- emacsen-common-1.4.15-orig/debian-startup.el	2021-06-01 11:00:11.000000000 -0400
+++ emacsen-common-1.4.15/debian-startup.el	2021-06-01 11:01:13.000000000 -0400
@@ -1,4 +1,4 @@
-;;; debian-startup.el --- Debian specific emacsen startup code.
+;;; fink-startup.el --- Fink specific emacsen startup code.
 
 ;; Copyright (C) 1998 Rob Browning
 
@@ -30,7 +30,7 @@
 ;; of Emacs for a Debian system.
 
 
-(defun debian-pkg-add-load-path-item (item)
+(defun fink-pkg-add-load-path-item (item)
   "Takes a path item (a string) and adds it to load path in the
 correct position for an add-on package, before the emacs system
 directories, but after the /usr/local/ directories.  After modifying
@@ -63,7 +63,7 @@
 
 ;; Rewritten to less elegant -- non recursive version because elisp
 ;; doesn't seem to handle tail recursion :<
-(defun debian-unique-strings (strings) 
+(defun fink-unique-strings (strings) 
   "Takes a list of strings and returns the list with *adjacent*
 duplicates removed."
   (let ((result '()))
@@ -73,7 +73,7 @@
       (setq strings (cdr strings)))
     (nreverse result)))
 
-(defun debian-run-directories (&rest dirs)
+(defun fink-run-directories (&rest dirs)
 
   "Load each file of the form XXfilename.el or XXfilename.elc in any
 of the dirs, where XX must be a number.  The files will be run in
@@ -106,7 +106,7 @@
                    files)))
          
          ;; Finally sort them, and delete duplicates
-         (base-names (debian-unique-strings (sort stripped-names 'string<)))
+         (base-names (fink-unique-strings (sort stripped-names 'string<)))
          
          (old-load-path load-path))
 
@@ -134,9 +134,9 @@
                         load-path))))      
         (setq load-path (append add-on-package-paths old-load-path))))))
 
-(defun debian-startup (flavor)
+(defun fink-startup (flavor)
 
-  ;; Our handling of debian-emacs-flavor here is truly weird, but we
+  ;; Our handling of fink-emacs-flavor here is truly weird, but we
   ;; have to do it like this because some of the emacsen flavors
   ;; didn't DWIM in their startup sequence.  I wasn't as clear as I
   ;; should have been in debian-policy, but they were also
@@ -144,15 +144,15 @@
 
   ;; It's even weirder now.  I've changed policy back to the old way,
   ;; but I'm also doing some sanity checking here and making sure that
-  ;; even debian-emacs-flavor gets set no matter what.  I'm in a rush
+  ;; even fink-emacs-flavor gets set no matter what.  I'm in a rush
   ;; right now, but I'll come back later and make all this cleaner and
   ;; better documented.  Sorry.
 
-  (if (not (boundp 'debian-emacs-flavor))
-      (defconst debian-emacs-flavor flavor
-        "A symbol representing the particular debian flavor of emacs that's
+  (if (not (boundp 'fink-emacs-flavor))
+      (defconst fink-emacs-flavor flavor
+        "A symbol representing the particular fink flavor of emacs that's
 running.  Something like 'emacs20, 'xemacs20, etc.")
         
-    (let ((common-dir "/etc/emacs/site-start.d")
-          (flavor-dir (concat "/etc/" (symbol-name flavor) "/site-start.d")))
-      (debian-run-directories flavor-dir common-dir))))
+    (let ((common-dir "@PREFIX@/etc/emacs/site-start.d")
+          (flavor-dir (concat "@PREFIX@/etc/" (symbol-name flavor) "/site-start.d")))
+      (fink-run-directories flavor-dir common-dir))))
diff -Naur emacsen-common-1.4.15-orig/emacs-install emacsen-common-1.4.15/emacs-install
--- emacsen-common-1.4.15-orig/emacs-install	2021-06-01 11:00:11.000000000 -0400
+++ emacsen-common-1.4.15/emacs-install	2021-06-01 11:01:13.000000000 -0400
@@ -7,8 +7,8 @@
 # Let emacs-package-install/remove know what's going on.
 $ENV{'CURRENTLY_HANDLING_EMACSEN'} = "Yes";
 
-my $lib_dir = "/usr/lib/emacsen-common";
-my $var_dir = "/var/lib/emacsen-common";
+my $lib_dir = "@PREFIX@/lib/emacsen-common";
+my $var_dir = "@PREFIX@/var/lib/emacsen-common";
 my $flavor = $ARGV[0];
 my $action = 'install';
 $action = 'remove' if $0 =~ /remove$/o;
diff -Naur emacsen-common-1.4.15-orig/emacs-package-install emacsen-common-1.4.15/emacs-package-install
--- emacsen-common-1.4.15-orig/emacs-package-install	2021-06-01 11:00:11.000000000 -0400
+++ emacsen-common-1.4.15/emacs-package-install	2021-06-01 11:01:13.000000000 -0400
@@ -7,8 +7,8 @@
 
 my $currently_handling_emacsen = $ENV{'CURRENTLY_HANDLING_EMACSEN'};
 
-my $lib_dir = "/usr/lib/emacsen-common";
-my $var_dir = "/var/lib/emacsen-common";
+my $lib_dir = "@PREFIX@/lib/emacsen-common";
+my $var_dir = "@PREFIX@/var/lib/emacsen-common";
 my $pkg = $ARGV[0];
 my $action = 'install';
 $action = 'remove' if $0 =~ /remove$/o;
@@ -36,13 +36,13 @@
 # Make sure if we create any files, we do it safely.
 umask 0022 or die "emacs-package-$action: can't set umask, aborting.";
 
-if (! -e '/var/lib/emacsen-common/installed-flavors')
+if (! -e '@PREFIX@/var/lib/emacsen-common/installed-flavors')
 {
   die <<EOS;
 ERROR: emacsen-common being used before being configured.
 ERROR: This is likely a bug in the ${pkg} package, which needs to
 ERROR: add one of the appropriate dependencies.
-ERROR: See /usr/share/doc/emacsen-common/debian-emacs-policy.gz
+ERROR: See @PREFIX@/share/doc/emacsen-common/debian-emacs-policy.gz
 ERROR: for details.
 EOS
 }
diff -Naur emacsen-common-1.4.15-orig/emacsen-common.install emacsen-common-1.4.15/emacsen-common.install
--- emacsen-common-1.4.15-orig/emacsen-common.install	2021-06-01 11:00:11.000000000 -0400
+++ emacsen-common-1.4.15/emacsen-common.install	2021-06-01 11:01:13.000000000 -0400
@@ -9,38 +9,69 @@
 
 if [ ${FLAVOR} != emacs ]
 then
+
+  # Try compiling a trivial testfile  {cswinehart  |  22 june 2004}
+  echo '(defun a-fake-func()  "This function does nothing"  )' > /tmp/emacsen-common-testfile.el
+  if ${FLAVOR} ${byte_compile_options} /tmp/emacsen-common-testfile.el
+  then
+      # It worked. Clean up the testfile and be done with it.
+      rm -f /tmp/emacsen-common-testfile.el{,c}
+  else 
+      # It failed. Stop trying to install and print a meaningful error message
+      printf "\n\n\n"
+      echo "  +-------------------------------------------------------------------+"      
+      echo "  |  Fink had a problem installing this version of Emacs because      |"
+      echo "  |  ${FLAVOR} couldn't be launched successfully.                       |"
+      echo "  |                                                                   |"
+      echo "  |  This typically happens when the package was compiled on a        |"
+      echo "  |  system with an older version of Mac OS X installed. At this      |"
+      echo "  |  point you should try recompiling the emacs version that caused   |"
+      echo "  |  this error with a command like:                                  |"
+      echo "  |    fink rebuild <flavor>                                          |"
+      echo "  |  where <flavor> is a package name like \`${FLAVOR}' or \`${FLAVOR}-nox' |"
+      echo "  |                                                                   |"
+      echo "  |  If this doesn't solve the problem, please notify the maintainer  |"
+      echo "  |  of the emacs package in question.                                |"
+      echo "  +-------------------------------------------------------------------+"
+      printf "\n\n\n\n"
+
+      # Clean up and return the error code
+      rm -f /tmp/emacsen-common-testfile.el{,c}
+      exit 1
+  fi
+
   echo emacsen-common: byte-compiling for ${FLAVOR}
 
   # If we had .el files that needed byte compiling in the package dir,
   # this is how we'd handle it.
 
-  #cp /usr/share/emacs/site-lisp/emacsen-common/*.el \
-  #   /usr/share/${FLAVOR}/site-lisp/emacsen-common
+  #cp @PREFIX@/share/emacs/site-lisp/emacsen-common/*.el \
+  #   @PREFIX@/share/${FLAVOR}/site-lisp/emacsen-common
   #${FLAVOR} ${byte_compile_options} \
-  #  /usr/share/${FLAVOR}/site-lisp/emacsen-common/*.el
-  #rm /usr/share/${FLAVOR}/site-lisp/emacsen-common/*.el
+  #  @PREFIX@/share/${FLAVOR}/site-lisp/emacsen-common/*.el
+  #rm @PREFIX@/share/${FLAVOR}/site-lisp/emacsen-common/*.el
 
   # Normal add-on packages should usually *not* scatter their files
   # directly in site-lisp, but should use a package subdir.  This
   # package/file is an exception.
 
   # Remove potentially stale versions.
-  rm -f /etc/${FLAVOR}/site-start.d/00debian-vars.elc \
-        /usr/share/${FLAVOR}/site-lisp/debian-startup.elc
+  rm -f @PREFIX@/etc/${FLAVOR}/site-start.d/00fink-vars.elc \
+        @PREFIX@/share/${FLAVOR}/site-lisp/fink-startup.elc
 
   # Make temporary copies of the .el files
-  cp /etc/emacs/site-start.d/00debian-vars.el /etc/${FLAVOR}/site-start.d
-  cp /usr/share/emacs/site-lisp/debian-startup.el \
-     /usr/share/${FLAVOR}/site-lisp/debian-startup.el 
+  cp @PREFIX@/etc/emacs/site-start.d/00fink-vars.el @PREFIX@/etc/${FLAVOR}/site-start.d
+  cp @PREFIX@/share/emacs/site-lisp/fink-startup.el \
+     @PREFIX@/share/${FLAVOR}/site-lisp/fink-startup.el 
 
   # byte compile everything.
   ${FLAVOR} ${byte_compile_options} \
-    /etc/${FLAVOR}/site-start.d/00debian-vars.el \
-    /usr/share/${FLAVOR}/site-lisp/debian-startup.el
+    @PREFIX@/etc/${FLAVOR}/site-start.d/00fink-vars.el \
+    @PREFIX@/share/${FLAVOR}/site-lisp/fink-startup.el
 
   # Remove the redundant .el files.
-  rm /etc/${FLAVOR}/site-start.d/00debian-vars.el \
-     /usr/share/${FLAVOR}/site-lisp/debian-startup.el
+  rm @PREFIX@/etc/${FLAVOR}/site-start.d/00fink-vars.el \
+     @PREFIX@/share/${FLAVOR}/site-lisp/fink-startup.el
 fi
 
 exit 0;
diff -Naur emacsen-common-1.4.15-orig/emacsen-common.remove emacsen-common-1.4.15/emacsen-common.remove
--- emacsen-common-1.4.15-orig/emacsen-common.remove	2021-06-01 11:00:11.000000000 -0400
+++ emacsen-common-1.4.15/emacsen-common.remove	2021-06-01 11:01:13.000000000 -0400
@@ -9,8 +9,8 @@
 if [ ${FLAVOR} != emacs ]
 then
   echo emacsen-common: purging byte-compiled files for ${FLAVOR}
-  rm -f /etc/${FLAVOR}/site-start.d/00debian-vars.elc \
-        /usr/share/${FLAVOR}/site-lisp/debian-startup.elc
+  rm -f @PREFIX@/etc/${FLAVOR}/site-start.d/00fink-vars.elc \
+        @PREFIX@/share/${FLAVOR}/site-lisp/fink-startup.elc
 fi
 
 exit 0;
diff -Naur emacsen-common-1.4.15-orig/generate-install-list emacsen-common-1.4.15/generate-install-list
--- emacsen-common-1.4.15-orig/generate-install-list	2021-06-01 11:00:11.000000000 -0400
+++ emacsen-common-1.4.15/generate-install-list	2021-06-01 11:08:34.000000000 -0400
@@ -8,8 +8,8 @@
 # it will sort them according to their dependencies.  It will also add
 # in other add-on packages that aren't mentioned, but are needed.
 
-my $lib_dir = "/usr/lib/emacsen-common";
-my $var_dir = "/var/lib/emacsen-common";
+my $lib_dir = "@PREFIX@/lib/emacsen-common";
+my $var_dir = "@PREFIX@/var/lib/emacsen-common";
 my $installed_add_on_pkgs = undef;
 
 sub cwd {
@@ -21,7 +21,7 @@
 sub installed_add_on_packages_list {
   # Caches value for future use...
 
-  if(! defined(@$installed_add_on_pkgs)) {
+  if( (! defined($installed_add_on_pkgs) ) || ( @$installed_add_on_pkgs == 0 ) ) {
     my $oldir = cwd();    
     chdir($lib_dir . "/packages/install/") or die "couldn't chdir";
     @$installed_add_on_pkgs = glob("*");
