automake
[Top][All Lists]
Advanced

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

Re: amtraces


From: Akim Demaille
Subject: Re: amtraces
Date: 03 Feb 2001 14:56:18 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Crater Lake)

"Derek R. Price" <address@hidden> writes:

Hi Derek, a few more comments on the fly.  I have not played with your
patch yet.

All these comments are related to the same idea: Automake must know as
less as possible about macros.  It means that if needed, we have to
equip Autoconf with macros which give a generic means to specify
former specialized knowledge, we have to equip existing macros
(Autoconf and Automake) with invocations to these macros etc.

Also, since next Automake will *require* next Autoconf, it is a
perfect moment for making simplifications in both.

Another aspect of the comment is: drop dead old macros.  Autoconf by
itself provides the binding to the newer macros, so trace only *new*
macros.  Here is an example of what I mean:

~/src/ace % echo "AC_INIT AC_CANONICAL_SYSTEM" | ace -t AC_CANONICAL_SYSTEM -t 
AC_CANONICAL_HOST -        
/tmp/ac23991/stdin:1:AC_CANONICAL_SYSTEM:
/tmp/ac23991/stdin:1:AC_CANONICAL_HOST:

i.e., drop AC_CANONICAL_SYSTEM *dead*.


> +    # Some things required by Automake.
> +    AC_ARG_PROGRAM => sub { $seen_arg_prog = $_[0] },

Hm, I'm in favor of having AC_ARG_PROGRAM always run.  I see no use in
having only partial support for this option across configures.  In
addition, AM_INIT_AUTOMAKE, IIRC, calls it by itself.

Pavel, Alexandre, any problem with integrating AC_ARG_PROGRAM in AC_INIT?


> +    AM_C_PROTOTYPES => sub { $am_c_prototypes = $_[0] },

Should be moved to an Autoconf macro.


> +    AC_CANONICAL_HOST => \&scan_autoconf_traces_AC_CANONICAL_HOST,
> +    AC_CANONICAL_SYSTEM => sub { $seen_canonical = $AC_CANONICAL_SYSTEM },

Drop this guy dead.

> +    AC_CHECK_TOOL => \&scan_autoconf_traces_AC_CANONICAL_HOST,

Sounds wrong: you don't need AC_CANONICAL_HOST to use AC_CHECK_TOOL.

> +    AM_CONDITIONAL => sub { $configure_cond{$_[2]} = $_[0] },
> +    AC_CONFIG_AUX_DIR => sub { @config_aux_path = $_[2] },

This macro gives too many problem.  Alexandre D. knows what I'm
referring to, I'd like him to start a thread in autoconf@ about this.


> +    AC_CONFIG_FILES => sub { &scan_autoconf_config_files ($_[2]) },
> +    # Handle configuration headers
> +    AC_CONFIG_HEADER => \&scan_autoconf_traces_AC_CONFIG_HEADER,
> +    AC_CONFIG_HEADERS => \&scan_autoconf_traces_AC_CONFIG_HEADER,
> +    AM_CONFIG_HEADER => \&scan_autoconf_traces_AM_CONFIG_HEADER,

Nope, they all point to only AC_CONFIG_HEADERS.  Don't trace the others.

> +    AC_DECL_YYTEXT =>
> +     sub { unless ($seen_decl_yytext eq $_[0])
> +           {
> +             $seen_decl_yytext = $_[0];
> +             &am_conf_line_warning (
> +                 split (/:/, $_[0]),
> +                 "\`AC_DECL_YYTEXT' is covered by \`AM_PROG_LEX'");
> +           }
> +         },

No longer exists, there is only AC_PROG_LEX which includes this.
AM_PROG_LEX is deprecated.


> +    AM_ENABLE_MULTILIB => sub { $seen_multilib = $_[0] },
> +    AC_EXEEXT => sub { $seen_exeext = 1 },

No longer exists, exeext is always computed when there is some
compilation involved, i.e., when Automake wants to use exeext and
obkext, don't check for them: they've been checked for.  Or just look
at $ac_subst{EXEEXT}.

> +    # Check for NLS support.
> +    AM_GNU_GETTEXT =>
> +     sub { # FIXME: eliminate redundant $ac_gettext_line
> +           $seen_gettext = $_[0];
> +           $ac_gettext_line = (split /:/, $_[0])[1];
> +         },

Why does it need to know this?  Hm, will look into the details some day.

> +    # This macro handles several different things.
> +    AM_INIT_AUTOMAKE =>
> +     sub { $seen_make_set = $_[0];
> +           $seen_arg_prog = $_[0];
> +           $seen_prog_install = $_[0];
> +           $package_version = $_[3];
> +           $package_version_line = (split /:/, $_[0])[2];
> +           $seen_init_automake = $_[0];
> +         },

Not good: --trace looks inside, you don't need to know how
AM_INIT_AUTOMAKE is written and what it does.  And now the proper
means to set the name/version of a package is via AC_INIT, more
precisely tracing _AC_INIT_PACKAGE.  Note that we can introduce a
macro just to ask for the value of an Autoconf macro:


/tmp % cat configure.ac                                          nostromo 14:40
AC_INIT(GNU Hello, 1.0)

m4_define([_AC_TRACE])
m4_define([AC_TRACE], [_AC_TRACE(m4_defn([$1]))])

AC_TRACE([AC_PACKAGE_NAME])
AC_TRACE([AC_PACKAGE_TARNAME])
AC_TRACE([AC_PACKAGE_STRING])
AC_TRACE([AC_PACKAGE_VERSION])
/tmp % ace -t _AC_TRACE                                          nostromo 14:40
configure.ac:6:_AC_TRACE:GNU Hello
configure.ac:7:_AC_TRACE:hello
configure.ac:8:_AC_TRACE:GNU Hello 1.0
configure.ac:9:_AC_TRACE:1.0


We can put here and there calls to AC_TRACE to announce variables.  Or
just declare an m4_define specialized in ``broadcasted'' variables.


> +    AC_LIBOBJ => sub { $libsources{"$_[2].c"} = $_[0] },
> +    _AC_LIBOBJ_DECL =>
> +     sub { $libsources{"$_[1].c"} = $_[0]
> +             unless defined $libsources{"$_[2].c"};
> +         },

FYI, I applied this to Autoconf:

2001-02-03  Akim Demaille  <address@hidden>

        * acfunctions.m4 (AC_FUNC_ERROR_AT_LINE, AC_FUNC_ONSTACK): Use
        AC_LIBSOURCES.

2001-02-03  Akim Demaille  <address@hidden>

        * acgeneral.m4 (AC_LIBOBJ_DECL): Remove.
        (AC_LIBSOURCES, AC_LIBSOURCE): New.


> +    AM_MAINTAINER_MODE =>
> +     sub { $seen_maint_mode = $_[0];
> +           $configure_cond{'MAINTAINER_MODE'} = $_[0];
> +         },

How about finally dropping support of this feature in the next-next
Automake?  :)


> +    AC_OBJEXT => sub { $seen_objext = 1 },

Same as exeext.


> +    # Like AC_CONFIG_FILES
> +    AC_OUTPUT => sub { &scan_autoconf_config_files ($_[2]) },

Nope, AC_OUTPUT dispatches its args to AC_CONFIG_FILES.  Great care
was taken precisely for this use of --trace: old macros points to
newer macros, i.e., it is Autoconf and Autoconf only that deals with
obsoleted macros.


> +    AC_PROG_LEX =>
> +     sub { &am_conf_line_warning (
> +               split (/:/, $_[0]),
> +               "automake requires \`AM_PROG_LEX', not \`AC_PROG_LEX'")
> +           unless ($seen_decl_yytext eq $_[0]);
> +         },
> +    AM_PROG_LEX => sub { $seen_decl_yytext = $_[0] },

See above.

> +    AC_PROG_LIBTOOL =>
> +     sub { $seen_libtool = $_[0];
> +           $libtool_line = (split /:/, $_[0])[1];
> +         },
> +    AM_PROG_LIBTOOL =>
> +     sub { &am_conf_line_warning (
> +             split (/:/, $_[0]),
> +             "\`AM_PROG_LIBTOOL' is obsolete, use \`AC_PROG_LIBTOOL' instead"
> +           );
> +           # FIXME: should we really be preserving AC_PROG_LIBTOOL behavior
> +           # below?
> +           $seen_libtool = $_[0];
> +           $libtool_line = (split /:/, $_[0])[1];
> +         },

We really have to clean up the Libtool macros :(


> +    AC_PROG_INSTALL => sub { $seen_prog_install = $_[0] },

Tracing AC_SUBST(INSTALL) seems way enough.  Let's factor!

> +    AC_PROG_MAKE_SET => sub { $seen_make_set = $_[0] },

Same.

> +    AC_REPLACE_FUNCS =>
> +     sub { foreach (split /\s/, $_[2])
> +           { $libsources{$_ . '.c'} = $_[0] }
> +         },

Don't: AC_REPLACE_FUNCS is invoking AC_LIBOBJ which point is exactly
to relieve Automake from having to know about AC_REPLACE_FUNCS.


> +    AC_SUBST =>
> +     sub { $configure_vars{$_[2]} = $_[0]
> +           unless defined $configure_vars{$_[2]};
> +         },
> +    # Populate libobjs array.
> +    # This section is an exception to the alphabetical ordering
> +    AC_FUNC_ALLOCA => sub { $libsources{'alloca.c'} = $_[0] },

Same, not needed.


> +    AM_FUNC_ERROR_AT_LINE =>
> +     sub { $libsources{'error.c'} = $_[0];
> +           $libsources{'error.h'} = $_[0];
> +         },

Same, not needed since this morning :)



> +    AC_FUNC_GETLOADAVG => sub { $libsources{'getloadavg.c'} = $_[0] },
> +    AC_FUNC_MEMCMP => sub { $libsources{'memcmp.c'} = $_[0] },
> +    AC_FUNC_MKTIME => sub { $libsources{'mktime.c'} = $_[0] },
> +    AM_FUNC_OBSTACK =>
> +     sub { $libsources{'obstack.c'} = $_[0];
> +           $libsources{'obstack.h'} = $_[0];
> +         },
> +    AM_FUNC_STRTOD => sub { $libsources{'strtod.c'} = $_[0] },
> +    AC_REPLACE_GNU_GETOPT =>
> +     sub { $libsources{'getopt.c'} = $_[0];
> +           $libsources{'getopt1.c'} = $_[0];
> +         },
> +    AM_REPLACE_GNU_GETOPT =>
> +     sub { $libsources{'getopt.c'} = $_[0];
> +           $libsources{'getopt1.c'} = $_[0];
> +         },
> +    AC_STRUCT_ST_BLOCKS => sub { $libsources{'fileblocks.c'} = $_[0] },
> +    AM_WITH_REGEX =>
> +     sub { $libsources{'rx.c'} = $_[0];
> +           $libsources{'rx.h'} = $_[0];
> +           $libsources{'regex.c'} = $_[0];
> +           $libsources{'regex.h'} = $_[0];
> +         },
> +);

We have to check each Automake and Autoconf macros which requires some
file, and make this ad hoc code useless.  AFAIR, these macros are
AC_REPLACE_FUNCSing, so this code is already useless.



> +sub scan_autoconf_traces_AC_CONFIG_HEADER
> +{
> +    # make pattern safe
> +    $_[2] =~ s/\W/\\$&/;
> +    &am_conf_line_error
> +         (split (/:/, $_[0]),
> +          "\`automake requires \`AM_CONFIG_HEADER', not \`AC_CONFIG_HEADER'")
> +     # but make sure we're not called from AM_CONFIG_HEADER
> +     unless grep /^$_[2]$/, @config_fullnames;
> +}

Hm, we should find a means to make AM_CONFIG_HEADER an obsolete
concept :(  Maybe 2.51, not 2.50.


> +    foreach $traced (keys %traced_macro_function)
> +    {
> +     # FIXME: I imagine we'll run into the system argument
> +     # length limits eventually...

Good call :( But then, we are doomed, because (watch your step),
although it seems that obviously autoconf can have an option to read
the trace requests from a file, and, instead of using the -t option of
m4 to use the traceon macros (so finally we never have a command line
which length depends upon the number of things to trace), so in spite
of the fact that the solution seems obvious, ISTR there are some
difference between -t and traceon which can hurt us.

But if this problem actually happens, there is a way out.  Just
adjustments will be needed.


> -        local ($file, $line, $macro, @args) = split /:/;
> +     /^([^:]*):([^:]*):([^:]*):/;
> +        local ($file, $line, $macro, $rest) = ($1, $2, $3, $');

Why do you prefer this?

Let's use `local' for what's not local, and `my' for what is!  :)






I think we are doing real good!  Your work is exiting...  Please, fill
the papers real fast.  If I were you, at the same time I'd sign those
for Autoconf.  You'll probably want to introduce generic macros for traces.



reply via email to

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