* gnulib-tool (nl): New variable. (func_import): Rewrite include directive extraction to only read each directive once. Index: gnulib-tool =================================================================== RCS file: /cvsroot/gnulib/gnulib/gnulib-tool,v retrieving revision 1.160 diff -u -r1.160 gnulib-tool --- gnulib-tool 13 Sep 2006 15:00:47 -0000 1.160 +++ gnulib-tool 14 Sep 2006 22:57:12 -0000 @@ -25,6 +25,8 @@ cvsdatestamp='$Date: 2006/09/13 15:00:47 $' last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'` version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'` +nl=' +' # You can set AUTOCONFPATH to empty if autoconf 2.57 is already in your PATH. AUTOCONFPATH= @@ -1949,29 +1944,30 @@ echo echo "You may need to add #include directives for the following .h files." ( - # First the #include <...> directives without #ifs, sorted for convenience. + # First the #include <...> directives without #ifs, sorted for convenience, + # then the #include "..." directives without #ifs, sorted for convenience, + # then the #include directives that are surrounded by #ifs. Not sorted. + : >"$tmp"/include-lt + : >"$tmp"/include-q + : >"$tmp"/include-if for module in $modules; do - if func_get_include_directive "$module" | grep '^#if' >/dev/null; then - : - else - func_get_include_directive "$module" | grep -v 'include "' - fi - done | LC_ALL=C sort -u - # Then the #include "..." directives without #ifs, sorted for convenience. - for module in $modules; do - if func_get_include_directive "$module" | grep '^#if' >/dev/null; then - : - else - func_get_include_directive "$module" | grep 'include "' - fi - done | LC_ALL=C sort -u - # Then the #include directives that are surrounded by #ifs. Not sorted. - for module in $modules; do - if func_get_include_directive "$module" | grep '^#if' >/dev/null; then - func_get_include_directive "$module" - fi + include_directive=`func_get_include_directive "$module"` + case $nl$include_directive in + *$nl\#if*) + echo "$include_directive" >> "$tmp"/include-if + ;; + *) + echo "$include_directive" | grep -v 'include "' >>"$tmp"/include-lt + echo "$include_directive" | grep 'include "' >>"$tmp"/include-q + ;; + esac done - ) | sed -e '/^$/d;' -e 's/^/ /' + LC_ALL=C sort -u "$tmp"/include-lt + LC_ALL=C sort -u "$tmp"/include-q + cat "$tmp"/include-if + ) | sed -e '/^$/d' -e 's/^/ /' + rm -f "$tmp"/include-lt "$tmp"/include-q "$tmp"/include-if + echo echo "Don't forget to" if test "$makefile_am" = Makefile.am; then