[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [PATCH 3/5] [ng] coverage: pure languages doesn't bring in
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [PATCH 3/5] [ng] coverage: pure languages doesn't bring in C support |
Date: |
Thu, 24 May 2012 09:42:01 +0200 |
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 <address@hidden>
---
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 66d0b0d..0000000
--- 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 <http://www.gnu.org/licenses/>.
-
-# 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 fbd2135..0000000
--- 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 <http://www.gnu.org/licenses/>.
-
-# Test to make sure that pure Fortran 77 sources don't include
-# C-specific code.
-# Matthew D. Langston <address@hidden>
-
-. ./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 0000000..5adb056
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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 <<END
+ AC_INIT([Only $2], [1.0])
+ AM_INIT_AUTOMAKE
+ AC_CONFIG_FILES([Makefile])
+ $macro
+END
+ echo bin_PROGRAMS = foo > 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 1ef8a2b..66be6cc 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
--
1.7.9.5
- [Automake-NG] [PATCH 0/5] Small simplification to suffix rules support, and added coverage, Stefano Lattarini, 2012/05/24
- [Automake-NG] [PATCH 1/5] [ng] coverage: custom pre-processes headers in prog_SOURCES, Stefano Lattarini, 2012/05/24
- [Automake-NG] [PATCH 3/5] [ng] coverage: pure languages doesn't bring in C support,
Stefano Lattarini <=
- [Automake-NG] [PATCH 4/5] [ng] coverage: mixing Fortran and C++, Stefano Lattarini, 2012/05/24
- [Automake-NG] [PATCH 2/5] [ng] rule: get rid of $KNOWN_EXTENSIONS_PATTERN, Stefano Lattarini, 2012/05/24
- [Automake-NG] [PATCH 5/5] [ng] rule, lang: get rid of 'suffix_rules_count', simplify logic, Stefano Lattarini, 2012/05/24
- Re: [Automake-NG] [PATCH 0/5] Small simplification to suffix rules support, and added coverage, Akim Demaille, 2012/05/25