[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/4] Add a convenience autoconf macro (AM_PROG_CLI) to help with
From: |
Raja R Harinath |
Subject: |
[PATCH 4/4] Add a convenience autoconf macro (AM_PROG_CLI) to help with matters. |
Date: |
Thu, 28 Jun 2007 18:43:19 +0530 |
* automake.in (register_language): Add Nemerle (.n) and Boo (.boo)
as languages "supported" by the CLI infrastructure.
(handle_cli_assembly_sources): Handle single-char extensions --
compiler variable ends in 'CC' rather than 'C'.
* lib/am/cli-assembly.am (%ASSEMBLY%): Use %LANGCC% instead of
%LANG%C for the name of the compiler variable.
* m4/cli.m4: New.
* m4/Makefile.am (dist_m4data_DATA): Add cli.m4.
* tests/cli4.test, tests/clim4-1.test, tests/clim4-2.test: New.
* tests/clim4-3.test, tests/clim4-4.test: New.
* tests/Makefile.am (TESTS): Update.
---
ChangeLog | 15 +++++++++++++++
automake.in | 10 ++++++----
lib/am/cli-assembly.am | 2 +-
m4/Makefile.am | 1 +
m4/cli.m4 | 38 ++++++++++++++++++++++++++++++++++++++
tests/Makefile.am | 5 +++++
tests/cli4.test | 37 +++++++++++++++++++++++++++++++++++++
tests/clim4-1.test | 40 ++++++++++++++++++++++++++++++++++++++++
tests/clim4-2.test | 40 ++++++++++++++++++++++++++++++++++++++++
tests/clim4-3.test | 40 ++++++++++++++++++++++++++++++++++++++++
tests/clim4-4.test | 41 +++++++++++++++++++++++++++++++++++++++++
11 files changed, 264 insertions(+), 5 deletions(-)
create mode 100644 m4/cli.m4
create mode 100755 tests/cli4.test
create mode 100755 tests/clim4-1.test
create mode 100755 tests/clim4-2.test
create mode 100755 tests/clim4-3.test
create mode 100755 tests/clim4-4.test
diff --git a/ChangeLog b/ChangeLog
index 2e75139..07e7edb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2007-06-28 Raja R Harinath <address@hidden>
+
+ Add a convenience autoconf macro (AM_PROG_CLI) to help with matters.
+ * automake.in (register_language): Add Nemerle (.n) and Boo (.boo)
+ as languages "supported" by the CLI infrastructure.
+ (handle_cli_assembly_sources): Handle single-char extensions --
+ compiler variable ends in 'CC' rather than 'C'.
+ * lib/am/cli-assembly.am (%ASSEMBLY%): Use %LANGCC% instead of
+ %LANG%C for the name of the compiler variable.
+ * m4/cli.m4: New.
+ * m4/Makefile.am (dist_m4data_DATA): Add cli.m4.
+ * tests/cli4.test, tests/clim4-1.test, tests/clim4-2.test: New.
+ * tests/clim4-3.test, tests/clim4-4.test: New.
+ * tests/Makefile.am (TESTS): Update.
+
2007-06-27 Raja R Harinath <address@hidden>
Add support for resources
diff --git a/automake.in b/automake.in
index c2ab593..aa5709a 100755
--- a/automake.in
+++ b/automake.in
@@ -983,10 +983,10 @@ register_language ('name' => 'java',
'pure' => 1,
'extensions' => ['.java', '.class', '.zip', '.jar']);
-# CLI - C#, VB
+# CLI - C#, VB, Nemerle, Boo
register_language ('name' => 'cli',
- 'Name' => 'Common Language Infrastructure (C# or VB)',
- 'extensions' => ['.cs', '.vb'],
+ 'Name' => 'Common Language Infrastructure (C#, VB, Nemerle,
Boo)',
+ 'extensions' => ['.cs', '.vb', '.n', '.boo'],
# No output.
'output_extensions' => sub { return () },
# Nothing to do.
@@ -4747,8 +4747,9 @@ sub handle_cli_assembly_sources ($$$%)
my $lang = uc substr $seen_extn, 1;
my $dirstamp = require_build_directory_maybe ($unxformed);
my $progflags = "${one_file}_${lang}FLAGS";
+ my $langcc = (length $lang == 1) ? "${lang}CC" : "${lang}C";
- require_variables ($unxformed, "Seen CLI source file with extension
$seen_extn", TRUE, $lang . 'C');
+ require_variables ($unxformed, "Seen CLI source file with extension
$seen_extn", TRUE, $langcc);
define_variable ($progflags, "\$(AM_${lang}FLAGS)", INTERNAL)
unless var $progflags;
@@ -4758,6 +4759,7 @@ sub handle_cli_assembly_sources ($$$%)
ASSEMBLY => $unxformed,
XASSEMBLY => $one_file,
LANG => $lang,
+ LANGCC => $langcc,
DIRSTAMP => $dirstamp);
return 1;
diff --git a/lib/am/cli-assembly.am b/lib/am/cli-assembly.am
index f85710c..bf5ed42 100644
--- a/lib/am/cli-assembly.am
+++ b/lib/am/cli-assembly.am
@@ -18,5 +18,5 @@
## 02110-1301, USA.
%ASSEMBLY%: $(%XASSEMBLY%_DEPENDENCIES) %DIRSTAMP%
@rm -f %ASSEMBLY%
- $(%LANG%C) $(%XASSEMBLY%_%LANG%FLAGS) $(%LANG%FLAGS) -out:$@
-target:%TARGET% \
+ $(%LANGCC%) $(%XASSEMBLY%_%LANG%FLAGS) $(%LANG%FLAGS) -out:$@
-target:%TARGET% \
$(%XASSEMBLY%_CMDSRCS) $(%XASSEMBLY%_CMDRSRCS)
$(%XASSEMBLY%_REFERENCES)
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 13d4243..a25ed3b 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -27,6 +27,7 @@ $(top_srcdir)/m4/amversion.m4 \
as.m4 \
auxdir.m4 \
ccstdc.m4 \
+cli.m4 \
cond.m4 \
depend.m4 \
depout.m4 \
diff --git a/m4/cli.m4 b/m4/cli.m4
new file mode 100644
index 0000000..a0c9b92
--- /dev/null
+++ b/m4/cli.m4
@@ -0,0 +1,38 @@
+# Check for CLI compilers. -*- Autoconf -*-
+
+# Copyright (C) 2007 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_CLI([FRAMEWORK-VERSION],[LANGS])
+# ----------------------------------------
+# Find the compiler for each of the listed languages. If LANGS is not set,
+# it defaults to the list [CS]. The framework version determines if we
+# use 'mcs' for version 1.1 or 'gmcs' for everything else. We default to
+# framework version 1.1.
+AC_DEFUN([AM_PROG_CLI],
+[_AM_PROG_CLI(m4_ifval([$1],[$1],[1.1]), m4_ifval([$2],[$2],[CS]))
+AC_CHECK_PROGS([RESGEN], [resgen], [false])
+AC_CHECK_PROGS([ILASM], [ilasm], [false])
+AC_CHECK_PROGS([ILDISASM], [monodis 'ildasm -text'], [false])
+])
+
+AC_DEFUN([_AM_PROG_CLI],
+[m4_foreach_w([l],[$2],[m4_n([_AM_PROG_CLI_LANG(l,[$1])])])])
+
+AC_DEFUN([_AM_PROG_CLI_LANG],
+[m4_ifdef([$0_$1],[$0_$1([$2])],[$0__FALLBACK([$1],[$2])])])
+
+AC_DEFUN([_AM_PROG_CLI_LANG_CS],
+[AC_CHECK_PROGS([CSC], [m4_if([$1],[1.1],[mcs],[gmcs]) csc], [false])])
+
+AC_DEFUN([_AM_PROG_CLI_LANG_VB],
+[AC_CHECK_PROGS([VBC], [vbnc vbc], [false])])
+
+AC_DEFUN([_AM_PROG_CLI_LANG_NEMERLE],
+[AC_CHECK_PROGS([NCC], [ncc], [false])])
+
+AC_DEFUN([_AM_PROG_CLI_LANG__FALLBACK],
+[AC_CHECK_PROGS([$1][C], [m4_translit([[$1]], [A-Z], [a-z])][c], [false])])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e725d87..a9eae32 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -94,6 +94,11 @@ clean2.test \
cli1.test \
cli2.test \
cli3.test \
+cli4.test \
+clim4-1.test \
+clim4-2.test \
+clim4-3.test \
+clim4-4.test \
colneq.test \
colneq2.test \
colon.test \
diff --git a/tests/cli4.test b/tests/cli4.test
new file mode 100755
index 0000000..89b98da
--- /dev/null
+++ b/tests/cli4.test
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test that we ask for appropriate compiler for an arbitrary language.
+
+. ./defs || exit 1
+
+set -e
+
+cat >Makefile.am <<END
+SUFFIXES = .foo
+noinst_CLIEXES = foo.exe
+foo_exe_SOURCES = a.foo
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE > warn.out 2>&1 && exit 1
+
+grep 'FOOC' warn.out
diff --git a/tests/clim4-1.test b/tests/clim4-1.test
new file mode 100755
index 0000000..452759f
--- /dev/null
+++ b/tests/clim4-1.test
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test that basic CLI functionality works.
+
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<END
+AM_PROG_CLI
+END
+
+cat >Makefile.am <<END
+noinst_CLIEXES = foo.exe
+foo_exe_SOURCES = a.cs baz/b.cs quux/c.cs
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+grep 'CSC =' Makefile.in
diff --git a/tests/clim4-2.test b/tests/clim4-2.test
new file mode 100755
index 0000000..3e96d56
--- /dev/null
+++ b/tests/clim4-2.test
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test that we support invoking Nemerle properly
+
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<END
+AM_PROG_CLI([1.1], [NEMERLE])
+END
+
+cat >Makefile.am <<END
+noinst_CLIEXES = foo.exe
+foo_exe_SOURCES = a.n
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+grep 'NCC =' Makefile.in
diff --git a/tests/clim4-3.test b/tests/clim4-3.test
new file mode 100755
index 0000000..62706d0
--- /dev/null
+++ b/tests/clim4-3.test
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test that we support invoking VB properly
+
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<END
+AM_PROG_CLI([1.1], [VB])
+END
+
+cat >Makefile.am <<END
+noinst_CLIEXES = foo.exe
+foo_exe_SOURCES = a.vb
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+grep 'VBC =' Makefile.in
diff --git a/tests/clim4-4.test b/tests/clim4-4.test
new file mode 100755
index 0000000..6f0420d
--- /dev/null
+++ b/tests/clim4-4.test
@@ -0,0 +1,41 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test that we support invoking some arbitrary language
+
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<END
+AM_PROG_CLI([1.1], [FOO])
+END
+
+cat >Makefile.am <<END
+SUFFIXES = .foo
+noinst_CLIEXES = foo.exe
+foo_exe_SOURCES = a.foo
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+grep 'FOOC =' Makefile.in
--
1.5.2.1.174.gcd03