autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: detection and support of OpenMP


From: Noah Misch
Subject: Re: detection and support of OpenMP
Date: Mon, 21 May 2007 16:12:29 -0700
User-agent: Mutt/1.5.9i

On Fri, May 18, 2007 at 12:49:16AM +0200, Bruno Haible wrote:
> + # _AC_LANG_OPENMP(C)
> + # ------------------
> + m4_define([_AC_LANG_OPENMP(C)],
> + [
> + #ifndef _OPENMP
> +  choke me
> + #endif
> + #include <omp.h>
> + int main () { return omp_get_num_threads (); }
> + ])

> + # This macro takes care to not produce redundant options if $CC $CFLAGS 
> already
> + # supports OpenMP. It also is careful to not pass options to compilers that
> + # misinterpret them; for example, most compilers accept "-openmp" and create
> + # an output file called 'penmp' rather than activating OpenMP support.
> + AC_DEFUN([AC_OPENMP],

If we reach the stage of testing additional compiler options, the current $CC
$CFLAGS failed to compile the test program.  If that compiler treats `-openmp'
like `-o penmp', it will still fail to compile the test program.  Do we really
need this special care?

Possible simplifying patch:

diff -Nurp -X dontdiff ac-clean/lib/autoconf/c.m4 
ac-openmp_percomp/lib/autoconf/c.m4
--- ac-clean/lib/autoconf/c.m4  2007-05-21 18:42:08.000000000 -0400
+++ ac-openmp_percomp/lib/autoconf/c.m4 2007-05-21 18:54:19.000000000 -0400
@@ -1906,48 +1906,13 @@ 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
-            break
-          fi
+        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
+          break
         done
       fi
       ])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]