--- Base.pm  (revision 10250)
+++ Base.pm  (local)
@@ -60,6 +60,7 @@ sub import {
 package SVN::_$pkg;
 require DynaLoader;
 bootstrap SVN::_$pkg;
+sub dl_load_flags { 0x01 }
 1;
     ' or die $@;
     };
--- Makefile.PL.in  (revision 10250)
+++ Makefile.PL.in  (local)
@@ -19,11 +19,10 @@ my $swig_version = @SWIG_VERSION@;
 my $swig = '@SWIG@';
 
 my @modules = qw/client delta fs ra repos wc/;
-my @ldpaths = ("$swig_builddir/perl/libsvn_swig_perl/.libs",
-               map {"$svnlib_builddir/libsvn_$_/.libs"} (@modules, qw/diff subr
-                                                                      ra_local
-                                                                      ra_svn
-                                                                      ra_dav/));
+my @ldpaths = map {"$svnlib_builddir/libsvn_$_/.libs"} (@modules, qw/diff subr
+                                                                     ra_local
+                                                                     ra_svn
+                                                                     ra_dav/);
 my @ldmodules = map {"-lsvn_$_-1"} (@modules, qw/diff subr/);
 
 my $apr_shlib_path_var = '@SVN_APR_SHLIB_PATH_VAR@';
@@ -43,8 +42,7 @@ my %config = (
     OBJECT => q/$(O_FILES)/,
     LIBS => [join(' ', $apr_ldflags,
                   (map {$_ = abs_path($_); "-L$_"} @ldpaths),
-                  @ldmodules, '-lsvn_swig_perl-1',
-                  `$swig -perl -ldflags`)],
+                  @ldmodules)],
 );
 
 sub perlish {
@@ -57,6 +55,7 @@ WriteMakefile(%config, NAME => 'SVN::_Co
 	      PM => {map { ("$_.pm" => "\$(INST_LIBDIR)/$_.pm") }
 		     map { perlish $_ }
 		     ('base', 'core', @modules)},
+              LDFROM => '$(O_FILES) '."$swig_srcdir/perl/libsvn_swig_perl/.libs/libsvn_swig_perl-1.a",
 	      clean => { FILES => "*.hi *.c *.bs".
                          join(' Makefile.','',@modules) }
 	     );
@@ -77,18 +76,21 @@ sub MY::postamble {
    my $module_c_files = join (' ',map { "svn_$_.c"} @modules);
    my $module_make_commands = join ('',map {"\t\$(MAKE) -f Makefile.$_\n"} @modules);
 
-   my $flags;
+   my ($flags, $flags_runtime);
    if ($swig_version >= 103020) {
      $flags = '-noruntime -noproxy';
+     $flags_runtime = '-runtime -noproxy';
    } else {
+     # XXX: prehaps deprecated
      $flags = '-c';
    }
    
-   my $swig_command = "$swig $flags -nopm -perl " .
-                      "-I$swig_srcdir " .
-                      "-I$swig_srcdir/perl/libsvn_swig_perl".
-                      " -I$svnlib_srcdir/include" .
-                      $apr_cflags;
+   my ($swig_command, $swig_command_runtime) =
+       map {"$swig $_ -nopm -perl " .
+            "-I$swig_srcdir " .
+            "-I$swig_srcdir/perl/libsvn_swig_perl".
+            " -I$svnlib_srcdir/include" .
+            $apr_cflags} ($flags, $flags_runtime);
 
    my $swig_modules_command = join ('',
                               map {"\nsvn_$_.c : $swig_srcdir/svn_$_.i ".
@@ -123,7 +125,7 @@ modules :: $module_c_files
 $module_make_commands\t\$(NOECHO) \$(TOUCH) \$\@
 
 core.c :: $swig_srcdir/core.i
-\t$swig_command -o core.c $swig_srcdir/core.i
+\t$swig_command_runtime -o core.c $swig_srcdir/core.i
 
 $swig_modules_command
 

