diff configure.ac @ 10471:bcabc1c4f20c

Add detection of OpenMP support to configure. Disabled by default
author David Bateman <dbateman@free.fr>
date Sat, 27 Mar 2010 18:23:54 +0100
parents 0152a451acb8
children 2ceb8e013597
line wrap: on
line diff
--- a/configure.ac	Sat Mar 27 10:07:10 2010 +0100
+++ b/configure.ac	Sat Mar 27 18:23:54 2010 +0100
@@ -427,6 +427,26 @@
   ;;
 esac
 
+## Test whether the compiler supports OpenMP. Experimental so disable by 
+## default. Enable it with the flag --enable-openmp
+USE_OPENMP=false
+AC_ARG_ENABLE(openmp,
+  [AS_HELP_STRING([--enable-openmp],
+     [(EXPERIMENTAL) use OpenMP SMP multi-threading])],
+  [if test "$enableval" = yes; then USE_OPENMP=true; fi], [])
+if $USE_OPENMP; then
+  case "$canonical_host_type" in
+    *-*-mingw* | *-*-cygwin* | *-*-gnu*)
+    OCTAVE_CHECK_OPENMP(-fopenmp)
+    ;;
+    *-*-msdosmsvc)
+    ## FIXME is this the right flag for MSVC?
+    OCTAVE_CHECK_OPENMP(-openmp)
+    ;;
+    ## Add other compilers supporting OpenMP here
+  esac
+fi
+
 AC_SUBST(XTRA_CFLAGS)
 AC_SUBST(XTRA_CXXFLAGS)
 
@@ -2314,6 +2334,19 @@
   warn_msg_printed=true
 fi
 
+if $USE_OPENMP; then
+  AC_MSG_WARN([])
+  AC_MSG_WARN([You used the EXPERIMENTAL --enable-openmp option.])
+  AC_MSG_WARN([Are you sure that is what you want to do?])
+  AC_MSG_WARN([])
+  AC_MSG_WARN([This option enables experimental SMP multithreding])
+  AC_MSG_WARN([code that has had very little testing. There is no])
+  AC_MSG_WARN([certainity that the results returned by Octave with])
+  AC_MSG_WARN([this option enabled will be correct.])
+  AC_MSG_WARN([])
+  warn_msg_printed=true
+fi
+
 native_graphics=true
 if test -n "$warn_freetype"; then
   AC_MSG_WARN([$warn_freetype])