diff -ruN Tk-804.035.orig/Makefile.PL Tk-804.035/Makefile.PL
--- Tk-804.035.orig/Makefile.PL	2019-10-20 11:36:39.000000000 -0500
+++ Tk-804.035/Makefile.PL	2020-04-14 09:20:37.000000000 -0500
@@ -48,7 +48,7 @@
 else
  {
   my $plibs = $Config{'libs'};
-  my $libs  = "$xlib -lX11$xtra";   # Used to have -lpt in here as well.
+  my $libs  = "$xtra $xlib -lX11";  # Used to have -lpt in here as well.
   my @try   = qw(-lsocket -lnsl -lm);
   push(@try,'-lc') if $^O =~ /svr4/i;
   my $lib;
diff -ruN Tk-804.035.orig/Tk/MMtry.pm Tk-804.035/Tk/MMtry.pm
--- Tk-804.035.orig/Tk/MMtry.pm	2013-11-15 17:50:03.000000000 -0600
+++ Tk-804.035/Tk/MMtry.pm	2020-04-14 09:20:37.000000000 -0500
@@ -26,7 +26,9 @@
  my $stderr_too = $VERBOSE ? '' : $stderr_too;
  my $out   = basename($file,'.c').$Config{'exe_ext'};
  warn "Test Compiling $file\n";
- my $msgs  = `$Config{'cc'} -o $out $Config{'ccflags'} @$inc $file $Config{ldflags} @$lib @$def $stderr_too`;
+ my $cmdline  = "$Config{'cc'} -o $out $Config{'ccflags'} @$inc $file $Config{ldflags} @$lib @$def $stderr_too";
+ warn $cmdline if $VERBOSE;
+ my $msgs  = `$cmdline`;
  my $ok = ($? == 0);
  warn "$msgs\n" if $VERBOSE && $msgs;
  unlink($out) if (-f $out);
@@ -43,6 +45,7 @@
  my $out   = basename($file,'.c').$Config{'exe_ext'};
  warn "Test Compile/Run $file\n";
  my $cmdline = "$Config{'cc'} -o $out $Config{'ccflags'} @$inc $file $Config{ldflags} @$lib @$def";
+ warn $cmdline if $VERBOSE;
  my $msgs  = `$cmdline $stderr_too`;
  my $ok = ($? == 0);
  warn "$cmdline:\n$msgs\n" if $VERBOSE && $msgs;
diff -ruN Tk-804.035.orig/myConfig Tk-804.035/myConfig
--- Tk-804.035.orig/myConfig	2019-10-20 11:36:39.000000000 -0500
+++ Tk-804.035/myConfig	2020-04-14 09:26:15.000000000 -0500
@@ -429,7 +429,7 @@
     $gccopt .= " -isystem $1";
    }
 
-  $inc = ($xinc eq "-I/usr/include") ? "" : $xinc;
+  $inc .= " " . ($xinc eq "-I/usr/include") ? "" : $xinc;
 
   if (!defined $XFT)
    {
@@ -439,7 +439,7 @@
    {
     # Found basic X libraries now see if we can find -lXft
 
-    my $ftinc = Ift("/usr/include","/usr/local/include",$X11INC||(),"/opt/X11/include");
+    my $ftinc = Ift("/usr/local/include");
     if ($ftinc)
      {
       print "xlib='$xlib' xinc='$xinc'\n";
@@ -448,10 +448,11 @@
       # on an old RedHat 8.0 system
       for my $def ([], ["-DNEED_FT2BUILD_H"])
        {
+	$ftinc .= ' -I/usr/local/include'; # XXX needed if freetype and xlibs are in different header directories, but should probably check if this is necessary
 	my $ftlib = '-L/usr/local/lib'; # XXX needed if freetype and xlibs are in different lib directories, but should probably check if this is necessary
-	if (try_run("config/xft.c",[$xinc,$ftinc],[$xlib,$ftlib,'-lXft','-lfontconfig'],$def))
+	if (try_run("config/xft.c",[$ftinc,$xinc],[$ftlib,$xlib,'-lXft','-lfontconfig'],$def))
          {
-          $inc .= " $ftinc";
+          $inc = "$ftinc $inc";
           warn "Seem to have -lXft\n";
           $define{USE_XFT_FONTS} = 1;
           $xlib .= " -lXft";
@@ -508,7 +509,7 @@
 } elsif ($IsWin32 or $^O eq 'cygwin') {
   $inc = '-I$(TKDIR) -I$(TKDIR)/pTk/mTk/xlib';
 }
-
+$inc = "$inc $xinc";  # lots of submodules need X11 headers
 
 if ($Config{'osname'} eq 'solaris' && $xlib =~ /\bopenwin\b/ )
  {
diff -ruN Tk-804.035.orig/pTk/Makefile.PL Tk-804.035/pTk/Makefile.PL
--- Tk-804.035.orig/pTk/Makefile.PL	2013-11-15 17:50:03.000000000 -0600
+++ Tk-804.035/pTk/Makefile.PL	2020-04-14 09:20:37.000000000 -0500
@@ -13,7 +13,7 @@
     'OBJECT'	=> '$(O_FILES)',
     macro	=> { WINARCH     => $win_arch },
     'DEFINE'	=> $define,
-    'INC'	=> "$inc -I. -Ibitmaps",
+    'INC'	=> "-I. -Ibitmaps $inc",
     'SKIP'	=> [qw( distclean dist makeaperl xs_o)],
     'clean'	=> {'FILES' => 'libpTk$(LIB_EXT)'}
 );
diff -ruN Tk-804.035.orig/t/exefiles.t Tk-804.035/t/exefiles.t
--- Tk-804.035.orig/t/exefiles.t	2013-11-15 17:50:03.000000000 -0600
+++ Tk-804.035/t/exefiles.t	2020-04-14 09:20:37.000000000 -0500
@@ -9,6 +9,7 @@
 use strict;
 use FindBin;
 use File::Spec;
+use Config;
 
 BEGIN {
     if (!eval q{
@@ -45,7 +46,21 @@
 for my $opt (@cmd) {
     my $script = shift @$opt;
     my $testname = "Executing $script with " . (@$opt ? "@$opt" : "no args");
-    my @cmd = ($^X, "-Mblib", "blib/script/$script", "-geometry", "+10+10", @$opt);
+    my @cmd;
+    if ($] >= 5.010 && $Config{"byteorder"} =~ /^1/) {
+	# little-endian means intel (not powerpc), for which fink has
+	# multiple single-arch distros that are seen by a single (fat)
+	# perl interp from apple for a perl version supported by fink
+	# (i.e., starting with 5.10.0). This is the logic taken from
+	# Fink::PkgVersion as of fink-0.29.13.
+	push @cmd, '/usr/bin/arch';
+	if ( $Config{"longsize"} == 4 ) {
+	    push @cmd, '-i386';   # 32-bit
+	} else {
+	    push @cmd, '-x86_64'; # 64-bit
+	}
+    }
+    push @cmd, $^X, "-Mblib", "blib/script/$script", "-geometry", "+10+10", @$opt;
     my $pid = fork;
     if ($pid == 0) {
 	warn "@cmd\n" if $DEBUG;
diff -ruN Tk-804.035.orig/t/fileevent.t Tk-804.035/t/fileevent.t
--- Tk-804.035.orig/t/fileevent.t	2019-12-21 02:45:36.000000000 -0600
+++ Tk-804.035/t/fileevent.t	2020-04-14 09:20:37.000000000 -0500
@@ -10,6 +10,7 @@
 use Carp;
 #use IPADM;
 use IO::Socket;
+use Config;
 use Tk;
 use Tk::LabEntry;
 use Tk::ROText;
@@ -274,7 +275,23 @@
 	open STDERR, ">&CW" or die "STDERR open $!";
 	STDOUT->autoflush(1);
 	STDERR->autoflush(1);
-	exec($^X,"/tmp/ipadmh", $DAEMON_HOST, $DAEMON_PORT) or die "exec $!";
+
+	my @cmd;
+	if ($] >= 5.010 && $Config{"byteorder"} =~ /^1/) {
+	    # little-endian means intel (not powerpc), for which fink has
+	    # multiple single-arch distros that are seen by a single (fat)
+	    # perl interp from apple for a perl version supported by fink
+	    # (i.e., starting with 5.10.0). This is the logic taken from
+	    # Fink::PkgVersion as of fink-0.29.13.
+	    push @cmd, '/usr/bin/arch';
+	    if ( $Config{"longsize"} == 4 ) {
+		push @cmd, '-i386';   # 32-bit
+	    } else {
+		push @cmd, '-x86_64'; # 64-bit
+	    }
+	}
+	push @cmd, $^X;
+	exec(@cmd, "/tmp/ipadmh", $DAEMON_HOST, $DAEMON_PORT) or die "exec $!";
 	die "exec warp $!";
     } else {
 	die "fork $!";
