fi
}
+
+# 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_scan_files
# Scan configure.(ac|in) and aclocal.m4 (if present) for use of libltdl
# and libtool. Possibly running some of these tools if necessary.
s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^])]*\).*$,ac_aux_dir=\1,
p
}
- /AC_CONFIG_MACRO_DIR(/ {
- s,^.*AC_CONFIG_MACRO_DIR([[ ]*\([^])]*\).*$,ac_macro_dir=\1,
- p
- }
/_LT_CONFIG_LTDL_DIR(/d
/LT_CONFIG_LTDL_DIR(/ {
s,^.*LT_CONFIG_LTDL_DIR([[ ]*\([^])]*\).*$,ac_ltdldir=\1,
# Just use the current directory if all else fails.
test -n "$aux_dir" || aux_dir=.
-
-
- # ------------------------------ #
- # Find local m4 macro directory. #
- # ------------------------------ #
-
- # Hunt for ACLOCAL_AMFLAGS in `Makefile.am' for a `-I' argument.
-
- my_sed_aclocal_flags='
- /^[ ]*ACLOCAL_[A-Z_]*FLAGS[ ]*=[ ]*/ {
- s,,,
- q
- }
- d'
- if test -f Makefile.am; then
- my_macro_dir_is_next=false
- for arg in `$SED "$my_sed_aclocal_flags" Makefile.am`; do
- if $my_macro_dir_is_next; then
- am_macro_dir="$arg"
- break
- else
- case $arg in
- -I) my_macro_dir_is_next=: ;;
- -I*)
- am_macro_dir=`$ECHO "$arg" | sed 's,^-I,,'`
- break
- ;;
- *) my_macro_dir_is_next=false ;;
- esac
- fi
- done
- fi
-
- macro_dir="$ac_macro_dir"
- test -z "$macro_dir" && macro_dir="$am_macro_dir"
-
- if test -n "$am_macro_dir" && test -n "$ac_macro_dir"; then
- test "$am_macro_dir" = "$ac_macro_dir" \
- || func_fatal_error "AC_CONFIG_MACRO_DIR([$ac_macro_dir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macro_dir."
- fi
}
# func_included_files searchfile
{
$debug_cmd
+ $require_ac_macro_dir
+
my_srcfile="$1"
my_src_serial="$2"
my_destfile="$3"
{
$debug_cmd
+ $require_macro_dir
+
# Remove any lingering files that my have been installed by some
# previous libtoolize release:
$opt_force && for file in $all_pkgmacro_files; do
{
$debug_cmd
+ $require_ac_macro_dir
+ $require_macro_dir
+
# Remove any lingering files that my have been installed by some
# previous libtoolize release:
$opt_force && for file in $all_pkgmacro_files; do
# user specified a macro_dir.
$opt_quiet || if test -n "$ac_macro_dir"; then
my_pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$ac_macro_dir'."
- elif test -n "$macro_dir"; then
+ else
my_pkgmacro_header="putting macros in \`$macro_dir'."
fi
{
$debug_cmd
+ $require_ac_macro_dir
+ $require_am_macro_dir
+ $require_macro_dir
+
# argz.m4, libtool.m4 and ltdl.m4 are handled specially:
func_massage_aclocal_DATA 'argz.m4|libtool.m4|ltdl.m4'
# 1. Parent has separate macro_dir to subproject ltdl:
if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" &&
- test -n "$macro_dir" && test "x$macro_dir" != "x$subproject_macro_dir"
+ test "x$macro_dir" != "x$subproject_macro_dir"
then
func_install_pkgmacro_parent
func_install_pkgmacro_subproject
func_install_pkgmacro_subproject
# 3. Not a subproject, but macro_dir was specified in parent:
- elif test -n "$macro_dir"; then
+ elif test -n "$ac_macro_dir$am_macro_dir"; then
func_install_pkgmacro_parent
# 4. AC_CONFIG_MACRO_DIR was not specified:
{
$debug_cmd
+ $require_ac_macro_dir
+ $require_am_macro_dir
$require_configure_ac
+ $require_macro_dir
$opt_quiet && return
test -n "$configure_ac" || return
ac_config_macro_dir_advised=false
- if test -n "$ac_macro_dir$ltdldir" && test -z "$macro_dir"; then
+ if test -n "$ac_macro_dir$ltdldir" && test -z "$ac_macro_dir$am_macro_dir"; then
my_ac_config_macro_srcdir="$aclocaldir"
if $opt_ltdl && test "$macro_dir" != "$subproject_macro_dir"; then
my_ac_config_macro_srcdir="$subproject_macro_dir"
ac_config_macro_dir_advised=:
fi
- if test -z "$am_macro_dir$macro_dir"; then
+ if test -z "$am_macro_dir$ac_macro_dir"; then
func_echo "Consider adding \`-I m4' to ACLOCAL_AMFLAGS in Makefile.am."
elif test -z "$am_macro_dir"; then
# most, once.
+# require_ac_macro_dir
+# --------------------
+# Extract ac_macro_dir from AC_CONFIG_MACRO_DIR.
+require_ac_macro_dir=func_require_ac_macro_dir
+func_require_ac_macro_dir ()
+{
+ $debug_cmd
+
+ $require_configure_ac
+
+ if test -n "$configure_ac"; then
+ func_extract_trace AC_CONFIG_MACRO_DIR
+ ac_macro_dir=$func_extract_trace_result
+ fi
+
+ require_ac_macro_dir=:
+}
+
+
+# require_aclocal_amflags
+# -----------------------
+# Extract `$aclocal_amflags' from `Makefile.am' if present.
+require_aclocal_amflags=func_require_aclocal_amflags
+func_require_aclocal_amflags ()
+{
+ $debug_cmd
+
+ $require_makefile_am
+
+ test -n "$makefile_am" && {
+ _G_sed_extract_aclocal_amflags='s|#.*$||
+ /^[ ]*ACLOCAL_AMFLAGS[ ]*=/ {
+ s|^.*=[ ]*\(.*\)|aclocal_amflags="\1"|
+ p
+ }'
+
+ _G_aclocal_flags_cmd=`$SED -n "$_G_sed_extract_aclocal_amflags" \
+ "$makefile_am"`
+ eval "$_G_aclocal_flags_cmd"
+
+ func_verbose "ACLOCAL_AMFLAGS='$aclocal_amflags'"
+ }
+
+ require_aclocal_amflags=:
+}
+
+
+# require_am_macro_dir
+# --------------------
+# Set am_macro_dir to the first directory specified in ACLOCAL_AMFLAGS.
+require_am_macro_dir=func_require_am_macro_dir
+func_require_am_macro_dir ()
+{
+ $debug_cmd
+
+ $require_aclocal_amflags
+
+ _G_minus_I_seen=false
+ for _G_arg in $aclocal_amflags; do
+ case $_G_minus_I_seen,$_G_arg in
+ :,*) am_macro_dir=$_G_arg; break ;;
+ *,-I) _G_minus_I_seen=: ;;
+ *,-I*) am_macro_dir=`expr x$_G_opt : 'x-I\(.*\)$'`; break ;;
+ esac
+ done
+
+ require_am_macro_dir=:
+}
+
+
# require_configure_ac
# --------------------
# Ensure that there is a `configure.ac' or `configure.in' file in the
}
+# require_macro_dir
+# -----------------
+# If both are specified, ensure both ACLOCAL_AMFLAGS and
+# AC_CONFIG_MACRO_DIR agree, and set macro_dir to the value of either.
+require_macro_dir=func_require_macro_dir
+func_require_macro_dir ()
+{
+ $debug_cmd
+
+ $require_ac_macro_dir
+ $require_am_macro_dir
+
+ macro_dir=$ac_macro_dir
+ test -n "$macro_dir" || macro_dir=$am_macro_dir
+ test -n "$macro_dir" || macro_dir=m4
+
+ if test -n "$ac_macro_dir" && test -n "$am_macro_dir"; then
+ test "$ac_macro_dir" = "$am_macro_dir" || func_fatal_error "\
+AC_CONFIG_MACRO_DIR([$ac_macro_dir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macro_dir."
+ fi
+
+ require_macro_dir=:
+}
+
+
+# require_makefile_am
+# -------------------
+# If not already set, set makefile_am to `Makefile.am' if that file is
+# present in the current directory.
+require_makefile_am=func_require_makefile_am
+func_require_makefile_am ()
+{
+ $debug_cmd
+
+ test -n "$makefile_am" || makefile_am=Makefile.am
+
+ if test -f Makefile.am; then
+ func_verbose "found \`$makefile_am'"
+ else
+ makefile_am=
+ fi
+
+ require_makefile_am=:
+}
+
+
## ----------- ##
## Main. ##
pkgltdldir=@pkgdatadir@
aclocaldir=@aclocaldir@
aux_dir=
- macro_dir=
seen_libtool=false
seen_ltdl=false
func_nonemptydir_p pkgdatadir
func_nonemptydir_p aclocaldir
+ extract_trace=$pkgdatadir/config/extract-trace
+
func_scan_files
case $ltdldir in
AT_CLEANUP
+## ------------------------------------------- ##
+## Create a working subproject without GNU M4. ##
+## ------------------------------------------- ##
+
+AT_SETUP([Subproject ltdl without GNU M4])
+
+AT_DATA(expout,
+[[libtoolize: putting auxiliary files in `ltdl/config'.
+libtoolize: linking file `ltdl/config/compile'
+libtoolize: linking file `ltdl/config/config.guess'
+libtoolize: linking file `ltdl/config/config.sub'
+libtoolize: linking file `ltdl/config/depcomp'
+libtoolize: linking file `ltdl/config/install-sh'
+libtoolize: linking file `ltdl/config/missing'
+libtoolize: linking file `ltdl/config/ltmain.sh'
+libtoolize: putting macros in `ltdl/m4'.
+libtoolize: linking file `ltdl/m4/argz.m4'
+libtoolize: linking file `ltdl/m4/libtool.m4'
+libtoolize: linking file `ltdl/m4/ltdl.m4'
+libtoolize: linking file `ltdl/m4/ltoptions.m4'
+libtoolize: linking file `ltdl/m4/ltsugar.m4'
+libtoolize: linking file `ltdl/m4/ltversion.m4'
+libtoolize: linking file `ltdl/m4/lt~obsolete.m4'
+libtoolize: putting libltdl files in `ltdl'.
+libtoolize: linking file `ltdl/COPYING.LIB'
+libtoolize: linking file `ltdl/README'
+libtoolize: linking file `ltdl/Makefile.am'
+libtoolize: linking file `ltdl/configure.ac'
+libtoolize: copying file `ltdl/aclocal.m4'
+libtoolize: linking file `ltdl/Makefile.in'
+libtoolize: linking file `ltdl/config-h.in'
+libtoolize: linking file `ltdl/configure'
+libtoolize: linking file `ltdl/argz_.h'
+libtoolize: linking file `ltdl/argz.c'
+libtoolize: linking file `ltdl/loaders/dld_link.c'
+libtoolize: linking file `ltdl/loaders/dlopen.c'
+libtoolize: linking file `ltdl/loaders/dyld.c'
+libtoolize: linking file `ltdl/loaders/load_add_on.c'
+libtoolize: linking file `ltdl/loaders/loadlibrary.c'
+libtoolize: linking file `ltdl/loaders/shl_load.c'
+libtoolize: linking file `ltdl/lt__dirent.c'
+libtoolize: linking file `ltdl/lt__strl.c'
+libtoolize: linking file `ltdl/libltdl/lt__alloc.h'
+libtoolize: linking file `ltdl/libltdl/lt__dirent.h'
+libtoolize: linking file `ltdl/libltdl/lt__glibc.h'
+libtoolize: linking file `ltdl/libltdl/lt__private.h'
+libtoolize: linking file `ltdl/libltdl/lt__strl.h'
+libtoolize: linking file `ltdl/libltdl/lt_dlloader.h'
+libtoolize: linking file `ltdl/libltdl/lt_error.h'
+libtoolize: linking file `ltdl/libltdl/lt_system.h'
+libtoolize: linking file `ltdl/libltdl/slist.h'
+libtoolize: linking file `ltdl/loaders/preopen.c'
+libtoolize: linking file `ltdl/lt__alloc.c'
+libtoolize: linking file `ltdl/lt_dlloader.c'
+libtoolize: linking file `ltdl/lt_error.c'
+libtoolize: linking file `ltdl/ltdl.c'
+libtoolize: linking file `ltdl/ltdl.h'
+libtoolize: linking file `ltdl/slist.c'
+]])
+
+AT_DATA([no-m4],
+[[#! /bin/sh
+echo 'error: do not call m4' >&2
+exit 1
+]])
+chmod a+x ./no-m4
+
+AT_CHECK([PATH=`pwd`:$PATH M4=`pwd`/no-m4 $LIBTOOLIZE --ltdl=ltdl], 0, expout)
+
+AT_CLEANUP
+
+
## --------------------------- ##
## Garbled LIBTOOLIZE_OPTIONS. ##
## --------------------------- ##