]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/c.m4 (AC_OPENMP): Use a simple loop instead of compiler
authorNoah Misch <noah@cs.caltech.edu>
Mon, 4 Jun 2007 03:16:36 +0000 (03:16 +0000)
committerNoah Misch <noah@cs.caltech.edu>
Mon, 4 Jun 2007 03:16:36 +0000 (03:16 +0000)
brand tests.

ChangeLog
lib/autoconf/c.m4

index 4f2e5ddace24764e9b053ba18bb54bf73cc2f1be..9e3e15aa4acc41d112fde933f59f8622f07f3e6f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-06-03  Noah Misch  <noah@cs.caltech.edu>,
+           Bruno Haible  <bruno@clisp.org>
+
+       * lib/autoconf/c.m4 (AC_OPENMP): Use a simple loop instead of compiler
+       brand tests.
+
 2007-05-31  Paul Eggert  <eggert@cs.ucla.edu>
 
        * doc/autoconf.texi (Particular Types): Give example of use for
index bd5e44e03a4313d7e88245d5fbd57c916eceeff7..e3f3198dcc64ec51246462eea9da2391266ce8ee 100644 (file)
@@ -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])])