diff --git a/bin/export.pike b/bin/export.pike
index 2756866feb872369e9a545a58967e0d6834ff303..ac7126e754f422b90bf8fcec310bd3d68f9ef5de 100755
--- a/bin/export.pike
+++ b/bin/export.pike
@@ -69,17 +69,18 @@ void run( string cmd, mixed ... args )
   }
 }
 
-void fix_configure(string dir)
+void fix_configure(string dir, Stdio.Stat aclocal)
 {
   Stdio.Stat config=file_stat(dir+"/configure");
   Stdio.Stat config_in=file_stat(dir+"/configure.in");
 
   if(config_in)
   {
-    if(!config || config_in->mtime > config->mtime)
+    if(!config || config_in->mtime > config->mtime ||
+       (aclocal && aclocal->mtime > config->mtime))
     {
       werror("Fixing configure in "+dir+".\n");
-      run( "autoconf", ([ "cwd":dir ]) );
+      run( pike_base_name+"/src/run_autoconfig", "--no-recursion", dir );
     }
   }
 }
@@ -371,11 +372,18 @@ int main(int argc, array(string) argv)
   if (snapshot)
     vpath = sprintf("Pike-v%d.%d-snapshot", @version);
 
-  fix_configure(pike_base_name+"/src");
+  Stdio.Stat aclocal=file_stat(pike_base_name+"/src/aclocal.m4");
+
+  fix_configure(pike_base_name+"/src", aclocal);
+  fix_configure(pike_base_name+"/src/modules", aclocal);
+  fix_configure(pike_base_name+"/src/post_modules", aclocal);
 
   foreach(get_dir(pike_base_name+"/src/modules"), string fn)
     if(Stdio.is_dir(pike_base_name+"/src/modules/"+fn))
-      fix_configure("modules/"+fn);
+      fix_configure(pike_base_name+"/src/modules/"+fn, aclocal);
+  foreach(get_dir(pike_base_name+"/src/post_modules"), string fn)
+    if(Stdio.is_dir(pike_base_name+"/src/post_modules/"+fn))
+      fix_configure(pike_base_name+"/src/post_modules/"+fn, aclocal);
 
   rm(vpath);
   symlink(".", vpath);