Index: trunk/psconfig/psdist
===================================================================
--- trunk/psconfig/psdist	(revision 18801)
+++ trunk/psconfig/psdist	(revision 18806)
@@ -16,57 +16,57 @@
 for (; @ARGV > 0; ) {
     if ($ARGV[0] eq "-diff") {
-	$diff = 1;
+        $diff = 1;
         shift; next;
     }
     if ($ARGV[0] eq "-update") {
-	$update = 1; shift; 
-	if ($ARGV[0] eq "tags") {
-	    $update_mode = "tags";
-	    shift; next
-	}
-	if ($ARGV[0] eq "head") {
-	    $update_mode = "head";
-	    shift; next
-	}
-	&usage();
+        $update = 1; shift;
+        if ($ARGV[0] eq "tags") {
+            $update_mode = "tags";
+            shift; next
+        }
+        if ($ARGV[0] eq "head") {
+            $update_mode = "head";
+            shift; next
+        }
+        &usage();
     }
     if ($ARGV[0] eq "-tag") {
-	$settag = 1; shift;
-	if ($ARGV[0] eq "dev") {
-	    $settag_mode = "dev";
-	    shift; next
-	}
-	if ($ARGV[0] eq "rev") {
-	    $settag_mode = "rev";
-	    shift; next
-	}
-	if ($ARGV[0] eq "branch") {
-	    $settag_mode = "branch";
-	    shift; next
-	}
-	&usage();
+        $settag = 1; shift;
+        if ($ARGV[0] eq "dev") {
+            $settag_mode = "dev";
+            shift; next
+        }
+        if ($ARGV[0] eq "rev") {
+            $settag_mode = "rev";
+            shift; next
+        }
+        if ($ARGV[0] eq "branch") {
+            $settag_mode = "branch";
+            shift; next
+        }
+        &usage();
     }
     if ($ARGV[0] eq "-dist") {
-	$mkdist = 1; shift;
-	if ($ARGV[0] eq "cvs") {
-	    $mkdist_mode = "cvs";
-	    shift; next
-	}
-	if ($ARGV[0] eq "tree") {
-	    $mkdist_mode = "tree";
-	    shift; next
-	}
-	if ($ARGV[0] eq "autogen") {
-	    $mkdist_mode = "autogen";
-	    shift; next
-	}
-	if ($ARGV[0] eq "tarball") {
-	    $mkdist_mode = "tarball";
-	    shift; next
-	}
-	&usage();
+        $mkdist = 1; shift;
+        if ($ARGV[0] eq "cvs") {
+            $mkdist_mode = "cvs";
+            shift; next
+        }
+        if ($ARGV[0] eq "tree") {
+            $mkdist_mode = "tree";
+            shift; next
+        }
+        if ($ARGV[0] eq "autogen") {
+            $mkdist_mode = "autogen";
+            shift; next
+        }
+        if ($ARGV[0] eq "tarball") {
+            $mkdist_mode = "tarball";
+            shift; next
+        }
+        &usage();
     }
     if ($ARGV[0] eq "-module") {
-	$module = $ARGV[1];
+        $module = $ARGV[1];
         shift; shift; next;
     }
@@ -101,10 +101,10 @@
 
     for ($i = 0; $i < @cvsname; $i++) {
-	# the base component cannot be rdiffed
-	print STDERR "--- $cvsname[$i] ---\n";
-	if ($cvsname[$i] eq "base") { next; }
-	if ($tag[$i] eq "") { next; }
-	&vsystem ("cvs -q rdiff -s -r $tag[$i] $cvsname[$i]");
-	print STDERR "\n\n";
+        # the base component cannot be rdiffed
+        print STDERR "--- $cvsname[$i] ---\n";
+        if ($cvsname[$i] eq "base") { next; }
+        if ($tag[$i] eq "") { next; }
+        &vsystem ("cvs -q rdiff -s -r $tag[$i] $cvsname[$i]");
+        print STDERR "\n\n";
     }
     exit 0;
@@ -115,30 +115,30 @@
     if ($settag_mode eq "") { die "-tag mode is not set\n"; }
     for ($i = 0; $i < @cvsname; $i++) {
-	if (($module ne "") && ($module ne $cvsname[$i])) { next; }
-	## XXX make this backwards compatible with pre-ipp-2.4 releases (with four, not five, entries)?
-	($do_tag, $do_build, $do_dist, $do_update, $dev_build) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)(\S)|;
-	if ($do_tag eq "N") { 
-	    push @remind, $cvsname[$i];
-	    next; 
-	}
-	if ($branchtag[$i] eq "") { die "branch tag missing for $cvsname[$i]\n"; }
-	if ($branchver[$i] eq "") { die "branch tag version missing\n"; }
-	$tag = "$branchtag[$i]$branchver[$i]";
-	if ($settag_mode eq "branch") { 
-	    &vsystem ("cvs -q rtag -b $branchtag[$i] $cvsname[$i]");
-	    next;
-	} 
-	if ($settag_mode eq "dev") { 
-	    &vsystem ("cvs -q rtag $tag $cvsname[$i]");
-	    next;
-	}
-	if ($settag_mode eq "rev") { 
-	    &vsystem ("cvs -q rtag -r $branchtag[$i] $tag $cvsname[$i]");
-	    next;
-	}
-	die "programming error";
+        if (($module ne "") && ($module ne $cvsname[$i])) { next; }
+        ## XXX make this backwards compatible with pre-ipp-2.4 releases (with four, not five, entries)?
+        ($do_tag, $do_build, $do_dist, $do_update, $dev_build) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)(\S)|;
+        if ($do_tag eq "N") {
+            push @remind, $cvsname[$i];
+            next;
+        }
+        if ($branchtag[$i] eq "") { die "branch tag missing for $cvsname[$i]\n"; }
+        if ($branchver[$i] eq "") { die "branch tag version missing\n"; }
+        $tag = "$branchtag[$i]$branchver[$i]";
+        if ($settag_mode eq "branch") {
+            &vsystem ("cvs -q rtag -b $branchtag[$i] $cvsname[$i]");
+            next;
+        }
+        if ($settag_mode eq "dev") {
+            &vsystem ("cvs -q rtag $tag $cvsname[$i]");
+            next;
+        }
+        if ($settag_mode eq "rev") {
+            &vsystem ("cvs -q rtag -r $branchtag[$i] $tag $cvsname[$i]");
+            next;
+        }
+        die "programming error";
     }
     for ($i = 0; $i < @remind; $i++) {
-	print STDERR "remember to set tag for $remind[$i] if needed\n";
+        print STDERR "remember to set tag for $remind[$i] if needed\n";
     }
     exit 0;
@@ -153,26 +153,26 @@
 
     for ($i = 0; $i < @cvsname; $i++) {
-	if (($module ne "") && ($module ne $cvsname[$i])) { next; }
-	($do_tag, $do_build, $do_dist, $do_update) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)|;
-	if ($do_update eq "N") { 
-	    push @remind, $cvsname[$i];
-	    next; 
-	}
-	# only update modules with tags
-	if ($branchtag[$i] eq "") { die "branch tag missing for $cvsname[$i]\n"; }
-	if ($branchver[$i] eq "") { die "branch tag version missing\n"; }
-	$tag = "$branchtag[$i]$branchver[$i]";
-	if ($update_mode eq "tags") { 
-	    &vsystem ("cvs -q co -r $tag $cvsname[$i]");
-	    next;
-	}
-	if ($update_mode eq "head") { 
-	    &vsystem ("cvs -q co -A $cvsname[$i]");
-	    next;
-	}
-	die "programming error";
+        if (($module ne "") && ($module ne $cvsname[$i])) { next; }
+        ($do_tag, $do_build, $do_dist, $do_update) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)|;
+        if ($do_update eq "N") {
+            push @remind, $cvsname[$i];
+            next;
+        }
+        # only update modules with tags
+        if ($branchtag[$i] eq "") { die "branch tag missing for $cvsname[$i]\n"; }
+        if ($branchver[$i] eq "") { die "branch tag version missing\n"; }
+        $tag = "$branchtag[$i]$branchver[$i]";
+        if ($update_mode eq "tags") {
+            &vsystem ("cvs -q co -r $tag $cvsname[$i]");
+            next;
+        }
+        if ($update_mode eq "head") {
+            &vsystem ("cvs -q co -A $cvsname[$i]");
+            next;
+        }
+        die "programming error";
     }
     for ($i = 0; $i < @remind; $i++) {
-	print STDERR "remember to update $remind[$i] if needed\n";
+        print STDERR "remember to update $remind[$i] if needed\n";
     }
     chdir $homedir;
@@ -188,19 +188,19 @@
     chdir $distribution;
     for ($i = 0; $i < @cvsname; $i++) {
-	if (($module ne "") && ($module ne $cvsname[$i])) { next; }
-	($do_tag, $do_build, $do_dist, $do_update) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)|;
-	if ($do_dist eq "N") { next; }
-
-	if ($branchtag[$i] eq "") { die "branch tag missing for $cvsname[$i]\n"; }
-	if ($branchver[$i] eq "") { die "branch tag version missing\n"; }
-	$tag = "$branchtag[$i]$branchver[$i]";
-
-	if ($mkdist_head) {
-	    &vsystem ("cvs co $cvsname[$i]");
-	    if ($status) { die "error running cvs"; }
-	} else {
-	    &vsystem ("cvs co -r $tag $cvsname[$i]");
-	    if ($status) { die "error running cvs"; }
-	}	
+        if (($module ne "") && ($module ne $cvsname[$i])) { next; }
+        ($do_tag, $do_build, $do_dist, $do_update) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)|;
+        if ($do_dist eq "N") { next; }
+
+        if ($branchtag[$i] eq "") { die "branch tag missing for $cvsname[$i]\n"; }
+        if ($branchver[$i] eq "") { die "branch tag version missing\n"; }
+        $tag = "$branchtag[$i]$branchver[$i]";
+
+        if ($mkdist_head) {
+            &vsystem ("cvs co $cvsname[$i]");
+            if ($status) { die "error running cvs"; }
+        } else {
+            &vsystem ("cvs co -r $tag $cvsname[$i]");
+            if ($status) { die "error running cvs"; }
+        }
     }
     chdir "..";
@@ -211,20 +211,25 @@
     if ($mkdist_mode eq "tree") { exit 0; }
 
+    # make sure the aclocal path exists
+    @word = split (" ", $ENV{'ACLOCAL_FLAGS'});
+    if (@word != 2) { &failure("setup", "ACLOCAL_FLAGS is not set"); }
+    if (! -e $word[1]) { vsystem ("mkdir -p $word[1]"); }
+
     # run autogen.sh, if present, to build a configure script
     chdir $distribution;
     for ($i = 0; $i < @cvsname; $i++) {
-	if (($module ne "") && ($module ne $cvsname[$i])) { next; }
-	($do_tag, $do_build, $do_dist, $do_update) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)|;
-	if ($do_dist eq "N") { next; }
-
-	if (! -e "$cvsname[$i]/autogen.sh" || -e "$cvsname[$i]/Build.PL" ) { next; }
-	chdir $cvsname[$i];
-
-	vsystem ("./autogen.sh --no-configure");
-	if ($status) { die "error running autogen.sh"; }
-
-#	vsystem ("make distclean");
-#	if ($status) { die "error running make distclean"; }
-	chdir "..";
+        if (($module ne "") && ($module ne $cvsname[$i])) { next; }
+        ($do_tag, $do_build, $do_dist, $do_update) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)|;
+        if ($do_dist eq "N") { next; }
+
+        if (! -e "$cvsname[$i]/autogen.sh" || -e "$cvsname[$i]/Build.PL" ) { next; }
+        chdir $cvsname[$i];
+
+        vsystem ("./autogen.sh --no-configure");
+        if ($status) { die "error running autogen.sh"; }
+
+#       vsystem ("make distclean");
+#       if ($status) { die "error running make distclean"; }
+        chdir "..";
     }
     chdir "..";
@@ -241,7 +246,7 @@
     @list = <$tagsets/*.dist>;
     foreach $line (@list) {
-	chomp $line;
-	($dist) = $line =~ m|$tagsets/(\S*).dist|;
-	print STDERR "$dist\n";
+        chomp $line;
+        ($dist) = $line =~ m|$tagsets/(\S*).dist|;
+        print STDERR "$dist\n";
     }
     exit 2;
@@ -262,25 +267,25 @@
 
     foreach $line (@list) {
-	chop $line;
-	if ($line =~ m|^\s*$|) { next; }
-	if ($line =~ m|^\s*\#|) { next; }
-
-	($mode, $cvsname, $branchtag, $branchver) = split (" ", $line);
-	
-	if ($cvsname eq "") { die "missing module name\n"; }
-
-	($do_tag, $do_build, $do_dist, $do_update) = $mode =~ m|(\S)(\S)(\S)(\S)|;
-	if (($do_tag ne "Y") && ($do_tag ne "N")) { die "invalid tag option $do_tag\n"; }
-	if (($do_build ne "Y") && ($do_build ne "N")) { die "invalid tag option $do_build\n"; }
-	if (($do_dist ne "Y") && ($do_dist ne "N")) { die "invalid tag option $do_dist\n"; }
-	if (($do_update ne "Y") && ($do_update ne "N")) { die "invalid tag option $do_update\n"; }
-	
-	# print "module: $cvsname, branchtag: $branchtag, branchver: $branchver "; 
-	# print "tag: $do_tag, build: $do_build, dist: $do_dist, update: $do_update\n";
-
-	push @mode, $mode;
-	push @cvsname, $cvsname;
-	push @branchtag, $branchtag;
-	push @branchver, $branchver;
+        chop $line;
+        if ($line =~ m|^\s*$|) { next; }
+        if ($line =~ m|^\s*\#|) { next; }
+
+        ($mode, $cvsname, $branchtag, $branchver) = split (" ", $line);
+
+        if ($cvsname eq "") { die "missing module name\n"; }
+
+        ($do_tag, $do_build, $do_dist, $do_update) = $mode =~ m|(\S)(\S)(\S)(\S)|;
+        if (($do_tag ne "Y") && ($do_tag ne "N")) { die "invalid tag option $do_tag\n"; }
+        if (($do_build ne "Y") && ($do_build ne "N")) { die "invalid tag option $do_build\n"; }
+        if (($do_dist ne "Y") && ($do_dist ne "N")) { die "invalid tag option $do_dist\n"; }
+        if (($do_update ne "Y") && ($do_update ne "N")) { die "invalid tag option $do_update\n"; }
+
+        # print "module: $cvsname, branchtag: $branchtag, branchver: $branchver ";
+        # print "tag: $do_tag, build: $do_build, dist: $do_dist, update: $do_update\n";
+
+        push @mode, $mode;
+        push @cvsname, $cvsname;
+        push @branchtag, $branchtag;
+        push @branchver, $branchver;
     }
 }
