Remove incorrect comment.
[gnulib.git] / gnulib-tool
index f196451..83d6528 100755 (executable)
@@ -22,7 +22,7 @@
 
 progname=$0
 package=gnulib
-cvsdatestamp='$Date: 2006-10-12 12:33:50 $'
+cvsdatestamp='$Date: 2006-10-23 11:25:20 $'
 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
 nl='
@@ -678,7 +678,7 @@ func_relconcat ()
   # m4base (to avoid an error in func_import) and optional for the others.
   sed_trimtrailingslashes='s,\([^/]\)//*$,\1,'
   case "$local_gnulib_dir" in
-    */ ) sourcebase=`echo "$local_gnulib_dir" | sed -e "$sed_trimtrailingslashes"` ;;
+    */ ) local_gnulib_dir=`echo "$local_gnulib_dir" | sed -e "$sed_trimtrailingslashes"` ;;
   esac
   case "$sourcebase" in
     */ ) sourcebase=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
@@ -907,6 +907,41 @@ func_get_automake_snippet ()
 {
   func_lookup_file "modules/$1"
   sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
+  case "$1" in
+    *-tests)
+      # *-tests module live in tests/, not lib/.
+      ;;
+    *)
+      # Synthesize an EXTRA_DIST augmentation.
+      sed_combine_lines='/\\$/{
+        :a
+        N
+        s/\\\
+//
+        s/\\$/\\/
+        ta
+      }'
+      sed_extract_mentioned_files='s/^lib_SOURCES[     ]*+=[   ]*//p'
+      already_mentioned_files=` \
+        sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file" \
+        | sed -e "$sed_combine_lines" \
+        | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
+      all_files=`func_get_filelist $1`
+      lib_files=`for f in $all_files; do \
+                   case $f in \
+                     lib/*) echo $f ;; \
+                   esac; \
+                 done | sed -e 's,^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
+      ;;
+  esac
 }
 
 # func_get_include_directive module
@@ -1179,12 +1214,11 @@ func_emit_lib_Makefile_am ()
   cat allsnippets.tmp
   echo
   echo "mostlyclean-local: mostlyclean-generic"
-  echo "       @test -z \"\$(MOSTLYCLEANDIRS)\" || \\"
-  echo "         for dir in \$(MOSTLYCLEANDIRS); do \\"
-  echo "           if test -d \$\$dir; then \\"
-  echo "             echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
-  echo "           fi; \\"
-  echo "         done"
+  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"
   rm -f allsnippets.tmp
 }
 
@@ -1282,12 +1316,11 @@ func_emit_tests_Makefile_am ()
   echo "       rm -rf SunWS_cache"
   echo
   echo "mostlyclean-local: mostlyclean-generic"
-  echo "       @test -z \"\$(MOSTLYCLEANDIRS)\" || \\"
-  echo "         for dir in \$(MOSTLYCLEANDIRS); do \\"
-  echo "           if test -d \$\$dir; then \\"
-  echo "             echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
-  echo "           fi; \\"
-  echo "         done"
+  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"
   rm -f allsnippets.tmp
 }
 
@@ -1311,10 +1344,9 @@ func_emit_initmacro_end ()
   echo "    ${macro_prefix}_libobjs="
   echo "    ${macro_prefix}_ltlibobjs="
   echo "    if test -n \"\$${macro_prefix}_LIBOBJS\"; then"
-  echo "      for i in \$${macro_prefix}_LIBOBJS; do"
-  echo "        # Remove the extension."
-  echo "        sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
-  echo "        i=\`echo \"\$i\" | sed \"\$sed_drop_objext\"\`"
+  echo "      # Remove the extension."
+  echo "      sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
+  echo "      for i in \`for i in \$${macro_prefix}_LIBOBJS; do echo \"\$i\"; done | sed \"\$sed_drop_objext\" | sort | uniq\`; do"
   echo "        ${macro_prefix}_libobjs=\"\$${macro_prefix}_libobjs \$i.\$ac_objext\""
   echo "        ${macro_prefix}_ltlibobjs=\"\$${macro_prefix}_ltlibobjs \$i.lo\""
   echo "      done"
@@ -2127,8 +2159,9 @@ func_create_testdir ()
     # All modules together.
     # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
     # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
+    # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
     modules=`func_all_modules`
-    modules=`for m in $modules; do if test $m != config-h && test $m != fnmatch-posix; then echo $m; fi; done`
+    modules=`for m in $modules; do case $m in config-h | fnmatch-posix | ftruncate | mountlist) ;; *) echo $m;; esac; done`
   fi
   modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u`