[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
54-fyi-ac-top-builddir.patch
From: |
Akim Demaille |
Subject: |
54-fyi-ac-top-builddir.patch |
Date: |
Mon, 27 Aug 2001 08:55:02 +0200 |
Writing Autotest requires some serious cleanups... I think packages
such as Automake and Gettext will be helped a lot with this patch.
What might be needed is a means for Automake to hook it stamping
mechanism on AC_CONFIG_HEADER, i.e., we might want something like
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_COMMANDS(config.h, [date >stamp-h])
be equivalent to
AC_CONFIG_HEADERS(config.h, [date >stamp-h])
currently autoconf fails denunciating a conflict: config.h used twice.
Maybe AC_CONFIG_HOOK(config.h, [date >stamp-h])?
Index: ChangeLog
from Akim Demaille <address@hidden>
* lib/autoconf/status.m4 (_AC_SRCPATHS): Rename `ac_dots' as
`ac_top_builddir' to mimic Automake's vocabulary, which much more
readable.
Adjust callers.
* doc/autoconf.texi (Configuration Actions): Document the vars
available in commands.
Emphasize the risks of collisions in init-cmds.
Index: NEWS
--- NEWS Mon, 20 Aug 2001 09:04:59 +0200 akim
+++ NEWS Fri, 24 Aug 2001 10:52:59 +0200 akim
@@ -25,6 +25,9 @@
ACTION-IF-UNKNOWN arguments. All are facultative, and the default
for ACTION-IF-TRUE is to define WORDS_BIGENDIAN like AC_C_BIGENDIAN
always did.
+** Generic macros
+- AC_CONFIG_COMMANDS, HEADERS, FILES, LINKS.
+ Provide the user with srcdir, ac_top_srcdir, ac_top_builddir, ac_srcdir.
* Major changes in Autoconf 2.52
** Documentation
Index: doc/autoconf.texi
--- doc/autoconf.texi Fri, 24 Aug 2001 10:10:37 +0200 akim
+++ doc/autoconf.texi Fri, 24 Aug 2001 10:49:18 +0200 akim
@@ -1772,25 +1772,6 @@ @node Configuration Actions, Configurati
A whitespace-separated list of tags, which are typically the names of
the files to instantiate.
address@hidden commands
-Shell commands output literally into @file{config.status}, and
-associated with a tag that the user can use to tell @file{config.status}
-which the commands to run. The commands are run each time a @var{tag}
-request is given to @file{config.status}; typically, each time the file
address@hidden@var{tag}} is created.
-
address@hidden init-cmds
-Shell commands output @emph{unquoted} near the beginning of
address@hidden, and executed each time @file{config.status} runs
-(regardless of the tag). Because they are unquoted, for example,
address@hidden will be output as the value of @code{var}. @var{init-cmds}
-is typically used by @file{configure} to give @file{config.status} some
-variables it needs to run the @var{commands}.
address@hidden table
-
-All these macros can be called multiple times, with different
address@hidden, of course!
-
You are encouraged to use literals as @var{tags}. In particular, you
should avoid
@@ -1808,11 +1789,10 @@ @node Configuration Actions, Configurati
@dots{} && AC_CONFIG_FOOS(foooo)
@end example
-The macro @code{AC_CONFIG_FILES} and @code{AC_CONFIG_HEADERS} use
-specials @var{tag}s: they may have the form @address@hidden or
+The macros @code{AC_CONFIG_FILES} and @code{AC_CONFIG_HEADERS} use
+special @var{tag}s: they may have the form @address@hidden or
@address@hidden:@var{inputs}}. The file @var{output} is instantiated
-from its templates, @var{inputs} if specified, defaulting to
address@hidden@var{output}.in}.
+from its templates, @var{inputs} (defaulting to @address@hidden).
For instance
@samp{AC_CONFIG_FILES(Makefile:boiler/top.mk:boiler/bot.mk)} asks for
@@ -1831,6 +1811,78 @@ @node Configuration Actions, Configurati
case they are first looked for in the build tree, and then in the source
tree.
address@hidden commands
+Shell commands output literally into @file{config.status}, and
+associated with a tag that the user can use to tell @file{config.status}
+which the commands to run. The commands are run each time a @var{tag}
+request is given to @file{config.status}; typically, each time the file
address@hidden@var{tag}} is created.
+
+The variable set during the execution of @command{configure} are
address@hidden available here: you first need to set them via the
address@hidden Nonetheless the following variables are precomputed:
+
address@hidden @code
address@hidden srcdir
+The path from the top build directory to the top source directory. This
+is what @command{configure}'s option @option{--srcdir} sets.
+
address@hidden ac_top_srcdir
+The path from the current build directory to the top source directory.
+
+
address@hidden ac_top_builddir
+The path from the current build directory to the top build directory.
+It can be empty, or else ends with a slash, so that you may concatenate
+it.
+
address@hidden ac_srcdir
+The path from the current build directory to the corresponding source
+directory.
address@hidden table
+
address@hidden
+The @dfn{current} directory refers to the directory (or
+pseudo-directory) containing the input part of @var{tags}. For
+instance, running
+
address@hidden
+AC_CONFIG_COMMANDS([deep/dir/out:in/in.in], address@hidden, address@hidden)
address@hidden example
+
address@hidden
+ with @option{--srcdir=../package} produces the following values:
+
address@hidden
+# Argument of --srcdir
+srcdir='../package'
+# Reversing deep/dir
+ac_top_builddir='../../'
+# Concatenation of $ac_top_builddir and srcdir
+ac_top_srcdir='../../../package'
+# Concatenation of $ac_top_srcdir and deep/dir
+ac_srcdir='../../../package/deep/dir'
address@hidden example
+
address@hidden
+independently of @samp{in/in.in}.
+
address@hidden init-cmds
+Shell commands output @emph{unquoted} near the beginning of
address@hidden, and executed each time @file{config.status} runs
+(regardless of the tag). Because they are unquoted, for example,
address@hidden will be output as the value of @code{var}. @var{init-cmds}
+is typically used by @file{configure} to give @file{config.status} some
+variables it needs to run the @var{commands}.
+
+You should be extremely cautious in your variable names: all the
address@hidden share the same name space and may overwrite each other
+in unpredictable ways. address@hidden
address@hidden table
+
+All these macros can be called multiple times, with different
address@hidden, of course!
+
@node Configuration Files, Makefile Substitutions, Configuration Actions, Setup
@section Creating Configuration Files
@@ -1856,16 +1908,16 @@ @node Configuration Files, Makefile Subs
Typical calls to @code{AC_CONFIG_FILES} look like this:
@example
-AC_CONFIG_FILES(Makefile src/Makefile man/Makefile X/Imakefile)
-AC_CONFIG_FILES(autoconf, chmod +x autoconf)
+AC_CONFIG_FILES([Makefile src/Makefile man/Makefile X/Imakefile])
+AC_CONFIG_FILES([autoconf], [chmod +x autoconf])
@end example
You can override an input file name by appending to @var{file} a
colon-separated list of input files. Examples:
@example
-AC_CONFIG_FILES(Makefile:boiler/top.mk:boiler/bot.mk
- lib/Makefile:boiler/lib.mk)
+AC_CONFIG_FILES([Makefile:boiler/top.mk:boiler/bot.mk]
+ [lib/Makefile:boiler/lib.mk])
@end example
@noindent
@@ -2287,8 +2339,8 @@ config.status: configure
(Be careful if you copy these lines directly into your Makefile, as you
will need to convert the indented lines to start with the tab character.)
-In addition, you should use @samp{AC_CONFIG_FILES(stamp-h, echo
-timestamp > stamp-h)} so @file{config.status} will ensure that
+In addition, you should use @samp{AC_CONFIG_FILES([stamp-h], [echo
+timestamp > stamp-h])} so @file{config.status} will ensure that
@file{config.h} is considered up to date. @xref{Output}, for more
information about @code{AC_OUTPUT}.
@@ -2340,8 +2392,8 @@ @node Configuration Headers, Configurati
colon-separated list of input files. Examples:
@example
-AC_CONFIG_HEADERS(config.h:config.hin)
-AC_CONFIG_HEADERS(defines.h:defs.pre:defines.h.in:defs.post)
+AC_CONFIG_HEADERS([config.h:config.hin])
+AC_CONFIG_HEADERS([defines.h:defs.pre:defines.h.in:defs.post])
@end example
@noindent
@@ -2368,8 +2420,8 @@ @node Header Templates, autoheader Invoc
@file{configure.ac} makes these calls:
@example
-AC_CONFIG_HEADERS(conf.h)
-AC_CHECK_HEADERS(unistd.h)
+AC_CONFIG_HEADERS([conf.h])
+AC_CHECK_HEADERS([unistd.h])
@end example
@noindent
@@ -2615,14 +2667,14 @@ @node Configuration Commands, Configurat
Here is an unrealistic example:
@example
fubar=42
-AC_CONFIG_COMMANDS(fubar,
+AC_CONFIG_COMMANDS([fubar],
[echo this is extra $fubar, and so on.],
[fubar=$fubar])
@end example
Here is a better one:
@example
-AC_CONFIG_COMMANDS(time-stamp, [date >time-stamp])
+AC_CONFIG_COMMANDS([time-stamp], [date >time-stamp])
@end example
@end defmac
@@ -10530,7 +10582,7 @@ is:
@example
fubar=27
AC_OUTPUT_COMMANDS([echo this is extra $fubar, and so on.],
- fubar=$fubar)
+ [fubar=$fubar])
AC_OUTPUT_COMMANDS([echo this is another, extra, bit],
[echo init bit])
@end example
@@ -10553,7 +10605,7 @@ is:
@example
@group
AC_OUTPUT_COMMANDS([echo "Square brackets: []"])
-AC_CONFIG_COMMANDS(default, [[echo "Square brackets: []"]])
+AC_CONFIG_COMMANDS([default], [[echo "Square brackets: []"]])
@end group
@end example
@end defmac
Index: lib/autoconf/autotest.m4
--- lib/autoconf/autotest.m4 Fri, 24 Aug 2001 09:53:17 +0200 akim
+++ lib/autoconf/autotest.m4 Fri, 24 Aug 2001 10:50:14 +0200 akim
@@ -75,7 +75,7 @@ AC_DEFUN([AC_CONFIG_TESTDIR],
at_testdir='$1'
srcdir='$ac_srcdir'
top_srcdir='$ac_top_srcdir'
-top_builddir='$ac_dots'
+top_builddir='$ac_top_builddir'
AUTOTEST_PATH='m4_default([$2], [.])'
Index: lib/autoconf/status.m4
--- lib/autoconf/status.m4 Fri, 24 Aug 2001 09:53:17 +0200 akim
+++ lib/autoconf/status.m4 Fri, 24 Aug 2001 09:59:05 +0200 akim
@@ -127,32 +127,33 @@
# - `$srcdir' is `top-build -> top-src'
#
# Ouputs:
-# - `ac_dots' is `build -> top_build'. If not empty, has a trailing slash.
+# - `ac_top_builddir' is `build -> top_build'.
+# If not empty, has a trailing slash.
# - `ac_srcdir' is `build -> src'.
# - `ac_top_srcdir' is `build -> top-src'
m4_define([_AC_SRCPATHS],
[if test $1 != .; then
ac_dir_suffix=/`echo $1 | sed 's,^\./,,'`
# A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo "$ac_dir_suffix" | sed 's,/[[^/]]*,../,g'`
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[[^/]]*,../,g'`
else
- ac_dir_suffix= ac_dots=
+ ac_dir_suffix= ac_top_builddir=
fi
case $srcdir in
.) # No --srcdir option. We are building in place.
ac_srcdir=.
- if test -z "$ac_dots"; then
+ if test -z "$ac_top_builddir"; then
ac_top_srcdir=.
else
- ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'`
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
fi ;;
[[\\/]]* | ?:[[\\/]]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
- ac_srcdir=$ac_dots$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_dots$srcdir ;;
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
])# _AC_SRCPATHS
@@ -749,7 +750,7 @@ m4_define([_AC_OUTPUT_LINKS],
case $srcdir in
[[\\/$]]* | ?:[[\\/]]* ) ac_rel_source=$srcdir/$ac_source ;;
- *) ac_rel_source=$ac_dots$srcdir/$ac_source ;;
+ *) ac_rel_source=$ac_top_builddir$srcdir/$ac_source ;;
esac
# Make a symlink if possible; otherwise try a hard link.
@@ -900,7 +901,7 @@ m4_define([_AC_OUTPUT_FILES],
AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
[ case $INSTALL in
[[\\/$]]* | ?:[[\\/]]* ) ac_INSTALL=$INSTALL ;;
- *) ac_INSTALL=$ac_dots$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
])dnl
@@ -1090,7 +1091,7 @@ m4_define([_AC_OUTPUT_SUBDIRS],
case $cache_file in
[[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
*) # Relative path.
- ac_sub_cache_file=$ac_dots$cache_file ;;
+ ac_sub_cache_file=$ac_top_builddir$cache_file ;;
esac
AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args
--cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 54-fyi-ac-top-builddir.patch,
Akim Demaille <=