annotate m4/openmp.m4 @ 17363:5a51fb7777a9

sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin Problem reported by Marco Atzeri in <http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00000.html>. * lib/sys_select.in.h [HAVE_SYS_SELECT_H && _CYGWIN_SYS_TIME_H]: Simply delegate to the system <sys/select.h> in this case too. Also, pay attention to _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H only if OSF/1, since otherwise Cygwin breaks, and it doesn't seem to be needed on Solaris either. * lib/sys_time.in.h [_CYGWIN_SYS_TIME_H]: Simply delgate to the system <sys/time.h> in this case.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 19 Mar 2013 09:08:47 -0700
parents e542fd46ad6f
children 344018b6e5d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14407
45ec4f35abdf Update AC_OPENMP macro for Lahey compiler on GNU/Linux.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 14398
diff changeset
1 # openmp.m4 serial 9
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16201
diff changeset
2 dnl Copyright (C) 2006-2013 Free Software Foundation, Inc.
8874
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 dnl This file can be removed once we assume autoconf >= 2.62.
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
10846
0c5305491a2b Avoid relying on m4_copy which has changed in newer autoconf.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 8874
diff changeset
9 dnl Expand to nothing in autoconf >= 2.62. m4_copy has a different
0c5305491a2b Avoid relying on m4_copy which has changed in newer autoconf.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 8874
diff changeset
10 dnl semantic in autoconf > 2.63.
0c5305491a2b Avoid relying on m4_copy which has changed in newer autoconf.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 8874
diff changeset
11 m4_ifdef([AC_OPENMP], [], [
0c5305491a2b Avoid relying on m4_copy which has changed in newer autoconf.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 8874
diff changeset
12
8874
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 # _AC_LANG_OPENMP
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 # ---------------
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 # Expands to some language dependent source code for testing the presence of
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 # OpenMP.
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 AC_DEFUN([_AC_LANG_OPENMP],
11016
5d3e28b13bb3 openmp.m4: revert quote-adding change, for portability to older autoconf
Jim Meyering <meyering@redhat.com>
parents: 11007
diff changeset
18 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
8874
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 # _AC_LANG_OPENMP(C)
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 # ------------------
11016
5d3e28b13bb3 openmp.m4: revert quote-adding change, for portability to older autoconf
Jim Meyering <meyering@redhat.com>
parents: 11007
diff changeset
22 m4_define([_AC_LANG_OPENMP(C)],
8874
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 [
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 #ifndef _OPENMP
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 choke me
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #endif
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 #include <omp.h>
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 int main () { return omp_get_num_threads (); }
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 ])
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 # _AC_LANG_OPENMP(C++)
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 # --------------------
11016
5d3e28b13bb3 openmp.m4: revert quote-adding change, for portability to older autoconf
Jim Meyering <meyering@redhat.com>
parents: 11007
diff changeset
33 m4_copy([_AC_LANG_OPENMP(C)], [_AC_LANG_OPENMP(C++)])
8874
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 # _AC_LANG_OPENMP(Fortran 77)
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 # ---------------------------
11016
5d3e28b13bb3 openmp.m4: revert quote-adding change, for portability to older autoconf
Jim Meyering <meyering@redhat.com>
parents: 11007
diff changeset
37 m4_define([_AC_LANG_OPENMP(Fortran 77)],
14398
5e1e246a6194 Fix OpenMP flag detection for various Fortran compilers.
Christian Rössel <christian.roessel@gmx.de>
parents: 14079
diff changeset
38 [
5e1e246a6194 Fix OpenMP flag detection for various Fortran compilers.
Christian Rössel <christian.roessel@gmx.de>
parents: 14079
diff changeset
39 program main
5e1e246a6194 Fix OpenMP flag detection for various Fortran compilers.
Christian Rössel <christian.roessel@gmx.de>
parents: 14079
diff changeset
40 implicit none
5e1e246a6194 Fix OpenMP flag detection for various Fortran compilers.
Christian Rössel <christian.roessel@gmx.de>
parents: 14079
diff changeset
41 !$ integer tid
5e1e246a6194 Fix OpenMP flag detection for various Fortran compilers.
Christian Rössel <christian.roessel@gmx.de>
parents: 14079
diff changeset
42 tid = 42
5e1e246a6194 Fix OpenMP flag detection for various Fortran compilers.
Christian Rössel <christian.roessel@gmx.de>
parents: 14079
diff changeset
43 call omp_set_num_threads(2)
5e1e246a6194 Fix OpenMP flag detection for various Fortran compilers.
Christian Rössel <christian.roessel@gmx.de>
parents: 14079
diff changeset
44 end
5e1e246a6194 Fix OpenMP flag detection for various Fortran compilers.
Christian Rössel <christian.roessel@gmx.de>
parents: 14079
diff changeset
45 ])
8874
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 # _AC_LANG_OPENMP(Fortran)
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 # ---------------------------
11016
5d3e28b13bb3 openmp.m4: revert quote-adding change, for portability to older autoconf
Jim Meyering <meyering@redhat.com>
parents: 11007
diff changeset
49 m4_copy([_AC_LANG_OPENMP(Fortran 77)], [_AC_LANG_OPENMP(Fortran)])
8874
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 # AC_OPENMP
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 # ---------
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 # Check which options need to be passed to the C compiler to support OpenMP.
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 # Set the OPENMP_CFLAGS / OPENMP_CXXFLAGS / OPENMP_FFLAGS variable to these
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 # options.
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 # The options are necessary at compile time (so the #pragmas are understood)
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 # and at link time (so the appropriate library is linked with).
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 # This macro takes care to not produce redundant options if $CC $CFLAGS already
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 # supports OpenMP. It also is careful to not pass options to compilers that
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 # misinterpret them; for example, most compilers accept "-openmp" and create
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 # an output file called 'penmp' rather than activating OpenMP support.
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 AC_DEFUN([AC_OPENMP],
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 [
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 OPENMP_[]_AC_LANG_PREFIX[]FLAGS=
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 AC_ARG_ENABLE([openmp],
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 [AS_HELP_STRING([--disable-openmp], [do not use OpenMP])])
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 if test "$enable_openmp" != no; then
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 AC_CACHE_CHECK([for $CC option to support OpenMP],
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp],
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 [AC_LINK_IFELSE([_AC_LANG_OPENMP],
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
71 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='none needed'],
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
72 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='unsupported'
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
73 dnl Try these flags:
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
74 dnl GCC >= 4.2 -fopenmp
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
75 dnl SunPRO C -xopenmp
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
76 dnl Intel C -openmp
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
77 dnl SGI C, PGI C -mp
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
78 dnl Tru64 Compaq C -omp
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
79 dnl IBM C (AIX, Linux) -qsmp=omp
14398
5e1e246a6194 Fix OpenMP flag detection for various Fortran compilers.
Christian Rössel <christian.roessel@gmx.de>
parents: 14079
diff changeset
80 dnl Cray CCE -homp
5e1e246a6194 Fix OpenMP flag detection for various Fortran compilers.
Christian Rössel <christian.roessel@gmx.de>
parents: 14079
diff changeset
81 dnl NEC SX -Popenmp
14407
45ec4f35abdf Update AC_OPENMP macro for Lahey compiler on GNU/Linux.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 14398
diff changeset
82 dnl Lahey Fortran (Linux) --openmp
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
83 dnl If in this loop a compiler is passed an option that it doesn't
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
84 dnl understand or that it misinterprets, the AC_LINK_IFELSE test
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
85 dnl will fail (since we know that it failed without the option),
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
86 dnl therefore the loop will continue searching for an option, and
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
87 dnl no output file called 'penmp' or 'mp' is created.
14407
45ec4f35abdf Update AC_OPENMP macro for Lahey compiler on GNU/Linux.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 14398
diff changeset
88 for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \
45ec4f35abdf Update AC_OPENMP macro for Lahey compiler on GNU/Linux.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 14398
diff changeset
89 -Popenmp --openmp; do
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
90 ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
91 _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
92 AC_LINK_IFELSE([_AC_LANG_OPENMP],
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
93 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp=$ac_option])
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
94 _AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
95 if test "$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != unsupported; then
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
96 break
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
97 fi
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11016
diff changeset
98 done])])
8874
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 case $ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp in #(
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 "none needed" | unsupported)
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 ;; #(
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102 *)
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp ;;
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104 esac
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 fi
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106 AC_SUBST([OPENMP_]_AC_LANG_PREFIX[FLAGS])
d0bb3e532814 New module 'openmp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107 ])
10846
0c5305491a2b Avoid relying on m4_copy which has changed in newer autoconf.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 8874
diff changeset
108
0c5305491a2b Avoid relying on m4_copy which has changed in newer autoconf.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 8874
diff changeset
109 ])