automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: proposed patch to support Unified Parallel C (version 3 of patch)


From: Alexandre Duret-Lutz
Subject: Re: proposed patch to support Unified Parallel C (version 3 of patch)
Date: Mon, 14 Aug 2006 22:38:15 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

Sorry for the delay.

>>> "JH" == Jonathan Higa <address@hidden> writes:
[...]
 JH> What's the right way to guarantee OBJEXT in the
 JH> output without hunting for an unnecessary compiler?

I'm not sure there is any.  Anyway if someone has a better idea
this can be fixed easily later.

I'm installing your patch as follows.  

I've tuned a few things, notably in upc.m4.  I couldn't think of
any reason someone would like to change the default if-no-found
value of UPC (because if you set it to something different than
':', configure will have a hard time trying to compute its
dependency mode) so since it was not documented I removed it.
I've added some documentation for the default search list, since
that feature is also supported by the other AC_PROG_* macros.

(BTW, does upc really require `-lm' to link a simple "Hello World"?)

2006-08-14  Jonathan Higa <address@hidden>

        * 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.

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        14 Aug 2006 20:27:24 -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 14 Aug 2006 20:27:24 -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   14 Aug 2006 20:27:26 -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,14 @@
 @code{GCJ} and @code{GCJFLAGS}.  @command{gcj} is the Java front-end to the
 GNU Compiler Collection.
 
address@hidden AM_PROG_UPC(address@hidden)
address@hidden AM_PROG_UPC
address@hidden 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 @@
 * 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 @@
 @itemx maude_LFLAGS
 @itemx maude_OBJCFLAGS
 @itemx maude_RFLAGS
address@hidden 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 @@
 @samp{_GCJFLAGS},
 @samp{_LFLAGS},
 @samp{_OBJCFLAGS},
address@hidden, and
address@hidden,
address@hidden, and
 @samp{_YFLAGS}.
 
 When using a per-target compilation flag, Automake will choose a
@@ -4721,6 +4733,40 @@
 @end vtable
 
 
address@hidden Unified Parallel C Support
address@hidden Unified Parallel C Support
+
address@hidden Unified Parallel C support
address@hidden 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:
+
address@hidden @code
address@hidden UPC
+The name of the Unified Parallel C compiler.
+
address@hidden UPCFLAGS
+Any flags to pass to the Unified Parallel C compiler.
+
address@hidden AM_UPCFLAGS
+The maintainer's variant of @code{UPCFLAGS}.
+
address@hidden UPCCOMPILE
+The command used to actually compile a Unified Parallel C source file.
+The file name is appended to form the complete command line.
+
address@hidden UPCLINK
+The command used to actually link a Unified Parallel C program.
address@hidden vtable
+
+
 @node Assembly Support
 @section Assembly Support
 
@@ -4967,6 +5013,9 @@
 @vindex OBJCLINK
 Objective C (@code{OBJCLINK})
 @item
address@hidden UPCLINK
+Unified Parallel C (@code{UPCLINK})
address@hidden
 @vindex LINK
 C (@code{LINK})
 @end enumerate
@@ -8800,6 +8849,7 @@
 @cindex @code{AM_LIBTOOLFLAGS} and @code{LIBTOOLFLAGS}
 @cindex @code{AM_OBJCFLAGS} and @code{OBJCFLAGS}
 @cindex @code{AM_RFLAGS} and @code{RFLAGS}
address@hidden @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 @@
 @cindex @code{LIBTOOLFLAGS} and @code{AM_LIBTOOLFLAGS}
 @cindex @code{OBJCFLAGS} and @code{AM_OBJCFLAGS}
 @cindex @code{RFLAGS} and @code{AM_RFLAGS}
address@hidden @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 @@
 @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}.
address@hidden, 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    14 Aug 2006 20:27:26 -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      14 Aug 2006 20:27:26 -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        14 Aug 2006 20:27:26 -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   14 Aug 2006 20:27:26 -0000
@@ -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
+])
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   14 Aug 2006 20:27:26 -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      14 Aug 2006 20:27:26 -0000
@@ -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 @@
 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      14 Aug 2006 20:27:26 -0000
@@ -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 <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
+
+./configure
+$MAKE distcheck
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     14 Aug 2006 20:27:26 -0000
@@ -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
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     14 Aug 2006 20:27:26 -0000
@@ -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 <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
+
+./configure
+$MAKE distcheck
-- 
Alexandre Duret-Lutz

Shared books are happy books.     http://www.bookcrossing.com/friend/gadl





reply via email to

[Prev in Thread] Current Thread [Next in Thread]