autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Improving autoscan: help!


From: Akim Demaille
Subject: Improving autoscan: help!
Date: 25 Jan 2001 18:28:57 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Crater Lake)

Running autoscan on (configured) CVS Automake gives:

warning: missing AC_CHECK_HEADERS([malloc.h]) wanted by: ansi2knr.c:157
warning: missing AC_CHECK_HEADERS([stdlib.h]) wanted by: ansi2knr.c:150
warning: missing AC_CHECK_HEADERS([string.h]) wanted by: ansi2knr.c:128 
ansi2knr.c:143
warning: missing AC_CHECK_HEADERS([strings.h]) wanted by: ansi2knr.c:130 
ansi2knr.c:138
warning: missing AC_FUNC_MALLOC wanted by: ansi2knr.c:160 ansi2knr.c:163 
ansi2knr.c:279 ansi2knr.c:518

I'd say we should have a special comment/tag to include in some files
to tell autoscan they handle their portability by themselves.  But of
course, in this case, we can also teach autoscan about ansi2knr.

warning: missing AC_PROG_CC wanted by: ansi2knr.c

Arg.  Anyway, we will have to special case ansi2knr.c, or to find a
means to tell autoscan there are files which are only *distributed*,
and not necessarily compiled by the package,

warning: missing AC_PROG_LEX wanted by: tests/Makefile.in:209 m4/Makefile.in:77
warning: missing AC_PROG_RANLIB wanted by: tests/Makefile.in:274
warning: missing AC_PROG_YACC wanted by: tests/Makefile.in:334

Huh?

~/src/am % sed -n '209p;274p;334p' tests/Makefile.in             nostromo 18:04
lex.test \
ranlib.test \
yacc.test \

Ah ah ah!  The definition of TESTS.

So I'd say the splitting of words in Makefiles in somewhat wrong:

  | sub scan_makefile
  | {
  |   my ($file) = @_;
  | 
  |   open(MFILE, "<$file") || die "$me: cannot open $file: $!\n";
  |   while (<MFILE>)
  |     {
  |       # Strip out comments and variable references.
  |       s/#.*//;
  |       s/\$\([^\)]*\)//g;
  |       s/\${[^\}]*}//g;
  |       s/@address@hidden@//g;
  | 
  |       # Variable assignments.
  |       while (s/\b([a-zA-Z_]\w*)\s*=/ /)

Should this include dots too?  And `-'?  But then, we can't use \b.

  |         {
  |           push (@{$makevars{$1}}, "$file:$.");
  |         }
  |       # Libraries.
  |       while (s/\B-l([a-zA-Z_]\w*)\b/ /)

Huh?  I don't understand the \B here.  Why not \b???

  |         {
  |           push (@{$libraries{$1}}, "$file:$.");
  |         }
  |       # Tokens in the code.
  |       while (s/\b([a-zA-Z_]\w*)\b/ /)

This is the culprit for lex, ranlib and yacc.  I'm no perlre expert,
but my RTFMing tells me it should be something like:

      while (s/(?<![^\w.])([a-zA-Z_][\w.]*)(?![^\w.])/ /)


  |         {
  |           push (@{$programs{$1}}, "$file:$.");
  |         }
  |     }
  |   close(MFILE);

and indeed it gives

~/src/am % ../ace/autoscan2 -A ../ace
warning: missing AC_CHECK_HEADERS([malloc.h]) wanted by: ansi2knr.c:157
warning: missing AC_CHECK_HEADERS([stdlib.h]) wanted by: ansi2knr.c:150
warning: missing AC_CHECK_HEADERS([string.h]) wanted by: ansi2knr.c:128 
ansi2knr.c:143
warning: missing AC_CHECK_HEADERS([strings.h]) wanted by: ansi2knr.c:130 
ansi2knr.c:138
warning: missing AC_FUNC_MALLOC wanted by: ansi2knr.c:160 ansi2knr.c:163 
ansi2knr.c:279 ansi2knr.c:518
warning: missing AC_PROG_CC wanted by: ansi2knr.c

but if some perlre expert could give some help/advices...  In
particular I would have enjoyed being able either to change the
meaning of \w (hence of \b), or to introduce new \k or whatever, but
without finding anything in the doc.

Or maybe change the strategy using the right `split' and loop over the
result?

  |       # Variable assignments.
  |       if (s/\b([a-zA-Z_]\w*)\s*=/ /)

`if', not `while'.

  |         {
  |           push (@{$makevars{$1}}, "$file:$.");
  |         }
  |       foreach (split (/\s/))
  |         if     (/^-l(\w+)$/) # is lib
  |         elsif  (/^([\w.]+)$/)   # is program

???






Finally, the current strategy for Makefiles is: ``if there are
Makefile.in and Makefile, scan only Makefile.in''.  Should we add ``if
there are Makefile.am and Makefile.in browse only Makefile.am
expecting automake to have handled its own portability issues in
aclocal.m4''?  Ie, just require AM_INIT_AUTOMAKE.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]