Mercurial > gnulib
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 |
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 | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | |
5 dnl with or without modifications, as long as this notice is preserved. | |
6 | |
7 dnl This file can be removed once we assume autoconf >= 2.62. | |
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 | 13 # _AC_LANG_OPENMP |
14 # --------------- | |
15 # Expands to some language dependent source code for testing the presence of | |
16 # OpenMP. | |
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 | 19 |
20 # _AC_LANG_OPENMP(C) | |
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 | 23 [ |
24 #ifndef _OPENMP | |
25 choke me | |
26 #endif | |
27 #include <omp.h> | |
28 int main () { return omp_get_num_threads (); } | |
29 ]) | |
30 | |
31 # _AC_LANG_OPENMP(C++) | |
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 | 34 |
35 # _AC_LANG_OPENMP(Fortran 77) | |
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 | 46 |
47 # _AC_LANG_OPENMP(Fortran) | |
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 | 50 |
51 # AC_OPENMP | |
52 # --------- | |
53 # Check which options need to be passed to the C compiler to support OpenMP. | |
54 # Set the OPENMP_CFLAGS / OPENMP_CXXFLAGS / OPENMP_FFLAGS variable to these | |
55 # options. | |
56 # The options are necessary at compile time (so the #pragmas are understood) | |
57 # and at link time (so the appropriate library is linked with). | |
58 # This macro takes care to not produce redundant options if $CC $CFLAGS already | |
59 # supports OpenMP. It also is careful to not pass options to compilers that | |
60 # misinterpret them; for example, most compilers accept "-openmp" and create | |
61 # an output file called 'penmp' rather than activating OpenMP support. | |
62 AC_DEFUN([AC_OPENMP], | |
63 [ | |
64 OPENMP_[]_AC_LANG_PREFIX[]FLAGS= | |
65 AC_ARG_ENABLE([openmp], | |
66 [AS_HELP_STRING([--disable-openmp], [do not use OpenMP])]) | |
67 if test "$enable_openmp" != no; then | |
68 AC_CACHE_CHECK([for $CC option to support OpenMP], | |
69 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp], | |
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 | 99 case $ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp in #( |
100 "none needed" | unsupported) | |
101 ;; #( | |
102 *) | |
103 OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp ;; | |
104 esac | |
105 fi | |
106 AC_SUBST([OPENMP_]_AC_LANG_PREFIX[FLAGS]) | |
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 ]) |