diff --git a/ChangeLog b/ChangeLog
index 5c0898b..6c7acf9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-09-18 Juergen Knoedlseder
+
+ * Bug fix version 0.5.1 released
+ ================================
+
+ clang++ compiler precedence is only taken for Mac OS X >= 10.7
+ Omit Python checks if Python bindings are disabled
+ Enhance OpenMP configuration on Darwin
+ Export MACOSX_DEPLOYMENT_TARGET only for --enable-universalsdk
+ Improve Python bindings configuration
+ Add TEST_ENV_DIR to load library path
+
2012-09-14 Juergen Knoedlseder
* Version 0.5.0 released
diff --git a/NEWS b/NEWS
index be4ab47..0fec725 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,8 @@
-New Features and Important Changes in ctools 00-05-00
+New Features and Important Changes in ctools 00-05-01
Author(s) : Juergen Knoedlseder
-September 14th, 2012
+September 18th, 2012
1. Introduction
@@ -13,9 +13,42 @@ important changes made since the last release of ctools.
2. Configuration
-----------------
-Added OpenMP support to allow for code parallelization. If available,
-OpenMP is enabled by default. OpenMP support may be disabled using
-the --disable-openmp flag.
+The clang++ compiler takes now only precedence over the g++ compiler
+if the system on which compilation is performed is Mac OS X 10.7 or
+later.
+
+If Python bindings are disabled we omit now all the Python related
+checks during configuration. This includes detection of the Python
+executable, detection of the swig executable, and the checks for the
+presence of the Python wrapper files.
+
+The Apple gcc compiler requires the gomp_thread_attr global to be
+defined when OpenMP functions are called without having any OpenMP
+section in the code. This specific requirement is now detected in
+the configure script using some dedicated test code, and the compile
+definition HAVE_OPENMP_DARWIN_KLUGE is set that allows inclusion of
+the appropriate code when needed.
+
+Furthermore, the OPENMP_LIB_LDFLAGS is not set to -lgomp on Darwin
+anymore as this appears not to be needed.
+
+The MACOSX_DEPLOYMENT_TARGET environment variable is now only exported
+when the --enable-universalsdk option is specified. This solved problems
+related to uncatched exceptions in unit tests. Possibly, these uncatched
+exceptions were due to weak linking, a feature that exists since Mac OS
+X version 10.2. By not exporting MACOSX_DEPLOYMENT_TARGET, Mac OS X
+version 10.1 is assumed.
+
+The Python bindings configuration has been improved to handle also
+the MacPorts gcc compiler on Mac OS X. Static linking during unit
+testing has been removed as this is no longer needed (don't ask me why).
+The double compilation for unit check has also be removed. A static
+link is used instead that allows adding of the wrapper directory to
+the PYTHONPATH.
+
+The TEST_ENV_DIR environment variable is also added to the load
+library path in the GammaLib setup script. This ensures the correct
+loading of shared libraries in non-standard locations.
3. Python interface
@@ -25,15 +58,7 @@ None
4. ctobssim - CTA observation simulation
----------------------------------------
-If several observations are processed at once, ctobssim now outputs
-an observation definition XML file and separate FITS files for each
-observation. The filenames of the FITS files will be written to the
-observation definition file.
-
-The executable now also benefits from OpenMP support, allowing for
-parallelized simulation of events in the presence of multiple
-processor cores.
-
+None
5. ctselect - CTA event selection
---------------------------------
@@ -47,11 +72,7 @@ None
7. ctlike - CTA maximum likelihood fitting
------------------------------------------
-ctlike computes now the total number of observed events and dumps
-them in the log file just before it dumps the number of predicted
-events. It also computes the difference between observed and
-predicted events so that the difference is immediately visible.
-
+None
8. ctskymap - CTA sky mapping
-----------------------------
diff --git a/README b/README
index 0713fd3..82f569f 100644
--- a/README
+++ b/README
@@ -1,8 +1,8 @@
ctools information
==================
-Version: 00-05-00 (Septemner 14th, 2012)
+Version: 00-05-01 (September 18th, 2012)
Author: Juergen Knodlseder (jurgen.knodlseder@irap.omp.eu)
-GammaLib dependency: 00-06-00
+GammaLib dependency: 00-06-02
License information
diff --git a/configure.ac b/configure.ac
index a2d80c5..de1a0c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,10 +66,27 @@ AC_CANONICAL_HOST
#############################################################################
# Check for valid C++ compiler. This has to come before the check for #
# header files, otherwise we won't detect if the C++ compiler is missing. #
+# #
+# A special kluge was added for Mac OS X >=10.7. As Apple switched to clang #
+# we search from this version on for the clang compiler. #
#############################################################################
+
+# Set default compiler lists
+cxx_list="g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++"
+cc_list="gcc cc cl.exe clang"
+
+# Check if we have Mac OS X >= 10.7
+if test `uname -s` = "Darwin"; then
+ if test `sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'` '>' 10.6; then
+ cxx_list="clang++ g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC"
+ cc_list="clang gcc cc cl.exe"
+ fi
+fi
+
+# Our language is C++
AC_LANG(C++)
-AC_PROG_CXX([g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++])
-AC_PROG_CC([gcc cc cl.exe clang])
+AC_PROG_CXX($cxx_list)
+AC_PROG_CC($cc_list)
#############################################################################
@@ -354,16 +371,17 @@ yes)
;;
esac
- # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
- # environment with a value that is the same as what we'll use
- # in the Makefile to ensure that we'll get the same compiler
- # environment during configure and build time.
- MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
- export MACOSX_DEPLOYMENT_TARGET
- EXPORT_MACOSX_DEPLOYMENT_TARGET=''
-
# Set compile, link and pre-processor flags dependent on architecture
if test "${enable_universalsdk}"; then
+
+ # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
+ # environment with a value that is the same as what we'll use
+ # in the Makefile to ensure that we'll get the same compiler
+ # environment during configure and build time.
+ MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
+ export MACOSX_DEPLOYMENT_TARGET
+ EXPORT_MACOSX_DEPLOYMENT_TARGET=''
+
UNIVERSAL_ARCH_FLAGS=""
if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
@@ -525,106 +543,107 @@ AC_ARG_ENABLE([python-binding],
if test "x$ac_enable_python_binding" = "xno"; then
AC_MSG_NOTICE([Python binding for ctools will not be built])
AC_MSG_NOTICE([Enable Python binding module building with --enable-python-binding])
-fi
-
-# Do we have Python and Python.h?
-AM_PATH_PYTHON([2.2],
- [has_python="yes"],
- [AC_MSG_WARN([Python >= 2.2 not found. Python >= 2.2 is required to build python binding. Python can be obtained from http://www.python.org])])
-
-# It would really be weired if Python has not been found, as barely every system has Python. Maybe
-# it was not found because the autoconf is so old, and in an early version of the AM_PATH_PYTHON
-# there were no [Action-if-found] and [Action-if-not-found] arguments, hence $has_python is possibly
-# badly set. However, the Python executable and version should be set correctly, and we can test
-# for this to see whether Python is really there or not.
-if test "x$has_python" = "xno"; then
- AM_PYTHON_CHECK_VERSION([$PYTHON], [${PYTHON_VERSION}],
- [has_python="yes"
- AC_MSG_NOTICE([Wow! You're running a pretty old system. Found Python nevertheless:-)])],
- [AC_MSG_WARN([Python not found.])])
-fi
-
-# If we have Python then verify the presence of the header and set some flags
-if test "x$has_python" = "xyes"; then
+else
- # Set opening and closing symbols to make setup.py compatible for versions 2 and 3
- if test ${PYTHON_VERSION} '<' 3; then
- PYTHON_OPEN=" "
- PYTHON_CLOSE=""
- else
- PYTHON_OPEN="("
- PYTHON_CLOSE=")"
- fi
- AC_SUBST(PYTHON_OPEN)
- AC_SUBST(PYTHON_CLOSE)
-
- # Do we have distutils?
- AC_MSG_CHECKING([for the distutils Python package])
- ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
- if test -z "$ac_distutils_result"; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
+ # Do we have Python and Python.h?
+ AM_PATH_PYTHON([2.2],
+ [has_python="yes"],
+ [AC_MSG_WARN([Python >= 2.2 not found. Python >= 2.2 is required to build python binding. Python can be obtained from http://www.python.org])])
+
+ # It would really be weired if Python has not been found, as barely every system has Python. Maybe
+ # it was not found because the autoconf is so old, and in an early version of the AM_PATH_PYTHON
+ # there were no [Action-if-found] and [Action-if-not-found] arguments, hence $has_python is possibly
+ # badly set. However, the Python executable and version should be set correctly, and we can test
+ # for this to see whether Python is really there or not.
+ if test "x$has_python" = "xno"; then
+ AM_PYTHON_CHECK_VERSION([$PYTHON], [${PYTHON_VERSION}],
+ [has_python="yes"
+ AC_MSG_NOTICE([Wow! You're running a pretty old system. Found Python nevertheless:-)])],
+ [AC_MSG_WARN([Python not found.])])
fi
- # If we have distutils then get python path from distutils ...
- if test -z "$ac_distutils_result"; then
- AC_MSG_CHECKING([for Python include path])
+ # If we have Python then verify the presence of the header and set some flags
+ if test "x$has_python" = "xyes"; then
+
+ # Set opening and closing symbols to make setup.py compatible for versions 2 and 3
if test ${PYTHON_VERSION} '<' 3; then
- python_path=`$PYTHON -c "import distutils.sysconfig; \
- print distutils.sysconfig.get_python_inc();"`
+ PYTHON_OPEN=" "
+ PYTHON_CLOSE=""
else
- python_path=`$PYTHON -c "import distutils.sysconfig; \
- print(distutils.sysconfig.get_python_inc());"`
- fi
- if test -n "${python_path}"; then
- AC_CHECK_HEADERS($python_path/Python.h, [has_python_h="yes"], [has_python_h="no"])
- python_path="-I$python_path"
+ PYTHON_OPEN="("
+ PYTHON_CLOSE=")"
+ fi
+ AC_SUBST(PYTHON_OPEN)
+ AC_SUBST(PYTHON_CLOSE)
+
+ # Do we have distutils?
+ AC_MSG_CHECKING([for the distutils Python package])
+ ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
+ if test -z "$ac_distutils_result"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
fi
- PYTHON_CPPFLAGS=$python_path
- CPPFLAGS="${CPPFLAGS} ${python_path}"
- AC_SUBST([PYTHON_CPPFLAGS])
- # ... otherwise check for includes relative to exectuable (obsolete?)
- else
+ # If we have distutils then get python path from distutils ...
+ if test -z "$ac_distutils_result"; then
+ if test ${PYTHON_VERSION} '<' 3; then
+ python_path=`$PYTHON -c "import distutils.sysconfig; \
+ print distutils.sysconfig.get_python_inc();"`
+ else
+ python_path=`$PYTHON -c "import distutils.sysconfig; \
+ print(distutils.sysconfig.get_python_inc());"`
+ fi
+ if test -n "${python_path}"; then
+ AC_CHECK_HEADERS($python_path/Python.h, [has_python_h="yes"], [has_python_h="no"])
+ python_path="-I$python_path"
+ fi
+ PYTHON_CPPFLAGS=$python_path
+ CPPFLAGS="${CPPFLAGS} ${python_path}"
+ AC_SUBST([PYTHON_CPPFLAGS])
+
+ # ... otherwise check for includes relative to exectuable (obsolete?)
+ else
- # Determine include path for python
- AC_PATH_PROG(PY_INCLUDE, python)
- PY_INCLUDE=`echo $PY_INCLUDE | sed -e "s/bin/include/"`
- PY_INCLUDE="$PY_INCLUDE$PYTHON_VERSION"
+ # Determine include path for python
+ AC_PATH_PROG(PY_INCLUDE, python)
+ PY_INCLUDE=`echo $PY_INCLUDE | sed -e "s/bin/include/"`
+ PY_INCLUDE="$PY_INCLUDE$PYTHON_VERSION"
- # Check if we have Python.h
- AC_CHECK_HEADERS($PY_INCLUDE/Python.h, [has_python_h="yes"], [has_python_h="no"])
+ # Check if we have Python.h
+ AC_CHECK_HEADERS($PY_INCLUDE/Python.h, [has_python_h="yes"], [has_python_h="no"])
- # Signal any problem
- if test "x$has_python_h" = "xno"; then
- AC_MSG_WARN([No Python header file "$PY_INCLUDE/Python.h" found. Please install appropriate Python development package.])
+ # Signal any problem
+ if test "x$has_python_h" = "xno"; then
+ AC_MSG_WARN([No Python header file "$PY_INCLUDE/Python.h" found. Please install appropriate Python development package.])
+ fi
fi
- fi
-fi
+ fi
-# Do we have swig?
-AC_PATH_PROG([SWIG], [swig])
-if test "$SWIG"; then
- has_swig="yes"
-fi
-AM_CONDITIONAL(HAVE_SWIG, test "x$has_swig" = "xyes")
+ # Do we have swig?
+ AC_PATH_PROG([SWIG], [swig])
+ if test "$SWIG"; then
+ has_swig="yes"
+ fi
-# Do we have wrappers (ctools_wrap.cpp and ctools.py)?
-has_wrappers="yes"
-AC_CHECK_FILES([pyext/ctools_wrap.cpp pyext/ctools.py],,
- [has_wrappers="no"])
-if test "x$has_wrappers" = "xno"; then
- AC_MSG_WARN([Python wrapper missing. Requires swig for wrapper generation.])
-fi
+ # Do we have wrappers (ctools_wrap.cpp and ctools.py)?
+ has_wrappers="yes"
+ AC_CHECK_FILES([pyext/ctools_wrap.cpp pyext/ctools.py],,
+ [has_wrappers="no"])
+ if test "x$has_wrappers" = "xno"; then
+ AC_MSG_WARN([Python wrapper missing. Requires swig for wrapper generation.])
+ fi
-# Signal if Python is enabled
-if test "x$ac_enable_python_binding" = "xyes" -a "x$has_python" = "xyes" -a "x$has_python_h" = "xyes"; then
- if test "x$has_swig" = "xyes" -o "x$has_wrappers" = "xyes"; then
- enable_python="yes"
+ # Signal if Python is enabled
+ if test "x$ac_enable_python_binding" = "xyes" -a "x$has_python" = "xyes" -a "x$has_python_h" = "xyes"; then
+ if test "x$has_swig" = "xyes" -o "x$has_wrappers" = "xyes"; then
+ enable_python="yes"
+ fi
fi
+
fi
+AM_CONDITIONAL(HAVE_SWIG, test "x$has_swig" = "xyes")
AM_CONDITIONAL(WITH_PYTHON, test "x$enable_python" = "xyes")
# Set Python environment
@@ -723,6 +742,7 @@ fi
# Initialise OpenMP availability
openmp_ok=no
gammalib_with_openmp=no
+darwin_kluge=no
# Detect if GammaLib has been compiled with OpenMP
AC_MSG_CHECKING(whether GammaLib has been compiled with OpenMP)
@@ -736,9 +756,6 @@ if test "x$ac_cv_prog_cxx_openmp" != "xunsupported" && test "x$ac_cv_prog_cxx_op
openmp_ok=yes
fi
-# Signal actual test
-AC_MSG_CHECKING(whether to enable OpenMP)
-
# If OpenMP is available
if test "x$openmp_ok" = "xyes"; then
@@ -758,12 +775,34 @@ if test "x$openmp_ok" = "xyes"; then
LDFLAGS=$SAVED_LDFLAGS
fi
+ # Special Darwin test to see whether OpenMP compiles without adding the
+ # gomp_thread_attr global or whether we need to add this global.
+ if test "$ac_sys_system" = "Darwin"; then
+ AC_MSG_CHECKING(whether we need to add gomp_thread_attr)
+ SAVED_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
+ AC_TRY_RUN(AC_LANG_PROGRAM([#include ],
+ [omp_set_num_threads(1);]),
+ [AC_MSG_RESULT(no)],
+ [AC_TRY_RUN(AC_LANG_PROGRAM([#include ;
+ #include ;
+ pthread_attr_t gomp_thread_attr;],
+ [omp_set_num_threads(1);]),
+ [AC_MSG_RESULT(yes)
+ darwin_kluge="yes"
+ AC_DEFINE([HAVE_OPENMP_DARWIN_KLUGE], [1], [Define if OpenMP Darwin kluge is needed])],
+ [AC_MSG_RESULT(no)
+ AC_MSG_WARN([Do not manage to compile OpenMP.])])])
+ CXXFLAGS=$SAVED_CXXFLAGS
+ fi
+
# If gammalib is compiled with OpenMP, ctools must also be compiled with
# openmp
if test "x$gammalib_with_openmp" = "xyes"; then
enable_openmp="yes"
else
# ... otherwise, we use it optionally
+ AC_MSG_CHECKING(whether to enable OpenMP)
AC_ARG_ENABLE([openmp],
AS_HELP_STRING([--enable-openmp],
[turn on OpenMP support [default=yes]]),
@@ -786,13 +825,13 @@ AC_SUBST(OPENMP_CXXFLAGS)
# Set system specific settings
OPENMP_LIB_LDFLAGS=
-if test "x$enable_openmp" = "xyes"; then
- case $ac_sys_system/$ac_sys_release in
- Darwin/*)
- OPENMP_LIB_LDFLAGS=-lgomp
- ;;
- esac
-fi
+#if test "x$enable_openmp" = "xyes"; then
+# case $ac_sys_system/$ac_sys_release in
+# Darwin/*)
+# OPENMP_LIB_LDFLAGS=-lgomp
+# ;;
+# esac
+#fi
AC_SUBST(OPENMP_LIB_LDFLAGS)
# Signal if ctools cannot be compiled as gammalibe requires OpenMP but ctools
@@ -861,26 +900,6 @@ if test "x$has_gammalib" = "xyes"; then
else
echo " - GammaLib support (no) no gammalib library found"
fi
-if test "x$has_python" = "xyes"; then
- echo " * Python (yes)"
-else
- echo " - Python (no)"
-fi
-if test "x$has_python_h" = "xyes"; then
- echo " * Python.h (yes)"
-else
- echo " - Python.h (no)"
-fi
-if test "x$has_swig" = "xyes"; then
- echo " * swig (yes)"
-else
- echo " - swig (no)"
-fi
-if test "x$has_wrappers" = "xyes"; then
- echo " * Python wrappers (yes)"
-else
- echo " - Python wrappers (no)"
-fi
# Dump Python binding information
if test "x$ac_enable_python_binding" = "xyes"; then
@@ -905,6 +924,26 @@ if test "x$ac_enable_python_binding" = "xyes"; then
else
echo " - Make Python binding (no) Python not installed"
fi
+ if test "x$has_python" = "xyes"; then
+ echo " * Python (yes)"
+ else
+ echo " - Python (no)"
+ fi
+ if test "x$has_python_h" = "xyes"; then
+ echo " * Python.h (yes)"
+ else
+ echo " - Python.h (no)"
+ fi
+ if test "x$has_swig" = "xyes"; then
+ echo " * swig (yes)"
+ else
+ echo " - swig (no)"
+ fi
+ if test "x$has_wrappers" = "xyes"; then
+ echo " * Python wrappers (yes)"
+ else
+ echo " - Python wrappers (no)"
+ fi
else
echo " - Make Python binding (no)"
fi
diff --git a/ctools.pc.in b/ctools.pc.in
index b27cf98..5509e97 100644
--- a/ctools.pc.in
+++ b/ctools.pc.in
@@ -8,7 +8,7 @@ Description: CTA science analysis tools
URL: http://cta.irap.omp.eu/ctools
Version: 0.6.0
Requires:
-Requires.private: GammaLib >= 0.6.0
+Requires.private: GammaLib >= 0.6.2
Conflicts:
Cflags: -I${includedir}/ctools
Libs: -L${libdir} -lctools
diff --git a/doc/html/download.html b/doc/html/download.html
index 3e70433..d8200e3 100644
--- a/doc/html/download.html
+++ b/doc/html/download.html
@@ -7,8 +7,8 @@
-The latest ctools release is ctools-00-05-00
-(14 September 2012).
+The latest ctools release is ctools-00-05-01
+(18 September 2012).
@@ -23,6 +23,11 @@ and gammalib versions.
Mac OS X package |
+| 00-05-01 |
+00-06-02 |
+ctools-00-05-01-macosx10.3.dmg |
+
+
| 00-05-00 |
00-06-01 |
ctools-00-05-00-macosx10.3.dmg |
@@ -77,6 +82,6 @@ and gammalib versions.
Last updated by: Jürgen
-Knödlseder (15 September 2012)
+Knödlseder (18 September 2012)