X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=inline;f=m4%2Fopenmp.m4;h=962c3275ce4e494e9c34f51d7c5b75068fa0af10;hb=dd44da552f3f158a55b04fbe11ef1d0faf5ee5ba;hp=8fd510b9ed511bce78c9459d8e3f02c2c6bdc381;hpb=05d766214c5d1c6991334d9420f41a8cb45a08a7;p=gnulib.git diff --git a/m4/openmp.m4 b/m4/openmp.m4 index 8fd510b9e..962c3275c 100644 --- a/m4/openmp.m4 +++ b/m4/openmp.m4 @@ -1,11 +1,15 @@ -# openmp.m4 serial 4 -dnl Copyright (C) 2006-2007 Free Software Foundation, Inc. +# openmp.m4 serial 9 +dnl Copyright (C) 2006-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This file can be removed once we assume autoconf >= 2.62. +dnl Expand to nothing in autoconf >= 2.62. m4_copy has a different +dnl semantic in autoconf > 2.63. +m4_ifdef([AC_OPENMP], [], [ + # _AC_LANG_OPENMP # --------------- # Expands to some language dependent source code for testing the presence of @@ -31,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) # --------------------------- @@ -57,30 +68,34 @@ AC_DEFUN([AC_OPENMP], AC_CACHE_CHECK([for $CC option to support OpenMP], [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp], [AC_LINK_IFELSE([_AC_LANG_OPENMP], - [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='none needed'], - [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='unsupported' - dnl Try these flags: - dnl GCC >= 4.2 -fopenmp - dnl SunPRO C -xopenmp - dnl Intel C -openmp - dnl SGI C, PGI C -mp - dnl Tru64 Compaq C -omp - dnl IBM C (AIX, Linux) -qsmp=omp - 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 - 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], - [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp=$ac_option]) - _AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS - if test "$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != unsupported; then - break - fi - done])]) + [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='none needed'], + [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='unsupported' + dnl Try these flags: + dnl GCC >= 4.2 -fopenmp + dnl SunPRO C -xopenmp + dnl Intel C -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 Lahey Fortran (Linux) --openmp + 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 -homp \ + -Popenmp --openmp; 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], + [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp=$ac_option]) + _AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS + if test "$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != unsupported; then + break + fi + done])]) case $ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp in #( "none needed" | unsupported) ;; #( @@ -90,3 +105,5 @@ AC_DEFUN([AC_OPENMP], fi AC_SUBST([OPENMP_]_AC_LANG_PREFIX[FLAGS]) ]) + +])