automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dirlist


From: Alexandre Duret-Lutz
Subject: Re: dirlist
Date: 31 Jul 2002 21:52:02 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi Chuck,

The FSF has received your assignment :)

I'm installing your patch on HEAD as follows.  I've just
reformated the ChangeLog a bit, and changed tests/defs to read
`dirlist' in the unversioned directory.

Thanks!

2002-07-31  Charles Wilson  <address@hidden>

        * aclocal.in (parse_arguments): Add support for extending
        default macro search path, using a `dirlist' file within
        the aclocal directory.
        * automake.texi (Invoking aclocal): Move option descriptions into ...
        (aclocal options): ... this new node.
        (Macro search path): New node.
        * tests/dirlist.test: New file.
        * tests/Makefile.am (TESTS): Add dirlist.test.
        * m4/dirlist: New file.
        * m4/Makefile.am (EXTRA_DIST): Add dirlist.
        * tests/defs: Honor any installed dirlist when searching for
        libtool.m4 and gettext.m4.

Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.189
diff -u -r1.189 NEWS
--- NEWS        30 Jul 2002 20:15:31 -0000      1.189
+++ NEWS        31 Jul 2002 19:49:23 -0000
@@ -23,6 +23,8 @@
   was defined for another condition.
 * Use Autoconf's --trace interface to inspect configure.ac and get
   a more accurate view of it.
+* Add support for extending aclocal's default macro search path
+  using a `dirlist' file within the aclocal directory.
 * automake --output-dir is deprecated.
 * Many bug fixes.
 
Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.71
diff -u -r1.71 aclocal.in
--- aclocal.in  29 Jul 2002 16:57:38 -0000      1.71
+++ aclocal.in  31 Jul 2002 19:49:30 -0000
@@ -46,6 +46,11 @@
 # Note also that the versioned directory is handled later.
 $acdir = "@datadir@/aclocal";
 $default_acdir = $acdir;
+# 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,
+# we will also check the specified acdir (this is done later).
+$default_dirlist = "$default_acdir/dirlist";
 
 # Some globals.
 
@@ -174,6 +179,26 @@
     {
        print $acdir, "\n";
        exit 0;
+    }
+
+    $default_dirlist="$acdir/dirlist"
+       if $acdir ne $default_acdir;
+
+    if (open (DEFAULT_DIRLIST, $default_dirlist))
+    {
+       while (<DEFAULT_DIRLIST>)
+       {
+           # Ignore '#' lines.
+           next if /^#/;
+           # strip off newlines and end-of-line comments
+           s/\s*\#.*$//;
+           chomp ($contents=$_);
+           if (-d $contents )
+           {
+               push (@dirlist, $contents);
+           }   
+       }
+       close (DEFAULT_DIRLIST);
     }
 
     # Search the versioned directory near the end, and then the
Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.292
diff -u -r1.292 automake.texi
--- automake.texi       22 Jul 2002 17:00:43 -0000      1.292
+++ automake.texi       31 Jul 2002 19:49:51 -0000
@@ -1341,7 +1341,8 @@
 to supply their own macros.
 
 At startup, @code{aclocal} scans all the @file{.m4} files it can find,
-looking for macro definitions.  Then it scans @file{configure.in}.  Any
+looking for macro definitions (@pxref{Macro search path}).  Then it 
+scans @file{configure.in}.  Any
 mention of one of the macros found in the first step causes that macro,
 and any macros it in turn requires, to be put into @file{aclocal.m4}.
 
@@ -1356,6 +1357,17 @@
 comment which will be completely ignored by @code{aclocal}, use
 @samp{##} as the comment leader.
 
address@hidden
+* aclocal options::             Options supported by aclocal
+* Macro search path::           How aclocal finds .m4 files
address@hidden menu
+
address@hidden aclocal options, Macro search path, Invoking aclocal, Invoking 
aclocal
address@hidden aclocal options
+
address@hidden aclocal, Options
address@hidden Options, aclocal
+
 @code{aclocal} accepts the following options:
 
 @table @code
@@ -1393,6 +1405,143 @@
 Print the version number of Automake and exit.
 @end table
 
address@hidden Macro search path, , aclocal options, Invoking aclocal
address@hidden Macro search path
+
address@hidden Macro search path
address@hidden aclocal search path
+
+By default, @command{aclocal} searches for @file{.m4} files in the following
+directories, in this order:
+
address@hidden @code
address@hidden @var{acdir-APIVERSION}
+This is where the @file{.m4} macros distributed with automake itself
+are stored.  @var{APIVERSION} depends on the automake release used; 
+for automake 1.6.x, @var{APIVERSION} = @code{1.6}.  
+
address@hidden @var{acdir}
+This directory is intended for third party @file{.m4} files, and is
+configured when @command{automake} itself is built.  This is 
address@hidden@@datadir@@/aclocal/}, which typically 
+expands to @address@hidden@}/share/aclocal/}.  To find the compiled-in 
+value of @var{acdir}, use the @code{--print-ac-dir} option 
+(@pxref{aclocal options}).
address@hidden table
+
+As an example, suppose that automake-1.6.2 was configured with
address@hidden/usr/local}.  Then, the search path would be:
+
address@hidden
address@hidden @file{/usr/local/share/aclocal-1.6/}
address@hidden @file{/usr/local/share/aclocal/}
address@hidden enumerate
+
+As explained in (@pxref{aclocal options}), there are several options that
+can be used to change or extend this search path.
+
address@hidden Modifying the macro search path: @code{--acdir}
+
+The most obvious option to modify the search path is 
address@hidden@var{dir}}, which changes default directory and
+drops the @var{APIVERSION} directory.  For example, if one specifies 
address@hidden/opt/private/}, then the search path becomes:
+
address@hidden
address@hidden @file{/opt/private/}
address@hidden enumerate
+
+Note that this option, @code{--acdir}, is intended for use
+by the internal automake test suite only; it is not ordinarily
+needed by end-users.
+
address@hidden Modifying the macro search path: @code{-I @var{dir}}
+
+Any extra directories specified using @code{-I} options 
+(@pxref{aclocal options}) are @emph{prepended} to this search list.  Thus,
address@hidden -I /foo -I /bar} results in the following search path:
+
address@hidden
address@hidden @file{/foo}
address@hidden @file{/bar}
address@hidden @address@hidden
address@hidden @var{acdir}
address@hidden enumerate
+
address@hidden Modifying the macro search path: @file{dirlist}
+
+There is a third mechanism for customizing the search path.  If a 
address@hidden file exists in @var{acdir}, then that
+file is assumed to contain a list of directories, one per line, to
+be added to the search list.  These directories are searched @emph{after} 
+any directories specified on the command line using @code{-I}, but
address@hidden the @var{acdir} and @var{acdir-APIVERSION} directories.
+
+For example, suppose 
address@hidden@var{acdir}/dirlist} contains the following:
+
address@hidden
+/test1
+/test2
address@hidden example
+
+and that @code{aclocal} was called with the @code{-I /foo -I /bar} options.
+Then, the search path would be
+
address@hidden
address@hidden @file{/foo}
address@hidden @file{/bar}
address@hidden @file{/test1}
address@hidden @file{/test2}
address@hidden @address@hidden
address@hidden @var{acdir}
address@hidden enumerate
+
+If the @address@hidden option is used, 
+then @command{aclocal} will search for the @file{dirlist} file in 
+the @emph{redirected} @var{acdir} directory.  In the 
address@hidden example above, @command{aclocal} will search the 
address@hidden/opt/private/} directory for @file{dirlist}.  Again, however,
+the @code{--acdir} option is intended for use by the internal
+automake test suite only; @code{--acdir} is not ordinarily 
+needed by end-users.
+
address@hidden is useful in the following situation: suppose that 
address@hidden version @code{1.6.2} is installed with 
+$prefix=/usr by the system vendor. Thus, the default search 
+directories are 
+
address@hidden
address@hidden @file{/usr/share/aclocal-1.6/}
address@hidden @file{/usr/share/aclocal/}
address@hidden enumerate
+
+However, suppose further that many packages have been manually 
+installed on the system, with $prefix=/usr/local, as is typical.
+In that case, many of these ``extra'' @file{.m4} files are in 
address@hidden/usr/local/share/aclocal}.  The only way to force 
address@hidden/usr/bin/aclocal} to find these ``extra'' @file{.m4} files 
+is to always call @code{aclocal -I /usr/local/share/aclocal}.  
+This is inconvenient.  With @file{dirlist}, one may create the file
+
address@hidden/usr/share/aclocal/dirlist}
+
+which contains only the single line
+
address@hidden/usr/local/share/aclocal}
+
+Now, the ``default'' search path on the affected system is
+
address@hidden
address@hidden @file{/usr/local/share/aclocal/}
address@hidden @file{/usr/share/aclocal-1.6/}
address@hidden @file{/usr/share/aclocal/}
address@hidden enumerate
+
+without the need for @code{-I} options; @code{-I} options can be reserved 
+for project-specific needs (@file{my-source-dir/m4/}), rather than
+using it to work around local system-dependent tool installation
+directories.
 
 @node Macros, Extending aclocal, Invoking aclocal, configure
 @section Autoconf macros supplied with Automake
Index: m4/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/m4/Makefile.am,v
retrieving revision 1.43
diff -u -r1.43 Makefile.am
--- m4/Makefile.am      19 Jul 2002 20:17:58 -0000      1.43
+++ m4/Makefile.am      31 Jul 2002 19:50:36 -0000
@@ -53,3 +53,4 @@
 
 nodist_m4data_DATA = amversion.m4
 DISTCLEANFILES = amversion.m4
+EXTRA_DIST = dirlist
Index: m4/dirlist
===================================================================
RCS file: m4/dirlist
diff -N m4/dirlist
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ m4/dirlist  31 Jul 2002 19:50:36 -0000
@@ -0,0 +1,3 @@
+# This file is used by the testsuite (dirlist.test)
+# it should not be installed
+./dirlist-test
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.425
diff -u -r1.425 Makefile.am
--- tests/Makefile.am   30 Jul 2002 20:15:32 -0000      1.425
+++ tests/Makefile.am   31 Jul 2002 19:50:36 -0000
@@ -132,6 +132,7 @@
 depend4.test \
 destdir.test \
 dirforbid.test \
+dirlist.test \
 discover.test \
 distcommon.test \
 distcommon2.test \
Index: tests/defs
===================================================================
RCS file: /cvs/automake/automake/tests/defs,v
retrieving revision 1.57
diff -u -r1.57 defs
--- tests/defs  19 Jul 2002 20:17:59 -0000      1.57
+++ tests/defs  31 Jul 2002 19:50:36 -0000
@@ -144,14 +144,34 @@
 # other `-I' directories added for libtool and gettext might contain
 # files from an old version of Automake that we don't want to use.
 aclocaldir=`(aclocal --print-ac-dir) 2>/dev/null`
+extra_includes=""
+if [ -f $aclocaldir/dirlist ] ; then
+   extra_includes=`(tmp_inc=""
+   while read LINE ; do
+      tmp_inc="$tmp_inc -I $LINE"
+   done
+   echo $tmp_inc) < $aclocaldir/dirlist`
+fi
 case $required in
   *libtool* )
-    test -f "$aclocaldir/libtool.m4" || exit 77
-    ACLOCAL="$ACLOCAL -I $srcdir/../m4 -I $aclocaldir"
+    libtool_found=no
+    for d in $extra_includes $aclocaldir ; do
+       if [ "x$d" != "x-I" ] && [ -f "$d/libtool.m4" ] ; then
+          libtool_found=yes
+       fi
+    done
+    test "x$libtool_found" = "xyes" || exit 77
+    ACLOCAL="$ACLOCAL -I $srcdir/../m4 $extra_includes -I $aclocaldir"
     ;;
   *gettext* )
-    test -f "$aclocaldir/gettext.m4" || exit 77
-    ACLOCAL="$ACLOCAL -I $srcdir/../m4 -I $aclocaldir"
+    gettext_found=no
+    for d in $extra_includes $aclocaldir ; do
+       if [ "x$d" != "x-I" ] && [ -f "$d/gettext.m4" ] ; then
+          gettext_found=yes
+       fi
+    done
+    test "x$gettext_found" = "xyes" || exit 77
+    ACLOCAL="$ACLOCAL -I $srcdir/../m4 $extra_includes -I $aclocaldir"
     ;;
 esac
 
Index: tests/dirlist.test
===================================================================
RCS file: tests/dirlist.test
diff -N tests/dirlist.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/dirlist.test  31 Jul 2002 19:50:36 -0000
@@ -0,0 +1,26 @@
+#! /bin/sh
+
+# Check dirlist support.
+# This test relies on m4/dirlist
+
+. $srcdir/defs || exit 1
+
+cat > configure.in <<EOF
+AC_INIT
+AM_INIT_GUILE_MODULE
+EOF
+
+mkdir dirlist-test
+
+cat >>dirlist-test/dirlist-check.m4 << 'END'
+AC_DEFUN([AM_INIT_GUILE_MODULE],[
+. $srcdir/../GUILE-VERSION
+AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+AC_CONFIG_AUX_DIR(..)
+module=[$1]
+AC_SUBST(module)])
+END
+
+$ACLOCAL || exit 1
+
+grep 'DEFUN.*AM_INIT_GUILE_MODULE' aclocal.m4

-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]