}
-# func_copy srcfile destfile
+# func_echo_once msg_var
+# Calls func_echo with the value of MSG_VAR, and then sets MSG_VAR="" so
+# that subsequent calls have no effect.
+func_echo_once ()
+{
+ $opt_debug
+ if test -n "$1"; then
+ eval my_msg=\$$1
+
+ if test -n "$my_msg"; then
+ func_echo "$my_msg"
+ eval $1=""
+ fi
+ fi
+}
+
+
+# func_copy srcfile destfile [msg_var]
# A wrapper for func_copy_cb that accepts arguments in the same order
# as the cp(1) shell command.
func_copy ()
if test -d "$2"; then
func_copy_cb "$my_f1" \
- `$ECHO "X$1" | $Xsed -e "$dirname"` "$2"
+ `$ECHO "X$1" | $Xsed -e "$dirname"` "$2" "$3"
else
func_copy_cb "$my_f1" \
`$ECHO "X$1" | $Xsed -e "$dirname"` \
- `$ECHO "X$2" | $Xsed -e "$dirname"`
+ `$ECHO "X$2" | $Xsed -e "$dirname"` \
+ "$3"
fi
}
-# func_copy_cb filename srcdir destdir
+# func_copy_cb filename srcdir destdir [msg_var]
# If option `--copy' was specified, or soft-linking SRCFILE to DESTFILE fails,
# then try to copy SRCFILE to DESTFILE (without changing the timestamp if
# possible).
my_file="$1"
my_srcdir="$2"
my_destdir="$3"
+ my_msg_var="$4"
copy_return_status=1
# Libtool is probably misinstalled if this happens:
if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \
| ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1 ; }
then
+ $opt_quiet || func_echo_once "$my_msg_var"
$opt_quiet || func_echo "copying $my_copy_msg"
copy_return_status=0
fi
else
if $LN_S "$my_srcdir/$my_file" "$my_destdir/$my_file"; then
+ $opt_quiet || func_echo_once "$my_msg_var"
$opt_quiet || func_echo "linking $my_copy_msg"
copy_return_status=0
fi
if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \
| ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1; } \
&& touch "$my_destdir/$my_file"; then
+ $opt_quiet || func_echo_once "$my_msg_var"
$opt_quiet || func_echo "copying $my_copy_msg"
copy_return_status=0
fi
fi
if test "$copy_return_status" != 0; then
+ $opt_quiet || func_echo_once "$my_msg_var"
func_error "can not copy \`$my_srcdir/$my_file' to \`$my_destdir/'"
exit_status=$EXIT_FAILURE
fi
}
-# func_copy_some_files srcfile_spec srcdir destdir [copy_cb=func_copy_cb]
+# func_copy_some_files srcfile_spec srcdir destdir [msg_var] [cb=func_copy_cb]
# Call COPY_CB for each regular file in SRCDIR named by the ':' delimited
# names in SRCFILE_SPEC. The odd calling convention is needed to allow
# spaces in file and directory names.
my_srcfile_spec="$1"
my_srcdir="$2"
my_destdir="$3"
- my_copy_cb="${4-func_copy_cb}"
+ my_msg_var="$4"
+ my_copy_cb="${5-func_copy_cb}"
my_save_IFS="$IFS"
IFS=:
if test -f "$my_srcdir/$my_filename"; then
if test "X$my_copy_cb" = Xfunc_copy_cb; then
$opt_force || if test -f "$my_destdir/$my_filename"; then
+ $opt_quiet || func_echo_once "$my_msg_var"
$opt_quiet \
|| func_error "\`$my_destdir/$my_filename' exists: use \`--force' to overwrite"
continue
fi
fi
else
+ func_echo_once "$my_msg_var"
func_fatal_error "\`$my_filename' not found in \`$my_srcdir'"
fi
- $my_copy_cb "$my_filename" "$my_srcdir" "$my_destdir"
+ $my_copy_cb "$my_filename" "$my_srcdir" "$my_destdir" "$my_msg_var"
done
IFS="$my_save_IFS"
}
if test "X$my_dest_serial" = "X$func_serial_max_result"; then
func_verbose "\`$my_srcfile' is serial $my_src_serial, less than $my_dest_serial in \`$my_destfile'"
- $opt_force \
- || func_error "\`$my_destfile' is newer: use \`--force' to overwrite"
+ $opt_force || if test -n "$ac_macrodir$ac_ltdldir"; then
+ func_error "\`$my_destfile' is newer: use \`--force' to overwrite"
+ fi
fi
fi
}
-# func_serial_update filename srcdir destdir [macro_regex] [old_macro_regex]
+# func_aclocal_update_check filename
+# Unless serial number of FILENAME is newer than the matching serial number
+# in aclocal.m4, set $func_aclocal_update_check to 'false'.
+func_aclocal_update_check ()
+{
+ $opt_debug
+ my_srcfile="$aclocaldir/$1"
+ my_destfile="aclocal.m4"
+
+ case $need in
+ libtool.m4)
+ my_src_serial=`func_serial "$my_srcfile" LT_INIT`
+ my_dest_serial=`func_serial "$my_destfile" LT_INIT`
+
+ # Strictly, this libtoolize ought not to have to deal with ancient
+ # serial formats, but we accept them here to be complete:
+ test "X$my_src_serial" = "X0" &&
+ my_src_serial=`func_serial "$my_srcfile" 'A[CM]_PROG_LIBTOOL'`
+ test "X$my_dest_serial" = "X0" &&
+ my_dest_serial=`func_serial "$my_destfile" 'A[CM]_PROG_LIBTOOL'`
+ ;;
+ ltdl.m4)
+ my_src_serial=`func_serial "$my_srcfile" LTDL_INIT`
+ my_dest_serial=`func_serial "$my_destfile" LTDL_INIT`
+ ;;
+ *)
+ my_src_serial=`func_serial "$my_srcfile" "$need"`
+ my_dest_serial=`func_serial "$my_destfile" "$need"`
+ ;;
+ esac
+
+ func_serial_update_check \
+ "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
+
+ func_aclocal_update_check_result="$func_serial_update_check_result"
+}
+
+
+# func_serial_update filename srcdir destdir [msg_var] [macro_re] [old_macro_re]
# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
# has a newer serial number, or DESTFILE does not yet exist, or the user
# specified `--force' at the command line. If given, MACRO_REGEX or
my_filename="$1"
my_srcdir="$2"
my_destdir="$3"
- my_macro_regex="$4"
- my_old_macro_regex="$5"
+ my_msg_var="$4"
+ my_macro_regex="$5"
+ my_old_macro_regex="$6"
my_serial_update_p=:
my_return_status=1
fi
if $my_serial_update_p || $opt_force; then
- func_copy "$my_srcfile" "$my_destfile"
+ func_copy "$my_srcfile" "$my_destfile" "$my_msg_var"
my_return_status=$?
- elif test "X$my_dest_serial" = "X$my_src_serial"; then
+ elif $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then
+ $opt_quiet || func_echo_once "$my_msg_var"
$opt_quiet \
|| func_echo "\`$my_destfile' is already up to date."
fi
if test -f aclocal.m4; then
func_serial_max \
"$my_src_serial" `func_serial aclocal.m4 "$my_macro_regex"`
- test "X$my_src_serial" = "X$func_serial_max_result" \
- && func_echo "You should add the contents of \`$my_destfile' to \`aclocal.m4'."
+ if test "X$my_src_serial" = "X$func_serial_max_result"; then
+ func_echo_once "$my_msg_var"
+ func_echo "You should add the contents of \`$my_destfile' to \`aclocal.m4'."
+ fi
fi
;;
esac
}
-# func_keyword_update filename srcdir destdir sed_script
+# func_keyword_update filename srcdir destdir sed_script [msg_var]
# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
# has a newer revision according to the serial number extracted by
# SED_SCRIPT, or DESTFILE does not yet exist, or the user specified
my_srcdir="$2"
my_destdir="$3"
my_sed_script="$4"
+ my_msg_var="$5"
my_srcfile="$my_srcdir/$my_filename"
my_destfile="$my_destdir/$my_filename"
fi
if $my_keyword_update_p || $opt_force; then
- func_copy "$my_srcfile" "$my_destfile"
- elif test "X$my_dest_serial" = "X$my_src_serial"; then
- $opt_quiet \
- || func_echo "\`$my_destfile' is already up to date."
+ func_copy "$my_srcfile" "$my_destfile" "$my_msg_var"
+ elif $opt_verbose || $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then
+ func_echo_once "$my_msg_var"
+ func_echo "\`$my_destfile' is already up to date."
fi
}
-# func_ltmain_update filename srcdir destdir
+# func_ltmain_update filename srcdir destdir [msg_var]
# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
# has a newer revision, or DESTFILE does not yet exist, or the user
# specified `--force' at the command line.
}
d'
- func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain"
+ func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain" "$4"
return $my_return_status
}
-# func_config_update filename srcdir destdir
+# func_config_update filename srcdir destdir [msg_var]
# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
# has a newer timestamp, or DESTFILE does not yet exist, or the user
# specified `--force' at the command line.
}
d'
- func_keyword_update "$1" "$2" "$3" "$my_sed_config"
+ func_keyword_update "$1" "$2" "$3" "$my_sed_config" "$4"
return $my_return_status
}
-# func_install_update filename srcdir destdir
+# func_install_update filename srcdir destdir [msg_var]
# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
# has a newer timestamp, or DESTFILE does not yet exist, or the user
# specified `--force' at the command line.
}
d'
- func_keyword_update "$1" "$2" "$3" "$my_sed_install"
+ func_keyword_update "$1" "$2" "$3" "$my_sed_install" "$4"
return $my_return_status
}
# Copy all the files from installed libltdl to this project, if the
# user specified a macrodir.
$opt_quiet || if test "x$macrodir" != "x$subproject_macrodir"; then
- func_echo "putting macros in \`$subproject_macrodir'."
+ pkgmacro_header="putting macros in \`$subproject_macrodir'."
elif test -n "$subproject_macrodir"; then
- func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$subproject_macrodir'."
+ pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$subproject_macrodir'."
fi
func_copy_some_files "argz.m4:libtool.m4:ltdl.m4:$pkgmacro_files" \
- "$aclocaldir" "$subproject_macrodir"
+ "$aclocaldir" "$subproject_macrodir" pkgmacro_header
}
# Copy all the files from installed libltdl to this project, if the
# user specified a macrodir.
$opt_quiet || if test -n "$ac_macrodir"; then
- func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$ac_macrodir'."
+ my_pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$ac_macrodir'."
elif test -n "$macrodir"; then
- func_echo "putting macros in \`$macrodir'."
+ my_pkgmacro_header="putting macros in \`$macrodir'."
fi
if $opt_ltdl; then
- func_serial_update argz.m4 "$aclocaldir" "$macrodir" argz.m4
+ func_serial_update argz.m4 "$aclocaldir" "$macrodir" \
+ my_pkgmacro_header argz.m4
else
func_verbose "Not copying \`$macrodir/argz.m4', libltdl not used."
fi
func_serial_update libtool.m4 "$aclocaldir" "$macrodir" \
- LT_INIT 'A[CM]_PROG_LIBTOOL'
+ my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL'
if $opt_ltdl; then
- func_serial_update ltdl.m4 "$aclocaldir" "$macrodir" 'LTDL_INIT'
+ func_serial_update ltdl.m4 "$aclocaldir" "$macrodir" \
+ my_pkgmacro_header 'LTDL_INIT'
else
func_verbose "Not copying \`$macrodir/ltdl.m4', libltdl not used."
fi
IFS=:
for file in $pkgmacro_files; do
IFS="$my_save_IFS"
- func_serial_update $file "$aclocaldir" "$macrodir" "$file"
+ func_serial_update "$file" "$aclocaldir" "$macrodir" \
+ my_pkgmacro_header "$file"
done
IFS="$my_save_IFS"
}
# Copy all the files from installed libltdl to this project, if the
# user specified `--ltdl'.
$opt_quiet || if test -n "$ac_ltdldir"; then
- func_echo "putting libltdl files in LT_CONFIG_LTDL_DIR, \`$ac_ltdldir'."
+ pkgltdl_header="putting libltdl files in LT_CONFIG_LTDL_DIR, \`$ac_ltdldir'."
elif test -n "$ltdldir"; then
- func_echo "putting libltdl files in \`$ltdldir'."
+ pkgltdl_header="putting libltdl files in \`$ltdldir'."
fi
# These files are handled specially, depending on ltdl_mode:
func_massage_pkgltdl_files 'Makefile.am|Makefile.in*|aclocal.m4|config*'
fi
- func_copy_some_files "$pkgltdl_files" "$pkgltdldir/libltdl" "$ltdldir"
+ func_copy_some_files "$pkgltdl_files" \
+ "$pkgltdldir/libltdl" "$ltdldir" pkgltdl_header
# For recursive ltdl modes, copy a suitable Makefile.{am,inc}:
case $ltdl_mode in
# Copy all the files from installed libltdl to this project, if the
# user specified an auxdir.
$opt_quiet || if test "x$ac_auxdir" = "x$subproject_auxdir"; then
- func_echo "putting auxiliary files in AC_CONFIG_AUX_DIR, \`$subproject_auxdir'."
+ pkgconfig_header="putting auxiliary files in AC_CONFIG_AUX_DIR, \`$subproject_auxdir'."
elif test -n "$auxdir"; then
- func_echo "putting auxiliary files in \`$auxdir'."
+ pkgconfig_header="putting auxiliary files in \`$auxdir'."
fi
- func_copy_some_files "$pkgconfig_files" "$pkgdatadir" "$ltdldir"
+ func_copy_some_files "$pkgconfig_files" \
+ "$pkgdatadir" "$ltdldir" pkgconfig_header
}
{
$opt_debug
- # Copy all the files from installed libltdl to this project, if the
- # user specified an auxdir.
- $opt_quiet || if test -n "$ac_auxdir"; then
- func_echo "putting auxiliary files in AC_CONFIG_AUX_DIR, \`$ac_auxdir'."
+ if test -n "$ac_auxdir"; then
+ pkgconfig_header="putting auxiliary files in AC_CONFIG_AUX_DIR, \`$ac_auxdir'."
elif test -n "$auxdir" || test "x$ltdldir" = "x."; then
- func_echo "putting auxiliary files in \`$auxdir'."
+ pkgconfig_header="putting auxiliary files in \`$auxdir'."
fi
if $opt_install; then
- func_config_update config.guess "$pkgdatadir/config" "$auxdir"
- func_config_update config.sub "$pkgdatadir/config" "$auxdir"
- func_install_update install-sh "$pkgdatadir/config" "$auxdir"
+ func_config_update config.guess \
+ "$pkgdatadir/config" "$auxdir" pkgconfig_header
+ func_config_update config.sub \
+ "$pkgdatadir/config" "$auxdir" pkgconfig_header
+ func_install_update install-sh \
+ "$pkgdatadir/config" "$auxdir" pkgconfig_header
fi
- func_ltmain_update ltmain.sh "$pkgdatadir/config" "$auxdir"
+ func_ltmain_update ltmain.sh \
+ "$pkgdatadir/config" "$auxdir" pkgconfig_header
}
ac_config_macro_dir_advised=false
-
# Suggest modern idioms for storing autoconf macros:
if test -z "$ac_macrodir$ltdldir"; then
- if test x"$macrodir" = x.; then
- func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([m4])' to $configure_ac and rerunning"
- func_echo " libtoolize, to keep the correct libtool macros in-tree."
- else
- func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([$macrodir])'to $configure.ac,"
- func_echo "and rerunning libtoolize."
+ if test -z "$macrodir" || test x"$macrodir" = x.; then
+ func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([m4])' to $configure_ac and"
+ func_echo "rerunning libtoolize, to keep the correct libtool macros in-tree."
+ elif test -z "$ac_macrodir$ltdldir"; then
+ func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([$macrodir])' to $configure_ac,"
+ func_echo "and rerunning libtoolize and aclocal."
fi
elif test -z "$macrodir"; then
my_needed="libtool.m4 ltoptions.m4 ltversion.m4 ltsugar.m4 lt~obsolete.m4"
$opt_ltdl && my_needed="$my_needed argz.m4 ltdl.m4"
- func_echo "You should add the contents of the following files to \`aclocal.m4':"
- for need in $my_needed; do
- func_echo " \`$my_ac_config_macro_srcdir/$need'"
- done
+ if test -f "aclocal.m4"; then
+ for need in $my_needed; do
+ func_aclocal_update_check $need
+ $func_aclocal_update_check_result && my_missing="$my_missing $need"
+ done
+ else
+ my_missing="$my_needed"
+ fi
- if test "$my_ac_config_macro_srcdir" != "$aclocaldir"; then
- func_echo "or else add \`AC_CONFIG_MACRO_DIR([$subproject_macrodir])' to $configure_ac."
- ac_config_macro_dir_advised=:
+ if test -n "$my_missing"; then
+ func_echo "You should add the contents of the following files to \`aclocal.m4':"
+ for need in $my_missing; do
+ func_echo " \`$my_ac_config_macro_srcdir/$need'"
+ done
+
+ if test "$my_ac_config_macro_srcdir" != "$aclocaldir"; then
+ func_echo "or else add \`AC_CONFIG_MACRO_DIR([$subproject_macrodir])' to $configure_ac."
+ ac_config_macro_dir_advised=:
+ fi
fi
fi
# libtoolize.at -- test libtoolize operation -*- Autotest -*-
#
-# Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
# Written by Gary V. Vaughan, 2005
#
# This file is part of GNU Libtool.
## -------------------------------------------------------------------- ##
AT_DATA(expout,
-[[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
-libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
+[[libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
## Next, a second update attempt with everything now updated. ##
## ---------------------------------------------------------- ##
-AT_DATA(expout,
-[[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
-libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
-libtoolize: `m4/libtool.m4' is already up to date.
-libtoolize: `m4/ltsugar.m4' is already up to date.
-libtoolize: `m4/ltversion.m4' is already up to date.
-libtoolize: `m4/lt~obsolete.m4' is already up to date.
-]])
+AT_DATA(expout, [[]])
AT_DATA(experr,
[[libtoolize: `build-aux/ltmain.sh' is newer: use `--force' to overwrite
LT_AT_CHECK_LIBTOOLIZE([--copy --force], 0, expout)
-## --------------------------------------------------------- ##
-## A final update attempt with everything now force updated. ##
-## --------------------------------------------------------- ##
+## ---------------------------------------------------------------- ##
+## A final update attempt with everything previously force updated. ##
+## ---------------------------------------------------------------- ##
-AT_DATA(expout,
-[[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
-libtoolize: `build-aux/ltmain.sh' is already up to date.
-libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
-libtoolize: `m4/libtool.m4' is already up to date.
-libtoolize: `m4/ltoptions.m4' is already up to date.
-libtoolize: `m4/ltsugar.m4' is already up to date.
-libtoolize: `m4/ltversion.m4' is already up to date.
-libtoolize: `m4/lt~obsolete.m4' is already up to date.
-]])
+AT_DATA(expout, [[]])
LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
-
AT_CLEANUP
## Next, a second update attempt with everything now updated. ##
## ---------------------------------------------------------- ##
-AT_DATA(expout,
-[[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
-libtoolize: `build-aux/config.guess' is already up to date.
-libtoolize: `build-aux/config.sub' is already up to date.
-libtoolize: `build-aux/install-sh' is already up to date.
-libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
-libtoolize: `m4/libtool.m4' is already up to date.
-libtoolize: `m4/ltsugar.m4' is already up to date.
-libtoolize: `m4/ltversion.m4' is already up to date.
-libtoolize: `m4/lt~obsolete.m4' is already up to date.
-]])
+AT_DATA(expout, [[]])
AT_DATA(experr,
[[libtoolize: `build-aux/ltmain.sh' is newer: use `--force' to overwrite
LT_AT_CHECK_LIBTOOLIZE([--copy --force --install], 0, expout)
-## --------------------------------------------------------- ##
-## A final update attempt with everything now force updated. ##
-## --------------------------------------------------------- ##
+## ---------------------------------------------------------------- ##
+## A final update attempt with everything previously force updated. ##
+## ---------------------------------------------------------------- ##
-AT_DATA(expout,
-[[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
-libtoolize: `build-aux/config.guess' is already up to date.
-libtoolize: `build-aux/config.sub' is already up to date.
-libtoolize: `build-aux/install-sh' is already up to date.
-libtoolize: `build-aux/ltmain.sh' is already up to date.
-libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
-libtoolize: `m4/libtool.m4' is already up to date.
-libtoolize: `m4/ltoptions.m4' is already up to date.
-libtoolize: `m4/ltsugar.m4' is already up to date.
-libtoolize: `m4/ltversion.m4' is already up to date.
-libtoolize: `m4/lt~obsolete.m4' is already up to date.
-]])
+AT_DATA(expout, [[]])
LT_AT_CHECK_LIBTOOLIZE([--copy --install], 0, expout)
AC_OUTPUT
]])
-[cat >expout <<EOF
-libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, \`build-aux'.
-libtoolize: copying file \`build-aux/ltmain.sh'
-libtoolize: You should add the contents of the following files to \`aclocal.m4':
-libtoolize: \`$tst_aclocaldir/libtool.m4'
-libtoolize: \`$tst_aclocaldir/ltoptions.m4'
-libtoolize: \`$tst_aclocaldir/ltversion.m4'
-libtoolize: \`$tst_aclocaldir/ltsugar.m4'
-libtoolize: \`$tst_aclocaldir/lt~obsolete.m4'
-EOF]
+AT_DATA([expout],
+[[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
+libtoolize: copying file `build-aux/ltmain.sh'
+libtoolize: You should add the contents of the following files to `aclocal.m4':
+libtoolize: `/usr/local/share/aclocal/libtool.m4'
+libtoolize: `/usr/local/share/aclocal/ltoptions.m4'
+libtoolize: `/usr/local/share/aclocal/ltversion.m4'
+libtoolize: `/usr/local/share/aclocal/ltsugar.m4'
+libtoolize: `/usr/local/share/aclocal/lt~obsolete.m4'
+]])
LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
]])
AT_DATA([expout],
-[[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
-libtoolize: `build-aux/ltmain.sh' is already up to date.
-libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
+[[libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
]])
AT_DATA([expout],
-[[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
-libtoolize: `build-aux/ltmain.sh' is already up to date.
-libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
+[[libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
-libtoolize: `m4/ltsugar.m4' is already up to date.
-libtoolize: `m4/ltversion.m4' is already up to date.
-libtoolize: `m4/lt~obsolete.m4' is already up to date.
]])
AT_DATA([experr],
AT_CLEANUP
+## ------------------------------------------------------------------ ##
+## Ensure libtoolize works when AC_CONFIG_MACRO_DIR is not specified. ##
+## ------------------------------------------------------------------ ##
+
+AT_SETUP([verbatim aclocal.m4 w/o AC_CONFIG_MACRO_DIR])
+
+AT_DATA([configure.ac],
+[[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
+LT_INIT
+AC_OUTPUT
+]])
+
+AT_DATA([aclocal.m4],
+[[# This should need upgrading:
+# serial 25 LT_INIT
+AC_DEFUN([LT_INIT],
+[blah])
+
+# This is newer than the upgrade version:
+# serial 99999 ltoptions.m4
+
+# This is older than the upgrade version:
+# serial 1 ltversion.m4
+]])
+
+AT_DATA([expout],
+[[libtoolize: putting auxiliary files in `.'.
+libtoolize: copying file `./ltmain.sh'
+libtoolize: You should add the contents of the following files to `aclocal.m4':
+libtoolize: `/usr/local/share/aclocal/libtool.m4'
+libtoolize: `/usr/local/share/aclocal/ltversion.m4'
+libtoolize: `/usr/local/share/aclocal/ltsugar.m4'
+libtoolize: `/usr/local/share/aclocal/lt~obsolete.m4'
+]])
+
+LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
+
+
+## ----------------------------------------------------------------------- ##
+## Upgrading an aclocal maintained aclocal.m4 without AC_CONFIG_MACRO_DIR. ##
+## ----------------------------------------------------------------------- ##
+
+rm -f aclocal.m4
+
+LT_AT_ACLOCAL()
+
+## The following code is adapted (and simplified) from libtoolize.m4sh
+####
+: ${GREP="grep"}
+: ${SED="sed"}
+
+basename="s,^.*/,,"
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+ $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+# func_serial filename [macro_regex]
+# Output the value of the serial number comment in FILENAME, where the
+# comment line must also match MACRO_REGEX, if given.
+func_serial ()
+{
+ my_filename="$1"
+ my_macro_regex="$2"
+ my_sed_serial='
+ /^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ {
+ s,^# serial \([1-9][0-9.]*\).*$,\1,
+ q
+ }
+ d'
+
+ # Search FILENAME and all the files it m4_includes for a serial number
+ # in the file that AC_DEFUNs MACRO_REGEX.
+ my_serial=
+ if test -z "$my_macro_regex" ||
+ test "$my_filename" = aclocal.m4 ||
+ test "$my_macro_regex" = `echo "$my_filename" | $SED "$basename"` ||
+ func_grep '^AC_DEFUN(\@<:@'"$my_macro_regex" "$my_filename"
+ then
+ my_serial=`$SED -e "$my_sed_serial" "$my_filename"`
+ fi
+
+ # If the file has no serial number, something is badly wrong!
+ test -n "$my_serial" || exit 1
+
+ echo $my_serial
+}
+
+# Make the serial number in aclocal.m4 higher than installed ltoptions.m4,
+# and the others match the macro files that libtoolize will compare against.
+libtool_serial=`func_serial "$tst_aclocaldir/libtool.m4" LT_INIT`
+ltversion_serial=`func_serial "$tst_aclocaldir/ltversion.m4" ltversion.m4`
+ltsugar_serial=`func_serial "$tst_aclocaldir/ltsugar.m4" ltsugar.m4`
+lt_obsolete_serial=`func_serial "$tst_aclocaldir/lt~obsolete.m4" lt~obsolete.m4`
+$SED -e 's,^#.*serial.*ltoptions.m4$,# serial 99999 ltoptions.m4,' \
+ -e "s,^#.*serial.*libtool.m4\$,# serial $libtool_serial libtool.m4," \
+ -e "s,^#.*serial.*ltversion.m4\$,# serial $ltversion_serial ltversion.m4," \
+ -e "s,^#.*serial.*ltsugar.m4\$,# serial $ltsugar_serial ltsugar.m4," \
+ -e "s,^#.*serial.*lt~obsolete.m4\$,# serial $lt_obsolete_serial lt~obsolete.m4," \
+ < aclocal.m4 > aclocal.m4t
+mv -f aclocal.m4t aclocal.m4
+
+LT_AT_CHECK_LIBTOOLIZE([--copy], 0)
+
+
+## --------------------- ##
+## Now, a forced update. ##
+## --------------------- ##
+
+AT_DATA(expout,
+[[libtoolize: putting auxiliary files in `.'.
+libtoolize: copying file `./ltmain.sh'
+]])
+
+LT_AT_CHECK_LIBTOOLIZE([--copy --force], 0, expout)
+
+AT_CLEANUP
+
+
## ------------------------------------------------------------- ##
## Check nonrecursive ltdl puts m4 files in AC_CONFIG_MACRO_DIR. ##
## ------------------------------------------------------------- ##