+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_description[$1]+set}"; then
+ echo "${modcache_description[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_description_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_description\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+}
+
+# func_get_comment module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_comment ()
+{
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^Comment$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_comment[$1]+set}"; then
+ echo "${modcache_comment[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_comment_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_comment\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+}
+
+# func_get_status module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_status ()
+{
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^Status$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_status[$1]+set}"; then
+ echo "${modcache_status[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_status_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_status\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+}
+
+# func_get_notice module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_notice ()
+{
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_notice[$1]+set}"; then
+ echo "${modcache_notice[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_notice_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_notice\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+}
+
+# func_get_applicability module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# The expected result (on stdout) is either 'main', or 'tests', or 'all'.
+func_get_applicability ()
+{
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ my_applicability=`sed -n -e "/^Applicability$sed_extract_prog" < "$lookedup_file"`
+ else
+ func_cache_lookup_module "$1"
+ # Get the field's value, without the final newline.
+ if $have_associative; then
+ my_applicability="${modcache_applicability[$1]}"
+ else
+ eval "my_applicability=\"\$${cachevar}_applicability\""
+ fi
+ fi
+ if test -n "$my_applicability"; then
+ echo $my_applicability
+ else
+ # The default is 'main' or 'tests', depending on the module's name.
+ case $1 in
+ *-tests) echo "tests";;
+ *) echo "main";;
+ esac
+ fi
+}
+
+# func_get_filelist module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_filelist ()
+{
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_files[$1]+set}"; then
+ echo "${modcache_files[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_files_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_files\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+ echo m4/00gnulib.m4
+ echo m4/gnulib-common.m4
+ case "$autoconf_minversion" in
+ 2.59)
+ echo m4/onceonly.m4
+ ;;
+ esac
+}
+
+# func_filter_filelist outputvar separator filelist prefix suffix removed_prefix removed_suffix [added_prefix [added_suffix]]
+# stores in outputvar the filtered and processed filelist. Filtering: Only the
+# elements starting with prefix and ending with suffix are considered.
+# Processing: removed_prefix and removed_suffix are removed from each element,
+# added_prefix and added_suffix are added to each element.
+# prefix, suffix should not contain shell-special characters.
+# removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
+# added_prefix, added_suffix should not contain the characters \|&.
+func_filter_filelist ()
+{
+ if test "$2" != "$nl" \
+ || { $fast_func_append \
+ && { test -z "$6" || $fast_func_remove_prefix; } \
+ && { test -z "$7" || $fast_func_remove_suffix; }; \
+ }; then
+ ffflist=
+ for fff in $3; do
+ # Do not quote possibly-empty parameters in case patterns,
+ # AIX and HP-UX ksh won't match them if they are empty.
+ case "$fff" in
+ $4*$5)
+ if test -n "$6"; then
+ func_remove_prefix fff "$6"
+ fi
+ if test -n "$7"; then
+ func_remove_suffix fff "$7"
+ fi
+ fff="$8${fff}$9"
+ if test -z "$ffflist"; then
+ ffflist="${fff}"
+ else
+ func_append ffflist "$2${fff}"
+ fi
+ ;;
+ esac
+ done
+ else
+ sed_fff_filter="s|^$6\(.*\)$7\$|$8\\1$9|"
+ ffflist=`for fff in $3; do
+ case "$fff" in
+ $4*$5) echo "$fff" ;;
+ esac
+ done | sed -e "$sed_fff_filter"`
+ fi
+ eval "$1=\"\$ffflist\""
+}
+
+# func_get_dependencies module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_dependencies ()
+{
+ # ${module}-tests implicitly depends on ${module}, if that module exists.
+ case "$1" in
+ *-tests)
+ fgd1="$1"
+ func_remove_suffix fgd1 '-tests'
+ if func_exists_module "$fgd1"; then
+ echo "$fgd1"
+ fi
+ ;;
+ esac
+ # Then the explicit dependencies listed in the module description.
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_dependson[$1]+set}"; then
+ echo "${modcache_dependson[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_dependson_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_dependson\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+}
+
+# func_get_autoconf_early_snippet module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_autoconf_early_snippet ()
+{
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^configure\.ac-early$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_configureac_early[$1]+set}"; then
+ echo "${modcache_configureac_early[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_configureac_early_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_configureac_early\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+}
+
+# func_get_autoconf_snippet module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_autoconf_snippet ()
+{
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_configureac[$1]+set}"; then
+ echo "${modcache_configureac[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_configureac_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_configureac\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+}
+
+# func_get_automake_snippet module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_automake_snippet ()
+{
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_makefile[$1]+set}"; then
+ echo "${modcache_makefile[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_makefile_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_makefile\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+ case "$1" in
+ *-tests)
+ # *-tests module live in tests/, not lib/.
+ # Synthesize an EXTRA_DIST augmentation.
+ all_files=`func_get_filelist $1`
+ func_filter_filelist tests_files " " "$all_files" 'tests/' '' 'tests/' ''
+ extra_files="$tests_files"
+ if test -n "$extra_files"; then
+ echo "EXTRA_DIST +=" $extra_files
+ echo
+ fi
+ ;;
+ *)
+ # Synthesize an EXTRA_DIST augmentation.
+ sed_combine_lines='/\\$/{
+ :a
+ N
+ s/\\\n/ /
+ s/\\$/\\/
+ ta
+ }'
+ sed_extract_mentioned_files='s/^lib_SOURCES[ ]*+=[ ]*//p'
+ already_mentioned_files=` \
+ { if ! $modcache; then
+ sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
+ else
+ if $have_associative; then
+ if test -n "${modcache_makefile[$1]+set}"; then
+ echo "${modcache_makefile[$1]}"
+ fi
+ else
+ eval 'field_set="$'"${cachevar}"'_makefile_set"'
+ if test -n "$field_set"; then
+ eval 'field_value="$'"${cachevar}"'_makefile"'
+ echo "${field_value}"
+ fi
+ fi
+ fi
+ } \
+ | sed -e "$sed_combine_lines" \
+ | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
+ all_files=`func_get_filelist $1`
+ func_filter_filelist lib_files "$nl" "$all_files" 'lib/' '' 'lib/' ''
+ # Remove $already_mentioned_files from $lib_files.
+ echo "$lib_files" | LC_ALL=C sort -u > "$tmp"/lib-files
+ extra_files=`for f in $already_mentioned_files; do echo $f; done \
+ | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
+ if test -n "$extra_files"; then
+ echo "EXTRA_DIST +=" $extra_files
+ echo
+ fi
+ # Synthesize also an EXTRA_lib_SOURCES augmentation.
+ # This is necessary so that automake can generate the right list of
+ # dependency rules.
+ # A possible approach would be to use autom4te --trace of the redefined
+ # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
+ # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
+ # inside autoconf's built-in macros are not missed).
+ # But it's simpler and more robust to do it here, based on the file list.
+ # If some .c file exists and is not used with AC_LIBOBJ - for example,
+ # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
+ # automake will generate a useless dependency; this is harmless.
+ case "$1" in
+ relocatable-prog-wrapper) ;;
+ *)
+ func_filter_filelist extra_files "$nl" "$extra_files" '' '.c' '' ''
+ if test -n "$extra_files"; then
+ echo "EXTRA_lib_SOURCES +=" $extra_files
+ echo
+ fi
+ ;;
+ esac
+ # Synthesize an EXTRA_DIST augmentation also for the files in build-aux/.
+ func_filter_filelist buildaux_files "$nl" "$all_files" 'build-aux/' '' 'build-aux/' ''
+ if test -n "$buildaux_files"; then
+ sed_prepend_auxdir='s,^,$(top_srcdir)/'"$auxdir"'/,'
+ echo "EXTRA_DIST += "`echo "$buildaux_files" | sed -e "$sed_prepend_auxdir"`
+ echo
+ fi
+ # Synthesize an EXTRA_DIST augmentation also for the files from top/.
+ func_filter_filelist top_files "$nl" "$all_files" 'top/' '' 'top/' ''
+ if test -n "$top_files"; then
+ sed_prepend_topdir='s,^,$(top_srcdir)/,'
+ echo "EXTRA_DIST += "`echo "$top_files" | sed -e "$sed_prepend_topdir"`
+ echo
+ fi
+ ;;
+ esac
+}
+
+# func_get_include_directive module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_include_directive ()
+{
+ {
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_include[$1]+set}"; then
+ echo "${modcache_include[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_include_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_include\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+ } | sed -e 's/^\(["<]\)/#include \1/'
+}
+
+# func_get_link_directive module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_link_directive ()
+{
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_link[$1]+set}"; then
+ echo "${modcache_link[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_link_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_link\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+}
+
+# func_get_license module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_license ()
+{
+ {
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_license[$1]+set}"; then
+ echo "${modcache_license[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_license_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_license\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+ # The default is GPL.
+ echo "GPL"
+ } | sed -e 's,^ *$,,' | sed -e 1q
+}
+
+# func_get_maintainer module
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+func_get_maintainer ()
+{
+ if ! $modcache; then
+ func_lookup_file "modules/$1"
+ sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
+ else
+ func_cache_lookup_module "$1"
+ # Output the field's value, including the final newline (if any).
+ if $have_associative; then
+ if test -n "${modcache_maintainer[$1]+set}"; then
+ echo "${modcache_maintainer[$1]}"
+ fi
+ else
+ eval "field_set=\"\$${cachevar}_maintainer_set\""
+ if test -n "$field_set"; then
+ eval "field_value=\"\$${cachevar}_maintainer\""
+ echo "${field_value}"
+ fi
+ fi
+ fi
+}
+
+# func_get_tests_module module
+# Input:
+# - local_gnulib_dir from --local-dir
+func_get_tests_module ()
+{
+ # The naming convention for tests modules is hardwired: ${module}-tests.
+ if test -f "$gnulib_dir/modules/$1"-tests \
+ || { test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
+ && test -f "$local_gnulib_dir/modules/$1"-tests; }; then
+ echo "$1"-tests
+ fi
+}
+
+# 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 ()
+{
+ for avoid in $avoidlist; do
+ if test "$avoid" = "$1"; then
+ 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
+}
+
+# func_modules_transitive_closure
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# - modules list of specified modules
+# - inctests true if tests should be included, blank otherwise
+# - incobsolete true if obsolete modules among dependencies should be
+# included, blank otherwise
+# - 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
+# - tmp pathname of a temporary directory
+# Output:
+# - modules list of modules, including dependencies
+func_modules_transitive_closure ()
+{
+ # In order to process every module only once (for speed), process an "input
+ # list" of modules, producing an "output list" of modules. During each round,
+ # more modules can be queued in the input list. Once a module on the input
+ # list has been processed, it is added to the "handled list", so we can avoid
+ # to process it again.
+ handledmodules=
+ inmodules="$modules"
+ outmodules=
+ while test -n "$inmodules"; do
+ inmodules_this_round="$inmodules"
+ inmodules= # Accumulator, queue for next round
+ for module in $inmodules_this_round; do
+ func_verify_module
+ if test -n "$module"; then
+ if func_acceptable $module; then
+ func_append outmodules " $module"
+ deps=`func_get_dependencies $module`
+ # Duplicate dependencies are harmless, but Jim wants a warning.
+ duplicated_deps=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
+ 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"
+ fi
+ fi
+ fi
+ fi
+ done
+ handledmodules=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
+ # 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`
+ done
+ modules=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
+ rm -f "$tmp"/queued-modules
+}
+
+# func_modules_add_dummy
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# - modules list of modules, including dependencies
+# Output:
+# - modules list of modules, including 'dummy' if needed
+func_modules_add_dummy ()
+{
+ # Determine whether any module provides a lib_SOURCES augmentation.
+ have_lib_SOURCES=
+ sed_remove_backslash_newline=':a
+/\\$/{
+s/\\$//
+N
+s/\n//
+ba
+}'
+ for module in $modules; do
+ func_verify_nontests_module
+ if test -n "$module"; then
+ # Extract the value of "lib_SOURCES += ...".
+ for file in `func_get_automake_snippet "$module" | sed -e "$sed_remove_backslash_newline" | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
+ # Ignore .h files since they are not compiled.
+ case "$file" in
+ *.h) ;;
+ *)
+ have_lib_SOURCES=yes
+ break 2
+ ;;
+ esac
+ done
+ fi
+ done
+ # Add the dummy module, to make sure the library will be non-empty.
+ if test -z "$have_lib_SOURCES"; then
+ if func_acceptable "dummy"; then
+ func_append modules " dummy"
+ fi
+ fi
+}
+
+# func_modules_notice
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# - verbose integer, default 0, inc/decremented by --verbose/--quiet
+# - modules list of modules, including dependencies
+func_modules_notice ()
+{
+ if test $verbose -ge -1; then
+ for module in $modules; do
+ func_verify_module
+ if test -n "$module"; then
+ msg=`func_get_notice $module`
+ if test -n "$msg"; then
+ echo "Notice from module $module:"
+ echo "$msg" | sed -e 's/^/ /'
+ fi
+ fi
+ done
+ fi
+}
+
+# func_modules_to_filelist
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# - modules list of modules, including dependencies
+# Output:
+# - files list of files
+func_modules_to_filelist ()
+{
+ files=
+ for module in $modules; do
+ func_verify_module
+ if test -n "$module"; then
+ fs=`func_get_filelist $module`
+ func_append files " $fs"
+ fi
+ done
+ files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
+}
+
+# func_execute_command command [args...]
+# Executes a command.
+# Uses also the variables
+# - verbose integer, default 0, inc/decremented by --verbose/--quiet
+func_execute_command ()
+{
+ if test $verbose -ge 0; then
+ echo "executing $*"
+ "$@"
+ else
+ # Commands like automake produce output to stderr even when they succeed.
+ # Turn this output off if the command succeeds.
+ "$@" > "$tmp"/cmdout 2>&1
+ cmdret=$?
+ if test $cmdret = 0; then
+ rm -f "$tmp"/cmdout
+ else
+ echo "executing $*"
+ cat "$tmp"/cmdout 1>&2
+ rm -f "$tmp"/cmdout
+ (exit $cmdret)
+ fi
+ fi
+}
+
+# func_dest_tmpfilename file
+# determines the name of a temporary file (file is relative to destdir).
+# Input:
+# - destdir target directory
+# - doit : if actions shall be executed, false if only to be printed
+# - tmp pathname of a temporary directory
+# Sets variable:
+# - tmpfile absolute filename of the temporary file
+func_dest_tmpfilename ()
+{
+ if $doit; then
+ # Put the new contents of $file in a file in the same directory (needed
+ # to guarantee that an 'mv' to "$destdir/$file" works).
+ tmpfile="$destdir/$1.tmp"
+ else
+ # Put the new contents of $file in a file in a temporary directory
+ # (because the directory of "$file" might not exist).
+ tmpfile="$tmp"/`basename "$1"`.tmp
+ fi
+}
+
+# func_add_file
+# copies a file from gnulib into the destination directory. The destination
+# is known to not exist.
+# Input:
+# - destdir target directory
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# - f the original file name
+# - lookedup_file name of the merged (combined) file
+# - lookedup_tmp true if it is located in the tmp directory, blank otherwise
+# - g the rewritten file name
+# - tmpfile absolute filename of the temporary file
+# - doit : if actions shall be executed, false if only to be printed
+# - symbolic true if files should be symlinked, copied otherwise
+# - lsymbolic true if files from local_gnulib_dir should be symlinked,
+# copied otherwise
+func_add_file ()
+{
+ if $doit; then
+ echo "Copying file $g"
+ if { test -n "$symbolic" \
+ || { test -n "$lsymbolic" \
+ && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
+ && test -z "$lookedup_tmp" \
+ && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
+ func_ln_if_changed "$lookedup_file" "$destdir/$g"
+ else
+ mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
+ fi
+ else
+ echo "Copy file $g"
+ fi
+}
+
+# func_update_file
+# copies a file from gnulib into the destination directory. The destination
+# is known to exist.
+# Input:
+# - destdir target directory
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# - f the original file name
+# - lookedup_file name of the merged (combined) file
+# - lookedup_tmp true if it is located in the tmp directory, blank otherwise
+# - g the rewritten file name
+# - tmpfile absolute filename of the temporary file
+# - doit : if actions shall be executed, false if only to be printed
+# - symbolic true if files should be symlinked, copied otherwise
+# - lsymbolic true if files from local_gnulib_dir should be symlinked,
+# copied otherwise
+# - already_present nonempty if the file should already exist, empty otherwise
+func_update_file ()
+{
+ if cmp "$destdir/$g" "$tmpfile" > /dev/null; then
+ : # The file has not changed.
+ else
+ # Replace the file.
+ if $doit; then
+ if test -n "$already_present"; then
+ echo "Updating file $g (backup in ${g}~)"
+ else
+ echo "Replacing file $g (non-gnulib code backed up in ${g}~) !!"
+ fi
+ mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
+ if { test -n "$symbolic" \
+ || { test -n "$lsymbolic" \
+ && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
+ && test -z "$lookedup_tmp" \
+ && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
+ func_ln_if_changed "$lookedup_file" "$destdir/$g"
+ else
+ mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
+ fi
+ else
+ if test -n "$already_present"; then
+ echo "Update file $g (backup in ${g}~)"
+ else
+ echo "Replace file $g (non-gnulib code backed up in ${g}~) !!"
+ fi
+ fi
+ fi
+}
+
+# func_emit_lib_Makefile_am
+# emits the contents of library makefile to standard output.
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# - modules list of modules, including dependencies
+# - libname library name
+# - pobase directory relative to destdir where to place *.po files
+# - auxdir directory relative to destdir where to place build aux files
+# - makefile_name from --makefile-name
+# - libtool true if libtool will be used, false or blank otherwise
+# - macro_prefix prefix of gl_LIBOBJS macros to use
+# - po_domain prefix of i18n domain to use (without -gnulib suffix)
+# - actioncmd (optional) command that will reproduce this invocation
+# - for_test true if creating a package for testing, false otherwise
+# - destfile filename relative to destdir of makefile being generated
+# Input/Output:
+# - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
+# list of edits to be done to Makefile.am variables
+# Output:
+# - uses_subdirs nonempty if object files in subdirs exist
+func_emit_lib_Makefile_am ()
+{
+ # When creating an includable Makefile.am snippet, augment variables with
+ # += instead of assigning them.
+ if test -n "$makefile_name"; then
+ assign='+='
+ else
+ assign='='
+ fi
+ if test "$libtool" = true; then
+ libext=la
+ perhapsLT=LT
+ sed_eliminate_LDFLAGS="$sed_noop"
+ else
+ libext=a
+ perhapsLT=
+ sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
+ fi
+ if $for_test; then
+ # When creating a package for testing: Attempt to provoke failures,
+ # especially link errors, already during "make" rather than during
+ # "make check", because "make check" is not possible in a cross-compiling
+ # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
+ sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
+ else
+ sed_transform_check_PROGRAMS="$sed_noop"
+ fi
+ echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
+ echo "## Process this file with automake to produce Makefile.in."
+ func_emit_copyright_notice
+ if test -n "$actioncmd"; then
+ # The maximum line length (excluding the terminating newline) of any file
+ # that is to be preprocessed by config.status is 3070. config.status uses
+ # awk, and the HP-UX 11.00 awk fails if a line has length >= 3071;
+ # similarly, the IRIX 6.5 awk fails if a line has length >= 3072.
+ len=`echo "$actioncmd" | wc -c`
+ if test -n "$len" && test "$len" -le 3000; then
+ echo "# Reproduce by: $actioncmd"
+ fi
+ fi
+ echo
+ uses_subdirs=
+ {
+ for module in $modules; do
+ func_verify_nontests_module
+ if test -n "$module"; then
+ {
+ func_get_automake_snippet "$module" |
+ LC_ALL=C \
+ sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
+ -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
+ -e "$sed_eliminate_LDFLAGS" \
+ -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' \
+ -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
+ -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
+ -e "$sed_transform_check_PROGRAMS"
+ if test "$module" = 'alloca'; then
+ echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
+ echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
+ fi
+ } > "$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
+ fi
+ rm -f "$tmp"/amsnippet
+ # Test whether there are some source files in subdirectories.
+ for f in `func_get_filelist "$module"`; do
+ case $f in
+ lib/*/*.c)
+ uses_subdirs=yes
+ break
+ ;;
+ esac
+ done
+ fi
+ done
+ } > "$tmp"/allsnippets
+ if test -z "$makefile_name"; then
+ # If there are source files in subdirectories, prevent collision of the
+ # object files (example: hash.c and libxml/hash.c).
+ subdir_options=
+ if test -n "$uses_subdirs"; then
+ subdir_options=' subdir-objects'
+ fi
+ echo "AUTOMAKE_OPTIONS = 1.5 gnits${subdir_options}"
+ fi
+ echo
+ if test -z "$makefile_name"; then
+ echo "SUBDIRS ="
+ echo "noinst_HEADERS ="
+ echo "noinst_LIBRARIES ="
+ echo "noinst_LTLIBRARIES ="
+ # 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
+ echo "pkgdata_DATA ="
+ fi
+ echo "EXTRA_DIST ="
+ echo "BUILT_SOURCES ="
+ echo "SUFFIXES ="
+ fi
+ echo "MOSTLYCLEANFILES $assign core *.stackdump"
+ if test -z "$makefile_name"; then
+ echo "MOSTLYCLEANDIRS ="
+ echo "CLEANFILES ="
+ echo "DISTCLEANFILES ="
+ echo "MAINTAINERCLEANFILES ="
+ fi
+ # Execute edits that apply to the Makefile.am being generated.
+ edit=0
+ while test $edit != $makefile_am_edits; do
+ edit=`expr $edit + 1`
+ eval dir=\"\$makefile_am_edit${edit}_dir\"
+ eval var=\"\$makefile_am_edit${edit}_var\"
+ eval val=\"\$makefile_am_edit${edit}_val\"
+ if test -n "$var"; then
+ if test "${dir}Makefile.am" = "$destfile" || test "./${dir}Makefile.am" = "$destfile"; then
+ echo "${var} += ${val}"
+ eval "makefile_am_edit${edit}_var="
+ fi
+ fi
+ done
+ if test -z "$makefile_name"; then
+ echo
+ echo "AM_CPPFLAGS ="
+ echo "AM_CFLAGS ="
+ fi
+ echo
+ if LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$tmp"/allsnippets > /dev/null \
+ || { test -n "$makefile_name" \
+ && test -f "$sourcebase/Makefile.am" \
+ && LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev/null; \
+ }; then
+ # One of the snippets or the user's Makefile.am already specifies an
+ # installation location for the library. Don't confuse automake by saying
+ # it should not be installed.
+ :
+ else
+ # By default, the generated library should not be installed.
+ echo "noinst_${perhapsLT}LIBRARIES += $libname.$libext"
+ fi
+ echo
+ echo "${libname}_${libext}_SOURCES ="
+ # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
+ # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
+ echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
+ echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
+ echo "EXTRA_${libname}_${libext}_SOURCES ="
+ if test "$libtool" = true; then
+ echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
+ fi
+ echo
+ if test -n "$pobase"; then
+ echo "AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\\\"${po_domain}-gnulib\\\""
+ echo
+ fi
+ cat "$tmp"/allsnippets \
+ | sed -e 's|\$(top_srcdir)/build-aux/|$(top_srcdir)/'"$auxdir"'/|g'
+ echo
+ echo "mostlyclean-local: mostlyclean-generic"
+ echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
+ echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
+ echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
+ echo " fi; \\"
+ echo " done; \\"
+ echo " :"
+ rm -f "$tmp"/allsnippets
+}
+
+# func_emit_po_Makevars
+# emits the contents of po/ makefile parameterization to standard output.
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# - sourcebase directory relative to destdir where to place source code
+# - pobase directory relative to destdir where to place *.po files
+# - po_domain prefix of i18n domain to use (without -gnulib suffix)
+func_emit_po_Makevars ()
+{
+ echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
+ func_emit_copyright_notice
+ echo
+ echo "# Usually the message domain is the same as the package name."
+ echo "# But here it has a '-gnulib' suffix."
+ echo "DOMAIN = ${po_domain}-gnulib"
+ echo
+ echo "# These two variables depend on the location of this directory."
+ echo "subdir = ${pobase}"
+ echo "top_builddir = "`echo "$pobase" | sed -e 's,//*,/,g' -e 's,[^/][^/]*,..,g'`
+ echo
+ cat <<\EOF
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = \
+ --keyword=_ --flag=_:1:pass-c-format \
+ --keyword=N_ --flag=N_:1:pass-c-format \
+ --keyword='proper_name:1,"This is a proper name. See the gettext manual, section Names."' \
+ --keyword='proper_name_utf8:1,"This is a proper name. See the gettext manual, section Names."' \
+ --flag=error:3:c-format --flag=error_at_line:5:c-format
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file. gnulib is copyrighted by the FSF.
+COPYRIGHT_HOLDER = Free Software Foundation, Inc.
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+# in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+# understood.
+# - Strings which make invalid assumptions about notation of date, time or
+# money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = bug-gnulib@gnu.org
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used. It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
+
+# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
+# context. Possible values are "yes" and "no". Set this to yes if the
+# package uses functions taking also a message context, like pgettext(), or
+# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
+USE_MSGCTXT = no
+EOF
+}
+
+# func_emit_po_POTFILES_in
+# emits the file list to be passed to xgettext to standard output.
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# - sourcebase directory relative to destdir where to place source code
+# - files list of new files
+func_emit_po_POTFILES_in ()
+{
+ echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
+ func_emit_copyright_notice
+ echo
+ echo "# List of files which contain translatable strings."
+ echo "$files" | sed -n -e "s,^lib/,$sourcebase/,p"
+}
+
+# func_emit_tests_Makefile_am witness_macro
+# emits the contents of tests makefile to standard output.
+# Input:
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# - modules list of modules, including dependencies
+# - libname library name
+# - auxdir directory relative to destdir where to place build aux files
+# - makefile_name from --makefile-name
+# - libtool true if libtool will be used, false or blank otherwise
+# - sourcebase relative directory containing lib source code
+# - m4base relative directory containing autoconf macros
+# - testsbase relative directory containing unit test code
+# - macro_prefix prefix of gl_LIBOBJS macros to use
+# - for_test true if creating a package for testing, false otherwise
+# - use_libtests true if a libtests.a should be built, false otherwise
+# - destfile filename relative to destdir of makefile being generated
+# Input/Output:
+# - makefile_am_edits and makefile_am_edit${edit}_{dir,var,val}
+# list of edits to be done to Makefile.am variables
+# Output:
+# - uses_subdirs nonempty if object files in subdirs exist
+func_emit_tests_Makefile_am ()
+{
+ witness_macro="$1"
+ if test "$libtool" = true; then
+ libext=la
+ sed_eliminate_LDFLAGS="$sed_noop"
+ else
+ libext=a
+ sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
+ fi
+ if $for_test; then
+ # When creating a package for testing: Attempt to provoke failures,
+ # especially link errors, already during "make" rather than during
+ # "make check", because "make check" is not possible in a cross-compiling
+ # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
+ sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
+ else
+ sed_transform_check_PROGRAMS="$sed_noop"
+ fi
+ testsbase_inverse=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
+ echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
+ echo "## Process this file with automake to produce Makefile.in."
+ func_emit_copyright_notice
+ echo
+ uses_subdirs=
+ {
+ for module in $modules; do
+ if $for_test; then
+ func_verify_tests_module
+ else
+ func_verify_module
+ fi
+ if test -n "$module"; then
+ {
+ func_get_automake_snippet "$module" |
+ LC_ALL=C \
+ sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
+ -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
+ -e "$sed_eliminate_LDFLAGS" \
+ -e 's,lib_\([A-Z][A-Z]*\),libtests_a_\1,g' \
+ -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
+ -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' \
+ -e "$sed_transform_check_PROGRAMS"
+ if $use_libtests && test "$module" = 'alloca'; then
+ echo "libtests_a_LIBADD += @${perhapsLT}ALLOCA@"
+ echo "libtests_a_DEPENDENCIES += @${perhapsLT}ALLOCA@"
+ fi
+ } > "$tmp"/amsnippet
+ # Skip the contents if it's entirely empty.
+ if grep '[^ ]' "$tmp"/amsnippet > /dev/null ; then
+ # 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.
+ for f in `func_get_filelist "$module"`; do
+ case $f in
+ lib/*/*.c | tests/*/*.c)
+ uses_subdirs=yes
+ break
+ ;;
+ esac
+ done
+ fi
+ done
+ } 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).
+ subdir_options=
+ if test -n "$uses_subdirs"; then
+ subdir_options=' subdir-objects'
+ fi
+ echo "AUTOMAKE_OPTIONS = 1.5 foreign${subdir_options}"
+ echo
+ if $for_test; then
+ echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
+ echo
+ fi
+ # 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 "TESTS ="
+ echo "XFAIL_TESTS ="
+ echo "TESTS_ENVIRONMENT ="
+ echo "noinst_PROGRAMS ="
+ if ! $for_test; then
+ echo "check_PROGRAMS ="
+ fi
+ echo "noinst_HEADERS ="
+ echo "noinst_LIBRARIES ="
+ if $use_libtests; then
+ if $for_test; then
+ echo "noinst_LIBRARIES += libtests.a"
+ else
+ echo "check_LIBRARIES = libtests.a"
+ fi
+ 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"/main_snippets "$tmp"/longrunning_snippets > /dev/null; then
+ echo "pkgdata_DATA ="
+ fi
+ echo "EXTRA_DIST ="
+ echo "BUILT_SOURCES ="
+ echo "SUFFIXES ="
+ echo "MOSTLYCLEANFILES = core *.stackdump"
+ echo "MOSTLYCLEANDIRS ="
+ echo "CLEANFILES ="
+ echo "DISTCLEANFILES ="
+ echo "MAINTAINERCLEANFILES ="
+ # Execute edits that apply to the Makefile.am being generated.
+ edit=0
+ while test $edit != $makefile_am_edits; do
+ edit=`expr $edit + 1`
+ eval dir=\"\$makefile_am_edit${edit}_dir\"
+ eval var=\"\$makefile_am_edit${edit}_var\"
+ eval val=\"\$makefile_am_edit${edit}_val\"
+ if test -n "$var"; then
+ if test "${dir}Makefile.am" = "$destfile" || test "./${dir}Makefile.am" = "$destfile"; then
+ echo "${var} += ${val}"
+ eval "makefile_am_edit${edit}_var="
+ fi
+ fi
+ done
+ echo
+ echo "AM_CPPFLAGS = \\"
+ if test -n "${witness_macro}"; then
+ echo " -D@${witness_macro}@=1 \\"
+ fi
+ echo " -I. -I\$(srcdir) \\"
+ echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
+ echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
+ echo
+ local_ldadd_before=''
+ local_ldadd_after=''
+ if $use_libtests; then
+ # All test programs need to be linked with libtests.a.
+ # It needs to be passed to the linker before ${libname}.${libext}, since
+ # the tests-related modules depend on the main modules.
+ # It also needs to be passed to the linker after ${libname}.${libext}
+ # because the latter might contain incomplete modules (such as the 'error'
+ # module whose dependency to 'progname' is voluntarily omitted).
+ # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
+ # not matter.
+ local_ldadd_before=' libtests.a'
+ local_ldadd_after=' libtests.a $(LIBTESTS_LIBDEPS)'
+ fi
+ echo "LDADD =${local_ldadd_before} ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}${local_ldadd_after}"
+ echo
+ if $use_libtests; then
+ echo "libtests_a_SOURCES ="
+ # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
+ # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@.
+ echo "libtests_a_LIBADD = \$(${macro_prefix}tests_LIBOBJS)"
+ echo "libtests_a_DEPENDENCIES = \$(${macro_prefix}tests_LIBOBJS)"
+ echo "EXTRA_libtests_a_SOURCES ="
+ # The circular dependency in LDADD requires this.
+ echo "AM_LIBTOOLFLAGS = --preserve-dup-deps"
+ echo
+ fi
+ # Many test scripts use ${EXEEXT} or ${srcdir}.
+ # EXEEXT is defined by AC_PROG_CC through autoconf.
+ # srcdir is defined by autoconf and automake.
+ echo "TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='\$(srcdir)'"
+ echo
+ 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 " rm -rf SunWS_cache"
+ echo
+ echo "mostlyclean-local: mostlyclean-generic"
+ echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
+ echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
+ echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
+ echo " fi; \\"
+ echo " done; \\"
+ echo " :"
+ rm -f "$tmp"/main_snippets "$tmp"/longrunning_snippets
+}
+
+# func_emit_initmacro_start macro_prefix
+# emits the first few statements of the gl_INIT macro to standard output.
+# - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
+func_emit_initmacro_start ()
+{
+ macro_prefix_arg="$1"
+ # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
+ # platform-dependent object files in ${macro_prefix_arg}_LIBOBJS instead of
+ # LIBOBJS. The purpose is to allow several gnulib instantiations under
+ # a single configure.ac file. (AC_CONFIG_LIBOBJ_DIR does not allow this
+ # flexibility.)
+ # Furthermore it avoids an automake error like this when a Makefile.am
+ # that uses pieces of gnulib also uses $(LIBOBJ):
+ # automatically discovered file `error.c' should not be explicitly mentioned
+ echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix_arg}_LIBOBJ]))"
+ echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix_arg}_REPLACE_FUNCS]))"
+ # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
+ # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
+ # automatically discovered file `error.c' should not be explicitly mentioned
+ # We let automake know about the files to be distributed through the
+ # EXTRA_lib_SOURCES variable.
+ echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))"
+ # Create data variables for checking the presence of files that are mentioned
+ # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables,
+ # because we want the check to happen when the configure file is created,
+ # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of
+ # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory
+ # in which to expect them.
+ echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])"
+ echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])"
+ echo " gl_COMMON"
+}
+
+# func_emit_initmacro_end macro_prefix
+# emits the last few statements of the gl_INIT macro to standard output.
+# - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
+func_emit_initmacro_end ()
+{
+ macro_prefix_arg="$1"
+ # Check the presence of files that are mentioned as AC_LIBSOURCES arguments.
+ # The check is performed only when autoconf is run from the directory where
+ # the configure.ac resides; if it is run from a different directory, the
+ # check is skipped.
+ echo " m4_ifval(${macro_prefix_arg}_LIBSOURCES_LIST, ["
+ echo " m4_syscmd([test ! -d ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[ ||"
+ echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do"
+ echo " if test ! -r ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file ; then"
+ echo " echo \"missing file ]m4_defn([${macro_prefix_arg}_LIBSOURCES_DIR])[/\$gl_file\" >&2"
+ echo " exit 1"
+ echo " fi"
+ echo " done])dnl"
+ echo " m4_if(m4_sysval, [0], [],"
+ echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])"
+ echo " ])"
+ echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])"
+ echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])"
+ echo " m4_popdef([AC_LIBSOURCES])"
+ echo " m4_popdef([AC_REPLACE_FUNCS])"
+ echo " m4_popdef([AC_LIBOBJ])"
+ echo " AC_CONFIG_COMMANDS_PRE(["
+ echo " ${macro_prefix_arg}_libobjs="
+ echo " ${macro_prefix_arg}_ltlibobjs="
+ echo " if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
+ echo " # Remove the extension."
+ echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
+ echo " for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
+ echo " ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs \$i.\$ac_objext\""
+ echo " ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
+ echo " done"
+ echo " fi"
+ echo " AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
+ echo " AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
+ echo " ])"
+}
+
+# func_emit_initmacro_done macro_prefix sourcebase
+# emits a few statements after the gl_INIT macro to standard output.
+# - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
+# - sourcebase directory relative to destdir where to place source code
+func_emit_initmacro_done ()
+{
+ macro_prefix_arg="$1"
+ sourcebase_arg="$2"
+ echo
+ echo "# Like AC_LIBOBJ, except that the module name goes"
+ echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
+ echo "AC_DEFUN([${macro_prefix_arg}_LIBOBJ], ["
+ echo " AS_LITERAL_IF([\$1], [${macro_prefix_arg}_LIBSOURCES([\$1.c])])dnl"
+ echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\""
+ echo "])"
+ echo
+ echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
+ echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS."
+ echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], ["
+ echo " m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
+ echo " AC_CHECK_FUNCS([\$1], , [${macro_prefix_arg}_LIBOBJ(\$ac_func)])"
+ echo "])"
+ echo
+ echo "# Like AC_LIBSOURCES, except the directory where the source file is"
+ echo "# expected is derived from the gnulib-tool parameterization,"
+ echo "# and alloca is special cased (for the alloca-opt module)."
+ echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
+ echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], ["
+ echo " m4_foreach([_gl_NAME], [\$1], ["
+ echo " m4_if(_gl_NAME, [alloca.c], [], ["
+ echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])"
+ echo " m4_append([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])"
+ echo " ])"
+ echo " ])"
+ echo "])"
+}
+
+# func_import modules
+# Uses also the variables
+# - destdir target directory
+# - local_gnulib_dir from --local-dir
+# - modcache true or false, from --cache-modules/--no-cache-modules
+# - verbose integer, default 0, inc/decremented by --verbose/--quiet
+# - libname library name
+# - sourcebase directory relative to destdir where to place source code
+# - m4base directory relative to destdir where to place *.m4 macros
+# - pobase directory relative to destdir where to place *.po files
+# - docbase directory relative to destdir where to place doc files
+# - testsbase directory relative to destdir where to place unit test code
+# - auxdir directory relative to destdir where to place build aux files
+# - inctests true if --with-tests was given, blank otherwise
+# - incobsolete true if --with-obsolete was given, blank otherwise
+# - inc_cxx_tests true if --with-c++-tests was given, blank otherwise
+# - inc_longrunning_tests true if --with-longrunning-tests was given, blank
+# otherwise
+# - inc_privileged_tests true if --with-privileged-tests was given, blank
+# otherwise
+# - inc_unportable_tests true if --with-unportable-tests was given, blank
+# otherwise
+# - inc_all_tests true if --with-all-tests was given, blank otherwise
+# - avoidlist list of modules to avoid, from --avoid
+# - lgpl yes or a number if library's license shall be LGPL,
+# blank otherwise
+# - makefile_name from --makefile-name
+# - libtool true if --libtool was given, false if --no-libtool was
+# given, blank otherwise
+# - guessed_libtool true if the configure.ac file uses libtool, false otherwise
+# - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
+# - po_domain prefix of i18n domain to use (without -gnulib suffix)
+# - vc_files true if --vc-files was given, false if --no-vc-files was
+# given, blank otherwise
+# - autoconf_minversion minimum supported autoconf version
+# - doit : if actions shall be executed, false if only to be printed
+# - symbolic true if files should be symlinked, copied otherwise
+# - lsymbolic true if files from local_gnulib_dir should be symlinked,
+# copied otherwise
+# - do_copyrights true if copyright notices in files should be replaced,
+# blank otherwise
+func_import ()
+{
+ # Get the cached settings.
+ cached_local_gnulib_dir=
+ cached_specified_modules=
+ cached_incobsolete=
+ cached_inc_cxx_tests=
+ cached_inc_longrunning_tests=
+ cached_inc_privileged_tests=
+ cached_inc_unportable_tests=
+ cached_inc_all_tests=
+ cached_avoidlist=
+ cached_sourcebase=
+ cached_m4base=
+ cached_pobase=
+ cached_docbase=
+ cached_testsbase=
+ cached_inctests=
+ cached_libname=
+ cached_lgpl=
+ cached_makefile_name=
+ cached_libtool=
+ cached_macro_prefix=
+ cached_po_domain=
+ cached_vc_files=
+ cached_files=
+ if test -f "$destdir"/$m4base/gnulib-cache.m4; then
+ cached_libtool=false
+ my_sed_traces='
+ s,#.*$,,
+ s,^dnl .*$,,
+ s, dnl .*$,,
+ /gl_LOCAL_DIR(/ {
+ s,^.*gl_LOCAL_DIR([[ ]*\([^]"$`\\)]*\).*$,cached_local_gnulib_dir="\1",p
+ }
+ /gl_MODULES(/ {
+ ta
+ :a
+ s/)/)/
+ tb
+ N
+ ba
+ :b
+ s,^.*gl_MODULES([[ ]*\([^]"$`\\)]*\).*$,cached_specified_modules="\1",p
+ }
+ /gl_WITH_OBSOLETE/ {
+ s,^.*$,cached_incobsolete=true,p
+ }
+ /gl_WITH_CXX_TESTS/ {
+ s,^.*$,cached_inc_cxx_tests=true,p
+ }
+ /gl_WITH_LONGRUNNING_TESTS/ {
+ s,^.*$,cached_inc_longrunning_tests=true,p
+ }
+ /gl_WITH_PRIVILEGED_TESTS/ {
+ s,^.*$,cached_inc_privileged_tests=true,p
+ }
+ /gl_WITH_UNPORTABLE_TESTS/ {
+ s,^.*$,cached_inc_unportable_tests=true,p
+ }
+ /gl_WITH_ALL_TESTS/ {
+ s,^.*$,cached_inc_all_tests=true,p
+ }
+ /gl_AVOID(/ {
+ s,^.*gl_AVOID([[ ]*\([^]"$`\\)]*\).*$,cached_avoidlist="\1",p
+ }
+ /gl_SOURCE_BASE(/ {
+ s,^.*gl_SOURCE_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_sourcebase="\1",p
+ }
+ /gl_M4_BASE(/ {
+ s,^.*gl_M4_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_m4base="\1",p
+ }
+ /gl_PO_BASE(/ {
+ s,^.*gl_PO_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_pobase="\1",p
+ }
+ /gl_DOC_BASE(/ {
+ s,^.*gl_DOC_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_docbase="\1",p
+ }
+ /gl_TESTS_BASE(/ {
+ s,^.*gl_TESTS_BASE([[ ]*\([^]"$`\\)]*\).*$,cached_testsbase="\1",p
+ }
+ /gl_WITH_TESTS/ {
+ s,^.*$,cached_inctests=true,p
+ }
+ /gl_LIB(/ {
+ s,^.*gl_LIB([[ ]*\([^]"$`\\)]*\).*$,cached_libname="\1",p
+ }
+ /gl_LGPL(/ {
+ s,^.*gl_LGPL([[ ]*\([^]"$`\\)]*\).*$,cached_lgpl="\1",p
+ }
+ /gl_LGPL/ {
+ s,^.*$,cached_lgpl=yes,p
+ }
+ /gl_MAKEFILE_NAME(/ {
+ s,^.*gl_MAKEFILE_NAME([[ ]*\([^]"$`\\)]*\).*$,cached_makefile_name="\1",p
+ }
+ /gl_LIBTOOL/ {
+ s,^.*$,cached_libtool=true,p
+ }
+ /gl_MACRO_PREFIX(/ {
+ s,^.*gl_MACRO_PREFIX([[ ]*\([^]"$`\\)]*\).*$,cached_macro_prefix="\1",p
+ }
+ /gl_PO_DOMAIN(/ {
+ s,^.*gl_PO_DOMAIN([[ ]*\([^]"$`\\)]*\).*$,cached_po_domain="\1",p
+ }
+ /gl_VC_FILES(/ {
+ s,^.*gl_VC_FILES([[ ]*\([^]"$`\\)]*\).*$,cached_vc_files="\1",p
+ }'
+ eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
+ if test -f "$destdir"/$m4base/gnulib-comp.m4; then
+ my_sed_traces='
+ s,#.*$,,
+ s,^dnl .*$,,
+ s, dnl .*$,,
+ /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
+ s,^.*$,cached_files=",p
+ n
+ ta
+ :a
+ s,^\]).*$,",
+ tb
+ s,["$`\\],,g
+ p
+ n
+ ba
+ :b
+ p
+ }'
+ eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
+ fi
+ fi
+
+ # Merge the cached settings with the specified ones.
+ # The m4base must be the same as expected from the pathname.
+ if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
+ func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
+ fi
+ # The local_gnulib_dir defaults to the cached one. Recall that the cached one
+ # is relative to $destdir, whereas the one we use is relative to . or absolute.
+ if test -z "$local_gnulib_dir"; then
+ if test -n "$cached_local_gnulib_dir"; then
+ case "$destdir" in
+ /*)
+ local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
+ *)
+ case "$cached_local_gnulib_dir" in
+ /*)
+ local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
+ *)
+ func_relconcat "$destdir" "$cached_local_gnulib_dir"
+ local_gnulib_dir="$relconcat" ;;
+ esac ;;
+ esac
+ fi
+ fi
+ # Append the cached and the specified module names. So that
+ # "gnulib-tool --import foo" means to add the module foo.
+ specified_modules="$cached_specified_modules $1"
+ # Included obsolete modules among the dependencies if specified either way.
+ if test -z "$incobsolete"; then
+ incobsolete="$cached_incobsolete"
+ fi
+ # Included special kinds of tests modules among the dependencies if specified
+ # either way.
+ if test -z "$inc_cxx_tests"; then
+ inc_cxx_tests="$cached_inc_cxx_tests"
+ fi
+ if test -z "$inc_longrunning_tests"; then
+ inc_longrunning_tests="$cached_inc_longrunning_tests"
+ fi
+ if test -z "$inc_privileged_tests"; then
+ inc_privileged_tests="$cached_inc_privileged_tests"
+ fi
+ if test -z "$inc_unportable_tests"; then
+ inc_unportable_tests="$cached_inc_unportable_tests"
+ fi
+ if test -z "$inc_all_tests"; then
+ inc_all_tests="$cached_inc_all_tests"
+ fi
+ # 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`
+ avoidlist=`echo $avoidlist`
+
+ # The sourcebase defaults to the cached one.
+ if test -z "$sourcebase"; then
+ sourcebase="$cached_sourcebase"
+ if test -z "$sourcebase"; then
+ func_fatal_error "missing --source-base option"
+ fi
+ fi
+ # The pobase defaults to the cached one.
+ if test -z "$pobase"; then
+ pobase="$cached_pobase"
+ fi
+ # The docbase defaults to the cached one.
+ if test -z "$docbase"; then
+ docbase="$cached_docbase"
+ if test -z "$docbase"; then
+ func_fatal_error "missing --doc-base option. --doc-base has been introduced on 2006-07-11; if your last invocation of 'gnulib-tool --import' is before that date, you need to run 'gnulib-tool --import' once, with a --doc-base option."
+ fi
+ fi
+ # The testsbase defaults to the cached one.
+ if test -z "$testsbase"; then
+ testsbase="$cached_testsbase"
+ if test -z "$testsbase"; then
+ func_fatal_error "missing --tests-base option"
+ fi
+ fi
+ # Require the tests if specified either way.
+ if test -z "$inctests"; then
+ inctests="$cached_inctests"
+ fi
+ # The libname defaults to the cached one.
+ if test -z "$supplied_libname"; then
+ libname="$cached_libname"
+ if test -z "$libname"; then
+ func_fatal_error "missing --lib option"
+ fi
+ fi
+ # Require LGPL if specified either way.
+ if test -z "$lgpl"; then
+ lgpl="$cached_lgpl"
+ fi
+ # The makefile_name defaults to the cached one.
+ if test -z "$makefile_name"; then
+ makefile_name="$cached_makefile_name"
+ fi
+ # Use libtool if specified either way, or if guessed.
+ if test -z "$libtool"; then
+ if test -n "$cached_m4base"; then
+ libtool="$cached_libtool"
+ else
+ libtool="$guessed_libtool"
+ fi
+ fi
+ # The macro_prefix defaults to the cached one.
+ if test -z "$macro_prefix"; then
+ macro_prefix="$cached_macro_prefix"
+ if test -z "$macro_prefix"; then
+ func_fatal_error "missing --macro-prefix option"
+ fi
+ fi
+ # The po_domain defaults to the cached one.
+ if test -z "$po_domain"; then
+ po_domain="$cached_po_domain"
+ fi
+ # The vc_files defaults to the cached one.
+ if test -z "$vc_files"; then
+ vc_files="$cached_vc_files"
+ fi
+
+ # Canonicalize the list of specified modules.
+ specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
+
+ # Determine final module list.
+ modules="$specified_modules"
+ func_modules_transitive_closure
+ if test $verbose -ge 0; then
+ echo "Module list with included dependencies:"
+ echo "$modules" | sed -e 's/^/ /'
+ fi
+ final_modules="$modules"
+
+ # Determine main module list and tests-related module list separately.
+ # The main module list is the transitive closure of the specified modules,
+ # ignoring tests modules. Its lib/* sources go into $sourcebase/. If --lgpl
+ # is specified, it will consist only of LGPLed source.
+ # The tests-related module list is the transitive closure of the specified
+ # modules, including tests modules, minus the main module list excluding
+ # modules of applicability 'all'. Its lib/* sources (brought in through
+ # dependencies of *-tests modules) go into $testsbase/. It may contain GPLed
+ # source, even if --lgpl is specified.
+ # Determine main module list.
+ saved_inctests="$inctests"
+ inctests=""
+ modules="$specified_modules"
+ func_modules_transitive_closure
+ main_modules="$modules"
+ inctests="$saved_inctests"
+ if test $verbose -ge 1; then
+ echo "Main module list:"
+ echo "$main_modules" | sed -e 's/^/ /'
+ fi
+ # Determine tests-related module list.
+ echo "$final_modules" | LC_ALL=C sort -u > "$tmp"/final-modules
+ testsrelated_modules=`for module in $main_modules; do
+ if test \`func_get_applicability $module\` = main; then
+ echo $module
+ fi
+ done \
+ | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/final-modules`
+ if test $verbose -ge 1; then
+ echo "Tests-related module list:"
+ echo "$testsrelated_modules" | sed -e 's/^/ /'
+ fi
+
+ # Add the dummy module to the main module list if needed.
+ modules="$main_modules"
+ func_modules_add_dummy
+ main_modules="$modules"
+
+ # Determine whether a $testsbase/libtests.a is needed.
+ use_libtests=false
+ for module in $testsrelated_modules; do
+ func_verify_nontests_module
+ if test -n "$module"; then
+ all_files=`func_get_filelist $module`
+ # Test whether some file in $all_files lies in lib/.
+ for f in $all_files; do
+ case $f in
+ lib/*)
+ use_libtests=true
+ break 2
+ ;;
+ esac
+ done
+ fi
+ done
+
+ # Add the dummy module to the tests-related module list if needed.
+ if $use_libtests; then
+ modules="$testsrelated_modules"
+ func_modules_add_dummy
+ testsrelated_modules="$modules"
+ fi
+
+ # If --lgpl, verify that the licenses of modules are compatible.
+ if test -n "$lgpl"; then
+ license_incompatibilities=
+ for module in $main_modules; do
+ license=`func_get_license $module`
+ case $license in
+ 'GPLed build tool') ;;
+ 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
+ *)
+ case "$lgpl" in
+ yes | 3)
+ case $license in
+ LGPL | LGPLv2+ | LGPLv3+) ;;
+ *) func_append license_incompatibilities "$module $license$nl" ;;
+ esac
+ ;;
+ 2)
+ case $license in
+ LGPLv2+) ;;
+ *) func_append license_incompatibilities "$module $license$nl" ;;
+ esac
+ ;;
+ *) func_fatal_error "invalid value lgpl=$lgpl" ;;
+ esac
+ ;;
+ esac
+ done
+ if test -n "$license_incompatibilities"; then
+ # Format the license incompatibilities as a table.
+ sed_expand_column1_width50_indent17='s,^\([^ ]*\) ,\1 ,
+s,^\(.................................................[^ ]*\) *, \1 ,'
+ license_incompatibilities=`echo "$license_incompatibilities" | sed -e "$sed_expand_column1_width50_indent17"`
+ func_fatal_error "incompatible license on modules:$nl$license_incompatibilities"
+ fi
+ fi
+
+ # Show banner notice of every module.
+ modules="$main_modules"
+ func_modules_notice
+
+ # Determine script to apply to imported library files.
+ sed_transform_lib_file=
+ for module in $main_modules; do
+ if test $module = config-h; then
+ # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
+ sed_transform_lib_file=$sed_transform_lib_file'
+ s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
+ '
+ break
+ fi
+ done
+ sed_transform_main_lib_file="$sed_transform_lib_file"
+ if test -n "$do_copyrights"; then
+ if test -n "$lgpl"; then
+ # Update license.
+ case "$lgpl" in
+ yes | 3)
+ sed_transform_main_lib_file=$sed_transform_main_lib_file'
+ s/GNU General/GNU Lesser General/g
+ '
+ ;;
+ 2)
+ sed_transform_main_lib_file=$sed_transform_main_lib_file'
+ s/GNU General/GNU Lesser General/g
+ s/version [23]\([ ,]\)/version 2.1\1/g
+ '
+ ;;
+ *) func_fatal_error "invalid value lgpl=$lgpl" ;;
+ esac
+ else
+ # Update license.
+ sed_transform_main_lib_file=$sed_transform_main_lib_file'
+ s/GNU Lesser General/GNU General/g
+ s/GNU Library General/GNU General/g
+ s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
+ '
+ fi
+ fi
+
+ # Determine script to apply to auxiliary files that go into $auxdir/.
+ sed_transform_build_aux_file=
+ if test -n "$do_copyrights"; then
+ # Update license.
+ sed_transform_build_aux_file=$sed_transform_build_aux_file'
+ s/GNU Lesser General/GNU General/g
+ s/GNU Library General/GNU General/g
+ s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
+ '
+ fi
+
+ # Determine script to apply to library files that go into $testsbase/.
+ sed_transform_testsrelated_lib_file="$sed_transform_lib_file"
+ if test -n "$do_copyrights"; then
+ # Update license.
+ sed_transform_testsrelated_lib_file=$sed_transform_testsrelated_lib_file'
+ s/GNU Lesser General/GNU General/g
+ s/GNU Library General/GNU General/g
+ s/version 2\(.1\)\{0,1\}\([ ,]\)/version 3\2/g
+ '
+ fi
+
+ # Determine the final file lists.
+ # They must be computed separately, because files in lib/* go into
+ # $sourcebase/ if they are in the main file list but into $testsbase/
+ # if they are in the tests-related file list. Furthermore lib/dummy.c
+ # can be in both.
+ # Determine final main file list.
+ modules="$main_modules"
+ func_modules_to_filelist
+ main_files="$files"
+ # Determine final tests-related file list.
+ modules="$testsrelated_modules"
+ func_modules_to_filelist
+ testsrelated_files=`echo "$files" | sed -e 's,^lib/,tests=lib/,'`
+ # Merge both file lists.
+ sed_remove_empty_lines='/^$/d'
+ files=`{ echo "$main_files"; echo "$testsrelated_files"; } | sed -e "$sed_remove_empty_lines" | LC_ALL=C sort -u`
+ if test $verbose -ge 0; then
+ echo "File list:"
+ sed_prettyprint_files='s,^tests=lib/\(.*\)$,lib/\1 -> tests/\1,'
+ echo "$files" | sed -e "$sed_prettyprint_files" -e 's/^/ /'
+ fi
+
+ test -n "$files" \
+ || func_fatal_error "refusing to do nothing"
+
+ # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
+ new_files="$files m4/gnulib-tool.m4"
+ old_files="$cached_files"
+ if test -f "$destdir"/$m4base/gnulib-tool.m4; then
+ func_append old_files " m4/gnulib-tool.m4"
+ fi
+
+ rewritten='%REWRITTEN%'
+ sed_rewrite_old_files="\
+ s,^build-aux/,$rewritten$auxdir/,
+ s,^doc/,$rewritten$cached_docbase/,
+ s,^lib/,$rewritten$cached_sourcebase/,
+ s,^m4/,$rewritten$cached_m4base/,
+ s,^tests/,$rewritten$cached_testsbase/,
+ s,^tests=lib/,$rewritten$cached_testsbase/,
+ s,^top/,$rewritten,
+ s,^$rewritten,,"
+ sed_rewrite_new_files="\
+ s,^build-aux/,$rewritten$auxdir/,
+ s,^doc/,$rewritten$docbase/,
+ s,^lib/,$rewritten$sourcebase/,
+ s,^m4/,$rewritten$m4base/,
+ s,^tests/,$rewritten$testsbase/,
+ s,^tests=lib/,$rewritten$testsbase/,
+ s,^top/,$rewritten,
+ s,^$rewritten,,"
+
+ # Create directories.
+ { echo "$sourcebase"
+ echo "$m4base"
+ if test -n "$pobase"; then
+ echo "$pobase"
+ fi
+ docfiles=`echo "$files" | sed -n -e 's,^doc/,,p'`
+ if test -n "$docfiles"; then
+ echo "$docbase"
+ fi
+ if test -n "$inctests"; then
+ echo "$testsbase"
+ fi
+ echo "$auxdir"
+ for f in $files; do echo $f; done \
+ | sed -e "$sed_rewrite_new_files" \
+ | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
+ | LC_ALL=C sort -u
+ } > "$tmp"/dirs
+ { # Rearrange file descriptors. Needed because "while ... done < ..."
+ # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
+ exec 5<&0 < "$tmp"/dirs
+ while read d; do
+ if test ! -d "$destdir/$d"; then
+ if $doit; then
+ echo "Creating directory $destdir/$d"
+ mkdir -p "$destdir/$d" || func_fatal_error "failed"
+ else
+ echo "Create directory $destdir/$d"
+ fi
+ fi
+ done
+ exec 0<&5 5<&-
+ }
+
+ # Copy files or make symbolic links. Remove obsolete files.
+ added_files=''
+ removed_files=''
+ delimiter=' '
+ # Construct a table with 2 columns: rewritten-file-name original-file-name,
+ # representing the files according to the last gnulib-tool invocation.
+ for f in $old_files; do echo $f; done \
+ | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
+ | LC_ALL=C sort \
+ > "$tmp"/old-files
+ # Construct a table with 2 columns: rewritten-file-name original-file-name,
+ # representing the files after this gnulib-tool invocation.
+ for f in $new_files; do echo $f; done \
+ | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
+ | LC_ALL=C sort \
+ > "$tmp"/new-files
+ # First the files that are in old-files, but not in new-files:
+ sed_take_first_column='s,'"$delimiter"'.*,,'
+ for g in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
+ # Remove the file. Do nothing if the user already removed it.
+ if test -f "$destdir/$g" || test -h "$destdir/$g"; then
+ if $doit; then
+ echo "Removing file $g (backup in ${g}~)"
+ mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
+ else
+ echo "Remove file $g (backup in ${g}~)"
+ fi
+ func_append removed_files "$g$nl"
+ fi
+ done
+ # func_add_or_update handles a file that ought to be present afterwards.
+ # Uses parameters
+ # - f the original file name
+ # - g the rewritten file name
+ # - already_present nonempty if the file should already exist, empty
+ # otherwise
+ func_add_or_update ()
+ {
+ of="$f"
+ case "$f" in
+ tests=lib/*) f=`echo "$f" | sed -e 's,^tests=lib/,lib/,'` ;;
+ esac
+ func_dest_tmpfilename "$g"
+ func_lookup_file "$f"
+ cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
+ if test -n "$sed_transform_main_lib_file"; then
+ case "$of" in
+ lib/*)
+ sed -e "$sed_transform_main_lib_file" \
+ < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
+ ;;
+ esac
+ fi
+ if test -n "$sed_transform_build_aux_file"; then
+ case "$of" in
+ build-aux/*)
+ sed -e "$sed_transform_build_aux_file" \
+ < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
+ ;;
+ esac
+ fi
+ if test -n "$sed_transform_testsrelated_lib_file"; then
+ case "$of" in
+ tests=lib/*)
+ sed -e "$sed_transform_testsrelated_lib_file" \
+ < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
+ ;;
+ esac
+ fi
+ if test -f "$destdir/$g"; then
+ # The file already exists.
+ func_update_file
+ else
+ # Install the file.
+ # Don't protest if the file should be there but isn't: it happens
+ # frequently that developers don't put autogenerated files into CVS.
+ func_add_file
+ func_append added_files "$g$nl"
+ fi
+ rm -f "$tmpfile"
+ }
+ # Then the files that are in new-files, but not in old-files:
+ sed_take_last_column='s,^.*'"$delimiter"',,'
+ already_present=
+ LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files \
+ | sed -e "$sed_take_last_column" \
+ | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
+ { # Rearrange file descriptors. Needed because "while ... done < ..."
+ # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
+ exec 5<&0 < "$tmp"/added-files
+ while read g f; do
+ func_add_or_update
+ done
+ exec 0<&5 5<&-
+ }
+ # Then the files that are in new-files and in old-files:
+ already_present=true
+ LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files \
+ | sed -e "$sed_take_last_column" \
+ | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
+ { # Rearrange file descriptors. Needed because "while ... done < ..."
+ # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
+ exec 5<&0 < "$tmp"/kept-files
+ while read g f; do
+ func_add_or_update
+ done
+ exec 0<&5 5<&-
+ }
+
+ # Command-line invocation printed in a comment in generated gnulib-cache.m4.
+ actioncmd="gnulib-tool --import"
+ func_append actioncmd " --dir=$destdir"
+ if test -n "$local_gnulib_dir"; then
+ func_append actioncmd " --local-dir=$local_gnulib_dir"
+ fi
+ func_append actioncmd " --lib=$libname"
+ func_append actioncmd " --source-base=$sourcebase"
+ func_append actioncmd " --m4-base=$m4base"
+ if test -n "$pobase"; then
+ func_append actioncmd " --po-base=$pobase"
+ fi
+ func_append actioncmd " --doc-base=$docbase"
+ func_append actioncmd " --tests-base=$testsbase"
+ func_append actioncmd " --aux-dir=$auxdir"
+ if test -n "$inctests"; then
+ func_append actioncmd " --with-tests"
+ fi
+ if test -n "$incobsolete"; then
+ func_append actioncmd " --with-obsolete"
+ fi
+ if test -n "$inc_cxx_tests"; then
+ func_append actioncmd " --with-c++-tests"
+ fi
+ if test -n "$inc_longrunning_tests"; then
+ func_append actioncmd " --with-longrunning-tests"
+ fi
+ if test -n "$inc_privileged_tests"; then
+ func_append actioncmd " --with-privileged-tests"
+ fi
+ if test -n "$inc_unportable_tests"; then
+ func_append actioncmd " --with-unportable-tests"
+ fi
+ if test -n "$inc_all_tests"; then
+ func_append actioncmd " --with-all-tests"
+ fi
+ for module in $avoidlist; do
+ func_append actioncmd " --avoid=$module"
+ done
+ if test -n "$lgpl"; then
+ if test "$lgpl" = yes; then
+ func_append actioncmd " --lgpl"
+ else
+ func_append actioncmd " --lgpl=$lgpl"
+ fi
+ fi
+ if test -n "$makefile_name"; then
+ func_append actioncmd " --makefile-name=$makefile_name"
+ fi
+ if test "$libtool" = true; then
+ func_append actioncmd " --libtool"
+ else
+ func_append actioncmd " --no-libtool"
+ fi
+ func_append actioncmd " --macro-prefix=$macro_prefix"
+ if test -n "$po_domain"; then
+ func_append actioncmd " --po-domain=$po_domain"
+ fi
+ if test -n "$vc_files"; then
+ if test "$vc_files" = true; then
+ func_append actioncmd " --vc-files"
+ else
+ func_append actioncmd " --no-vc-files"
+ fi
+ fi
+ func_append actioncmd " `echo $specified_modules`"
+
+ # Default the makefile name to Makefile.am.
+ if test -n "$makefile_name"; then
+ makefile_am=$makefile_name
+ else
+ makefile_am=Makefile.am
+ fi
+
+ # Create normal Makefile.ams.
+ for_test=false
+
+ # Setup list of Makefile.am edits that are to be performed afterwards.
+ # Some of these edits apply to files that we will generate; others are
+ # under the responsibility of the developer.
+ makefile_am_edits=0
+ # func_note_Makefile_am_edit dir var value
+ # remembers that ${dir}Makefile.am needs to be edited to that ${var} mentions
+ # ${value}.
+ func_note_Makefile_am_edit ()
+ {
+ makefile_am_edits=`expr $makefile_am_edits + 1`
+ eval makefile_am_edit${makefile_am_edits}_dir=\"\$1\"
+ eval makefile_am_edit${makefile_am_edits}_var=\"\$2\"
+ eval makefile_am_edit${makefile_am_edits}_val=\"\$3\"
+ }
+ if test "$makefile_am" = Makefile.am; then
+ sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
+ sourcebase_base=`basename "$sourcebase"`
+ func_note_Makefile_am_edit "$sourcebase_dir" SUBDIRS "$sourcebase_base"
+ fi
+ if test -n "$pobase"; then
+ pobase_dir=`echo "$pobase" | sed -n -e 's,/[^/]*$,/,p'`
+ pobase_base=`basename "$pobase"`
+ func_note_Makefile_am_edit "$pobase_dir" SUBDIRS "$pobase_base"
+ fi
+ if test -n "$inctests"; then
+ if test "$makefile_am" = Makefile.am; then
+ testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
+ testsbase_base=`basename "$testsbase"`
+ func_note_Makefile_am_edit "$testsbase_dir" SUBDIRS "$testsbase_base"
+ fi
+ fi
+ func_note_Makefile_am_edit "" ACLOCAL_AMFLAGS "-I ${m4base}"
+ {
+ # Find the first parent directory of $m4base that contains or will contain
+ # a Makefile.am.
+ sed_last='s,^.*/\([^/][^/]*\)//*$,\1/,
+s,//*$,/,'
+ sed_butlast='s,[^/][^/]*//*$,,'
+ dir1="${m4base}/"; dir2=""
+ while test -n "$dir1" \
+ && ! { test -f "${destdir}/${dir1}Makefile.am" \
+ || test "${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
+ || test "./${dir1}Makefile.am" = "$sourcebase/$makefile_am" \
+ || { test -n "$inctests" \
+ && { test "${dir1}Makefile.am" = "$testsbase/$makefile_am" \
+ || test "./${dir1}Makefile.am" = "$testsbase/$makefile_am"; }; }; }; do
+ dir2=`echo "$dir1" | sed -e "$sed_last"`"$dir2"
+ dir1=`echo "$dir1" | sed -e "$sed_butlast"`
+ done
+ func_note_Makefile_am_edit "$dir1" EXTRA_DIST "${dir2}gnulib-cache.m4"
+ }
+
+ # Create library makefile.
+ func_dest_tmpfilename $sourcebase/$makefile_am
+ destfile="$sourcebase/$makefile_am"
+ modules="$main_modules"
+ func_emit_lib_Makefile_am > "$tmpfile"
+ if test -f "$destdir"/$sourcebase/$makefile_am; then
+ if cmp "$destdir"/$sourcebase/$makefile_am "$tmpfile" > /dev/null; then
+ rm -f "$tmpfile"
+ else
+ if $doit; then
+ echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
+ mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
+ mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
+ else
+ echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
+ rm -f "$tmpfile"
+ fi
+ fi
+ else
+ if $doit; then
+ echo "Creating $sourcebase/$makefile_am"
+ mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
+ else
+ echo "Create $sourcebase/$makefile_am"
+ rm -f "$tmpfile"
+ fi
+ func_append added_files "$sourcebase/$makefile_am$nl"
+ fi
+
+ # Create po/ directory.
+ if test -n "$pobase"; then
+ # Create po makefile and auxiliary files.
+ for file in Makefile.in.in remove-potcdate.sin; do
+ func_dest_tmpfilename $pobase/$file
+ func_lookup_file build-aux/po/$file
+ cat "$lookedup_file" > "$tmpfile"
+ if test -f "$destdir"/$pobase/$file; then
+ if cmp "$destdir"/$pobase/$file "$tmpfile" > /dev/null; then
+ rm -f "$tmpfile"
+ else
+ if $doit; then
+ echo "Updating $pobase/$file (backup in $pobase/$file~)"
+ mv -f "$destdir"/$pobase/$file "$destdir"/$pobase/$file~
+ mv -f "$tmpfile" "$destdir"/$pobase/$file
+ else
+ echo "Update $pobase/$file (backup in $pobase/$file~)"
+ rm -f "$tmpfile"
+ fi
+ fi
+ else
+ if $doit; then
+ echo "Creating $pobase/$file"
+ mv -f "$tmpfile" "$destdir"/$pobase/$file
+ else
+ echo "Create $pobase/$file"
+ rm -f "$tmpfile"
+ fi
+ func_append added_files "$pobase/$file$nl"
+ fi
+ done
+ # Create po makefile parameterization, part 1.
+ func_dest_tmpfilename $pobase/Makevars
+ func_emit_po_Makevars > "$tmpfile"
+ if test -f "$destdir"/$pobase/Makevars; then
+ if cmp "$destdir"/$pobase/Makevars "$tmpfile" > /dev/null; then
+ rm -f "$tmpfile"
+ else
+ if $doit; then
+ echo "Updating $pobase/Makevars (backup in $pobase/Makevars~)"
+ mv -f "$destdir"/$pobase/Makevars "$destdir"/$pobase/Makevars~
+ mv -f "$tmpfile" "$destdir"/$pobase/Makevars
+ else
+ echo "Update $pobase/Makevars (backup in $pobase/Makevars~)"
+ rm -f "$tmpfile"
+ fi
+ fi
+ else
+ if $doit; then
+ echo "Creating $pobase/Makevars"
+ mv -f "$tmpfile" "$destdir"/$pobase/Makevars
+ else
+ echo "Create $pobase/Makevars"
+ rm -f "$tmpfile"
+ fi
+ func_append added_files "$pobase/Makevars$nl"
+ fi
+ # Create po makefile parameterization, part 2.
+ func_dest_tmpfilename $pobase/POTFILES.in
+ func_emit_po_POTFILES_in > "$tmpfile"
+ if test -f "$destdir"/$pobase/POTFILES.in; then
+ if cmp "$destdir"/$pobase/POTFILES.in "$tmpfile" > /dev/null; then
+ rm -f "$tmpfile"
+ else
+ if $doit; then
+ echo "Updating $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
+ mv -f "$destdir"/$pobase/POTFILES.in "$destdir"/$pobase/POTFILES.in~
+ mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.in
+ else
+ echo "Update $pobase/POTFILES.in (backup in $pobase/POTFILES.in~)"
+ rm -f "$tmpfile"
+ fi
+ fi
+ else
+ if $doit; then
+ echo "Creating $pobase/POTFILES.in"
+ mv -f "$tmpfile" "$destdir"/$pobase/POTFILES.in
+ else
+ echo "Create $pobase/POTFILES.in"
+ rm -f "$tmpfile"
+ fi
+ func_append added_files "$pobase/POTFILES.in$nl"
+ fi
+ # Fetch PO files.
+ TP_URL="http://translationproject.org/latest/"
+ TP_RSYNC_URI="translationproject.org::tp/latest/"
+ if $doit; then
+ echo "Fetching gnulib PO files from $TP_URL"
+ (cd "$destdir"/$pobase \
+ && { # Prefer rsync over wget if it is available, since it consumes
+ # less network bandwidth, due to compression.
+ if type rsync 2>/dev/null | grep / > /dev/null; then
+ rsync -Lrtz "${TP_RSYNC_URI}gnulib/" .
+ else
+ wget --quiet -r -l1 -nd -np -A.po "${TP_URL}gnulib"
+ fi
+ }
+ )
+ else
+ echo "Fetch gnulib PO files from $TP_URL"
+ fi
+ # Create po/LINGUAS.
+ if $doit; then
+ func_dest_tmpfilename $pobase/LINGUAS
+ (cd "$destdir"/$pobase \
+ && { echo '# Set of available languages.'
+ LC_ALL=C ls -1 *.po | sed -e 's,\.po$,,'
+ }
+ ) > "$tmpfile"
+ if test -f "$destdir"/$pobase/LINGUAS; then
+ if cmp "$destdir"/$pobase/LINGUAS "$tmpfile" > /dev/null; then
+ rm -f "$tmpfile"
+ else
+ echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
+ mv -f "$destdir"/$pobase/LINGUAS "$destdir"/$pobase/LINGUAS~
+ mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
+ fi
+ else
+ echo "Creating $pobase/LINGUAS"
+ mv -f "$tmpfile" "$destdir"/$pobase/LINGUAS
+ func_append added_files "$pobase/LINGUAS$nl"
+ fi
+ else
+ if test -f "$destdir"/$pobase/LINGUAS; then
+ echo "Update $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
+ else
+ echo "Create $pobase/LINGUAS"
+ fi
+ fi
+ fi