annotate src/fftw-3.3.3/m4/ax_openmp.m4 @ 83:ae30d91d2ffe

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