automake-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] New tests on obsoleted usages of automake/autoconf macros.


From: Ralf Wildenhues
Subject: Re: [PATCH] New tests on obsoleted usages of automake/autoconf macros.
Date: Thu, 17 Jun 2010 21:27:44 +0200
User-agent: Mutt/1.5.20 (2010-04-22)

Hi Stefano,

* Stefano Lattarini wrote on Sat, Jun 12, 2010 at 11:31:57PM CEST:
> New tests on obsoleted usages of automake/autoconf macros (as
> AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT).

I have some detail questions about these tests, below.
Thanks for working on them!

Cheers,
Ralf

> --- /dev/null
> +++ b/tests/backcompat2.test

> @@ -0,0 +1,69 @@
> +# A trick to make the test run muuuch faster, by avoiding repeated
> +# runs of aclocal (one order of magnitude improvement in speed!).
> +echo 'AC_INIT(x,0) AM_INIT_AUTOMAKE' >configure.in
> +$ACLOCAL

Hmm, does that mean this test completely relies on caching?
You probably need a $sleep or "rm -rf autom4te.cache" before
each of the following edits to configure.in, to avoid autotools
operating on old cached transformations of the file.  Am I overlooking
something here?

> +rm -f configure.in
> +
> +cat > config.h.in <<'END'
> +#undef PACKAGE
> +#undef VERSION
> +END
> +
> +for am_arg3 in ':' 'false' '#' ' '; do
> +  cat > configure.in <<END
> +AC_INIT
> +AC_CONFIG_HEADERS([config.h])
> +AM_INIT_AUTOMAKE([pkgname], [pkgversion], [$am_arg3])
> +AC_OUTPUT
> +END
> +  cat configure.in # might be useful for debugging
> +  $AUTOCONF
> +  ./configure
> +  test -f config.h # sanity check
> +  cat config.h # might be useful for debugging
> +  # The non-empty third argument should prevent PACKAGE and VERSION
> +  # from being AC_DEFINE'd.
> +  $EGREP 'pkg(name|version)' config.h && Exit 1
> +done
> +
> +for am_extra_args in '' ',' ', []'; do
> +  cat > configure.in <<END
> +AC_INIT
> +AC_CONFIG_HEADERS([config.h])
> +AM_INIT_AUTOMAKE([pkgname], [pkgversion]$am_extra_args)
> +AC_OUTPUT
> +END
> +  cat configure.in # might be useful for debugging
> +  $AUTOCONF
> +  ./configure
> +  test -f config.h # sanity check
> +  cat config.h # might be useful for debugging
> +  grep '^ *# *define  *PACKAGE  *"pkgname" *$' config.h
> +  grep '^ *# *define  *VERSION  *"pkgversion" *$' config.h
> +done

> --- /dev/null
> +++ b/tests/backcompat3.test
> @@ -0,0 +1,144 @@

> +# Backward-compatibility test: check what happens when AC_INIT and
> +# AM_INIT_AUTOMAKE are both given two or more arguments.
> +
> +. ./defs || Exit 1
> +
> +set -e
> +
> +empty=''
> +
> +cat > Makefile.am <<'END'
> +got: Makefile
> +     @{ \

Please put ':;' before '{', see `info Autoconf "Limitations of
Builtins"' on {...}.

> +       echo 'PACKAGE = $(PACKAGE)'; \
> +       echo 'VERSION = $(VERSION)'; \
> +       echo 'PACKAGE_NAME = $(PACKAGE_NAME)'; \
> +       echo 'PACKAGE_VERSION = $(PACKAGE_VERSION)'; \
> +       echo 'PACKAGE_STRING = $(PACKAGE_STRING)'; \
> +       echo 'PACKAGE_TARNAME = $(PACKAGE_TARNAME)'; \
> +       echo 'PACKAGE_BUGREPORT = $(PACKAGE_BUGREPORT)'; \
> +       echo 'PACKAGE_URL = $(PACKAGE_URL)'; \

git Automake still aims to build with Autoconf 2.62, which didn't
provide PACKAGE_URL yet, that is only 2.64+.  Does this test work
with older Autoconf versions?

> +     } >$@
> +END
> +
> +
> +### Run 1 ###
> +
> +cat > configure.in <<END
> +AC_INIT([ac_name], [ac_version])
> +AM_INIT_AUTOMAKE([am_name], [am_version])
> +AC_CONFIG_FILES([Makefile])
> +AC_OUTPUT
> +END
> +
> +cat configure.in
> +
> +$ACLOCAL
> +$AUTOCONF
> +$AUTOMAKE
> +
> +./configure
> +
> +cat >exp <<END
> +PACKAGE = am_name
> +VERSION = am_version
> +PACKAGE_NAME = ac_name
> +PACKAGE_VERSION = ac_version
> +PACKAGE_STRING = ac_name ac_version
> +PACKAGE_TARNAME = ac_name
> +PACKAGE_BUGREPORT = $empty
> +PACKAGE_URL = $empty
> +END
> +
> +$MAKE got
> +
> +diff exp got
> +
> +
> +### Run 2 ###
> +
> +cat > configure.in <<END
> +AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname], [ac_url])
> +AM_INIT_AUTOMAKE([am_name], [am_version])
> +AC_CONFIG_FILES([Makefile])
> +AC_OUTPUT
> +END
> +
> +cat configure.in
> +
> +$ACLOCAL
> +$AUTOCONF
> +$AUTOMAKE
> +
> +./configure
> +
> +cat >exp <<END
> +PACKAGE = am_name
> +VERSION = am_version
> +PACKAGE_NAME = ac_name
> +PACKAGE_VERSION = ac_version
> +PACKAGE_STRING = ac_name ac_version
> +PACKAGE_TARNAME = ac_tarname
> +PACKAGE_BUGREPORT = ac_bugreport
> +PACKAGE_URL = ac_url
> +END
> +
> +$MAKE got
> +
> +diff exp got
> +
> +
> +### Run 3 ###
> +
> +cat > configure.in <<END
> +AC_INIT([ac_name], [ac_version])
> +AM_INIT_AUTOMAKE([am_name], [am_version], [am_foo_quux])
> +AC_CONFIG_FILES([Makefile])
> +AC_OUTPUT
> +END
> +
> +cat configure.in
> +
> +$ACLOCAL
> +$AUTOCONF
> +$AUTOMAKE
> +
> +./configure
> +
> +cat >exp <<END
> +PACKAGE = am_name
> +VERSION = am_version
> +PACKAGE_NAME = ac_name
> +PACKAGE_VERSION = ac_version
> +PACKAGE_STRING = ac_name ac_version
> +PACKAGE_TARNAME = ac_name
> +PACKAGE_BUGREPORT = $empty
> +PACKAGE_URL = $empty
> +END
> +
> +$MAKE got
> +
> +diff exp got
> +
> +$FGREP am_foo_quux Makefile.in Makefile configure config.status && Exit 1
> +
> +
> +### Done ###



> --- /dev/null
> +++ b/tests/backcompat6.test

> +# Anyone doing something like this in a real-life package probably
> +# deserves to be killed.

I'm not yet sure whether I really want this particular test.

> +cat > configure.in <<'END'
> +dnl. Everything here is *deliberately* underquoted!
> +AC_INIT(${me-xxx}.c) dnl. Hacky!
> +PACKAGE=nonesuch-${me-xxx} dnl. Hacky!
> +VERSION=nonesuch-0.1
> +AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
> +AC_SUBST(one,1)
> +two=2
> +AC_SUBST(two, $two)
> +three=3
> +AC_SUBST(three)
> +AC_PROG_CC
> +AC_CONFIG_HEADERS(config.h:config.hin)
> +AC_OUTPUT(Makefile foo.got:foo1.in:foo2.in:foo3.in)
> +END
> +
> +echo @one@ > foo1.in
> +echo @two@ > foo2.in
> +echo @three@ > foo3.in
> +
> +cat >config.hin <<'END'
> +#undef PACKAGE
> +#undef VERSION
> +END
> +
> +cat >> Makefile.am <<END
> +bin_PROGRAMS = foo
> +foo_SOURCES = $me.c
> +DISTCLEANFILES = *.tmp
> +check-local:
> +     rm -f exp got
> +     echo 'PACKAGE = nonesuch-$me' > exp.tmp
> +     echo 'VERSION = nonesuch-0.1'  >> exp.tmp
> +     echo 'PACKAGE = \$(PACKAGE)' > got1.tmp
> +     echo 'VERSION = \$(VERSION)' >> got1.tmp
> +     ./foo > got2.tmp
> +     cat exp.tmp
> +     cat got1.tmp
> +     cat got2.tmp
> +     diff exp.tmp got1.tmp
> +     diff exp.tmp got2.tmp
> +END
> +
> +cat > $me.c <<'END'
> +#include <config.h>
> +#include <stdio.h>
> +int main (void)
> +{
> +  printf("PACKAGE = %s\nVERSION = %s\n", PACKAGE, VERSION);
> +  return 0;
> +}
> +END
> +
> +$ACLOCAL
> +$AUTOMAKE
> +$AUTOCONF
> +
> +me=$me ./configure  # Hacky!
> +
> +cat >foo.exp <<'END'
> +1
> +2
> +3
> +END
> +
> +diff foo.exp foo.got
> +
> +$MAKE
> +$MAKE check
> +
> +distdir=nonesuch-$me-nonesuch-0.1
> +$MAKE distdir
> +test -f $distdir/$me.c
> +test ! -f $distdir/foo.got
> +
> +me=$me $MAKE distcheck  # Hacky!
> +
> +:
> diff --git a/tests/init.test b/tests/init.test
> index 38ec681..61a5b63 100755
> --- a/tests/init.test
> +++ b/tests/init.test
> @@ -1,5 +1,5 @@
>  #! /bin/sh
> -# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
> +# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
>  #
>  # This program is free software; you can redistribute it and/or modify
>  # it under the terms of the GNU General Public License as published by
> @@ -14,20 +14,27 @@
>  # You should have received a copy of the GNU General Public License
>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
>  
> -# Make sure we give a sensible error message when neither AC_INIT nor
> -# AM_INIT_AUTOMAKE are given arguments.
> +# Make sure we give a sensible error message when AC_INIT and
> +# AM_INIT_AUTOMAKE are both given less than two arguments.
>  
>  . ./defs || Exit 1
>  
>  set -e
>  
> -cat >configure.in <<END
> -AC_INIT
> -AM_INIT_AUTOMAKE
> +for ac_init_args in '' '([x])'; do
> +  for am_init_args in '' '([1.10])'; do
> +    rm -rf aclocal.m4 autom4ate*.cache

Typo autom4ate.

> +    cat >configure.in <<END
> +AC_INIT$ac_init_args
> +AM_INIT_AUTOMAKE$am_init_args
>  END
> +    cat configure.in # might be useful for debugging
> +    # The error message should mention AC_INIT, not AC_PACKAGE_VERSION.
> +    ($ACLOCAL && $AUTOCONF) 2>stderr && { cat stderr >&2; Exit 1; }
> +    cat stderr >&2
> +    $FGREP AC_PACKAGE_VERSION stderr && Exit 1
> +    grep 'configure\.in:.* AC_INIT .*arguments' stderr
> +  done
> +done
>  
> -# The error message should mension AC_INIT, not AC_PACKAGE_VERSION.
> -($ACLOCAL && $AUTOCONF) 2>stderr && { cat stderr >&2; Exit 1; }
> -cat stderr >&2
> -grep AC_PACKAGE_VERSION stderr && Exit 1
> -grep AC_INIT stderr
> +:



reply via email to

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