summaryrefslogtreecommitdiff
path: root/devel/automake110/files/patch-aclocal.in
blob: 0740a6dda4f9dfc12c1e870a55af7ece6d249bd4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
--- aclocal.in.orig	Sat Oct 12 23:14:57 2002
+++ aclocal.in	Thu Feb 13 14:57:16 2003
@@ -29,7 +29,7 @@
 
 BEGIN
 {
-  my $perllibdir = $ENV{'perllibdir'} || '@datadir@/@PACKAGE@-@APIVERSION@';
+  my $perllibdir = $ENV{'perllibdir'} || '@datadir@/@PACKAGE@@APIPVERSION@';
   unshift @INC, $perllibdir;
 }
 
@@ -42,8 +42,9 @@
 $PACKAGE = '@PACKAGE@';
 # Note that this isn't pkgdatadir, but a separate directory.
 # Note also that the versioned directory is handled later.
-$acdir = '@datadir@/aclocal';
+$acdir = '@datadir@/aclocal@APIPVERSION@';
 $default_acdir = $acdir;
+$acdir_x11 = '%%X11BASE%%/share/aclocal';
 # contains a list of directories, one per line, to be added
 # to the dirlist in addition to $acdir, as if -I had been
 # added to the command line.  If acdir has been redirected,
@@ -188,11 +189,7 @@
     $default_dirlist="$acdir/dirlist"
 	if $acdir ne $default_acdir;
 
-    # Search the versioned directory near the end, and then the
-    # unversioned directory last.  Only do this if the user didn't
-    # override acdir.
-    push (@dirlist, "$acdir-$APIVERSION")
-	if $acdir eq $default_acdir;
+    unshift @dirlist, $acdir_x11 if -d "$acdir_x11/.";
 
     # By default $(datadir)/aclocal doesn't exist.  We don't want to
     # get an error in the case where we are searching the default
@@ -290,12 +287,13 @@
 	$file_contents{'acinclude.m4'} = &scan_file ('acinclude.m4');
     }
 
+    local (@skipinolist) = ();
     local ($m4dir);
     foreach $m4dir (@dirlist)
     {
 	opendir (DIR, $m4dir)
 	    || die "aclocal: couldn't open directory `$m4dir': $!\n";
-	local ($file, $fullfile);
+	local ($file, $fullfile, $ino);
 	foreach $file (sort grep (! /^\./, readdir (DIR)))
 	{
 	    # Only examine .m4 files.
@@ -305,6 +303,12 @@
 	    next if $file eq 'aclocal.m4';
 
 	    $fullfile = $m4dir . '/' . $file;
+
+	    # Do not scan a file more than once.
+	    $ino = (stat($fullfile))[1];
+	    next if grep($ino eq $_, @skipinolist);
+	    push @skipinolist, $ino;
+
 	    $file_contents{$fullfile} = &scan_file ($fullfile);
 	}
 	closedir (DIR);