From: Stefano Lattarini Date: Tue, 31 Aug 2010 13:14:29 +0000 (+0200) Subject: Extend tests on AC_LIBOBJ and friends. X-Git-Tag: ng-0.5a~309^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88c5437de865d8d5574d12c1ba6256743987efc0;p=thirdparty%2Fautomake.git Extend tests on AC_LIBOBJ and friends. * tests/aclibobj.test: Removed, superseded by ... * tests/libobj1.test: ... this new test, which runs autoconf, ./configure and make, to ensure everything really works. * tests/libobj3.test: Add trailing `:' command. Quote literal dot in grep regexp. * tests/libobj4.test: Enable `errexit' shell flag, and related changes. Add trailing `:' command. Use proper m4 quoting. * tests/ltlibobjs.test: Likewise. * tests/libobj5.test: Enable `errexit' shell flag, and related changes. Add trailing `:' command. Make more robust by using longer filenames to be grepped. * tests/libobj8.test: Enable `errexit' shell flag, and related changes. Add trailing `:' command. Use the configure.in stub provided by ./defs, rather than writing it from scratch. * tests/libobj2.test: Likewise. Also, add calls to autoconf, ./configure and make, to ensure everything really works. * tests/libobj7.test: Likewise, and ensure that at least one function listed in AC_REPLACE_FUNCTIONS is truly replaced. * tests/libobj13.test: Make grepping of Automake stderr slighty stricter. Add trailing `:' command. * tests/libobj12.test: Likewise. Also, prefer "cat + here-doc" over "echo" to append to Makefile.am, and some cosmetic changes in spacing. * tests/libobj14.test: Call `Exit 1' if sourcing of ./defs fails. Slighty improve m4 quoting. Add trailing `:' command. * tests/libobj10.test: Add calls to autoconf, ./configure and make, to ensure everything really works. Also, remove tests that nonexistent source for AC_LIBOBJ cause an Automake failure: this is already checked by ... * tests/libobj15a.test: ... this new test. * tests/libobj15b.test: New test, sister test of libobj15a.test, checks AC_LIBSOURCE instead of AC_LIBOBJ. * tests/libobj15c.test: New test, sister test of libobj15a.test, checks AC_LIBSOURCES instead of AC_LIBOBJ. * tests/libobj11.test: Removed, superseded by ... * tests/libobj16a.test: ... this new test. * tests/libobj16b.test: New test, sister test of libobj16a.test, but using oldish/depracated idioms. * tests/libobj17.test: New test. * tests/libobj18.test: Likewise. * tests/libobj19.test: Likewise. * tests/libobj20a.test: Likewise. * tests/libobj20b.test: Likewise. * tests/libobj20c.test: Likewise. * tests/Makefile.am (TESTS): Updated. --- diff --git a/ChangeLog b/ChangeLog index e8864f125..59635e200 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,52 @@ +2010-12-09 Stefano Lattarini + + Extend tests on AC_LIBOBJ and friends. + * tests/aclibobj.test: Removed, superseded by ... + * tests/libobj-basic.test: ... this new test, which runs autoconf, + ./configure and make, to ensure everything really works. + * tests/libobj3.test: Add trailing `:' command. Escape literal + dot in grep regexp. + * tests/libobj4.test: Enable `errexit' shell flag, and related + changes. Add trailing `:' command. Use proper m4 quoting. + * tests/ltlibobjs.test: Likewise. + * tests/libobj5.test: Enable `errexit' shell flag, and related + changes. Add trailing `:' command. Make more robust by using + longer filenames to be grepped. + * tests/libobj8.test: Enable `errexit' shell flag, and related + changes. Add trailing `:' command. Use the configure.in + stub provided by ./defs, rather than writing it from scratch. + * tests/libobj2.test: Likewise. Also, add calls to autoconf, + ./configure and make, to ensure everything really works. + * tests/libobj7.test: Likewise, and ensure that at least one + function listed in AC_REPLACE_FUNCTIONS is truly replaced. + * tests/libobj13.test: Make grepping of Automake stderr slightly + stricter. Add trailing `:' command. + * tests/libobj12.test: Likewise. Also, prefer "cat + here-doc" + over "echo" to append to Makefile.am, and some cosmetic changes + in spacing. + * tests/libobj14.test: Call `Exit 1' if sourcing of ./defs fails. + Slighty improve m4 quoting. Add trailing `:' command. + * tests/libobj10.test: Add calls to autoconf, ./configure and + make, to ensure everything really works. Also, remove tests that + nonexistent source for AC_LIBOBJ cause an Automake failure: this + is already checked by ... + * tests/libobj15a.test: ... this new test. + * tests/libobj15b.test: New test, sister test of libobj15a.test, + checks AC_LIBSOURCE instead of AC_LIBOBJ. + * tests/libobj15c.test: New test, sister test of libobj15a.test, + checks AC_LIBSOURCES instead of AC_LIBOBJ. + * tests/libobj11.test: Removed, superseded by ... + * tests/libobj16a.test: ... this new test. + * tests/libobj16b.test: New test, sister test of libobj16a.test, + but using oldish/deprecated idioms. + * tests/libobj17.test: New test. + * tests/libobj18.test: Likewise. + * tests/libobj19.test: Likewise. + * tests/libobj20a.test: Likewise. + * tests/libobj20b.test: Likewise. + * tests/libobj20c.test: Likewise. + * tests/Makefile.am (TESTS): Updated. + 2010-11-25 Stefano Lattarini Fix spurious failures in `silent*.test' for $CC != gcc diff --git a/tests/Makefile.am b/tests/Makefile.am index dab04e393..e91551045 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -37,7 +37,6 @@ $(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am MAINTAINERCLEANFILES = $(parallel_tests) TESTS = \ -aclibobj.test \ aclocal.test \ aclocal3.test \ aclocal4.test \ @@ -416,6 +415,7 @@ lex5.test \ lflags.test \ lflags2.test \ libexec.test \ +libobj-basic.test \ libobj2.test \ libobj3.test \ libobj4.test \ @@ -423,10 +423,20 @@ libobj5.test \ libobj7.test \ libobj8.test \ libobj10.test \ -libobj11.test \ libobj12.test \ libobj13.test \ libobj14.test \ +libobj15a.test \ +libobj15b.test \ +libobj15c.test \ +libobj16a.test \ +libobj16b.test \ +libobj17.test \ +libobj18.test \ +libobj19.test \ +libobj20a.test \ +libobj20b.test \ +libobj20c.test \ library.test \ library2.test \ library3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index de21f4334..17b96916d 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -304,7 +304,6 @@ pr401c-p.test MAINTAINERCLEANFILES = $(parallel_tests) TESTS = \ -aclibobj.test \ aclocal.test \ aclocal3.test \ aclocal4.test \ @@ -683,6 +682,7 @@ lex5.test \ lflags.test \ lflags2.test \ libexec.test \ +libobj-basic.test \ libobj2.test \ libobj3.test \ libobj4.test \ @@ -690,10 +690,20 @@ libobj5.test \ libobj7.test \ libobj8.test \ libobj10.test \ -libobj11.test \ libobj12.test \ libobj13.test \ libobj14.test \ +libobj15a.test \ +libobj15b.test \ +libobj15c.test \ +libobj16a.test \ +libobj16b.test \ +libobj17.test \ +libobj18.test \ +libobj19.test \ +libobj20a.test \ +libobj20b.test \ +libobj20c.test \ library.test \ library2.test \ library3.test \ diff --git a/tests/libobj-basic.test b/tests/libobj-basic.test new file mode 100755 index 000000000..64b9c2bf9 --- /dev/null +++ b/tests/libobj-basic.test @@ -0,0 +1,110 @@ +#! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Make sure AC_LIBSOURCE and AC_LIBSOURCES work. + +. ./defs || Exit 1 + +set -e + +mv configure.in configure.proto +cat >> configure.proto << 'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_OUTPUT +END + +cat > Makefile.am << 'END' +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = foo.c +libtu_a_LIBADD = $(LIBOBJS) + +include extra-checks.am +.PHONY: $(extra_checks) pre-test + +pre-test: distdir + ls -l $(srcdir) $(builddir) $(distdir) + $(AR) tv libtu.a +$(extra_checks): pre-test +check-local: $(extra_checks) + +maude-src: + grep dummy_maude $(srcdir)/maude.c +maude-dist: + grep dummy_maude $(distdir)/maude.c +liver-src: + grep dummy_liver $(srcdir)/liver.c +liver-dist: + grep dummy_liver $(distdir)/liver.c +liver-not-dist: + test -d $(distdir) + test ! -r $(distdir)/liver.c +maude-not-dist: + test -d $(distdir) + test ! -r $(distdir)/maude.c +END + +cat > foo.c << 'END' +extern int dummy_foo; +END + +cat > maude.c << 'END' +extern int dummy_maude; +END + +cat > liver.c << 'END' +extern int dummy_liver; +END + +# AC_LIBSOURCE should work also if called after AC_OUTPUT. +cat configure.proto - > configure.in < extra-checks.am << 'END' +extra_checks = maude-src maude-dist liver-not-dist +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE +./configure + +$MAKE check +$MAKE distcheck + +$MAKE distclean +# Avoid timestamp-related differences. +rm -rf autom4te*.cache + +cat > extra-checks.am << 'END' +extra_checks = maude-src maude-dist liver-src liver-dist +END + +# AC_LIBSOURCES should work also if called after AC_OUTPUT. +cat configure.proto - > configure.in < Makefile.am << 'END' noinst_LIBRARIES = libfoo.a -libfoo_a_LIBADD = @LIBOBJS@ +libfoo_a_SOURCES = +libfoo_a_LIBADD = $(LIBOBJS) +BUILT_SOURCES = foo.c +CLEANFILES = foo.c +foo.c: + echo 'extern int dummy;' > $@ END $ACLOCAL -AUTOMAKE_fails -grep 'Makefile.am:2:.*foo\.c' stderr +$AUTOCONF +$AUTOMAKE -echo 'BUILT_SOURCES = foo.c' >> Makefile.am +./configure -$AUTOMAKE +$MAKE +ar t libfoo.a # for debugging +$MAKE distcheck + +: diff --git a/tests/libobj12.test b/tests/libobj12.test index 5f1d02908..747d7a0d9 100755 --- a/tests/libobj12.test +++ b/tests/libobj12.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 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,11 +14,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . - # Test if a file can be mentioned in LIBOBJS and explicitly. # (See libobj13.test for the LTLIBRARIES check.) . ./defs || Exit 1 + set -e cat >> configure.in << 'END' @@ -48,22 +48,30 @@ END : > bar.c $ACLOCAL -$AUTOMAKE # This however should be diagnosed, since foo.c and bar.c are in @LIBOBJS@. -echo 'libfoo_a_SOURCES += foo.c' >> Makefile.am -echo 'p1_SOURCES += bar.c' >> Makefile.am +cat >> Makefile.am << 'END' +libfoo_a_SOURCES += foo.c +p1_SOURCES += bar.c +END + AUTOMAKE_fails -$FGREP foo.c stderr -$FGREP bar.c stderr +grep 'foo\.c.*explicitly mentioned' stderr +grep 'bar\.c.*explicitly mentioned' stderr # Global `LDADD' can also come into play. cat > Makefile.am << 'END' noinst_PROGRAMS = a b LDADD = @LIBOBJS@ END + $AUTOMAKE grep 'a_DEPENDENCIES.*LIBOBJS' Makefile.in -echo 'a_SOURCES = foo.c' >> Makefile.am + +cat >> Makefile.am << 'END' +a_SOURCES = foo.c +END AUTOMAKE_fails -$FGREP foo.c stderr +grep 'foo\.c.*explicitly mentioned' stderr + +: diff --git a/tests/libobj13.test b/tests/libobj13.test index 6ca68c9e6..6d1e68dfd 100755 --- a/tests/libobj13.test +++ b/tests/libobj13.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 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,12 +14,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . - # Test if a file can be mentioned in LTLIBOBJS and explicitly. # (Like libobj12.test, but for Libtool libraries.) required='libtoolize' . ./defs || Exit 1 + set -e cat >> configure.in << 'END' @@ -47,4 +47,6 @@ $AUTOMAKE --add-missing # This however should be diagnosed, since foo.c is in @LIBOBJS@. echo 'libfoo_la_SOURCES += foo.c' >> Makefile.am AUTOMAKE_fails -$FGREP foo.c stderr +grep 'foo\.c.*explicitly mentioned' stderr + +: diff --git a/tests/libobj14.test b/tests/libobj14.test index 0ee750c83..08841c36d 100755 --- a/tests/libobj14.test +++ b/tests/libobj14.test @@ -27,7 +27,7 @@ set -e cat >>configure.in <<'EOF' AC_PROG_CC AC_LIBSOURCE([bar.c]) -AM_CONDITIONAL([CASE], :) +AM_CONDITIONAL([CASE], [:]) AC_OUTPUT EOF @@ -43,3 +43,5 @@ EOF $ACLOCAL $AUTOMAKE + +: diff --git a/tests/libobj11.test b/tests/libobj15a.test similarity index 71% rename from tests/libobj11.test rename to tests/libobj15a.test index 204ff8bb4..51da834bc 100755 --- a/tests/libobj11.test +++ b/tests/libobj15a.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2008 Free Software Foundation, Inc. +# Copyright (C) 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,26 +14,26 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# AC_LIBOBJ must allow [] around its argument. +# Nonexistent sources for AC_LIBOBJ should cause an Automake failure. . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) +set -e + +cat >> configure.in << 'END' AC_PROG_CC AC_PROG_RANLIB -AC_LIBOBJ([mountlist]) -AC_OUTPUT(Makefile) +AC_LIBOBJ([foobar]) END cat > Makefile.am << 'END' noinst_LIBRARIES = libtu.a libtu_a_SOURCES = -libtu_a_LIBADD = @LIBOBJS@ +libtu_a_LIBADD = $(LIBOBJS) END -: > mountlist.c +$ACLOCAL +AUTOMAKE_fails +grep 'configure\.in:.*required file.*foobar\.c.*' stderr -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +: diff --git a/tests/libobj15b.test b/tests/libobj15b.test new file mode 100755 index 000000000..000ba1fd9 --- /dev/null +++ b/tests/libobj15b.test @@ -0,0 +1,43 @@ +#! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Nonexistent source for AC_LIBSOURCE should cause Automake to fail. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_LIBSOURCE([foobar.c]) +# FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s) +# specified in AC_LIBSOURCE call(s) do not exist. Should we fix +# this limitation? Or is the current behaviour good enough? +AC_OUTPUT +END + +cat > Makefile.am << 'END' +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = +libtu_a_LIBADD = $(LIBOBJS) +END + +$ACLOCAL +AUTOMAKE_fails +grep 'configure\.in:.*required file.*foobar\.c.*' stderr + +: diff --git a/tests/libobj15c.test b/tests/libobj15c.test new file mode 100755 index 000000000..f1aa259a2 --- /dev/null +++ b/tests/libobj15c.test @@ -0,0 +1,50 @@ +#! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Nonexistent sources for AC_LIBSOURCES should cause Automake to fail. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_RANLIB +AC_LIBSOURCES([foobar.c, bazquux.c]) +# FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s) +# specified in AC_LIBSOURCES call(s) do not exist. Should we fix +# this limitation? Or is the current behaviour good enough? +AC_OUTPUT +END + +cat > Makefile.am << 'END' +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = +libtu_a_LIBADD = $(LIBOBJS) +END + +$ACLOCAL + +AUTOMAKE_fails +grep 'configure\.in:.*required file.*foobar\.c.*' stderr +grep 'configure\.in:.*required file.*bazquux\.c.*' stderr + +: > foobar.c +AUTOMAKE_fails +grep 'configure\.in:.*required file.*bazquux\.c.*' stderr +grep 'foobar\.c' stderr && Exit 1 + +: diff --git a/tests/libobj16a.test b/tests/libobj16a.test new file mode 100755 index 000000000..a67381976 --- /dev/null +++ b/tests/libobj16a.test @@ -0,0 +1,139 @@ +#! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Make sure AC_LIBOBJ and friends work. +# Please keep this in sync with sister test `libobj16b.test'. + +. ./defs || Exit 1 + +set -e + +mv configure.in configure.proto +cat >> configure.proto << 'END' +AC_PROG_CC +AC_PROG_RANLIB +%LIBOBJ-STUFF% # will be activated later +AC_OUTPUT +END + +cat > Makefile.am << 'END' +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = +libtu_a_LIBADD = $(LIBOBJS) + +include extra-checks.am +.PHONY: $(extra_checks) pre-test + +pre-test: distdir + ls -l $(srcdir) $(builddir) $(distdir) + $(AR) tv libtu.a +$(extra_checks): pre-test +check-local: $(extra_checks) + +maude-src: + grep dummy_maude $(srcdir)/maude.c +maude-dist: + grep dummy_maude $(distdir)/maude.c +liver-src: + grep dummy_liver $(srcdir)/liver.c +liver-dist: + grep dummy_liver $(distdir)/liver.c +liver-not-dist: distdir + test ! -r $(distdir)/liver.c +maude-not-dist: distdir + test ! -r $(distdir)/maude.c +maude-lib: + $(AR) t libtu.a | grep maude +maude-not-lib: + $(AR) t libtu.a | grep maude && exit 1; exit 0 +liver-lib: + $(AR) t libtu.a | grep liver +liver-not-lib: + $(AR) t libtu.a | grep liver && exit 1; exit 0 +END + +cat > maude.c << 'END' +extern int dummy_maude; +END + +cat > liver.c << 'END' +extern int dummy_liver; +END + +sed '/%LIBOBJ-STUFF%/{ +s/.*// +i\ +AC_LIBOBJ([maude]) +}' configure.proto > configure.in +cat configure.in # for debugging + +cat > extra-checks.am << 'END' +extra_checks = maude-src maude-dist maude-lib liver-not-dist +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure + +$MAKE +$MAKE check +$MAKE distcheck +$MAKE distclean + +# Avoid timestamp-related differences. +rm -rf autom4te*.cache + +cat > extra-checks.am << 'END' +extra_checks = maude-src maude-dist liver-src liver-dist +if MAUDE_COND +extra_checks += maude-lib liver-not-lib +else +extra_checks += maude-not-lib liver-lib +endif +END + +sed '/%LIBOBJ-STUFF%/{ +s/.*// +i\ +AM_CONDITIONAL([MAUDE_COND], [test x"$MAUDE" = x"yes"])\ +if test x"$MAUDE" = x"yes"; then\ + AC_LIBOBJ([maude])\ +else\ + AC_LIBOBJ([liver])\ +fi\ +AC_LIBSOURCES([maude.c, liver.c]) +}' configure.proto > configure.in +cat configure.in # for debugging + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure MAUDE=yes +$MAKE +$MAKE check +$MAKE distcheck +$MAKE distclean + +./configure MAUDE=no +$MAKE +$MAKE check +$MAKE distcheck +$MAKE distclean + +: diff --git a/tests/libobj16b.test b/tests/libobj16b.test new file mode 100755 index 000000000..f2ac76d3f --- /dev/null +++ b/tests/libobj16b.test @@ -0,0 +1,140 @@ +#! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Make sure AC_LIBOBJ and friends work. +# Please keep this in sync with sister test `libobj16b.test'. + +. ./defs || Exit 1 + +set -e + +mv configure.in configure.proto +cat >> configure.proto << 'END' +AC_PROG_CC +AC_PROG_RANLIB +%LIBOBJ-STUFF% # will be activated later +AC_OUTPUT +END + +cat > Makefile.am << 'END' +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = +libtu_a_LIBADD = @LIBOBJS@ + +include extra-checks.am +.PHONY: $(extra_checks) pre-test + +pre-test: distdir + ls -l $(srcdir) $(builddir) $(distdir) + $(AR) tv libtu.a +$(extra_checks): pre-test +check-local: $(extra_checks) + +maude-src: + grep dummy_maude $(srcdir)/maude.c +maude-dist: + grep dummy_maude $(distdir)/maude.c +liver-src: + grep dummy_liver $(srcdir)/liver.c +liver-dist: + grep dummy_liver $(distdir)/liver.c +liver-not-dist: distdir + test ! -r $(distdir)/liver.c +maude-not-dist: distdir + test ! -r $(distdir)/maude.c +maude-lib: + $(AR) t libtu.a | grep maude +maude-not-lib: + $(AR) t libtu.a | grep maude && exit 1; exit 0 +liver-lib: + $(AR) t libtu.a | grep liver +liver-not-lib: + $(AR) t libtu.a | grep liver && exit 1; exit 0 +END + +cat > maude.c << 'END' +extern int dummy_maude; +END + +cat > liver.c << 'END' +extern int dummy_liver; +END + +sed '/%LIBOBJ-STUFF%/{ +s/.*// +i\ +AC_LIBOBJ(maude) dnl: do not quote this! +}' configure.proto > configure.in +cat configure.in # for debugging + +cat > extra-checks.am << 'END' +extra_checks = maude-src maude-dist maude-lib liver-not-dist +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure + +$MAKE +$MAKE check +$MAKE distcheck +$MAKE distclean + +# Avoid timestamp-related differences. +rm -rf autom4te*.cache + +cat > extra-checks.am << 'END' +extra_checks = maude-src maude-dist liver-src liver-dist +if MAUDE_COND +extra_checks += maude-lib liver-not-lib +else +extra_checks += maude-not-lib liver-lib +endif +END + +sed '/%LIBOBJ-STUFF%/{ +s/.*// +i\ +AM_CONDITIONAL([MAUDE_COND], [test x"$MAUDE" = x"yes"])\ +if test x"$MAUDE" = x"yes"; then\ + AC_LIBOBJ(maude) dnl: do not quote this!\ +else\ + AC_LIBOBJ(liver) dnl: do not quote this!\ +fi\ +AC_LIBSOURCE(maude.c) dnl: do not quote this!\ +AC_LIBSOURCE(liver.c) dnl: do not quote this! +}' configure.proto > configure.in +cat configure.in # for debugging + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure MAUDE=yes +$MAKE +$MAKE check +$MAKE distcheck +$MAKE distclean + +./configure MAUDE=no +$MAKE +$MAKE check +$MAKE distcheck +$MAKE distclean + +: diff --git a/tests/libobj17.test b/tests/libobj17.test new file mode 100755 index 000000000..daf4039a3 --- /dev/null +++ b/tests/libobj17.test @@ -0,0 +1,67 @@ +#! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Make sure AC_LIBOBJ accept non-literal arguments. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_RANLIB +foo=${FOO-oops} +AC_LIBSOURCES([quux.c, zardoz.c]) +AC_LIBOBJ([$foo]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = +libtu_a_LIBADD = $(LIBOBJS) +END + +cat > quux.c <<'END' +extern int dummy; +END + +cat > zardoz.c <<'END' +extern int dummy; +END + +# These might print warnings, but should not error out. +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure FOO=quux +$MAKE +ls -l # for debugging +test -f libtu.a +ar t libtu.a | $FGREP quux +ar t libtu.a | $FGREP zardoz && Exit 1 + +$MAKE distclean + +./configure FOO=zardoz +$MAKE +ls -l # for debugging +test -f libtu.a +ar t libtu.a | $FGREP zardoz +ar t libtu.a | $FGREP quux && Exit 1 + +: diff --git a/tests/libobj18.test b/tests/libobj18.test new file mode 100755 index 000000000..e03493e23 --- /dev/null +++ b/tests/libobj18.test @@ -0,0 +1,46 @@ +#! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Make sure AC_LIBSOURCE and AC_LIBSOURCES use arguments literally. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_RANLIB +foo=dummy bar=dummy baz=dummy +AC_LIBSOURCE([$foo.c]) +AC_LIBSOURCES([$bar.c, $baz.c]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = +libtu_a_LIBADD = $(LIBOBJS) +END + +: > dummy.c + +$ACLOCAL +AUTOMAKE_fails +grep 'configure\.in:.*required file.*\$foo\.c.*not found' stderr +grep 'configure\.in:.*required file.*\$bar\.c.*not found' stderr +grep 'configure\.in:.*required file.*\$baz\.c.*not found' stderr + +: diff --git a/tests/libobj19.test b/tests/libobj19.test new file mode 100755 index 000000000..4fd150b98 --- /dev/null +++ b/tests/libobj19.test @@ -0,0 +1,62 @@ +#! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test support for AC_CONFIG_LIBOBJ_DIR. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_CONFIG_LIBOBJ_DIR([libobj-dir]) +AC_PROG_CC +AC_PROG_RANLIB +AC_LIBOBJ([foobar]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects ## required for our setup to work +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = +libtu_a_LIBADD = $(LIBOBJS) +check-local: distdir + ls -l $(srcdir)/* $(builddir)/* $(distdir)/* + test -f libtu.a + test ! -r $(srcdir)/foobar.c + test -f $(srcdir)/libobj-dir/foobar.c + test ! -r $(distdir)/foobar.c + test -f $(distdir)/libobj-dir/foobar.c + $(AR) t libtu.a + $(AR) t libtu.a | grep foobar +END + +mkdir libobj-dir +cat > libobj-dir/foobar.c << 'END' +extern int dummy; +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure + +$MAKE +$MAKE check +$MAKE distcheck + +: diff --git a/tests/libobj2.test b/tests/libobj2.test index 81b0e7222..913fef9bf 100755 --- a/tests/libobj2.test +++ b/tests/libobj2.test @@ -1,6 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 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 @@ -20,13 +20,25 @@ . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) +set -e + +cat >> configure.in << 'END' +AC_CONFIG_FILES([subdir/Makefile]) AC_PROG_CC AC_PROG_RANLIB AC_LIBOBJ([fsusage]) -AC_OUTPUT(subdir/Makefile) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +SUBDIRS = subdir +check-local: distdir + ls -l $(srcdir) $(srcdir)/subdir + ls -l $(distdir) $(distdir)/subdir + ls -l $(builddir) $(builddir)/subdir + test -f $(srcdir)/subdir/fsusage.c + test -f $(distdir)/subdir/fsusage.c + $(AR) tv $(builddir)/subdir/libtu.a END mkdir subdir @@ -37,9 +49,20 @@ libtu_a_SOURCES = libtu_a_LIBADD = @LIBOBJS@ END -: > subdir/fsusage.c +cat > subdir/fsusage.c << 'END' +extern int dummy; +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +# Older grepping check, kept "just to be sure". +$FGREP 'fsusage.c' subdir/Makefile.in + +./configure -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$MAKE check +$MAKE distcheck -grep 'fsusage\.c' subdir/Makefile.in +: diff --git a/tests/aclibobj.test b/tests/libobj20a.test similarity index 67% rename from tests/aclibobj.test rename to tests/libobj20a.test index 6ef6f6bcf..25c3cf331 100755 --- a/tests/aclibobj.test +++ b/tests/libobj20a.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002, 2003, 2008 Free Software Foundation, Inc. +# Copyright (C) 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,36 +14,32 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure AC_LIBOBJ and friends work. +# Test error reporting for AC_CONFIG_LIBOBJ_DIR. +# See also sister tests `libobj20b.test' and `libobj20c.test' . . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' +AC_CONFIG_LIBOBJ_DIR([libobj-dir]) AC_PROG_CC AC_PROG_RANLIB -AC_OUTPUT +AC_LIBOBJ([foo]) END cat > Makefile.am << 'END' noinst_LIBRARIES = libtu.a libtu_a_SOURCES = -libtu_a_LIBADD = @LIBOBJS@ +libtu_a_LIBADD = $(LIBOBJS) END -: > maude.c -: > liver.c +mkdir libobj-dir +: > libobj-dir/foo.c $ACLOCAL +AUTOMAKE_fails +grep 'LIBOBJS.*used outside.*libobj-dir' stderr +grep 'subdir-objects.*not set' stderr -set -e - -cp configure.in X -echo 'AC_LIBSOURCE(maude.c)' >> configure.in -$AUTOMAKE - -# Avoid timestamp-related differences. -rm -rf autom4te.cache - -cp X configure.in -echo 'AC_LIBSOURCES([maude.c, liver.c])' >> configure.in -$AUTOMAKE +: diff --git a/tests/libobj20b.test b/tests/libobj20b.test new file mode 100755 index 000000000..1662110d4 --- /dev/null +++ b/tests/libobj20b.test @@ -0,0 +1,57 @@ +#! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test error reporting for AC_CONFIG_LIBOBJ_DIR. +# See also sister tests `libobj20a.test' and `libobj20c.test' . + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_CONFIG_LIBOBJ_DIR([libobj-dir]) +AC_PROG_CC +AC_PROG_RANLIB +AC_LIBSOURCE([foobar.c]) +# FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s) +# specified in AC_LIBSOURCE call(s) do not exist. Should we fix +# this limitation? Or is the current behaviour good enough? +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = +libtu_a_LIBADD = $(LIBOBJS) +END + +$ACLOCAL + +AUTOMAKE_fails +grep 'configure\.in:.*required directory.*libobj-dir' stderr + +mkdir libobj-dir +: > foobar.c # oops, it should be in libobj-dir... +AUTOMAKE_fails +grep 'configure\.in:.*required file.*libobj-dir/foobar.c.*' stderr + +rm -f foobar.c + +: > libobj-dir/foobar.c +$AUTOMAKE # now we should succeed + +: diff --git a/tests/libobj20c.test b/tests/libobj20c.test new file mode 100755 index 000000000..4884359d8 --- /dev/null +++ b/tests/libobj20c.test @@ -0,0 +1,53 @@ +#! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test error reporting for AC_CONFIG_LIBOBJ_DIR. +# See also sister tests `libobj20a.test' and `libobj20b.test' . + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_CONFIG_LIBOBJ_DIR([libobj-dir]) +AC_PROG_CC +AC_PROG_RANLIB +AC_LIBOBJ([foobar]) +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects ## required for our setup to work +noinst_LIBRARIES = libtu.a +libtu_a_SOURCES = +libtu_a_LIBADD = $(LIBOBJS) +END + +$ACLOCAL + +AUTOMAKE_fails +grep 'configure\.in:.*required directory.*\./libobj-dir' stderr + +mkdir libobj-dir +: > foobar.c # oops, it should be in libobj-dir! +AUTOMAKE_fails +grep 'configure\.in:.*required file.*libobj-dir/foobar.c.*' stderr + +rm -f foobar.c + +: > libobj-dir/foobar.c +$AUTOMAKE # now we should succeed + +: diff --git a/tests/libobj3.test b/tests/libobj3.test index 0aeced91b..29aa6d55d 100755 --- a/tests/libobj3.test +++ b/tests/libobj3.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 1997, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 2001, 2002, 2003, 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,7 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure we complain if @LIBOBJS@ is used without being set in configure.in +# Make sure we complain if @LIBOBJS@ is used without being set in +# configure.in. . ./defs || Exit 1 @@ -32,4 +34,6 @@ END $ACLOCAL AUTOMAKE_fails -grep 'Makefile.am:3:.*LIBOBJS' stderr +grep 'Makefile\.am:3:.*LIBOBJS' stderr + +: diff --git a/tests/libobj4.test b/tests/libobj4.test index d6639be58..d31e5ff20 100755 --- a/tests/libobj4.test +++ b/tests/libobj4.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 2002, 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 @@ -19,14 +19,18 @@ . ./defs || Exit 1 +set -e + cat > Makefile.am << 'END' bin_PROGRAMS = foo END cat >> configure.in << 'END' AC_PROG_CC -AC_REPLACE_FUNCS(foo) +AC_REPLACE_FUNCS([foo]) END -$ACLOCAL || Exit 1 +$ACLOCAL $AUTOMAKE + +: diff --git a/tests/libobj5.test b/tests/libobj5.test index 6add9e37a..7aa218a9f 100755 --- a/tests/libobj5.test +++ b/tests/libobj5.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 2002, 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 @@ -19,6 +19,8 @@ . ./defs || Exit 1 +set -e + cat > Makefile.am << 'END' bin_PROGRAMS = joe LDADD = @LIBOBJS@ @@ -27,11 +29,13 @@ END cat >> configure.in << 'END' AC_PROG_CC AC_REPLACE_FUNCS(\ - foo) + foo_bar_quux) END -: > foo.c +: > foo_bar_quux.c + +$ACLOCAL +$AUTOMAKE +$FGREP foo_bar_quux.c Makefile.in -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 -$FGREP foo.c Makefile.in +: diff --git a/tests/libobj7.test b/tests/libobj7.test index 73a8ab0e2..be51db7fa 100755 --- a/tests/libobj7.test +++ b/tests/libobj7.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1997, 1998, 2000, 2001, 2002, 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 @@ -18,33 +19,55 @@ . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) +set -e + +cat >> configure.in << 'END' AC_PROG_CC AC_PROG_RANLIB -AC_REPLACE_FUNCS(basename dirname strsignal) -AC_OUTPUT(Makefile) +# `am__dummy_function' is there to ensure that at least one function is +# replaced, to avoid creating an empty archive which can cause problems +# with e.g. Solaris ar. +AC_REPLACE_FUNCS([basename dirname am__dummy_function]) +AC_OUTPUT END cat > Makefile.am << 'END' noinst_LIBRARIES = libtu.a libtu_a_SOURCES = libtu_a_LIBADD = @LIBOBJS@ +check-local: test1 test2 test3 +.PHONY: test1 test2 test3 +test1: all + $(AR) tv libtu.a +test2: + @echo DIST_COMMON = $(DIST_COMMON) + echo ' ' $(DIST_COMMON) ' ' | grep '[ /]basename\.c ' + echo ' ' $(DIST_COMMON) ' ' | grep '[ /]dirname\.c ' + echo ' ' $(DIST_COMMON) ' ' | grep '[ /]am__dummy_function\.c ' +test3: distdir + test -f $(distdir)/basename.c + test -f $(distdir)/dirname.c + test -f $(distdir)/am__dummy_function.c +END + +cat > basename.c <<'END' +extern int dummy1; +END +cat > dirname.c <<'END' +extern int dummy2; END +cat > am__dummy_function.c <<'END' +extern int dummy3; +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure + +$MAKE +$MAKE check +$MAKE distcheck -: > basename.c -: > dirname.c -: > strsignal.c - -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 - -sed -n -e ': again - /^DIST_COMMON.*[^\]$/ p - /^DIST_COMMON/ { - s/^DIST_COMMON//p - n - s/^/DIST_COMMON/ - b again - }' < Makefile.in | $FGREP dirname.c +: diff --git a/tests/libobj8.test b/tests/libobj8.test index c06746bef..95f21ed1e 100755 --- a/tests/libobj8.test +++ b/tests/libobj8.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1998, 2000, 2001, 2002, 2006 Free Software Foundation, Inc. +# Copyright (C) 1998, 2000, 2001, 2002, 2006, 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 @@ -19,15 +20,15 @@ . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) +set -e + +cat >> configure.in << 'END' AC_PROG_CC AC_PROG_CC_STDC AC_PROG_RANLIB AC_REPLACE_FUNCS(basename dirname strsignal) AM_C_PROTOTYPES -AC_OUTPUT(Makefile) +AC_OUTPUT END cat > Makefile.am << 'END' @@ -44,7 +45,9 @@ END : > ansi2knr.1 : > ansi2knr.c -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE + +$FGREP 'strsignal_.c:' Makefile.in -grep 'strsignal_.c:' Makefile.in +: diff --git a/tests/ltlibobjs.test b/tests/ltlibobjs.test index fd6647324..e34e667e5 100755 --- a/tests/ltlibobjs.test +++ b/tests/ltlibobjs.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2001, 2002, 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 @@ -19,8 +19,10 @@ required=libtool . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' -AC_SUBST(LTLIBOBJS) +AC_SUBST([LTLIBOBJS]) AC_PROG_LIBTOOL END @@ -35,5 +37,7 @@ END : > config.guess : > config.sub -$ACLOCAL || Exit 1 +$ACLOCAL $AUTOMAKE + +: