changeset 21556:12f207a534aa

maint: merge stable to default.
author John W. Eaton <jwe@octave.org>
date Mon, 28 Mar 2016 22:56:18 -0400
parents 8014bba57c2b (current diff) 9f0088f3f335 (diff)
children f6663c49870c
files configure.ac libinterp/corefcn/sysdep.cc
diffstat 2 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Mon Mar 28 22:53:27 2016 -0400
+++ b/configure.ac	Mon Mar 28 22:56:18 2016 -0400
@@ -507,16 +507,20 @@
   AX_OPENMP([XTRA_CXXFLAGS="$XTRA_CXXFLAGS $OPENMP_CXXFLAGS"; ENABLE_OPENMP=yes], [])
   AC_LANG_POP(C++)
 fi
-dnl Define here since it is skipped if the first argument to
-dnl AX_OPENMP is not empty.
-if test $ENABLE_OPENMP = yes; then
-  AC_DEFINE(OCTAVE_ENABLE_OPENMP, 1, [Define if OpenMP is enabled.])
-fi
+
 ## Set these for any other tests that may require them.  They will be
 ## reset before output files are generated.
 CFLAGS="$CFLAGS $OPENMP_CFLAGS"
 CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
 
+dnl Define here since it is skipped if the first argument to
+dnl AX_OPENMP is not empty.
+if test $ENABLE_OPENMP = yes; then
+  AC_CHECK_HEADERS([omp.h])
+  AC_CHECK_FUNCS([omp_get_num_threads])
+  AC_DEFINE(OCTAVE_ENABLE_OPENMP, 1, [Define if OpenMP is enabled])
+fi
+
 ### When compiling math for x87, problems may arise in some code comparing
 ### floating-point intermediate results.  The root cause is the extra precision
 ### (~80 bits) of x87 co-processor registers versus the IEEE standard 64 bits.
--- a/libinterp/corefcn/sysdep.cc	Mon Mar 28 22:53:27 2016 -0400
+++ b/libinterp/corefcn/sysdep.cc	Mon Mar 28 22:56:18 2016 -0400
@@ -60,6 +60,10 @@
 #  include <ieeefp.h>
 #endif
 
+#if defined (HAVE_OMP_H)
+#  include <omp.h>
+#endif
+
 #include "cmd-edit.h"
 #include "file-ops.h"
 #include "lo-mappers.h"
@@ -309,6 +313,10 @@
 void
 sysdep_init (void)
 {
+#if defined (HAVE_OMP_GET_NUM_THREADS)
+  omp_get_num_threads ();
+#endif
+
 #if defined (__386BSD__) || defined (__FreeBSD__) || defined (__NetBSD__)
   BSD_init ();
 #elif defined (__MINGW32__)