From: Alexandre Duret-Lutz Date: Mon, 14 Aug 2006 20:38:38 +0000 (+0000) Subject: * automake.in: Register "Unified Parallel C" as language. X-Git-Tag: Release-1-9b~15 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=6661fa165d90df54d38c8b748ccc63f71a1f8ad0;p=automake.git * automake.in: Register "Unified Parallel C" as language. (lang_upc_rewrite): New function. (resolve_linker): Consider UPCLINK. * lib/Automake/Variable.pm (%_ac_macro_for_var): Suggest AM_PROG_UPC for UPC and UPCFLAGS. * m4/upc.m4: New file. * m4/depend.m4 (_AM_DEPENDENCIES): Add UPC case. * m4/Makefile.am (dist_m4data_DATA): Add upc.m4. * doc/automake.texi (Unified Parallel C Support): New node. (Public macros): Mention AM_PROG_UPC. (Program and Library Variables, Flag Variables Ordering): Mention UPCFLAGS. * tests/upc.test, tests/upc2.test, tests/upc3.test: New file. * tests/Makefile.am (TESTS): Add them. * tests/ext.test: Also test upc files. --- diff --git a/ChangeLog b/ChangeLog index 7a811f47..2b7421c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2006-08-14 Jonathan Higa + + * automake.in: Register "Unified Parallel C" as language. + (lang_upc_rewrite): New function. + (resolve_linker): Consider UPCLINK. + * lib/Automake/Variable.pm (%_ac_macro_for_var): Suggest + AM_PROG_UPC for UPC and UPCFLAGS. + * m4/upc.m4: New file. + * m4/depend.m4 (_AM_DEPENDENCIES): Add UPC case. + * m4/Makefile.am (dist_m4data_DATA): Add upc.m4. + * doc/automake.texi (Unified Parallel C Support): New node. + (Public macros): Mention AM_PROG_UPC. + (Program and Library Variables, Flag Variables Ordering): + Mention UPCFLAGS. + * tests/upc.test, tests/upc2.test, tests/upc3.test: New file. + * tests/Makefile.am (TESTS): Add them. + * tests/ext.test: Also test upc files. + 2006-08-04 Alexandre Duret-Lutz * doc/automake.texi (Scripts): Fix some errors in previous patch. diff --git a/NEWS b/NEWS index 44e28f51..112a2229 100644 --- a/NEWS +++ b/NEWS @@ -118,6 +118,10 @@ New in 1.9a: This new version check ensures that the whole build system has been generated using the same autoconf version. + + - New support for Unified Parallel C: + - AM_PROG_UPC looks for a UPC compiler. + - A new section of the manual documents the support. New in 1.9: diff --git a/automake.in b/automake.in index b64fe8c7..4cbe8f85 100755 --- a/automake.in +++ b/automake.in @@ -731,7 +731,7 @@ register_language ('name' => 'cxx', register_language ('name' => 'objc', 'Name' => 'Objective C', 'config_vars' => ['OBJC'], - 'linker' => 'OBJCLINK',, + 'linker' => 'OBJCLINK', 'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', 'autodep' => 'OBJC', 'flags' => ['OBJCFLAGS', 'CPPFLAGS'], @@ -744,6 +744,23 @@ register_language ('name' => 'objc', 'pure' => 1, 'extensions' => ['.m']); +# Unified Parallel C. +register_language ('name' => 'upc', + 'Name' => 'Unified Parallel C', + 'config_vars' => ['UPC'], + 'linker' => 'UPCLINK', + 'link' => '$(UPCLD) $(AM_UPCFLAGS) $(UPCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', + 'autodep' => 'UPC', + 'flags' => ['UPCFLAGS', 'CPPFLAGS'], + 'compile' => '$(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)', + 'compiler' => 'UPCCOMPILE', + 'compile_flag' => '-c', + 'output_flag' => '-o', + 'lder' => 'UPCLD', + 'ld' => '$(UPC)', + 'pure' => 1, + 'extensions' => ['.upc']); + # Headers. register_language ('name' => 'header', 'Name' => 'Header', @@ -5340,6 +5357,12 @@ sub lang_objc_rewrite return &lang_sub_obj; } +# Rewrite a single Unified Parallel C file. +sub lang_upc_rewrite +{ + return &lang_sub_obj; +} + # Rewrite a single Java file. sub lang_java_rewrite { @@ -5511,7 +5534,7 @@ sub resolve_linker { my (%linkers) = @_; - foreach my $l (qw(GCJLINK CXXLINK F77LINK FCLINK OBJCLINK)) + foreach my $l (qw(GCJLINK CXXLINK F77LINK FCLINK OBJCLINK UPCLINK)) { return $l if defined $linkers{$l}; } diff --git a/doc/automake.texi b/doc/automake.texi index c67b7f9f..c89d9f02 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -172,6 +172,7 @@ Building Programs and Libraries * Yacc and Lex:: Yacc and Lex support * C++ Support:: Compiling C++ sources * Objective C Support:: Compiling Objective C sources +* Unified Parallel C Support:: Compiling Unified Parallel C sources * Assembly Support:: Compiling assembly sources * Fortran 77 Support:: Compiling Fortran 77 sources * Fortran 9x Support:: Compiling Fortran 9x sources @@ -2488,6 +2489,14 @@ This macro finds the @command{gcj} program or causes an error. It sets @code{GCJ} and @code{GCJFLAGS}. @command{gcj} is the Java front-end to the GNU Compiler Collection. +@item AM_PROG_UPC([@var{compiler-search-list}]) +@acindex AM_PROG_UPC +@vindex UPC +Find a compiler for Unified Parallel C and define the @code{UPC} +variable. The default @var{compiler-search-list} is @samp{upcc upc}. +This macro will abort @command{configure} if no Unified Parallel C +compiler is found. + @item AM_WITH_DMALLOC @acindex AM_WITH_DMALLOC @cindex @command{dmalloc}, support for @@ -3074,6 +3083,7 @@ to build programs and libraries. * Yacc and Lex:: Yacc and Lex support * C++ Support:: Compiling C++ sources * Objective C Support:: Compiling Objective C sources +* Unified Parallel C Support:: Compiling Unified Parallel C sources * Assembly Support:: Compiling assembly sources * Fortran 77 Support:: Compiling Fortran 77 sources * Fortran 9x Support:: Compiling Fortran 9x sources @@ -4158,6 +4168,7 @@ maude_LINK = $(CCLD) -magic -o $@@ @itemx maude_LFLAGS @itemx maude_OBJCFLAGS @itemx maude_RFLAGS +@itemx maude_UPCFLAGS @itemx maude_YFLAGS @cindex per-target compilation flags, defined Automake allows you to set compilation flags on a per-program (or @@ -4173,7 +4184,8 @@ Automake. These @dfn{per-target compilation flags} are @samp{_GCJFLAGS}, @samp{_LFLAGS}, @samp{_OBJCFLAGS}, -@samp{_RFLAGS}, and +@samp{_RFLAGS}, +@samp{_UPCFLAGS}, and @samp{_YFLAGS}. When using a per-target compilation flag, Automake will choose a @@ -4721,6 +4733,40 @@ The command used to actually link a Objective C program. @end vtable +@node Unified Parallel C Support +@section Unified Parallel C Support + +@cindex Unified Parallel C support +@cindex Support for Unified Parallel C + +Automake includes some support for Unified Parallel C. + +Any package including Unified Parallel C code must define the output +variable @code{UPC} in @file{configure.ac}; the simplest way to do +this is to use the @code{AM_PROG_UPC} macro (@pxref{Public macros}). + +A few additional variables are defined when an Unified Parallel C +source file is seen: + +@vtable @code +@item UPC +The name of the Unified Parallel C compiler. + +@item UPCFLAGS +Any flags to pass to the Unified Parallel C compiler. + +@item AM_UPCFLAGS +The maintainer's variant of @code{UPCFLAGS}. + +@item UPCCOMPILE +The command used to actually compile a Unified Parallel C source file. +The file name is appended to form the complete command line. + +@item UPCLINK +The command used to actually link a Unified Parallel C program. +@end vtable + + @node Assembly Support @section Assembly Support @@ -4967,6 +5013,9 @@ Fortran (@code{FCLINK}) @vindex OBJCLINK Objective C (@code{OBJCLINK}) @item +@vindex UPCLINK +Unified Parallel C (@code{UPCLINK}) +@item @vindex LINK C (@code{LINK}) @end enumerate @@ -8800,6 +8849,7 @@ flags, not appended. @cindex @code{AM_LIBTOOLFLAGS} and @code{LIBTOOLFLAGS} @cindex @code{AM_OBJCFLAGS} and @code{OBJCFLAGS} @cindex @code{AM_RFLAGS} and @code{RFLAGS} +@cindex @code{AM_UPCFLAGS} and @code{UPCFLAGS} @cindex @code{AM_YFLAGS} and @code{YFLAGS} @cindex @code{CCASFLAGS} and @code{AM_CCASFLAGS} @cindex @code{CFLAGS} and @code{AM_CFLAGS} @@ -8813,6 +8863,7 @@ flags, not appended. @cindex @code{LIBTOOLFLAGS} and @code{AM_LIBTOOLFLAGS} @cindex @code{OBJCFLAGS} and @code{AM_OBJCFLAGS} @cindex @code{RFLAGS} and @code{AM_RFLAGS} +@cindex @code{UPCFLAGS} and @code{AM_UPCFLAGS} @cindex @code{YFLAGS} and @code{AM_YFLAGS} This section attempts to answer all the above questions. We will @@ -8821,7 +8872,7 @@ answer holds for all the compile flags used in Automake: @code{CCASFLAGS}, @code{CFLAGS}, @code{CPPFLAGS}, @code{CXXFLAGS}, @code{FCFLAGS}, @code{FFLAGS}, @code{GCJFLAGS}, @code{LDFLAGS}, @code{LFLAGS}, @code{LIBTOOLFLAGS}, @code{OBJCFLAGS}, @code{RFLAGS}, -and @code{YFLAGS}. +@code{UPCFLAGS}, and @code{YFLAGS}. @code{CPPFLAGS}, @code{AM_CPPFLAGS}, and @code{mumble_CPPFLAGS} are three variables that can be used to pass flags to the C preprocessor diff --git a/doc/stamp-vti b/doc/stamp-vti index 7e049f89..89b27f3b 100644 --- a/doc/stamp-vti +++ b/doc/stamp-vti @@ -1,4 +1,4 @@ -@set UPDATED 4 August 2006 +@set UPDATED 14 August 2006 @set UPDATED-MONTH August 2006 @set EDITION 1.9a @set VERSION 1.9a diff --git a/doc/version.texi b/doc/version.texi index 7e049f89..89b27f3b 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 4 August 2006 +@set UPDATED 14 August 2006 @set UPDATED-MONTH August 2006 @set EDITION 1.9a @set VERSION 1.9a diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm index 96e405e5..87124f70 100644 --- a/lib/Automake/Variable.pm +++ b/lib/Automake/Variable.pm @@ -185,6 +185,8 @@ my %_ac_macro_for_var = OBJC => 'AC_PROG_OBJC', OBJCFLAGS => 'AC_PROG_OBJC', RANLIB => 'AC_PROG_RANLIB', + UPC => 'AM_PROG_UPC', + UPCFLAGS => 'AM_PROG_UPC', YACC => 'AC_PROG_YACC', ); diff --git a/m4/Makefile.am b/m4/Makefile.am index adc77e68..13d4243b 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -55,7 +55,8 @@ runlog.m4 \ sanity.m4 \ strip.m4 \ substnot.m4 \ -tar.m4 +tar.m4 \ +upc.m4 EXTRA_DIST = dirlist amversion.in diff --git a/m4/Makefile.in b/m4/Makefile.in index a6dc9c59..4308e205 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -176,7 +176,8 @@ runlog.m4 \ sanity.m4 \ strip.m4 \ substnot.m4 \ -tar.m4 +tar.m4 \ +upc.m4 EXTRA_DIST = dirlist amversion.in all: all-am diff --git a/m4/depend.m4 b/m4/depend.m4 index c3d92321..fd093733 100644 --- a/m4/depend.m4 +++ b/m4/depend.m4 @@ -34,6 +34,7 @@ AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) diff --git a/m4/upc.m4 b/m4/upc.m4 new file mode 100644 index 00000000..a819ea72 --- /dev/null +++ b/m4/upc.m4 @@ -0,0 +1,20 @@ +# Find a compiler for Unified Parallel C. -*- Autoconf -*- + +# Copyright (C) 2006 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. + +AC_DEFUN([AM_PROG_UPC], +[dnl We need OBJEXT and EXEEXT, but Autoconf doesn't offer any public +dnl macro to compute them. Use AC_PROG_CC instead. +AC_REQUIRE([AC_PROG_CC])dnl +AC_ARG_VAR([UPC], [Unified Parallel C compiler command])dnl +AC_ARG_VAR([UPCFLAGS], [Unified Parallel C compiler flags])dnl +AC_CHECK_TOOLS([UPC], [m4_default([$1], [upcc upc])], [:]) +if test "$UPC" = :; then + AC_MSG_ERROR([no Unified Parallel C compiler was found], [77]) +fi +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([UPC])])dnl +]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 7ee9370f..61f999a9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -570,6 +570,9 @@ txinfo30.test \ txinfo31.test \ transform.test \ unused.test \ +upc.test \ +upc2.test \ +upc3.test \ vars.test \ vars3.test \ vartar.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index b0bc5f4f..46b74b4c 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -701,6 +701,9 @@ txinfo30.test \ txinfo31.test \ transform.test \ unused.test \ +upc.test \ +upc2.test \ +upc3.test \ vars.test \ vars3.test \ vartar.test \ diff --git a/tests/ext.test b/tests/ext.test index 5e54aa50..dcd60129 100755 --- a/tests/ext.test +++ b/tests/ext.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2001, 2002, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -26,17 +26,18 @@ cat >> configure.in << 'END' AC_PROG_F77 AC_PROG_FC AC_PROG_OBJC +AM_PROG_UPC END cat > Makefile.am << 'END' bin_PROGRAMS = foo -foo_SOURCES = 1.f 2.for 3.f90 4.F 5.r 6.m +foo_SOURCES = 1.f 2.for 3.f90 4.F 5.r 6.m 7.upc END $ACLOCAL || exit 1 $AUTOMAKE || exit 1 -for ext in f for f90 F r m +for ext in f for f90 F r m upc do grep "^$ext\.o:" Makefile.in && exit 1 done diff --git a/tests/upc.test b/tests/upc.test new file mode 100755 index 00000000..1b1f100c --- /dev/null +++ b/tests/upc.test @@ -0,0 +1,53 @@ +#! /bin/sh +# Copyright (C) 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. + +# A simple Hello World for UPC. + +. ./defs || exit 1 +set -e + +cat >> configure.in << 'END' +AM_PROG_UPC +AC_OUTPUT +END + +cat > hello.upc << 'END' +#include +#include +int +main (void) +{ + printf ("Thread %d says, 'Hello.'\n", MYTHREAD); + return 0; +} +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = hello +hello_SOURCES = hello.upc +hello_LDADD = -lm +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure +$MAKE distcheck diff --git a/tests/upc2.test b/tests/upc2.test new file mode 100755 index 00000000..6f6e3297 --- /dev/null +++ b/tests/upc2.test @@ -0,0 +1,37 @@ +#! /bin/sh +# Copyright (C) 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 Automake suggests using AM_PROG_UPC if Unified Parallel C +# sources are used. + +. ./defs || exit 1 + +set -e + +echo AC_PROG_CC >>configure.in + +cat >Makefile.am <<'END' +bin_PROGRAMS = hello +hello_SOURCES = hello.upc +END + +$ACLOCAL +AUTOMAKE_fails +grep AM_PROG_UPC stderr diff --git a/tests/upc3.test b/tests/upc3.test new file mode 100755 index 00000000..847a99d8 --- /dev/null +++ b/tests/upc3.test @@ -0,0 +1,68 @@ +#! /bin/sh +# Copyright (C) 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 C and Unified Parallel C link safely. + +. ./defs || exit 1 +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AM_PROG_UPC +AC_OUTPUT +END + +cat > hello.upc << 'END' +#include +#include +#include "message.h" +int +main (void) +{ + printf ("Thread %d says, '%s'\n", MYTHREAD, message()); + return 0; +} +END + +cat > message.h << 'END' +const char *message (void); +END + +cat > mix.c << 'END' +#include "message.h" +const char * +message (void) +{ + return "Hello."; +} +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = hello +hello_SOURCES = hello.upc mix.c message.h +hello_LDADD = -lm +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure +$MAKE distcheck