Fix OpenMP flag detection for various Fortran compilers.
authorChristian Rössel <christian.roessel@gmx.de>
Sun, 20 Feb 2011 17:50:14 +0000 (18:50 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 28 Feb 2011 06:17:39 +0000 (07:17 +0100)
* m4/openmp.m4 (_AC_LANG_OPENMP(Fortran 77)): Use '!$'
OpenMP-conditional compilation construct, to force compile
failure with missing OpenMP flag.
(AC_OPENMP): Add flags for Cray CCE and NEC SX compilers.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
m4/openmp.m4

index e349a4e3352e24736114d71b00058f271cc55800..4e10af68bbfe4f01073accb10a0bb2e933dc9b4c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-28  Christian Rössel  <christian.roessel@gmx.de>  (tiny change)
+           Markus Geimer  <m.geimer@fz-juelich.de>  (tiny change)
+
+       Fix OpenMP flag detection for various Fortran compilers.
+       * m4/openmp.m4 (_AC_LANG_OPENMP(Fortran 77)): Use '!$'
+       OpenMP-conditional compilation construct, to force compile
+       failure with missing OpenMP flag.
+       (AC_OPENMP): Add flags for Cray CCE and NEC SX compilers.
+
 2011-02-25  Eric Blake  <eblake@redhat.com>
 
        strstr: expand test coverage
index f2424df803ad1f29f6bd0aad4faf3a183dfb229f..cedfb4cd500d7dbcef3adcf6312b15f135feb8aa 100644 (file)
@@ -1,4 +1,4 @@
-# openmp.m4 serial 7
+# openmp.m4 serial 8
 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,7 +35,14 @@ m4_copy([_AC_LANG_OPENMP(C)], [_AC_LANG_OPENMP(C++)])
 # _AC_LANG_OPENMP(Fortran 77)
 # ---------------------------
 m4_define([_AC_LANG_OPENMP(Fortran 77)],
-[AC_LANG_FUNC_LINK_TRY([omp_get_num_threads])])
+[
+      program main
+      implicit none
+!$    integer tid
+      tid = 42
+      call omp_set_num_threads(2)
+      end
+])
 
 # _AC_LANG_OPENMP(Fortran)
 # ---------------------------
@@ -70,12 +77,14 @@ AC_DEFUN([AC_OPENMP],
           dnl   SGI C, PGI C         -mp
           dnl   Tru64 Compaq C       -omp
           dnl   IBM C (AIX, Linux)   -qsmp=omp
+          dnl   Cray CCE             -homp
+          dnl   NEC SX               -Popenmp
           dnl If in this loop a compiler is passed an option that it doesn't
           dnl understand or that it misinterprets, the AC_LINK_IFELSE test
           dnl will fail (since we know that it failed without the option),
           dnl therefore the loop will continue searching for an option, and
           dnl no output file called 'penmp' or 'mp' is created.
-          for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do
+          for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp -Popenmp; do
             ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
             _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
             AC_LINK_IFELSE([_AC_LANG_OPENMP],