--with-obsolete Include obsolete modules when they occur among the
dependencies. By default, dependencies to obsolete
modules are ignored.
+ --with-c++-tests Include even unit tests for C++ interoperability.
+ --with-longrunning-tests
+ Include even unit tests that are long-runners.
+ --with-privileged-tests
+ Include even unit tests that require root
+ privileges.
+ --with-unportable-tests
+ Include even unit tests that fail on some platforms.
+ --with-all-tests Include all kinds of problematic unit tests.
--avoid=MODULE Avoid including the given MODULE. Useful if you
have code that provides equivalent functionality.
This option can be repeated.
'gl_INIT'. Default is 'gl'.
--po-domain=NAME Specify the prefix of the i18n domain. Usually use
the package name. A suffix '-gnulib' is appended.
- --with-c++-tests Include even unit tests for C++ interoperability.
- --with-longrunning-tests
- Include even unit tests that are long-runners.
- --with-privileged-tests
- Include even unit tests that require root
- privileges.
- --with-unportable-tests
- Include even unit tests that fail on some platforms.
- --with-all-tests Include all kinds of problematic unit tests.
--vc-files Update version control related files.
--no-vc-files Don't update version control related files
(.gitignore and/or .cvsignore).
--no-changelog Don't update or create ChangeLog files.
+Options for --create-[mega]testdir, --[mega]test:
+ --without-c++-tests Exclude unit tests for C++ interoperability.
+ --without-longrunning-tests
+ Exclude unit tests that are long-runners.
+ --without-privileged-tests
+ Exclude unit tests that require root privileges.
+ --without-unportable-tests
+ Exclude unit tests that fail on some platforms.
+
Options for --import, --update, --create-[mega]testdir, --[mega]test:
-s, --symbolic, --symlink Make symbolic links instead of copying files.
--local-symlink Make symbolic links instead of copying files, only
# - inc_unportable_tests true if --with-unportable-tests was given, blank
# otherwise
# - inc_all_tests true if --with-all-tests was given, blank otherwise
+# - excl_cxx_tests true if --without-c++-tests was given, blank otherwise
+# - excl_longrunning_tests true if --without-longrunning-tests was given,
+# blank otherwise
+# - excl_privileged_tests true if --without-privileged-tests was given, blank
+# otherwise
+# - excl_unportable_tests true if --without-unportable-tests was given, blank
+# otherwise
# - avoidlist list of modules to avoid, from --avoid
# - lgpl yes or a number if --lgpl was given, blank otherwise
# - makefile_name from --makefile-name
inc_privileged_tests=
inc_unportable_tests=
inc_all_tests=
+ excl_cxx_tests=
+ excl_longrunning_tests=
+ excl_privileged_tests=
+ excl_unportable_tests=
avoidlist=
lgpl=
makefile_name=
--with-all-tests | --with-all-test | --with-all-tes | --with-all-te | --with-all-t | --with-all- | --with-all | --with-al | --with-a)
inc_all_tests=true
shift ;;
+ --without-c++-tests | --without-c++-test | --without-c++-tes | --without-c++-te | --without-c++-t | --without-c++- | --without-c++ | --without-c+ | --without-c)
+ excl_cxx_tests=true
+ shift ;;
+ --without-longrunning-tests | --without-longrunning-test | --without-longrunning-tes | --without-longrunning-te | --without-longrunning-t | --without-longrunning- | --without-longrunning | --without-longrunnin | --without-longrunni | --without-longrunn | --without-longrun | --without-longru | --without-longr | --without-long | --without-lon | --without-lo | --without-l)
+ excl_longrunning_tests=true
+ shift ;;
+ --without-privileged-tests | --without-privileged-test | --without-privileged-tes | --without-privileged-te | --without-privileged-t | --without-privileged- | --without-privileged | --without-privilege | --without-privileg | --without-privile | --without-privil | --without-privi | --without-priv | --without-pri | --without-pr | --without-p)
+ excl_privileged_tests=true
+ shift ;;
+ --without-unportable-tests | --without-unportable-test | --without-unportable-tes | --without-unportable-te | --without-unportable-t | --without-unportable- | --without-unportable | --without-unportabl | --without-unportab | --without-unporta | --without-unport | --without-unpor | --without-unpo | --without-unp | --without-un | --without-u)
+ excl_unportable_tests=true
+ shift ;;
--avoid )
shift
if test $# = 0; then
esac
done
+ if test "$mode" = import; then
+ if test -n "$excl_cxx_tests" || test -n "$excl_longrunning_tests" \
+ || test -n "$excl_privileged_tests" || test -n "$excl_unportable_tests"; then
+ echo "gnulib-tool: invalid options for 'import' mode" 1>&2
+ echo "Try 'gnulib-tool --help' for more information." 1>&2
+ func_exit 1
+ fi
+ fi
if test "$mode" = update; then
if test $# != 0; then
echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
|| test -n "$inc_cxx_tests" || test -n "$inc_longrunning_tests" \
|| test -n "$inc_privileged_tests" || test -n "$inc_unportable_tests" \
|| test -n "$inc_all_tests" \
+ || test -n "$excl_cxx_tests" || test -n "$excl_longrunning_tests" \
+ || test -n "$excl_privileged_tests" || test -n "$excl_unportable_tests" \
|| test -n "$avoidlist" || test -n "$lgpl" || test -n "$makefile_name" \
|| test -n "$macro_prefix" || test -n "$po_domain" \
|| test -n "$vc_files"; then
if $modcache; then
# Note: The 'eval' silences stderr output in dash.
- if declare -A x 2>/dev/null && { x[f/2]='foo'; x[f/3]='bar'; eval test '${x[f/2]}' = foo; }; then
+ if (declare -A x && { x[f/2]='foo'; x[f/3]='bar'; eval test '${x[f/2]}' = foo; }) 2>/dev/null; then
# Zsh 4 and Bash 4 have associative arrays.
have_associative=true
else
# func_acceptable module
# tests whether a module is acceptable.
# Input:
-# - inc_cxx_tests true if C++ interoperability tests should be included,
-# blank otherwise
-# - inc_longrunning_tests true if long-runnings tests should be included,
-# blank otherwise
-# - inc_privileged_tests true if tests that require root privileges should be
-# included, blank otherwise
-# - inc_unportable_tests true if tests that fail on some platforms should be
-# included, blank otherwise
-# - inc_all_tests true if all kinds of problematic unit tests should be
-# included, blank otherwise
# - avoidlist list of modules to avoid
func_acceptable ()
{
return 1
fi
done
- case "$1" in
- *-tests)
- inc=true
- for word in `func_get_status "$1"`; do
- case "$word" in
- c++-test)
- test -n "$inc_all_tests" || test -n "$inc_cxx_tests" \
- || inc=false
- ;;
- longrunning-test)
- test -n "$inc_all_tests" || test -n "$inc_longrunning_tests" \
- || inc=false
- ;;
- privileged-test)
- test -n "$inc_all_tests" || test -n "$inc_privileged_tests" \
- || inc=false
- ;;
- unportable-test)
- test -n "$inc_all_tests" || test -n "$inc_unportable_tests" \
- || inc=false
- ;;
- *-test)
- test -n "$inc_all_tests" \
- || inc=false
- ;;
- esac
- done
- if ! $inc; then
- return 1
- fi
- ;;
- esac
return 0
}
# included, blank otherwise
# - inc_unportable_tests true if tests that fail on some platforms should be
# included, blank otherwise
-# - inc_all_tests true if all kinds of problematic unit tests should be
-# included, blank otherwise
+# - inc_all_direct_tests true if all kinds of problematic unit tests among
+# the unit tests of the specified modules should be
+# included, blank otherwise
+# - inc_all_indirect_tests true if all kinds of problematic unit tests among
+# the unit tests of the dependencies should be
+# included, blank otherwise
+# - excl_cxx_tests true if C++ interoperability tests should be excluded,
+# blank otherwise
+# - excl_longrunning_tests true if long-runnings tests should be excluded,
+# blank otherwise
+# - excl_privileged_tests true if tests that require root privileges should be
+# excluded, blank otherwise
+# - excl_unportable_tests true if tests that fail on some platforms should be
+# excluded, blank otherwise
# - avoidlist list of modules to avoid
# - tmp pathname of a temporary directory
# Output:
handledmodules=
inmodules="$modules"
outmodules=
+ fmtc_inc_all_tests="$inc_all_direct_tests"
while test -n "$inmodules"; do
inmodules_this_round="$inmodules"
inmodules= # Accumulator, queue for next round
if test -n "$duplicated_deps"; then
func_warning "module $module has duplicated dependencies: "`echo $duplicated_deps`
fi
- for dep in $deps; do
- if test -n "$incobsolete" \
- || { inc=true
- for word in `func_get_status $dep`; do
- case "$word" in
- obsolete)
- inc=false
- ;;
- esac
- done
- $inc
- }; then
- func_append inmodules " $dep"
- fi
- done
if test -n "$inctests"; then
testsmodule=`func_get_tests_module $module`
if test -n "$testsmodule"; then
- func_append inmodules " $testsmodule"
+ deps="$deps $testsmodule"
fi
fi
+ for dep in $deps; do
+ # Determine whether to include the dependency or tests module.
+ inc=true
+ for word in `func_get_status $dep`; do
+ case "$word" in
+ obsolete)
+ test -n "$incobsolete" \
+ || inc=false
+ ;;
+ c++-test)
+ test -z "$excl_cxx_tests" \
+ || inc=false
+ test -n "$fmtc_inc_all_tests" || test -n "$inc_cxx_tests" \
+ || inc=false
+ ;;
+ longrunning-test)
+ test -z "$excl_longrunning_tests" \
+ || inc=false
+ test -n "$fmtc_inc_all_tests" || test -n "$inc_longrunning_tests" \
+ || inc=false
+ ;;
+ privileged-test)
+ test -z "$excl_privileged_tests" \
+ || inc=false
+ test -n "$fmtc_inc_all_tests" || test -n "$inc_privileged_tests" \
+ || inc=false
+ ;;
+ unportable-test)
+ test -z "$excl_unportable_tests" \
+ || inc=false
+ test -n "$fmtc_inc_all_tests" || test -n "$inc_unportable_tests" \
+ || inc=false
+ ;;
+ *-test)
+ test -n "$fmtc_inc_all_tests" \
+ || inc=false
+ ;;
+ esac
+ done
+ if $inc; then
+ func_append inmodules " $dep"
+ fi
+ done
fi
fi
done
# Remove $handledmodules from $inmodules.
for m in $inmodules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/queued-modules
inmodules=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
+ fmtc_inc_all_tests="$inc_all_indirect_tests"
done
modules=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
rm -f "$tmp"/queued-modules
done
if test -z "$makefile_name"; then
echo
- echo "AM_CPPFLAGS ="
+ if $for_test; then
+ echo "AM_CPPFLAGS = -DGNULIB_STRICT_CHECKING=1"
+ else
+ echo "AM_CPPFLAGS ="
+ fi
echo "AM_CFLAGS ="
fi
echo
} > "$tmp"/amsnippet
# Skip the contents if it's entirely empty.
if grep '[^ ]' "$tmp"/amsnippet > /dev/null ; then
- echo "## begin gnulib module $module"
- echo
- cat "$tmp"/amsnippet
- echo "## end gnulib module $module"
- echo
+ # Mention long-running tests at the end.
+ ofd=3
+ for word in `func_get_status "$module"`; do
+ if test "$word" = 'longrunning-test'; then
+ ofd=4
+ break
+ fi
+ done
+ { echo "## begin gnulib module $module"
+ echo
+ cat "$tmp"/amsnippet
+ echo "## end gnulib module $module"
+ echo
+ } >&$ofd
fi
rm -f "$tmp"/amsnippet
# Test whether there are some source files in subdirectories.
done
fi
done
- } > "$tmp"/allsnippets
+ } 3> "$tmp"/main_snippets 4> "$tmp"/longrunning_snippets
# Generate dependencies here, since it eases the debugging of test failures.
# If there are source files in subdirectories, prevent collision of the
# object files (example: hash.c and libxml/hash.c).
# Nothing is being added to SUBDIRS; nevertheless the existence of this
# variable is needed to avoid an error from automake:
# "AM_GNU_GETTEXT used but SUBDIRS not defined"
- echo "SUBDIRS ="
+ echo "SUBDIRS = ."
echo "TESTS ="
echo "XFAIL_TESTS ="
echo "TESTS_ENVIRONMENT ="
fi
# Automake versions < 1.9b create an empty pkgdatadir at installation time
# if you specify pkgdata_DATA to empty. This is a workaround.
- if grep '^pkgdata_DATA *+=' "$tmp"/allsnippets > /dev/null; then
+ if grep '^pkgdata_DATA *+=' "$tmp"/main_snippets "$tmp"/longrunning_snippets > /dev/null; then
echo "pkgdata_DATA ="
fi
echo "EXTRA_DIST ="
done
echo
echo "AM_CPPFLAGS = \\"
+ if $for_test; then
+ echo " -DGNULIB_STRICT_CHECKING=1 \\"
+ fi
if test -n "${witness_macro}"; then
echo " -D@${witness_macro}@=1 \\"
fi
# srcdir is defined by autoconf and automake.
echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
echo
- cat "$tmp"/allsnippets \
+ cat "$tmp"/main_snippets "$tmp"/longrunning_snippets \
| sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
echo "# Clean up after Solaris cc."
echo "clean-local:"
echo " fi; \\"
echo " done; \\"
echo " :"
- rm -f "$tmp"/allsnippets
+ rm -f "$tmp"/main_snippets "$tmp"/longrunning_snippets
}
# func_emit_initmacro_start macro_prefix
if test -z "$inc_all_tests"; then
inc_all_tests="$cached_inc_all_tests"
fi
+ # --without-*-tests options are not supported here.
+ excl_cxx_tests=
+ excl_longrunning_tests=
+ excl_privileged_tests=
+ excl_unportable_tests=
# Append the cached and the specified avoidlist. This is probably better
# than dropping the cached one when --avoid is specified at least once.
avoidlist=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
# Canonicalize the list of specified modules.
specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
+ # Include all kinds of tests modules if --with-all-tests was specified.
+ inc_all_direct_tests="$inc_all_tests"
+ inc_all_indirect_tests="$inc_all_tests"
+
# Determine final module list.
modules="$specified_modules"
func_modules_transitive_closure
else
sed_replace_build_aux="$sed_noop"
fi
+ echo " gl_m4_base='$m4base'"
func_emit_initmacro_start $macro_prefix
echo " gl_source_base='$sourcebase'"
for module in $main_modules; do
# Define a tests witness macro that depends on the package.
# PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by AC_INIT.
# See <http://lists.gnu.org/archive/html/automake/2009-05/msg00145.html>.
- echo " ${macro_prefix}tests_WITNESS=IN_\`echo \"\${PACKAGE-\$PACKAGE_TARNAME}\" | LC_ALL=C tr 'a-z' 'A-Z' | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'\`_GNULIB_TESTS"
+ echo "changequote(,)dnl"
+ echo " ${macro_prefix}tests_WITNESS=IN_\`echo \"\${PACKAGE-\$PACKAGE_TARNAME}\" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'\`_GNULIB_TESTS"
+ echo "changequote([, ])dnl"
echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
# - inctests true if tests should be included, blank otherwise
# - incobsolete true if obsolete modules among dependencies should be
# included, blank otherwise
+# - excl_cxx_tests true if C++ interoperability tests should be excluded,
+# blank otherwise
+# - excl_longrunning_tests true if long-runnings tests should be excluded,
+# blank otherwise
+# - excl_privileged_tests true if tests that require root privileges should be
+# excluded, blank otherwise
+# - excl_unportable_tests true if tests that fail on some platforms should be
+# excluded, blank otherwise
# - avoidlist list of modules to avoid
# - libtool true if --libtool was given, false if --no-libtool was
# given, blank otherwise
fi
modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u`
- # Unlike in func_import, here we want to include all kinds of tests.
- inc_all_tests=true
+ # Unlike in func_import, here we want to include all kinds of tests for the
+ # directly specified modules, but not for dependencies.
+ inc_all_direct_tests=true
+ inc_all_indirect_tests="$inc_all_tests"
# Check that the license of every module is consistent with the license of
# its dependencies.
s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
ba
}'
+ echo "gl_m4_base='../$m4base'"
func_emit_initmacro_start $macro_prefix
# We don't have explicit ordering constraints between the various
# autoconf snippets. It's cleanest to put those of the library before
else
sed_replace_build_aux="$sed_noop"
fi
+ echo "gl_m4_base='$m4base'"
func_emit_initmacro_start $macro_prefix
echo "gl_source_base='$sourcebase'"
for module in $modules; do
fi
# Need to run configure and make once, to create built files that are to be
# distributed (such as getdate.c).
+ sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
# Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
| sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
cleaned_files=`for file in $cleaned_files; do echo " $file "; done`
# Extract the value of "BUILT_SOURCES += ...". Remove variable references
# such $(FOO_H) because they don't refer to distributed files.
- sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
built_sources=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
| sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
| sed -e "$sed_remove_make_variables"`
*) echo $file ;;
esac;
done`
- if test -n "$distributed_built_sources"; then
+ tests_distributed_built_sources=
+ if test -n "$inctests"; then
+ # Likewise for built files in the $testsbase directory.
+ tests_cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$testsbase/Makefile.am" \
+ | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
+ tests_cleaned_files=`for file in $tests_cleaned_files; do echo " $file "; done`
+ tests_built_sources=`sed -e "$sed_remove_backslash_newline" < "$testdir/$testsbase/Makefile.am" \
+ | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
+ | sed -e "$sed_remove_make_variables"`
+ tests_distributed_built_sources=`for file in $tests_built_sources; do
+ case "$tests_cleaned_files" in
+ *" "$file" "*) ;;
+ *) echo $file ;;
+ esac;
+ done`
+ fi
+ if test -n "$distributed_built_sources" || test -n "$tests_distributed_built_sources"; then
(cd "$testdir"
./configure || func_exit 1
- cd "$sourcebase"
- echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
- $MAKE built_sources || func_exit 1
- cd ..
- $MAKE distclean || func_exit 1
+ if test -n "$distributed_built_sources"; then
+ cd "$sourcebase"
+ echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
+ $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
+ built_sources \
+ || func_exit 1
+ cd ..
+ fi
+ if test -n "$tests_distributed_built_sources"; then
+ cd "$testsbase"
+ echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
+ $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
+ built_sources \
+ || func_exit 1
+ cd ..
+ fi
+ $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
+ distclean \
+ || func_exit 1
) || func_exit 1
fi
}