X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fopenmp.m4;h=cac6d839beeb3fdf942b06780d8b4f44bdd47506;hb=6a0fd2e2d7d6a7e787ada21ffbe5f8ac0e3a06f1;hp=8c9c06f1aed58fefbd6cd26c505c3c4cda30b94f;hpb=42d1eda5dcce2d68deab7a642e7f29bcd7144a0d;p=gnulib.git diff --git a/m4/openmp.m4 b/m4/openmp.m4 index 8c9c06f1a..cac6d839b 100644 --- a/m4/openmp.m4 +++ b/m4/openmp.m4 @@ -1,5 +1,5 @@ -# openmp.m4 serial 6 -dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. +# openmp.m4 serial 9 +dnl Copyright (C) 2006-2014 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. @@ -15,11 +15,11 @@ m4_ifdef([AC_OPENMP], [], [ # Expands to some language dependent source code for testing the presence of # OpenMP. AC_DEFUN([_AC_LANG_OPENMP], -[_AC_LANG_DISPATCH([$0], [_AC_LANG], [$@])]) +[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) # _AC_LANG_OPENMP(C) # ------------------ -m4_define([_AC_LANG_OPENMP([C])], +m4_define([_AC_LANG_OPENMP(C)], [ #ifndef _OPENMP choke me @@ -30,16 +30,23 @@ int main () { return omp_get_num_threads (); } # _AC_LANG_OPENMP(C++) # -------------------- -m4_copy([_AC_LANG_OPENMP([C])], [_AC_LANG_OPENMP([C++])]) +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])]) +m4_define([_AC_LANG_OPENMP(Fortran 77)], +[ + program main + implicit none +!$ integer tid + tid = 42 + call omp_set_num_threads(2) + end +]) # _AC_LANG_OPENMP(Fortran) # --------------------------- -m4_copy([_AC_LANG_OPENMP([Fortran 77])], [_AC_LANG_OPENMP([Fortran])]) +m4_copy([_AC_LANG_OPENMP(Fortran 77)], [_AC_LANG_OPENMP(Fortran)]) # AC_OPENMP # --------- @@ -61,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) ;; #(