]> sourceware.org Git - automake.git/commitdiff
2002-07-31 Charles Wilson <cwilson@ece.gatech.edu>
authorAlexandre Duret-Lutz <adl@gnu.org>
Wed, 31 Jul 2002 19:58:24 +0000 (19:58 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Wed, 31 Jul 2002 19:58:24 +0000 (19:58 +0000)
        * 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.

13 files changed:
ChangeLog
NEWS
aclocal.in
automake.texi
m4/Makefile.am
m4/Makefile.in
m4/dirlist [new file with mode: 0644]
stamp-vti
tests/Makefile.am
tests/Makefile.in
tests/defs
tests/dirlist.test [new file with mode: 0755]
version.texi

index 163df1a127a2282313354bc892746ecff09842fc..12a441c0751a03fa00137e075a70b47f80dfb0f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2002-07-31  Charles Wilson  <cwilson@ece.gatech.edu>
+
+       * 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.
+
 2002-07-30  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        Build info files in builddir instead of srcdir (for PR automake/168),
@@ -11,7 +26,7 @@
        * lib/am/texibuild.am: Rewrite to output files in the current
        directory, not $(srcdir).  Also, support both generic and
        non-generic output.  Pass `-o $@' to makeinfo, texinfo, and
-       texi2dvi -- this is a partial fix for PR automake/339.
+       texi2dvi (for PR automake/339).
        * tests/texinfo3.test: Make sure the `.texi:' rule is output.
        * tests/texinfo10.test: Use set -e, so the checks are not ignored.
        * tests/texinfo16.test: New file.
diff --git a/NEWS b/NEWS
index 114504b0063fed8b9e0cd0c16d7e04db5045350a..fb270075422d13dc7c4591894d5edca0d741e7a5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,8 @@ New in 1.6c:
   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.
 \f
index 7f37916eda884caf63d9d2ca63531d1addeac181..c938e42fa15ac5c63a2b7eb1dbe1c913004bc848 100644 (file)
@@ -46,6 +46,11 @@ $prefix = "@prefix@";
 # 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.
 
@@ -176,6 +181,26 @@ sub parse_arguments
        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
     # unversioned directory last.  Only do this if the user didn't
     # override acdir.
index 3522308f2f5c55fb5e1175ddc72f4aaee052b4ca..95b48d3bd983af47a862e9f739349484e37fdb0f 100644 (file)
@@ -1341,7 +1341,8 @@ search around.  Also, the @code{aclocal} mechanism allows other packages
 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 @@ including both @samp{#} and @samp{dnl} comments.  If you want to make a
 comment which will be completely ignored by @code{aclocal}, use
 @samp{##} as the comment leader.
 
+@menu
+* aclocal options::             Options supported by aclocal
+* Macro search path::           How aclocal finds .m4 files
+@end menu
+
+@node aclocal options, Macro search path, Invoking aclocal, Invoking aclocal
+@section aclocal options
+
+@cindex aclocal, Options
+@cindex Options, aclocal
+
 @code{aclocal} accepts the following options:
 
 @table @code
@@ -1393,6 +1405,143 @@ Print the names of the files it examines.
 Print the version number of Automake and exit.
 @end table
 
+@node Macro search path, , aclocal options, Invoking aclocal
+@section Macro search path
+
+@cindex Macro search path
+@cindex aclocal search path
+
+By default, @command{aclocal} searches for @file{.m4} files in the following
+directories, in this order:
+
+@table @code
+@item @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}.  
+
+@item @var{acdir}
+This directory is intended for third party @file{.m4} files, and is
+configured when @command{automake} itself is built.  This is 
+@file{@@datadir@@/aclocal/}, which typically 
+expands to @file{$@{prefix@}/share/aclocal/}.  To find the compiled-in 
+value of @var{acdir}, use the @code{--print-ac-dir} option 
+(@pxref{aclocal options}).
+@end table
+
+As an example, suppose that automake-1.6.2 was configured with
+@code{--prefix=/usr/local}.  Then, the search path would be:
+
+@enumerate
+@item @file{/usr/local/share/aclocal-1.6/}
+@item @file{/usr/local/share/aclocal/}
+@end enumerate
+
+As explained in (@pxref{aclocal options}), there are several options that
+can be used to change or extend this search path.
+
+@subsection Modifying the macro search path: @code{--acdir}
+
+The most obvious option to modify the search path is 
+@code{--acdir=@var{dir}}, which changes default directory and
+drops the @var{APIVERSION} directory.  For example, if one specifies 
+@code{--acdir=/opt/private/}, then the search path becomes:
+
+@enumerate
+@item @file{/opt/private/}
+@end 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.
+
+@subsection 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,
+@code{aclocal -I /foo -I /bar} results in the following search path:
+
+@enumerate
+@item @file{/foo}
+@item @file{/bar}
+@item @var{acdir}-@var{APIVERSION}
+@item @var{acdir}
+@end enumerate
+
+@subsection Modifying the macro search path: @file{dirlist}
+
+There is a third mechanism for customizing the search path.  If a 
+@file{dirlist} 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
+@emph{before} the @var{acdir} and @var{acdir-APIVERSION} directories.
+
+For example, suppose 
+@file{@var{acdir}/dirlist} contains the following:
+
+@example
+/test1
+/test2
+@end example
+
+and that @code{aclocal} was called with the @code{-I /foo -I /bar} options.
+Then, the search path would be
+
+@enumerate
+@item @file{/foo}
+@item @file{/bar}
+@item @file{/test1}
+@item @file{/test2}
+@item @var{acdir}-@var{APIVERSION}
+@item @var{acdir}
+@end enumerate
+
+If the @code{--acdir=@var{dir}} option is used, 
+then @command{aclocal} will search for the @file{dirlist} file in 
+the @emph{redirected} @var{acdir} directory.  In the 
+@code{--acdir} example above, @command{aclocal} will search the 
+@file{/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.
+
+@file{dirlist} is useful in the following situation: suppose that 
+@code{automake} version @code{1.6.2} is installed with 
+$prefix=/usr by the system vendor. Thus, the default search 
+directories are 
+
+@enumerate
+@item @file{/usr/share/aclocal-1.6/}
+@item @file{/usr/share/aclocal/}
+@end 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 
+@file{/usr/local/share/aclocal}.  The only way to force 
+@file{/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
+
+@file{/usr/share/aclocal/dirlist}
+
+which contains only the single line
+
+@file{/usr/local/share/aclocal}
+
+Now, the ``default'' search path on the affected system is
+
+@enumerate
+@item @file{/usr/local/share/aclocal/}
+@item @file{/usr/share/aclocal-1.6/}
+@item @file{/usr/share/aclocal/}
+@end 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 cfcb55c6b1823a08df1b0702f72690df686e569a..79e2795afbbd7e4a741a62d9dec82c0d2de2b742 100644 (file)
@@ -53,3 +53,4 @@ strip.m4
 
 nodist_m4data_DATA = amversion.m4
 DISTCLEANFILES = amversion.m4
+EXTRA_DIST = dirlist
index 2b2a5c5d07bf5b85215457ca1ad561ae0c0448df..b32a02b5da25ce3d4f632df5493a1a32f27be282 100644 (file)
@@ -123,6 +123,7 @@ strip.m4
 
 nodist_m4data_DATA = amversion.m4
 DISTCLEANFILES = amversion.m4
+EXTRA_DIST = dirlist
 subdir = m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs
 CONFIG_CLEAN_FILES = amversion.m4
diff --git a/m4/dirlist b/m4/dirlist
new file mode 100644 (file)
index 0000000..ac070b3
--- /dev/null
@@ -0,0 +1,3 @@
+# This file is used by the testsuite (dirlist.test)
+# it should not be installed
+./dirlist-test
index de0ca61435294416b901cb6f2793e759d402eecd..f808452949d724826b334bcf92bc0ce00612a0f7 100644 (file)
--- a/stamp-vti
+++ b/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 30 July 2002
+@set UPDATED 31 July 2002
 @set UPDATED-MONTH July 2002
 @set EDITION 1.6c
 @set VERSION 1.6c
index a1ecc8afd9795cf02f932abdf6789a102f02d0f2..5f203ea203b6196d282f89340e231325cfc3567e 100644 (file)
@@ -132,6 +132,7 @@ depend3.test \
 depend4.test \
 destdir.test \
 dirforbid.test \
+dirlist.test \
 discover.test \
 distcommon.test \
 distcommon2.test \
index c780a5af8cce12f407894c2fca4698d76ab49599..d279136f1538530e1c79e9594b781eb135c6fd9c 100644 (file)
@@ -220,6 +220,7 @@ depend3.test \
 depend4.test \
 destdir.test \
 dirforbid.test \
+dirlist.test \
 discover.test \
 distcommon.test \
 distcommon2.test \
index 5127d01b6bfedc63ee11100bc78e9f58dbc0efb3..63150409905d66b7c6aa769fe2ad12c1f8e53b60 100644 (file)
@@ -144,14 +144,34 @@ fi
 # 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
 
diff --git a/tests/dirlist.test b/tests/dirlist.test
new file mode 100755 (executable)
index 0000000..51463ca
--- /dev/null
@@ -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
index 781d4ea7880e9db9550538250324cfee87a71d1e..f808452949d724826b334bcf92bc0ce00612a0f7 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 21 July 2002
+@set UPDATED 31 July 2002
 @set UPDATED-MONTH July 2002
 @set EDITION 1.6c
 @set VERSION 1.6c
This page took 0.044736 seconds and 5 git commands to generate.