Commit 097d9165249ae39045d97d5c4db19058a45e58a0

Authored by Jürgen Knödlseder
1 parent 1e20fe60

Add OPENMP_LIB_LDFLAGS for OpenMP support on Mac OS X.

For OpenMP to work properly on Mac OS X, the -lgomp library has to be linked. For this purpose, a new variable OPENMP_LIB_LDFLAGS has been created that is set by configure to -lgomp in the presence of OpenMP support.

The ctobssim Makefile.am has been modified to take this parameter into account during linking.
configure.ac
@@ -734,6 +734,19 @@ else @@ -734,6 +734,19 @@ else
734 AC_MSG_RESULT(no) 734 AC_MSG_RESULT(no)
735 fi 735 fi
736 736
  737 +# Set system specific settings
  738 +OPENMP_LIB_LDFLAGS=
  739 +if test "x$enable_openmp" = "xyes"; then
  740 + case $ac_sys_system/$ac_sys_release in
  741 + Darwin/*)
  742 + #
  743 + #
  744 + OPENMP_LIB_LDFLAGS=-lgomp
  745 + ;;
  746 + esac
  747 +fi
  748 +AC_SUBST(OPENMP_LIB_LDFLAGS)
  749 +
737 # Signal if ctools cannot be compiled as gammalibe requires OpenMP but ctools 750 # Signal if ctools cannot be compiled as gammalibe requires OpenMP but ctools
738 # cannot be compiled with OpenMP 751 # cannot be compiled with OpenMP
739 if test "x$enable_openmp" = "xno" && test "x$gammalib_with_openmp" = "xyes"; then 752 if test "x$enable_openmp" = "xno" && test "x$gammalib_with_openmp" = "xyes"; then
src/ctobssim/Makefile.am
@@ -9,6 +9,7 @@ sources = ctobssim.cpp @@ -9,6 +9,7 @@ sources = ctobssim.cpp
9 # Libtool library 9 # Libtool library
10 noinst_LTLIBRARIES = libctobssim.la 10 noinst_LTLIBRARIES = libctobssim.la
11 libctobssim_la_SOURCES = $(sources) 11 libctobssim_la_SOURCES = $(sources)
  12 +libctobssim_la_LDFLAGS = @OPENMP_LIB_LDFLAGS@
12 13
13 # Program definition 14 # Program definition
14 ctobssim_SOURCES = main.cpp 15 ctobssim_SOURCES = main.cpp