2011-11-03 16:23:45 +08:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
# Make sure we've evaluated the option-parser library.
|
syntax-check: fix violations and implement sc_prohibit_sed_s_comma.
I like to name temporary directories that I will remove shortly
with two leading commas so that they sort lexicographically at
the top of `ls' output. Now, `./configure
--prefix=`pwd`/,,inst' works again, for the first time in
several years.
* cfg.mk (sc_prohibit_sed_s_comma): Comma is too common a
character to use routinely as the separator for sed
substitutions on file paths and other variables determined by
the user, causing bugs like the one I describe above. Make sure
we don't accidentally reintroduce any comma separators in
future.
* Makefile.am, bootstrap, bootstrap.conf, build-aux/extract-trace,
build-aux/general.m4sh, build-aux/git-hooks/commit-msg,
build-aux/git-log-fix, build-aux/ltmain.m4sh, libtoolize.m4sh,
m4/libtool.m4, m4/ltdl.m4, tests/cdemo-undef.test,
tests/cmdline_wrap.at, tests/darwin.at, tests/defs.m4sh,
tests/getopt-m4sh.at, tests/install.at, tests/libtoolize.at,
tests/mdemo/Makefile.am, tests/need_lib_prefix.at,
tests/sysroot.at, tests/tagdemo-undef.test, tests/testsuite.at:
Try to use `|' as the default separator wherever possible,
otherwise something else that doesn't occur in the substitution
expression.
* NEWS: Updated.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2011-11-21 19:02:23 +08:00
|
|
|
test -n "$progpath" || . `echo "$0" |${SED-sed} 's|[^/]*$||'`/options-parser
|
2011-11-03 16:23:45 +08:00
|
|
|
|
|
|
|
# Set a version string.
|
syntax-check: fix violations and implement sc_prohibit_sed_s_comma.
I like to name temporary directories that I will remove shortly
with two leading commas so that they sort lexicographically at
the top of `ls' output. Now, `./configure
--prefix=`pwd`/,,inst' works again, for the first time in
several years.
* cfg.mk (sc_prohibit_sed_s_comma): Comma is too common a
character to use routinely as the separator for sed
substitutions on file paths and other variables determined by
the user, causing bugs like the one I describe above. Make sure
we don't accidentally reintroduce any comma separators in
future.
* Makefile.am, bootstrap, bootstrap.conf, build-aux/extract-trace,
build-aux/general.m4sh, build-aux/git-hooks/commit-msg,
build-aux/git-log-fix, build-aux/ltmain.m4sh, libtoolize.m4sh,
m4/libtool.m4, m4/ltdl.m4, tests/cdemo-undef.test,
tests/cmdline_wrap.at, tests/darwin.at, tests/defs.m4sh,
tests/getopt-m4sh.at, tests/install.at, tests/libtoolize.at,
tests/mdemo/Makefile.am, tests/need_lib_prefix.at,
tests/sysroot.at, tests/tagdemo-undef.test, tests/testsuite.at:
Try to use `|' as the default separator wherever possible,
otherwise something else that doesn't occur in the substitution
expression.
* NEWS: Updated.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2011-11-21 19:02:23 +08:00
|
|
|
scriptversion=2011-11-21.10; # UTC
|
2011-11-03 16:23:45 +08:00
|
|
|
|
|
|
|
# Extract macro arguments from autotools input with GNU M4.
|
|
|
|
# Written by Gary V. Vaughan, 2010
|
|
|
|
#
|
2012-09-16 14:10:09 +08:00
|
|
|
# Copyright (C) 2010-2012 Free Software Foundation, Inc.
|
2011-11-03 16:23:45 +08:00
|
|
|
# This is free software; see the source for copying conditions. There is NO
|
|
|
|
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
#
|
|
|
|
##### PLEASE CHECK `--version' WORKS AFTER EDITING THE ABOVE COPYRIGHT #####
|
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
## ------ ##
|
|
|
|
## Usage. ##
|
|
|
|
## ------ ##
|
|
|
|
|
|
|
|
# Run `./extract-trace --help' for help with using this script from the
|
|
|
|
# command line.
|
|
|
|
#
|
|
|
|
# Or source first `options-parser' and then this file into your own
|
|
|
|
# scripts in order to make use of the function and variable framework
|
|
|
|
# they define, and also to avoid the overhead of forking to run this
|
|
|
|
# script in its own process on every call.
|
|
|
|
|
|
|
|
|
|
|
|
## -------------- ##
|
|
|
|
## Configuration. ##
|
|
|
|
## -------------- ##
|
|
|
|
|
|
|
|
usage='$progname MACRO_NAME FILE [...]'
|
|
|
|
|
|
|
|
long_help_message='
|
|
|
|
The first argument to this program is the name of an autotools macro
|
|
|
|
whose arguments you want to extract by examining the files listed in the
|
|
|
|
remaining arguments using the same tool that Autoconf and Automake use,
|
|
|
|
GNU M4.
|
|
|
|
|
|
|
|
The arguments are returned separated by colons, with each traced call
|
|
|
|
on a separate line.'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## ------------------##
|
|
|
|
## Helper functions. ##
|
|
|
|
## ------------------##
|
|
|
|
|
|
|
|
# This section contains the helper functions used by the rest of
|
|
|
|
# `extract-trace'.
|
|
|
|
|
|
|
|
|
|
|
|
# func_autoconf_configure MAYBE-CONFIGURE-FILE
|
|
|
|
# --------------------------------------------
|
|
|
|
# Ensure that MAYBE-CONFIGURE-FILE is the name of a file in the current
|
|
|
|
# directory which contains an uncommented call to AC_INIT.
|
|
|
|
func_autoconf_configure ()
|
|
|
|
{
|
|
|
|
$debug_cmd
|
|
|
|
|
syntax-check: fix violations and implement sc_prohibit_sed_s_comma.
I like to name temporary directories that I will remove shortly
with two leading commas so that they sort lexicographically at
the top of `ls' output. Now, `./configure
--prefix=`pwd`/,,inst' works again, for the first time in
several years.
* cfg.mk (sc_prohibit_sed_s_comma): Comma is too common a
character to use routinely as the separator for sed
substitutions on file paths and other variables determined by
the user, causing bugs like the one I describe above. Make sure
we don't accidentally reintroduce any comma separators in
future.
* Makefile.am, bootstrap, bootstrap.conf, build-aux/extract-trace,
build-aux/general.m4sh, build-aux/git-hooks/commit-msg,
build-aux/git-log-fix, build-aux/ltmain.m4sh, libtoolize.m4sh,
m4/libtool.m4, m4/ltdl.m4, tests/cdemo-undef.test,
tests/cmdline_wrap.at, tests/darwin.at, tests/defs.m4sh,
tests/getopt-m4sh.at, tests/install.at, tests/libtoolize.at,
tests/mdemo/Makefile.am, tests/need_lib_prefix.at,
tests/sysroot.at, tests/tagdemo-undef.test, tests/testsuite.at:
Try to use `|' as the default separator wherever possible,
otherwise something else that doesn't occur in the substitution
expression.
* NEWS: Updated.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2011-11-21 19:02:23 +08:00
|
|
|
_G_sed_no_comment='s|#.*$||; s|^dnl .*$||; s| dnl .*$||;'
|
2011-11-03 16:23:45 +08:00
|
|
|
_G_ac_init=
|
|
|
|
|
|
|
|
# If we were passed a genuine file, make sure it calls AC_INIT.
|
|
|
|
test -f "$1" \
|
|
|
|
&& _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |grep AC_INIT`
|
|
|
|
|
|
|
|
# Otherwise it is not a genuine Autoconf input file.
|
|
|
|
test -n "$_G_ac_init"
|
|
|
|
_G_status=$?
|
|
|
|
|
syntax-check: [REDO] fix violations and implement sc_prohibit_test_const_follows_var.
To safely use a non-literal fist argument to 'test', you must
always prepend a literal non-'-' character, but often the second
operand is a constant that doesn't begin with a '-' already, so
always use 'test a = "$b"' instead of the noisy 'test "X$b" = Xa'.
* cf.mk (sc_prohibit_test_const_follws_var): New syntax-check
rule to ensure we don't reintroduce noisy test operands.
bootstrap, build-aux/extract-trace, build-aux/general.m4sh,
build-aux/ltmain.m4sh, configure.ac, doc/libtool.texi, libtoolize.m4sh,
m4/argz.m4, m4/libtool.m4, m4/ltdl.m4, tests/bindir.at, tests/defs.m4sh,
tests/demo-relink.test, tests/demo/configure.ac,
tests/depdemo-relink.test, tests/destdir.at, tests/duplicate_conv.at,
tests/fail.at, tests/getopt-m4sh.at, tests/help.at, tests/libtoolize.at,
tests/link-2.test, tests/link-order2.at, tests/lt_dlopenext.at,
tests/mdemo/configure.ac, tests/mdemo2/configure.ac,
tests/need_lib_prefix.at, tests/nocase.at, tests/pdemo/configure.ac,
tests/pic_flag.at, tests/search-path.at, tests/shlibpath.at,
tests/static.at, tests/sysroot.at, tests/tagtrace.test,
tests/testsuite.at, tests/with-pic.at: Swap operands to avoid useless
noise.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2012-10-02 10:40:40 +08:00
|
|
|
test 0 -ne "$_G_status" \
|
2011-11-03 16:23:45 +08:00
|
|
|
&& func_verbose "\`$1' not using Autoconf"
|
|
|
|
|
|
|
|
(exit $_G_status)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# func_find_tool ENVVAR NAMES...
|
|
|
|
# ------------------------------
|
|
|
|
# Search for a required program. Use the value of ENVVAR, if set,
|
|
|
|
# otherwise find the first of the NAMES that can be run (i.e.,
|
|
|
|
# supports --version). If found, set ENVVAR to the program name,
|
|
|
|
# die otherwise.
|
|
|
|
func_find_tool ()
|
|
|
|
{
|
|
|
|
$debug_cmd
|
|
|
|
|
|
|
|
_G_find_tool_envvar=$1
|
|
|
|
shift
|
|
|
|
_G_find_tool_names=$@
|
|
|
|
eval "_G_find_tool_res=\$$_G_find_tool_envvar"
|
|
|
|
if test -n "$_G_find_tool_res"; then
|
|
|
|
_G_find_tool_error_prefix="\$$find_tool_envvar: "
|
|
|
|
else
|
|
|
|
for _G_prog
|
|
|
|
do
|
|
|
|
if func_tool_version_output $_G_prog >/dev/null; then
|
|
|
|
_G_find_tool_res=$_G_prog
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
if test -n "$_G_find_tool_res"; then
|
|
|
|
func_tool_version_output >/dev/null $_G_find_tool_res "\
|
|
|
|
${_G_find_tool_error_prefix}Cannot run \`$_G_find_tool_res --version'"
|
|
|
|
|
|
|
|
# Make sure the result is exported to the environment for children
|
|
|
|
# to use.
|
|
|
|
eval "$_G_find_tool_envvar=\$_G_find_tool_res"
|
|
|
|
eval "export $_G_find_tool_envvar"
|
|
|
|
else
|
|
|
|
func_error "\
|
|
|
|
One of these is required:
|
|
|
|
$_G_find_tool_names"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# func_tool_version_output CMD [FATAL-ERROR-MSG]
|
|
|
|
# ----------------------------------------------
|
|
|
|
# Attempt to run `CMD --version', discarding errors. The output can be
|
|
|
|
# ignored by redirecting stdout, and this function used simply to test
|
|
|
|
# whether the command exists and exits normally when passed a
|
libtoolize: rename `libltdl/config' directory to standard `build-aux'.
In addition to moving the autoconf auxiliary script directory
into the place expected by GNU developers ($top_srcdir/build-aux)
we also simplify libtoolize somewhat by having libltdl use
whatever directory was specified by the parent project. This is
much more flexible, allows libltdl client projects to also use a
single canonical `$top_srcdir/build-aux' auxiliary script
directory, and maintains backward compatibility with existing
projects that wish to continue using $ltdl_dir/config.
* libltdl/config: Moved whole directory from here...
* build-aux: ...to here.
* libtoolize.m4sh (func_install_pkgaux_subproject): Remove.
(func_install_pkgaux_parent): Remove.
(func_install_pkgaux_files): Considerably simplified now that we
have only a single auxiliary directory to worry about.
(subproject_aux_dir): Remove.
* bootstrap.conf (libtool_readme_release_package_substitutions):
No need to substitute our old unusual aux_dir location into
README-release any more.
* cfg.mk (_build-aux): Now that we use the standard location for
this directory, no need to set this variable either.
* configure.ac (AC_INIT): git-version-gen has moved.
(AC_CONFIG_AUX_DIR): Adjust.
* Makefile.am (stamp-mk, auxexefiles, auxfiles)
(install-data-local): Use build-aux instead of config.
(libltdl/stamp-mk): Ditto.
* libltdl/configure.ac, tests/cdemo/configure.ac,
tests/demo/configure.ac, tests/depdemo/configure.ac,
tests/f77demo/configure.ac, tests/fcdemo/configure.ac,
tests/mdemo/configure.ac, tests/mdemo2/configure.ac,
tests/pdemo/configure.ac, tests/tagdemo/configure.ac
(AC_CONFIG_AUX_DIR): Ditto.
* tests/defs.m4sh (aux_dir): Ditto.
* tests/configure-iface.at, tests/getopt-m4sh.at,
tests/libtoolize.at, tests/subproject.at, tests/testsuite.at:
Ditto.
* Makefile.am (ltdl_ac_aux_dir): Extract at build-time...
* libtoolize.m4sh (require_ltdl_ac_aux_dir): ...so that
libtoolize can access it at runtime without requiring GNU M4 via
the extract-trace script.
(require_Makefile_am_filter): Use it to determine whether the
aux_dir declared in the current (parent) project configure is
compatible with the declarations in installed ltdl autotools
source files.
(require_configure_ac_filter): New function to perform similar
checks and rewrite configure.ac during installation if necessary.
* NEWS: Updated.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2011-10-27 11:00:29 +08:00
|
|
|
# `--version' argument.
|
2011-11-03 16:23:45 +08:00
|
|
|
# When FATAL-ERROR-MSG is given, then this function will display the
|
|
|
|
# message and exit if running `CMD --version' returns a non-zero exit
|
|
|
|
# status.
|
|
|
|
func_tool_version_output ()
|
|
|
|
{
|
|
|
|
$debug_cmd
|
|
|
|
|
|
|
|
_G_cmd=$1
|
|
|
|
_G_fatal_error_msg=$2
|
|
|
|
|
|
|
|
# Some tools, like `git2cl' produce thousands of lines of output
|
|
|
|
# unless stdin is /dev/null - in that case we want to return
|
|
|
|
# successfully without saving all of that output. Other tools,
|
|
|
|
# such as `help2man' exit with a non-zero status when stdin comes
|
|
|
|
# from /dev/null, so we re-execute without /dev/null if that
|
|
|
|
# happens. This means that occasionally, the output from both calls
|
|
|
|
# ends up in the result, but the alternative would be to discard the
|
|
|
|
# output from one call, and hope the other produces something useful.
|
|
|
|
{ $_G_cmd --version </dev/null || $_G_cmd --version; } 2>/dev/null
|
|
|
|
_G_status=$?
|
|
|
|
|
syntax-check: [REDO] fix violations and implement sc_prohibit_test_const_follows_var.
To safely use a non-literal fist argument to 'test', you must
always prepend a literal non-'-' character, but often the second
operand is a constant that doesn't begin with a '-' already, so
always use 'test a = "$b"' instead of the noisy 'test "X$b" = Xa'.
* cf.mk (sc_prohibit_test_const_follws_var): New syntax-check
rule to ensure we don't reintroduce noisy test operands.
bootstrap, build-aux/extract-trace, build-aux/general.m4sh,
build-aux/ltmain.m4sh, configure.ac, doc/libtool.texi, libtoolize.m4sh,
m4/argz.m4, m4/libtool.m4, m4/ltdl.m4, tests/bindir.at, tests/defs.m4sh,
tests/demo-relink.test, tests/demo/configure.ac,
tests/depdemo-relink.test, tests/destdir.at, tests/duplicate_conv.at,
tests/fail.at, tests/getopt-m4sh.at, tests/help.at, tests/libtoolize.at,
tests/link-2.test, tests/link-order2.at, tests/lt_dlopenext.at,
tests/mdemo/configure.ac, tests/mdemo2/configure.ac,
tests/need_lib_prefix.at, tests/nocase.at, tests/pdemo/configure.ac,
tests/pic_flag.at, tests/search-path.at, tests/shlibpath.at,
tests/static.at, tests/sysroot.at, tests/tagtrace.test,
tests/testsuite.at, tests/with-pic.at: Swap operands to avoid useless
noise.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2012-10-02 10:40:40 +08:00
|
|
|
test 0 -ne "$_G_status" && test -n "$_G_fatal_error_msg" \
|
2011-11-03 16:23:45 +08:00
|
|
|
&& func_fatal_error "$_G_fatal_error_msg"
|
|
|
|
|
|
|
|
(exit $_G_status)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
## -------------------- ##
|
|
|
|
## Resource management. ##
|
|
|
|
## -------------------- ##
|
|
|
|
|
|
|
|
# This section contains definitions for functions that each ensure a
|
|
|
|
# particular resource (a file, or a non-empty configuration variable for
|
|
|
|
# example) is available, and if appropriate to extract default values
|
|
|
|
# from pertinent package files. Where a variable already has a non-
|
|
|
|
# empty value (as set by the package's `bootstrap.conf'), that value is
|
|
|
|
# used in preference to deriving the default. Call them using their
|
|
|
|
# associated `require_*' variable to ensure that they are executed, at
|
|
|
|
# most, once.
|
|
|
|
#
|
|
|
|
# It's entirely deliberate that calling these functions can set
|
|
|
|
# variables that don't obey the namespace limitations obeyed by the rest
|
|
|
|
# of this file, in order that that they be as useful as possible to
|
|
|
|
# callers.
|
|
|
|
|
|
|
|
|
|
|
|
# require_configure_ac
|
|
|
|
# --------------------
|
|
|
|
# Ensure that there is a `configure.ac' or `configure.in' file in the
|
|
|
|
# current directory which contains an uncommented call to AC_INIT, and
|
|
|
|
# that `$configure_ac' contains its name.
|
|
|
|
require_configure_ac=func_require_configure_ac
|
|
|
|
func_require_configure_ac ()
|
|
|
|
{
|
|
|
|
$debug_cmd
|
|
|
|
|
|
|
|
test -z "$configure_ac" \
|
|
|
|
&& func_autoconf_configure configure.ac && configure_ac=configure.ac
|
|
|
|
test -z "$configure_ac" \
|
|
|
|
&& func_autoconf_configure configure.in && configure_ac=configure.in
|
|
|
|
test -z "$configure_ac" \
|
|
|
|
|| func_verbose "found \`$configure_ac'"
|
|
|
|
|
|
|
|
require_configure_ac=:
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# require_gnu_m4
|
|
|
|
# --------------
|
|
|
|
# Search for GNU M4, and export it in $M4.
|
|
|
|
require_gnu_m4=func_require_gnu_m4
|
|
|
|
func_require_gnu_m4 ()
|
|
|
|
{
|
|
|
|
$debug_cmd
|
|
|
|
|
|
|
|
test -n "$M4" || {
|
|
|
|
# Find the first m4 binary that responds to --version.
|
|
|
|
func_find_tool M4 gm4 gnum4 m4
|
|
|
|
}
|
|
|
|
|
|
|
|
test -n "$M4" || func_fatal_error "\
|
|
|
|
Please install GNU M4, or \`export M4=/path/to/gnu/m4'."
|
|
|
|
|
|
|
|
func_verbose "export M4='$M4'"
|
|
|
|
|
|
|
|
# Make sure the search result is visible to subshells
|
|
|
|
export M4
|
|
|
|
|
|
|
|
require_gnu_m4=:
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
## --------------- ##
|
|
|
|
## Core functions. ##
|
|
|
|
## --------------- ##
|
|
|
|
|
|
|
|
# This section contains the high level functions used when calling this
|
|
|
|
# file as a script. `func_extract_trace' is probably the only one that you
|
|
|
|
# won't want to replace if you source this file into your own script.
|
|
|
|
|
|
|
|
|
|
|
|
# func_extract_trace MACRO_NAMES [FILENAME]...
|
|
|
|
# --------------------------------------------
|
|
|
|
# set `$func_extract_trace_result' to a colon delimited list of arguments
|
|
|
|
# to any of the comma separated list of MACRO_NAMES in FILENAME. If no
|
|
|
|
# FILENAME is given, then `$configure_ac' is assumed.
|
|
|
|
func_extract_trace ()
|
|
|
|
{
|
|
|
|
$debug_cmd
|
|
|
|
|
|
|
|
$require_configure_ac
|
|
|
|
$require_gnu_m4
|
|
|
|
|
2011-12-18 15:32:40 +08:00
|
|
|
_G_m4_traces=`$bs_echo "--trace=$1" |$SED 's%,% --trace=%g'`
|
|
|
|
_G_re_macros=`$bs_echo "($1)" |$SED 's%,%|%g'`
|
2011-11-03 16:23:45 +08:00
|
|
|
_G_macros="$1"; shift
|
|
|
|
test $# -gt 0 || {
|
|
|
|
set dummy $configure_ac
|
|
|
|
shift
|
|
|
|
}
|
|
|
|
|
|
|
|
# Generate an error if the first file is missing
|
|
|
|
<"$1"
|
|
|
|
|
|
|
|
# Sadly, we can't use `autom4te' tracing to extract macro arguments,
|
|
|
|
# because it complains about things we want to ignore at bootstrap
|
|
|
|
# time - like missing m4_include files; AC_PREREQ being newer than
|
|
|
|
# the installed autoconf; and returns nothing when tracing
|
|
|
|
# `AM_INIT_AUTOMAKE' when aclocal hasn't been generated yet.
|
|
|
|
#
|
|
|
|
# The following tries to emulate a less persnickety version of (and
|
|
|
|
# due to not having to wait for Perl startup on every invocation,
|
|
|
|
# it's probably faster too):
|
|
|
|
#
|
|
|
|
# autom4te --language=Autoconf --trace=$my_macro:\$% "$@"
|
|
|
|
#
|
|
|
|
# First we give a minimal set of macro declarations to M4 to prime
|
|
|
|
# it for reading Autoconf macros, while still providing some of the
|
|
|
|
# functionality generally used at m4-time to supply dynamic
|
|
|
|
# arguments to Autocof functions, but without following
|
|
|
|
# `m4_s?include' files.
|
|
|
|
_G_mini='
|
|
|
|
# Initialisation.
|
|
|
|
m4_changequote([,])
|
|
|
|
m4_define([m4_copy], [m4_define([$2], m4_defn([$1]))])
|
|
|
|
m4_define([m4_rename], [m4_copy([$1], [$2])m4_undefine([$1])])
|
|
|
|
|
|
|
|
# Disable these macros.
|
|
|
|
m4_undefine([m4_dnl])
|
|
|
|
m4_undefine([m4_include])
|
|
|
|
m4_undefine([m4_m4exit])
|
|
|
|
m4_undefine([m4_m4wrap])
|
|
|
|
m4_undefine([m4_maketemp])
|
|
|
|
|
|
|
|
# Copy and rename macros not handled by "m4 --prefix".
|
|
|
|
m4_define([dnl], [m4_builtin([dnl])])
|
|
|
|
m4_copy([m4_define], [m4_defun])
|
|
|
|
m4_rename([m4_ifelse], [m4_if])
|
|
|
|
m4_ifdef([m4_mkstemp], [m4_undefine([m4_mkstemp])])
|
|
|
|
m4_rename([m4_patsubst], [m4_bpatsubst])
|
|
|
|
m4_rename([m4_regexp], [m4_bregexp])
|
|
|
|
|
|
|
|
# "m4sugar.mini" - useful m4-time macros for dynamic arguments.
|
|
|
|
# If we discover packages that need more m4 macros defined in
|
|
|
|
# order to bootstrap correctly, add them here:
|
|
|
|
m4_define([m4_bmatch],
|
|
|
|
[m4_if([$#], 0, [], [$#], 1, [], [$#], 2, [$2],
|
|
|
|
[m4_if(m4_bregexp([$1], [$2]), -1,
|
|
|
|
[$0([$1], m4_shift3($@))], [$3])])])
|
|
|
|
m4_define([m4_ifndef], [m4_ifdef([$1], [$3], [$2])])
|
|
|
|
m4_define([m4_ifset],
|
|
|
|
[m4_ifdef([$1], [m4_ifval(m4_defn([$1]), [$2], [$3])], [$3])])
|
|
|
|
m4_define([m4_require], [$1])
|
|
|
|
m4_define([m4_shift3], [m4_shift(m4shift(m4shift($@)))])
|
|
|
|
|
|
|
|
# "autoconf.mini" - things from autoconf macros we care about.
|
|
|
|
m4_copy([m4_defun], [AC_DEFUN])
|
|
|
|
|
|
|
|
# Dummy definitions for the macros we want to trace.
|
|
|
|
# AM_INIT_AUTOMAKE at least produces no trace without this.
|
|
|
|
'
|
libtoolize: rename `libltdl/config' directory to standard `build-aux'.
In addition to moving the autoconf auxiliary script directory
into the place expected by GNU developers ($top_srcdir/build-aux)
we also simplify libtoolize somewhat by having libltdl use
whatever directory was specified by the parent project. This is
much more flexible, allows libltdl client projects to also use a
single canonical `$top_srcdir/build-aux' auxiliary script
directory, and maintains backward compatibility with existing
projects that wish to continue using $ltdl_dir/config.
* libltdl/config: Moved whole directory from here...
* build-aux: ...to here.
* libtoolize.m4sh (func_install_pkgaux_subproject): Remove.
(func_install_pkgaux_parent): Remove.
(func_install_pkgaux_files): Considerably simplified now that we
have only a single auxiliary directory to worry about.
(subproject_aux_dir): Remove.
* bootstrap.conf (libtool_readme_release_package_substitutions):
No need to substitute our old unusual aux_dir location into
README-release any more.
* cfg.mk (_build-aux): Now that we use the standard location for
this directory, no need to set this variable either.
* configure.ac (AC_INIT): git-version-gen has moved.
(AC_CONFIG_AUX_DIR): Adjust.
* Makefile.am (stamp-mk, auxexefiles, auxfiles)
(install-data-local): Use build-aux instead of config.
(libltdl/stamp-mk): Ditto.
* libltdl/configure.ac, tests/cdemo/configure.ac,
tests/demo/configure.ac, tests/depdemo/configure.ac,
tests/f77demo/configure.ac, tests/fcdemo/configure.ac,
tests/mdemo/configure.ac, tests/mdemo2/configure.ac,
tests/pdemo/configure.ac, tests/tagdemo/configure.ac
(AC_CONFIG_AUX_DIR): Ditto.
* tests/defs.m4sh (aux_dir): Ditto.
* tests/configure-iface.at, tests/getopt-m4sh.at,
tests/libtoolize.at, tests/subproject.at, tests/testsuite.at:
Ditto.
* Makefile.am (ltdl_ac_aux_dir): Extract at build-time...
* libtoolize.m4sh (require_ltdl_ac_aux_dir): ...so that
libtoolize can access it at runtime without requiring GNU M4 via
the extract-trace script.
(require_Makefile_am_filter): Use it to determine whether the
aux_dir declared in the current (parent) project configure is
compatible with the declarations in installed ltdl autotools
source files.
(require_configure_ac_filter): New function to perform similar
checks and rewrite configure.ac during installation if necessary.
* NEWS: Updated.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2011-10-27 11:00:29 +08:00
|
|
|
|
2011-11-03 16:23:45 +08:00
|
|
|
_G_save=$IFS
|
|
|
|
IFS=,
|
|
|
|
for _G_macro in $_G_macros; do
|
|
|
|
IFS=$_G_save
|
|
|
|
func_append _G_mini "AC_DEFUN([$_G_macro])$nl"
|
|
|
|
done
|
|
|
|
IFS=$_G_save
|
|
|
|
|
|
|
|
# We discard M4's stdout, but the M4 trace output from reading our
|
|
|
|
# "autoconf.mini" followed by any other files passed to this
|
|
|
|
# function is then scanned by sed to transform it into a colon
|
|
|
|
# delimited argument list assigned to a shell variable.
|
syntax-check: fix violations and implement sc_prohibit_sed_s_comma.
I like to name temporary directories that I will remove shortly
with two leading commas so that they sort lexicographically at
the top of `ls' output. Now, `./configure
--prefix=`pwd`/,,inst' works again, for the first time in
several years.
* cfg.mk (sc_prohibit_sed_s_comma): Comma is too common a
character to use routinely as the separator for sed
substitutions on file paths and other variables determined by
the user, causing bugs like the one I describe above. Make sure
we don't accidentally reintroduce any comma separators in
future.
* Makefile.am, bootstrap, bootstrap.conf, build-aux/extract-trace,
build-aux/general.m4sh, build-aux/git-hooks/commit-msg,
build-aux/git-log-fix, build-aux/ltmain.m4sh, libtoolize.m4sh,
m4/libtool.m4, m4/ltdl.m4, tests/cdemo-undef.test,
tests/cmdline_wrap.at, tests/darwin.at, tests/defs.m4sh,
tests/getopt-m4sh.at, tests/install.at, tests/libtoolize.at,
tests/mdemo/Makefile.am, tests/need_lib_prefix.at,
tests/sysroot.at, tests/tagdemo-undef.test, tests/testsuite.at:
Try to use `|' as the default separator wherever possible,
otherwise something else that doesn't occur in the substitution
expression.
* NEWS: Updated.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2011-11-21 19:02:23 +08:00
|
|
|
_G_transform='s|#.*$||; s|^dnl .*$||; s| dnl .*$||;'
|
2011-11-03 16:23:45 +08:00
|
|
|
|
|
|
|
# Unfortunately, alternation in regexp addresses doesn't work in at
|
|
|
|
# least BSD (and hence Mac OS X) sed, so we have to append a capture
|
|
|
|
# and print block for each traced macro to the sed transform script.
|
|
|
|
_G_save=$IFS
|
|
|
|
IFS=,
|
|
|
|
for _G_macro in $_G_macros; do
|
|
|
|
IFS=$_G_save
|
|
|
|
func_append _G_transform '
|
|
|
|
/^m4trace: -1- '"$_G_macro"'/ {
|
syntax-check: fix violations and implement sc_prohibit_sed_s_comma.
I like to name temporary directories that I will remove shortly
with two leading commas so that they sort lexicographically at
the top of `ls' output. Now, `./configure
--prefix=`pwd`/,,inst' works again, for the first time in
several years.
* cfg.mk (sc_prohibit_sed_s_comma): Comma is too common a
character to use routinely as the separator for sed
substitutions on file paths and other variables determined by
the user, causing bugs like the one I describe above. Make sure
we don't accidentally reintroduce any comma separators in
future.
* Makefile.am, bootstrap, bootstrap.conf, build-aux/extract-trace,
build-aux/general.m4sh, build-aux/git-hooks/commit-msg,
build-aux/git-log-fix, build-aux/ltmain.m4sh, libtoolize.m4sh,
m4/libtool.m4, m4/ltdl.m4, tests/cdemo-undef.test,
tests/cmdline_wrap.at, tests/darwin.at, tests/defs.m4sh,
tests/getopt-m4sh.at, tests/install.at, tests/libtoolize.at,
tests/mdemo/Makefile.am, tests/need_lib_prefix.at,
tests/sysroot.at, tests/tagdemo-undef.test, tests/testsuite.at:
Try to use `|' as the default separator wherever possible,
otherwise something else that doesn't occur in the substitution
expression.
* NEWS: Updated.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2011-11-21 19:02:23 +08:00
|
|
|
s|^m4trace: -1- '"$_G_macro"'[([]*||
|
2011-11-03 16:23:45 +08:00
|
|
|
s|], [[]|:|g
|
|
|
|
s|[])]*$|:|
|
|
|
|
s|\(.\):$|\1|
|
|
|
|
p
|
|
|
|
}'
|
|
|
|
done
|
|
|
|
IFS=$_G_save
|
|
|
|
|
|
|
|
# Save the command pipeline results for further use by callers of
|
|
|
|
# this function.
|
2011-12-18 15:32:40 +08:00
|
|
|
func_extract_trace_result=`$bs_echo "$_G_mini" \
|
2011-11-03 16:23:45 +08:00
|
|
|
|$M4 -daq --prefix $_G_m4_traces - "$@" 2>&1 1>/dev/null \
|
|
|
|
|$SED -n -e "$_G_transform"`
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# func_main [ARG]...
|
|
|
|
# ------------------
|
|
|
|
func_main ()
|
|
|
|
{
|
|
|
|
$debug_cmd
|
|
|
|
|
|
|
|
# Option processing.
|
|
|
|
func_options "$@"
|
|
|
|
eval set dummy "$func_options_result"; shift
|
|
|
|
|
|
|
|
# Validate remaining non-option arguments.
|
|
|
|
test $# -gt 1 \
|
|
|
|
|| func_fatal_help "not enough arguments"
|
|
|
|
|
|
|
|
# Pass non-option arguments to extraction function.
|
|
|
|
func_extract_trace "$@"
|
|
|
|
|
|
|
|
# Display results.
|
|
|
|
test -n "$func_extract_trace_result" \
|
2011-12-18 15:32:40 +08:00
|
|
|
&& $bs_echo "$func_extract_trace_result"
|
2011-11-03 16:23:45 +08:00
|
|
|
|
|
|
|
# The End.
|
|
|
|
exit $EXIT_SUCCESS
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
## --------------------------- ##
|
|
|
|
## Actually perform the trace. ##
|
|
|
|
## --------------------------- ##
|
|
|
|
|
|
|
|
# Only call `func_main' if this script was called directly.
|
|
|
|
test extract-trace = "$progname" && func_main "$@"
|
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
|
|
|
# sh-indentation: 2
|
|
|
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
|
|
|
# time-stamp-start: "scriptversion="
|
|
|
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
|
|
# time-stamp-time-zone: "UTC"
|
|
|
|
# time-stamp-end: "; # UTC"
|
|
|
|
# End:
|