From a4c439444a29f62ef21d24d3cbf676919ad1e426 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 23 May 2012 23:12:47 +0200 Subject: [PATCH] [ng] coverage: pure languages doesn't bring in C support Automake, when dealing with a Makefile.am using a single "pure" language (like C++ and Fortran), shouldn't output stuff related to C compilation. Extend some tests checking this behaviour, since it is implemented by a parts of the codebase we plan to touch soon. * t/fnoc.sh, t/cxxnoc.sh: Removed, merged ... * t/no-c.tap: ... in here. Checks for more languages (Java, modern Fortran, Objective C and Objective C++). * t/suffix3.sh: Enhance. Signed-off-by: Stefano Lattarini --- t/cxxnoc.sh | 37 ---------------------------------- t/fnoc.sh | 39 ----------------------------------- t/no-c.tap | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ t/suffix3.sh | 7 +++++++ 4 files changed, 64 insertions(+), 76 deletions(-) delete mode 100755 t/cxxnoc.sh delete mode 100755 t/fnoc.sh create mode 100755 t/no-c.tap diff --git a/t/cxxnoc.sh b/t/cxxnoc.sh deleted file mode 100755 index 66d0b0df2..000000000 --- a/t/cxxnoc.sh +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/sh -# Copyright (C) 1996-2012 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 to make sure pure C++ sources don't include C-specific code. - -. ./defs || Exit 1 - -cat >> configure.ac << 'END' -AC_PROG_CXX -END - -cat > Makefile.am << 'END' -sbin_PROGRAMS = anonymous -anonymous_SOURCES = doe.C jane.C -END - -: > doe.C -: > jane.C - -$ACLOCAL -$AUTOMAKE - -$FGREP '(CC)' Makefile.in && Exit 1 -Exit 0 diff --git a/t/fnoc.sh b/t/fnoc.sh deleted file mode 100755 index fbd21352f..000000000 --- a/t/fnoc.sh +++ /dev/null @@ -1,39 +0,0 @@ -#! /bin/sh -# Copyright (C) 1998-2012 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 to make sure that pure Fortran 77 sources don't include -# C-specific code. -# Matthew D. Langston - -. ./defs || Exit 1 - -cat >> configure.ac << 'END' -AC_PROG_F77 -END - -cat > Makefile.am << 'END' -sbin_PROGRAMS = anonymous -anonymous_SOURCES = doe.f jane.f -END - -: > doe.f -: > jane.f - -$ACLOCAL -$AUTOMAKE - -grep '[^F]CC' Makefile.in | grep -v MKDEP && Exit 1 -Exit 0 diff --git a/t/no-c.tap b/t/no-c.tap new file mode 100755 index 000000000..5adb056df --- /dev/null +++ b/t/no-c.tap @@ -0,0 +1,57 @@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Projects using only Fortran or C++ shouldn't need C-related stuff. + +am_create_testdir=empty +. ./defs || Exit 1 + +plan_ 6 + +only_ () +{ + test $# -eq 3 || fatal_ "only_: bad usage" + lang=$1; shift + macro=$1; shift + sources=$* + : ================ $lang ================ : + mkdir "$macro" + cd "$macro" + unindent > configure.ac < Makefile.am + echo foo_SOURCES = $sources >> Makefile.am + r=ok + $ACLOCAL \ + && $AUTOMAKE -a \ + && not $EGREP '\(CC\)|\(CFLAGS\)|AM_CFLAGS' Makefile.in \ + || r='not ok' + result_ "$r" "$lang only" + cd .. +} + +only_ "C++" AC_PROG_CXX '1.cxx 2.cpp 3.c++ 4.cc 5.C' +only_ "Fortran" AC_PROG_FC 'a.f90 b.f95 c.f03 d.f08' +only_ "Fortran 77" AC_PROG_F77 'x.f y.for' +only_ "Java" AM_PROG_GCJ 'foo.java bar.class' +only_ "Objective C" AC_PROG_OBJC 'zardoz.m fu.m' +only_ "Objective C++" AC_PROG_OBJCXX 'foo.mm bar.mm' + +: diff --git a/t/suffix3.sh b/t/suffix3.sh index 1ef8a2b42..66be6cc1f 100755 --- a/t/suffix3.sh +++ b/t/suffix3.sh @@ -45,6 +45,13 @@ $FGREP foo.c Makefile.in && Exit 1 # However Automake must figure that foo.zoo is eventually # transformed into foo.o, and use this latter file (to link foo). $FGREP 'foo.$(OBJEXT)' Makefile.in +# Finally, our dummy package doesn't use C in any way, so it the +# Makefile shouldn't contain stuff related to the C compiler. +$FGREP '$(LINK)' Makefile.in && Exit 1 +$FGREP 'AM_CFLAGS' Makefile.in && Exit 1 +$FGREP '$(CFLAGS)' Makefile.in && Exit 1 +$FGREP '$(CC)' Makefile.in && Exit 1 + $AUTOCONF ./configure -- 2.47.2