diff --git a/ChangeLog b/ChangeLog index 4f2e5dda..9e3e15aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-06-03 Noah Misch , + Bruno Haible + + * lib/autoconf/c.m4 (AC_OPENMP): Use a simple loop instead of compiler + brand tests. + 2007-05-31 Paul Eggert * doc/autoconf.texi (Particular Types): Give example of use for diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index bd5e44e0..e3f3198d 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -1903,49 +1903,18 @@ AC_DEFUN([AC_OPENMP], dnl SGI C, PGI C -mp dnl Tru64 Compaq C -omp dnl IBM C (AIX, Linux) -qsmp=omp - for ac_brand in GCC SunPRO Intel SGI/PGI Compaq IBM; do - case $ac_brand in #( - GCC) - ac_conditional='defined __GNUC__' - ac_option='-fopenmp' ;; #( - SunPRO) - ac_conditional='defined __SUNPRO_C || defined __SUNPRO_CC' - ac_option='-xopenmp' ;; #( - Intel) - ac_conditional='defined __INTEL_COMPILER' - ac_option='-openmp' ;; #( - SGI/PGI) - ac_conditional='defined __sgi || defined __PGI || defined __PGIC__' - ac_option='-mp' ;; #( - Compaq) - ac_conditional='defined __DECC || defined __DECCXX' - ac_option='-omp' ;; #( - IBM) - ac_conditional='defined __xlc__ || defined __xlC__' - ac_option='-qsmp=omp' ;; - esac - if test $ac_brand = GCC; then - if test "$ac_compiler_gnu" = yes; then - ac_openmp_result=yes - else - ac_openmp_result=no - fi - else - AC_EGREP_CPP([Brand], - [ - #if $ac_conditional - Brand - #endif - ], - [ac_openmp_result=yes], - [ac_openmp_result=no]) - fi - if test $ac_openmp_result = yes; then - 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 + 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])])