Mercurial > octave
changeset 22398:1442ae783e1f
check for pthread and openmp libs before shared lib support (bug #48786)
* configure.ac: Move checks for pthread and openmp libraries before
checks for shared library support.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 28 Aug 2016 10:39:28 -0400 |
parents | 5b9f2502b1dd |
children | f0836b5ec628 |
files | configure.ac |
diffstat | 1 files changed, 44 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Fri Aug 26 20:13:06 2016 +0200 +++ b/configure.ac Sun Aug 28 10:39:28 2016 -0400 @@ -484,6 +484,50 @@ AC_SUBST(DEPEND_FLAGS) AC_SUBST(DEPEND_EXTRA_SED_PATTERN) +### Check for pthread library + +AX_PTHREAD +## Include pthread libs and flags early in case other tests need them. +## They seem to be required for the OpenGL tests on Debian systems. +LIBS="$PTHREAD_LIBS $LIBS" +XTRA_CFLAGS="$XTRA_CFLAGS $PTHREAD_CFLAGS" +XTRA_CXXFLAGS="$XTRA_CXXFLAGS $PTHREAD_CFLAGS" +## Set these for any other tests that may require them. They will be +## reset before output files are generated. +CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" + +### Test whether the compiler supports OpenMP. This is enabled by default +### now to allow the option of using OpenMP in loadable modules. + +ENABLE_OPENMP=no +check_for_openmp=yes +AC_ARG_ENABLE([openmp], + [AS_HELP_STRING([--disable-openmp], + [disable OpenMP SMP multi-threading])], + [if test "$enableval" = no; then check_for_openmp=no; fi], []) +if test $check_for_openmp = yes; then + AC_LANG_PUSH(C) + AX_OPENMP([XTRA_CFLAGS="$XTRA_CFLAGS $OPENMP_CFLAGS"; ENABLE_OPENMP=yes], []) + AC_LANG_POP(C) + AC_LANG_PUSH(C++) + AX_OPENMP([XTRA_CXXFLAGS="$XTRA_CXXFLAGS $OPENMP_CXXFLAGS"; ENABLE_OPENMP=yes], []) + AC_LANG_POP(C++) +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 + ### Start determination of shared vs. static libraries ## Use -static if compiling on Alpha OSF/1 1.3 systems. @@ -1055,50 +1099,6 @@ AC_SUBST(MKOCTFILE_LD_CXX) AC_SUBST(MKOCTFILE_RANLIB) -### Check for pthread library - -AX_PTHREAD -## Include pthread libs and flags early in case other tests need them. -## They seem to be required for the OpenGL tests on Debian systems. -LIBS="$PTHREAD_LIBS $LIBS" -XTRA_CFLAGS="$XTRA_CFLAGS $PTHREAD_CFLAGS" -XTRA_CXXFLAGS="$XTRA_CXXFLAGS $PTHREAD_CFLAGS" -## Set these for any other tests that may require them. They will be -## reset before output files are generated. -CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" - -### Test whether the compiler supports OpenMP. This is enabled by default -### now to allow the option of using OpenMP in loadable modules. - -ENABLE_OPENMP=no -check_for_openmp=yes -AC_ARG_ENABLE([openmp], - [AS_HELP_STRING([--disable-openmp], - [disable OpenMP SMP multi-threading])], - [if test "$enableval" = no; then check_for_openmp=no; fi], []) -if test $check_for_openmp = yes; then - AC_LANG_PUSH(C) - AX_OPENMP([XTRA_CFLAGS="$XTRA_CFLAGS $OPENMP_CFLAGS"; ENABLE_OPENMP=yes], []) - AC_LANG_POP(C) - AC_LANG_PUSH(C++) - AX_OPENMP([XTRA_CXXFLAGS="$XTRA_CXXFLAGS $OPENMP_CXXFLAGS"; ENABLE_OPENMP=yes], []) - AC_LANG_POP(C++) -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.