On 8/4/06, Alexandre Duret-Lutz <[EMAIL PROTECTED]> wrote:

Congratulations on the patch, and thanks for making it complete.
It looks great, but I can see a couple of minor problems.  My
main complaint is that your tests do not show that building a
upc program actually work.


Here is a Version 4 which should fix everything noted in the previous
message, but there's at least one new problem that I don't know how to fix.
I added AC_PROG_CC in AM_PROG_UPC to force OBJEXT into Makefile.in; without
it, upc.test will fail.  What's the right way to guarantee OBJEXT in the
output without hunting for an unnecessary compiler?
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.306
diff -u -r1.306 NEWS
--- NEWS	21 Apr 2006 19:02:29 -0000	1.306
+++ NEWS	5 Aug 2006 18:26:55 -0000
@@ -118,6 +118,10 @@
 
     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:
 
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1626
diff -u -r1.1626 automake.in
--- automake.in	4 Aug 2006 12:54:30 -0000	1.1626
+++ automake.in	5 Aug 2006 18:27:00 -0000
@@ -731,7 +731,7 @@
 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 @@
 		   '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 @@
     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 @@
 {
     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};
     }
Index: doc/automake.texi
===================================================================
RCS file: /cvs/automake/automake/doc/automake.texi,v
retrieving revision 1.140
diff -u -r1.140 automake.texi
--- doc/automake.texi	4 Aug 2006 16:27:38 -0000	1.140
+++ doc/automake.texi	5 Aug 2006 18:27:09 -0000
@@ -172,6 +172,7 @@
 * 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,13 @@
 @code{GCJ} and @code{GCJFLAGS}.  @command{gcj} is the Java front-end to the
 GNU Compiler Collection.
 
[EMAIL PROTECTED] AM_PROG_UPC
[EMAIL PROTECTED] AM_PROG_UPC
[EMAIL PROTECTED] UPC
[EMAIL PROTECTED] UPCFLAGS
+Find a compiler for Unified Parallel C.  This is required if any
+Unified Parallel C source is included.
+
 @item AM_WITH_DMALLOC
 @acindex AM_WITH_DMALLOC
 @cindex @command{dmalloc}, support for
@@ -3074,6 +3082,7 @@
 * 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 +4167,7 @@
 @itemx maude_LFLAGS
 @itemx maude_OBJCFLAGS
 @itemx maude_RFLAGS
[EMAIL PROTECTED] 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 +4183,8 @@
 @samp{_GCJFLAGS},
 @samp{_LFLAGS},
 @samp{_OBJCFLAGS},
[EMAIL PROTECTED], and
[EMAIL PROTECTED],
[EMAIL PROTECTED], and
 @samp{_YFLAGS}.
 
 When using a per-target compilation flag, Automake will choose a
@@ -4721,6 +4732,40 @@
 @end vtable
 
 
[EMAIL PROTECTED] Unified Parallel C Support
[EMAIL PROTECTED] Unified Parallel C Support
+
[EMAIL PROTECTED] Unified Parallel C support
[EMAIL PROTECTED] 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
[EMAIL PROTECTED] in @file{configure.ac}; the simplest way to do this is to use
+the @code{AM_PROG_UPC} macro.
+
+A few additional variables are defined when an Unified Parallel C source file
+is seen:
+
[EMAIL PROTECTED] @code
[EMAIL PROTECTED] UPC
+The name of the Unified Parallel C compiler.
+
[EMAIL PROTECTED] UPCFLAGS
+Any flags to pass to the Unified Parallel C compiler.
+
[EMAIL PROTECTED] AM_UPCFLAGS
+The maintainer's variant of @code{UPCFLAGS}.
+
[EMAIL PROTECTED] UPCCOMPILE
+The command used to actually compile a Unified Parallel C source file.  The
+file name is appended to form the complete command line.
+
[EMAIL PROTECTED] UPCLINK
+The command used to actually link a Unified Parallel C program.
[EMAIL PROTECTED] vtable
+
+
 @node Assembly Support
 @section Assembly Support
 
@@ -4967,6 +5012,9 @@
 @vindex OBJCLINK
 Objective C (@code{OBJCLINK})
 @item
[EMAIL PROTECTED] UPCLINK
+Unified Parallel C (@code{UPCLINK})
[EMAIL PROTECTED]
 @vindex LINK
 C (@code{LINK})
 @end enumerate
@@ -8800,6 +8848,7 @@
 @cindex @code{AM_LIBTOOLFLAGS} and @code{LIBTOOLFLAGS}
 @cindex @code{AM_OBJCFLAGS} and @code{OBJCFLAGS}
 @cindex @code{AM_RFLAGS} and @code{RFLAGS}
[EMAIL PROTECTED] @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 +8862,7 @@
 @cindex @code{LIBTOOLFLAGS} and @code{AM_LIBTOOLFLAGS}
 @cindex @code{OBJCFLAGS} and @code{AM_OBJCFLAGS}
 @cindex @code{RFLAGS} and @code{AM_RFLAGS}
[EMAIL PROTECTED] @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 +8871,7 @@
 @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}.
[EMAIL PROTECTED], 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
Index: lib/Automake/Variable.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/Variable.pm,v
retrieving revision 1.44
diff -u -r1.44 Variable.pm
--- lib/Automake/Variable.pm	17 Apr 2006 12:14:07 -0000	1.44
+++ lib/Automake/Variable.pm	5 Aug 2006 18:27:10 -0000
@@ -185,6 +185,8 @@
    OBJC => 'AC_PROG_OBJC',
    OBJCFLAGS => 'AC_PROG_OBJC',
    RANLIB => 'AC_PROG_RANLIB',
+   UPC => 'AM_PROG_UPC',
+   UPCFLAGS => 'AM_PROG_UPC',
    YACC => 'AC_PROG_YACC',
    );
 
Index: m4/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/m4/Makefile.am,v
retrieving revision 1.55
diff -u -r1.55 Makefile.am
--- m4/Makefile.am	9 Apr 2006 07:46:55 -0000	1.55
+++ m4/Makefile.am	5 Aug 2006 18:27:10 -0000
@@ -55,7 +55,8 @@
 sanity.m4 \
 strip.m4 \
 substnot.m4 \
-tar.m4
+tar.m4 \
+upc.m4
 
 EXTRA_DIST = dirlist amversion.in
 
Index: m4/depend.m4
===================================================================
RCS file: /cvs/automake/automake/m4/depend.m4,v
retrieving revision 1.37
diff -u -r1.37 depend.m4
--- m4/depend.m4	6 Jun 2006 20:55:44 -0000	1.37
+++ m4/depend.m4	5 Aug 2006 18:27:10 -0000
@@ -34,6 +34,7 @@
 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=])
 
Index: m4/upc.m4
===================================================================
RCS file: m4/upc.m4
diff -N m4/upc.m4
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ m4/upc.m4	5 Aug 2006 18:27:10 -0000
@@ -0,0 +1,19 @@
+# Find a compiler for Unified Parallel C.
+
+# 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],[
+AC_ARG_VAR([UPC], [Unified Parallel C compiler])
+AC_ARG_VAR([UPCFLAGS], [Unified Parallel C options])
+AC_CHECK_PROGS([UPC], [m4_if([$1],,[upcc upc],[$1])], [m4_if([$2],,[:],[$2])])
+if test "$UPC" = :
+then
+AC_MSG_ERROR([No Unified Parallel C compiler was found.])
+fi
+AC_PROG_CC dnl Why does _AM_DEPENDENCIES require AC_PROG_CC?
+_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([UPC])])
+])
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.607
diff -u -r1.607 Makefile.am
--- tests/Makefile.am	4 Aug 2006 14:53:32 -0000	1.607
+++ tests/Makefile.am	5 Aug 2006 18:27:10 -0000
@@ -570,6 +570,9 @@
 txinfo31.test \
 transform.test \
 unused.test \
+upc.test \
+upc2.test \
+upc3.test \
 vars.test \
 vars3.test \
 vartar.test \
Index: tests/ext.test
===================================================================
RCS file: /cvs/automake/automake/tests/ext.test,v
retrieving revision 1.8
diff -u -r1.8 ext.test
--- tests/ext.test	20 Mar 2006 20:31:29 -0000	1.8
+++ tests/ext.test	5 Aug 2006 18:27:10 -0000
@@ -26,17 +26,18 @@
 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
Index: tests/upc.test
===================================================================
RCS file: tests/upc.test
diff -N tests/upc.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/upc.test	5 Aug 2006 18:27:10 -0000
@@ -0,0 +1,57 @@
+#! /bin/sh
+# Copyright (C) 2001, 2002, 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 `.upc' extension works.
+# From Ralf Corsepius (for C++).
+
+. ./defs || exit 1
+set -e
+
+cat >> configure.in << 'END'
+AM_PROG_UPC
+AC_OUTPUT
+END
+
+cat > hello.upc << 'END'
+#include <stdio.h>
+#include <upc.h>
+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
+
+if ./configure
+then $MAKE distcheck
+elif grep 'No Unified Parallel C compiler' config.log
+then exit 77
+else exit 1
+fi
Index: tests/upc2.test
===================================================================
RCS file: tests/upc2.test
diff -N tests/upc2.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/upc2.test	5 Aug 2006 18:27:10 -0000
@@ -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 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
Index: tests/upc3.test
===================================================================
RCS file: tests/upc3.test
diff -N tests/upc3.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/upc3.test	5 Aug 2006 18:27:10 -0000
@@ -0,0 +1,70 @@
+#! /bin/sh
+# Copyright (C) 2001, 2002, 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 <stdio.h>
+#include <upc.h>
+#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
+
+if ./configure
+then $MAKE distcheck
+elif grep 'No Unified Parallel C compiler' config.log
+then exit 77
+else exit 1
+fi

Reply via email to