libtoolize: source extract-trace rather than fork and execute each call.

Rather than forking and executing a full $SHELL for each macro
extraction, source the script and its dependencies into our
execution space and use the provided func_extract_trace API.
* libtoolize.m4sh: Source extract-trace from an appropriate
directory determined presently by make.
(func_extract_trace): Remove this wrapper.
* Makefile.am (abs_aux_dir): Absolute path to extract-trace
directory.
(configure_edit): Inject abs_aux_dir into uninstalled libtoolize.
(bin_SCRIPTS): Remove libtoolize.
(uninstall-hook): Manually uninstall libtoolize.
(install-data-local): Inject pkgauxdir into installed libtoolize
during installation.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
This commit is contained in:
Gary V. Vaughan 2012-10-07 22:32:18 +07:00
parent 125eb722e4
commit 2a43c87092
2 changed files with 23 additions and 20 deletions

View File

@ -266,6 +266,7 @@ all-local: $(LTDL_BOOTSTRAP_DEPS)
## ---------------- ##
ltdl_ac_aux_dir = `$(extract_trace) AC_CONFIG_AUX_DIR $(srcdir)/libltdl/configure.ac`
abs_aux_dir = `$(lt__cd) $(srcdir)/$(aux_dir) && pwd`
configure_edit = $(SED) \
-e 's|@aclocaldir\@|$(aclocaldir)|g' \
@ -287,10 +288,11 @@ configure_edit = $(SED) \
-e 's|@pkgmacro_files\@|$(pkgmacro_files)|g' \
-e 's|@prefix\@|$(prefix)|g' \
-e 's|@SED\@|$(SED)|g' \
-e "/^\\. /s|@auxscriptsdir\@|$(abs_aux_dir)|g" \
-e 's|@srcdir\@|$(srcdir)|g'
# The libtool distributor and the standalone libtool script.
bin_SCRIPTS = libtoolize libtool
bin_SCRIPTS = libtool
libtoolize: $(libtoolize_in) $(config_status)
$(AM_V_at)rm -f '$@'
@ -501,7 +503,7 @@ install-data-local: $(lt_Makefile_in)
$(INSTALL_DATA) "$(srcdir)/$(macro_dir)/$$p" "$(DESTDIR)$(aclocaldir)/$$p"; \
done
## install the helper scripts
@list='extract-trace options-parser $(pkgaux_scripts)' && \
@list='extract-trace funclib.sh options-parser $(pkgaux_scripts)' && \
for p in $$list; do \
d=`echo "$(DESTDIR)$(pkgauxdir)/$$p" |$(SED) 's|[^/]*$$||'`; \
test -d "$$d" || $(mkinstalldirs) "$$d"; \
@ -521,7 +523,10 @@ install-data-local: $(lt_Makefile_in)
echo " $(INSTALL_DATA) '$(ltdldir)/$$p' '$(DESTDIR)$(pkgdatadir)/$$p'"; \
$(INSTALL_DATA) "$(ltdldir)/$$p" "$(DESTDIR)$(pkgdatadir)/$$p"; \
done
-chmod a+x '$(DESTDIR)$(pkgdatadir)/configure'
## Update direcory locations for installed libtoolize script
$(SED) -e "/^\\. /s|$(abs_aux_dir)|$(pkgauxdir)|g" libtoolize \
> '$(DESTDIR)$(bindir)/libtoolize';
-chmod a+x '$(DESTDIR)$(pkgdatadir)/configure' '$(DESTDIR)$(bindir)/libtoolize'
## ------------- ##
@ -602,6 +607,8 @@ uninstall-hook:
echo " rm -f '$(DESTDIR)$(aclocaldir)/$$f'"; \
rm -f "$(DESTDIR)$(aclocaldir)/$$f"; \
done
@echo " rm -f '$(DESTDIR)$(bindir)/libtoolize'"; \
rm -f '$(DESTDIR)$(bindir)/libtoolize'
## ----------- ##

View File

@ -23,6 +23,19 @@ AS_INIT[]m4_divert_push([HEADER-COPYRIGHT])
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## -------------------------- ##
## Source external libraries. ##
## -------------------------- ##
# Much of our low-level functionality needs to be sourced from external
# libraries, which are installed to $pkgauxdir under normal use, though
# we also need to be able to find them in $srcdir during testing, or if
# executed directly from the build tree.
. "@auxscriptsdir@/options-parser"
. "@auxscriptsdir@/extract-trace"
# Usage: $progname [OPTION]...
#
# Prepare a package to use libtool.
@ -297,23 +310,6 @@ func_copy ()
}
# func_extract_trace macro_name [filename ...]
# set `$func_extract_trace_result' to a colon delimited list of arguments
# to MACRO_NAME in FILENAME. If no FILENAME is given, then
# `configure.ac' is assumed.
func_extract_trace ()
{
$opt_debug
if test 1 -eq $#; then
test -n "$configure_ac" || return
set dummy "$@" "$configure_ac"; shift
fi
func_extract_trace_result=`$extract_trace ${1+"$@"}`
}
# func_included_files searchfile
# Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE.
func_included_files ()