comparison src/fftw-3.3.3/m4/ax_openmp.m4 @ 10:37bf6b4a2645

Add FFTW3
author Chris Cannam
date Wed, 20 Mar 2013 15:35:50 +0000
parents
children
comparison
equal deleted inserted replaced
9:c0fb53affa76 10:37bf6b4a2645
1 dnl @synopsis AX_OPENMP([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
2 dnl @summary determine how to compile programs using OpenMP
3 dnl @category InstalledPackages
4 dnl
5 dnl This macro tries to find out how to compile programs that
6 dnl use OpenMP, a standard API and set of compiler directives for
7 dnl parallel programming (see http://www.openmp.org/).
8 dnl
9 dnl On success, it sets the OPENMP_CFLAGS/OPENMP_CXXFLAGS/OPENMP_FFLAGS
10 dnl output variable to the flag (e.g. -omp) used both to compile *and* link
11 dnl OpenMP programs in the current language.
12 dnl
13 dnl NOTE: You are assumed to not only compile your program with these
14 dnl flags, but also link it with them as well.
15 dnl
16 dnl If you want to compile everything with OpenMP, you should set:
17 dnl
18 dnl CFLAGS="$CFLAGS $OPENMP_CFLAGS"
19 dnl #OR# CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
20 dnl #OR# FFLAGS="$FFLAGS $OPENMP_FFLAGS"
21 dnl
22 dnl (depending on the selected language).
23 dnl
24 dnl The user can override the default choice by setting the corresponding
25 dnl environment variable (e.g. OPENMP_CFLAGS).
26 dnl
27 dnl ACTION-IF-FOUND is a list of shell commands to run if an OpenMP
28 dnl flag is found, and ACTION-IF-NOT-FOUND is a list of commands
29 dnl to run it if it is not found. If ACTION-IF-FOUND is not specified,
30 dnl the default action will define HAVE_OPENMP.
31 dnl
32 dnl @version 2006-11-20
33 dnl @license GPLWithACException
34 dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
35
36 AC_DEFUN([AX_OPENMP], [
37 AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
38
39 AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
40 ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown
41 # Flags to try: -fopenmp (gcc), -openmp (icc), -mp (SGI & PGI),
42 # -xopenmp (Sun), -omp (Tru64), -qsmp=omp (AIX), none
43 ax_openmp_flags="-fopenmp -openmp -mp -xopenmp -omp -qsmp=omp none"
44 if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then
45 ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags"
46 fi
47 for ax_openmp_flag in $ax_openmp_flags; do
48 case $ax_openmp_flag in
49 none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;;
50 *) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;;
51 esac
52 AC_TRY_LINK_FUNC(omp_set_num_threads,
53 [ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break])
54 done
55 []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS
56 ])
57 if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" = "xunknown"; then
58 m4_default([$2],:)
59 else
60 if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" != "xnone"; then
61 OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ax_cv_[]_AC_LANG_ABBREV[]_openmp
62 fi
63 m4_default([$1], [AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])])
64 fi
65 AC_SUBST(OPENMP_[]_AC_LANG_PREFIX[]FLAGS)
66 ])dnl AX_OPENMP