Commit 9bf38725bb7102d57833bc674ee4346789a8ca54
Merge branch 'devel' into comptel
Conflicts: configure.ac test/Makefile.am Both conflicts have been resolved.
Showing
14 changed files
with
301 additions
and
277 deletions
ChangeLog
| 1 | +2012-09-17 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | |
| 2 | + | |
| 3 | + * Bug fix version 0.6.2 released | |
| 4 | + ================================ | |
| 5 | + | |
| 6 | + clang++ compiler precedence is only taken for Mac OS X >= 10.7 | |
| 7 | + Omit Python checks if Python bindings are disabled | |
| 8 | + Enhance OpenMP configuration on Darwin | |
| 9 | + Export MACOSX_DEPLOYMENT_TARGET only for --enable-universalsdk | |
| 10 | + Improve Python bindings configuration | |
| 11 | + Add TEST_ENV_DIR to load library path | |
| 12 | + | |
| 13 | +2012-09-15 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | |
| 14 | + | |
| 15 | + * Bug fix version 0.6.1 released | |
| 16 | + ================================ | |
| 17 | + | |
| 18 | + Do not require gammalib/__init__.py file to be present | |
| 19 | + clang++ compiler takes precedence over g++ compiler | |
| 20 | + | |
| 1 | 21 | 2012-09-14 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> |
| 2 | 22 | |
| 3 | 23 | * Version 0.6.0 released | ... | ... |
NEWS
| 1 | -New Features and Important Changes in GammaLib 00-06-00 | |
| 1 | +New Features and Important Changes in GammaLib 00-06-02 | |
| 2 | 2 | |
| 3 | 3 | Author(s) : Juergen Knoedlseder |
| 4 | 4 | |
| 5 | -September, 14th, 2012 | |
| 5 | +September, 17th, 2012 | |
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | 1. Introduction |
| ... | ... | @@ -10,27 +10,50 @@ September, 14th, 2012 |
| 10 | 10 | This document briefly summarizes module by module the most important |
| 11 | 11 | changes made since the last release of GammaLib. |
| 12 | 12 | |
| 13 | -The code quality was enhanced in this release by resolving errors and | |
| 14 | -warnings issued by the cppcheck code quality check utility. A few real | |
| 15 | -errors were detected, the remaining modifications concerned mainly the | |
| 16 | -coding style and the translation of C-style casts into C++ style casts. | |
| 17 | - | |
| 18 | 13 | |
| 19 | 14 | 2. Configuration |
| 20 | 15 | ----------------- |
| 21 | -Added OpenMP support to allow for code parallelization. If available, | |
| 22 | -OpenMP is enabled by default. OpenMP support may be disabled using | |
| 23 | -the --disable-openmp flag. | |
| 24 | - | |
| 25 | -Check for the presence of the Python.h header file and the wrapper | |
| 26 | -files for Python bindings. | |
| 16 | +The clang++ compiler takes now only precedence over the g++ compiler | |
| 17 | +if the system on which compilation is performed is Mac OS X 10.7 or | |
| 18 | +later. | |
| 19 | + | |
| 20 | +If Python bindings are disabled we omit now all the Python related | |
| 21 | +checks during configuration. This includes detection of the Python | |
| 22 | +executable, detection of the swig executable, and the checks for the | |
| 23 | +presence of the Python wrapper files. | |
| 24 | + | |
| 25 | +The Apple gcc compiler requires the gomp_thread_attr global to be | |
| 26 | +defined when OpenMP functions are called without having any OpenMP | |
| 27 | +section in the code. This specific requirement is now detected in | |
| 28 | +the configure script using some dedicated test code, and the compile | |
| 29 | +definition HAVE_OPENMP_DARWIN_KLUGE is set that allows inclusion of | |
| 30 | +the appropriate code when needed. | |
| 31 | + | |
| 32 | +Furthermore, the OPENMP_LIB_LDFLAGS is not set to -lgomp on Darwin | |
| 33 | +anymore as this appears not to be needed. | |
| 34 | + | |
| 35 | +The MACOSX_DEPLOYMENT_TARGET environment variable is now only exported | |
| 36 | +when the --enable-universalsdk option is specified. This solved problems | |
| 37 | +related to uncatched exceptions in unit tests. Possibly, these uncatched | |
| 38 | +exceptions were due to weak linking, a feature that exists since Mac OS | |
| 39 | +X version 10.2. By not exporting MACOSX_DEPLOYMENT_TARGET, Mac OS X | |
| 40 | +version 10.1 is assumed. | |
| 41 | + | |
| 42 | +The Python bindings configuration has been improved to handle also | |
| 43 | +the MacPorts gcc compiler on Mac OS X. Static linking during unit | |
| 44 | +testing has been removed as this is no longer needed (don't ask me why). | |
| 45 | +The double compilation for unit check has also be removed. A static | |
| 46 | +link is used instead that allows adding of the wrapper directory to | |
| 47 | +the PYTHONPATH. | |
| 48 | + | |
| 49 | +The TEST_ENV_DIR environment variable is also added to the load | |
| 50 | +library path in the GammaLib setup script. This ensures the correct | |
| 51 | +loading of shared libraries in non-standard locations. | |
| 27 | 52 | |
| 28 | 53 | |
| 29 | 54 | 3. Application module |
| 30 | 55 | --------------------- |
| 31 | -The GLog class was improved. The printed dates reflect now the time | |
| 32 | -when a new line was started in a log file. The copy operator has also | |
| 33 | -been implemented. | |
| 56 | +None | |
| 34 | 57 | |
| 35 | 58 | |
| 36 | 59 | 4. FITS I/O Interface |
| ... | ... | @@ -40,28 +63,12 @@ None |
| 40 | 63 | |
| 41 | 64 | 5. Linear algebra module |
| 42 | 65 | ------------------------ |
| 43 | -The matrix classes have been refactored using the actual coding | |
| 44 | -conventions. | |
| 45 | - | |
| 46 | -Two bugs were corrected in GSparseMatrix. First, the non-equal | |
| 47 | -operator != had a bug that left the major part of the matrix untested. | |
| 48 | -This had hidden a problem with the fill stack from the unit test. | |
| 49 | -Once the != operator bug was corrected, the unit test revealed that | |
| 50 | -the misusage of an internal working array corrupted the fill stack | |
| 51 | -after a flush. This has been corrected by adding an additional | |
| 52 | -working array, so that conflicts can no longer arise. | |
| 66 | +None | |
| 53 | 67 | |
| 54 | 68 | |
| 55 | 69 | 6. Model module |
| 56 | 70 | --------------- |
| 57 | -Added GModelSpatialMap model that allow using skymap for the spatial | |
| 58 | -component of the model. The Monte Carlo method as well as the function | |
| 59 | -evaluation methods have been implemented. The function evaluation | |
| 60 | -methods make use of the GSkymap sky direction access operators that | |
| 61 | -performs a bi-linear interpolation of the pixels values for a given | |
| 62 | -direction. Note that the total flux in the sky map is normalized | |
| 63 | -internally to 1 ph/cm2/s. Negative pixels will automatically be set to | |
| 64 | -zero. | |
| 71 | +None | |
| 65 | 72 | |
| 66 | 73 | |
| 67 | 74 | 7. Numerics module |
| ... | ... | @@ -71,10 +78,7 @@ None |
| 71 | 78 | |
| 72 | 79 | 8. Observation module |
| 73 | 80 | --------------------- |
| 74 | -The optimization of model parameters makes now use of OpenMP (if | |
| 75 | -available) for parallelization of the likelihood computation. This | |
| 76 | -allows the increase of the code execution speed in the presence of | |
| 77 | -multiple processor cores. | |
| 81 | +None | |
| 78 | 82 | |
| 79 | 83 | |
| 80 | 84 | 9. Optimization module |
| ... | ... | @@ -84,14 +88,7 @@ None |
| 84 | 88 | |
| 85 | 89 | 10. Sky module |
| 86 | 90 | -------------- |
| 87 | -Added sky direction access operator to GSkymap class. This operator | |
| 88 | -returns the intensity in the sky map as function of the sky direction, | |
| 89 | -performing a bi-linear interpolation between the pixel values of the | |
| 90 | -map. | |
| 91 | - | |
| 92 | -For consistency with other classes, GSkyDir arguments are now passed | |
| 93 | -by reference in the GSkymap access operators. Also map indices have | |
| 94 | -been declared by reference. | |
| 91 | +None | |
| 95 | 92 | |
| 96 | 93 | |
| 97 | 94 | 11. Support module |
| ... | ... | @@ -106,15 +103,7 @@ None |
| 106 | 103 | |
| 107 | 104 | 13. Test module |
| 108 | 105 | --------------- |
| 109 | -A new module has been introduced that supports unit testing of | |
| 110 | -GammaLib. The module contains so far three classes: | |
| 111 | -- GTestSuites is a container class for unit test suites | |
| 112 | -- GTestSuite implements a specific unit test suite | |
| 113 | -- GTestCase collects information about a specific test case | |
| 114 | -GTestSuites outputs the result in a JUnit compliant XML file for test | |
| 115 | -report analysis. The usual console output is also supported. The | |
| 116 | -GammaLib unit tests have been rewritten to make use of the new | |
| 117 | -test suite. | |
| 106 | +None | |
| 118 | 107 | |
| 119 | 108 | |
| 120 | 109 | 14. Multi-wavelength interface |
| ... | ... | @@ -124,22 +113,10 @@ None |
| 124 | 113 | |
| 125 | 114 | 15. Fermi-LAT interface |
| 126 | 115 | ---------------------- |
| 127 | -Added support for Pass 7 data. In particular, P7SOURCE_V6 response | |
| 128 | -functions are now included in the GammaLib distribution, together | |
| 129 | -with some test data for the Crab. The LAT response code has also | |
| 130 | -been refactored to support more cleanly various PSF versions. | |
| 131 | -Efficiency factors, needed by Pass 7, are now also supported. Note | |
| 132 | -that we still lack support for the Phi dependence of the IRF, and | |
| 133 | -also energy dispersion has not yet been implemented. | |
| 116 | +None | |
| 134 | 117 | |
| 135 | 118 | |
| 136 | 119 | 16. CTA interface |
| 137 | 120 | ----------------- |
| 138 | -Added support for diffuse sources to CTA response. FITS sky maps can | |
| 139 | -now be used to simulated and to fit CTA event data, both in binned and | |
| 140 | -unbinned mode. Specifically, the GCTAResponse::irf_diffuse and | |
| 141 | -GCTAResponse::npred_diffuse methods have been implemented to do the | |
| 142 | -job. Some optimization has been performed to adjust the precision | |
| 143 | -of the integrations that need to be performed for the diffuse response | |
| 144 | -computation. | |
| 121 | +None | |
| 145 | 122 | ... | ... |
README
configure.ac
| ... | ... | @@ -29,11 +29,10 @@ |
| 29 | 29 | ############################################################################# |
| 30 | 30 | # Initialisation # |
| 31 | 31 | ############################################################################# |
| 32 | -AC_INIT([gammalib], [0.6.0], [jurgen.knodlseder@irap.omp.eu], [gammalib]) | |
| 32 | +AC_INIT([gammalib], [0.6.2], [jurgen.knodlseder@irap.omp.eu], [gammalib]) | |
| 33 | 33 | AC_CONFIG_SRCDIR([src/support/GTools.cpp]) |
| 34 | 34 | AC_CONFIG_MACRO_DIR([m4]) |
| 35 | 35 | AM_INIT_AUTOMAKE([gnu no-dependencies]) |
| 36 | -#AC_CONFIG_HEADERS([config.h]) | |
| 37 | 36 | AM_CONFIG_HEADER([config.h]) |
| 38 | 37 | |
| 39 | 38 | |
| ... | ... | @@ -78,10 +77,27 @@ AC_CANONICAL_HOST |
| 78 | 77 | ############################################################################# |
| 79 | 78 | # Check for valid C++ compiler. This has to come before the check for # |
| 80 | 79 | # header files, otherwise we won't detect if the C++ compiler is missing. # |
| 80 | +# # | |
| 81 | +# A special kluge was added for Mac OS X >=10.7. As Apple switched to clang # | |
| 82 | +# we search from this version on for the clang compiler. # | |
| 81 | 83 | ############################################################################# |
| 84 | + | |
| 85 | +# Set default compiler lists | |
| 86 | +cxx_list="g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++" | |
| 87 | +cc_list="gcc cc cl.exe clang" | |
| 88 | + | |
| 89 | +# Check if we have Mac OS X >= 10.7 | |
| 90 | +if test `uname -s` = "Darwin"; then | |
| 91 | + if test `sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'` '>' 10.6; then | |
| 92 | + cxx_list="clang++ g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC" | |
| 93 | + cc_list="clang gcc cc cl.exe" | |
| 94 | + fi | |
| 95 | +fi | |
| 96 | + | |
| 97 | +# Our language is C++ | |
| 82 | 98 | AC_LANG(C++) |
| 83 | -AC_PROG_CXX([g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++]) | |
| 84 | -AC_PROG_CC([gcc cc cl.exe clang]) | |
| 99 | +AC_PROG_CXX($cxx_list) | |
| 100 | +AC_PROG_CC($cc_list) | |
| 85 | 101 | |
| 86 | 102 | |
| 87 | 103 | ############################################################################# |
| ... | ... | @@ -370,16 +386,17 @@ yes) |
| 370 | 386 | ;; |
| 371 | 387 | esac |
| 372 | 388 | |
| 373 | - # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the | |
| 374 | - # environment with a value that is the same as what we'll use | |
| 375 | - # in the Makefile to ensure that we'll get the same compiler | |
| 376 | - # environment during configure and build time. | |
| 377 | - MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET" | |
| 378 | - export MACOSX_DEPLOYMENT_TARGET | |
| 379 | - EXPORT_MACOSX_DEPLOYMENT_TARGET='' | |
| 380 | - | |
| 381 | 389 | # Set compile, link and pre-processor flags dependent on architecture |
| 382 | 390 | if test "${enable_universalsdk}"; then |
| 391 | + | |
| 392 | + # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the | |
| 393 | + # environment with a value that is the same as what we'll use | |
| 394 | + # in the Makefile to ensure that we'll get the same compiler | |
| 395 | + # environment during configure and build time. | |
| 396 | + MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET" | |
| 397 | + export MACOSX_DEPLOYMENT_TARGET | |
| 398 | + EXPORT_MACOSX_DEPLOYMENT_TARGET='' | |
| 399 | + | |
| 383 | 400 | UNIVERSAL_ARCH_FLAGS="" |
| 384 | 401 | if test "$UNIVERSAL_ARCHS" = "32-bit" ; then |
| 385 | 402 | UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386" |
| ... | ... | @@ -638,6 +655,7 @@ fi |
| 638 | 655 | ############################################################################# |
| 639 | 656 | # Initialise flags |
| 640 | 657 | openmp_ok=no |
| 658 | +darwin_kluge=no | |
| 641 | 659 | |
| 642 | 660 | # Check if openMP is available |
| 643 | 661 | m4_ifdef([AC_OPENMP],[AC_OPENMP], [AX_OPENMP([openmp_ok=yes],[openmp_ok=no])]) |
| ... | ... | @@ -664,6 +682,27 @@ if test "x$openmp_ok" = "xyes" ; then |
| 664 | 682 | LDFLAGS=$SAVED_LDFLAGS |
| 665 | 683 | fi |
| 666 | 684 | |
| 685 | + # Special Darwin test to see whether OpenMP compiles without adding the | |
| 686 | + # gomp_thread_attr global or whether we need to add this global. | |
| 687 | + if test "$ac_sys_system" = "Darwin"; then | |
| 688 | + AC_MSG_CHECKING(whether we need to add gomp_thread_attr) | |
| 689 | + SAVED_CXXFLAGS=$CXXFLAGS | |
| 690 | + CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS" | |
| 691 | + AC_TRY_RUN(AC_LANG_PROGRAM([#include <omp.h>], | |
| 692 | + [omp_set_num_threads(1);]), | |
| 693 | + [AC_MSG_RESULT(no)], | |
| 694 | + [AC_TRY_RUN(AC_LANG_PROGRAM([#include <omp.h>; | |
| 695 | + #include <pthread.h>; | |
| 696 | + pthread_attr_t gomp_thread_attr;], | |
| 697 | + [omp_set_num_threads(1);]), | |
| 698 | + [AC_MSG_RESULT(yes) | |
| 699 | + darwin_kluge="yes" | |
| 700 | + AC_DEFINE([HAVE_OPENMP_DARWIN_KLUGE], [1], [Define if OpenMP Darwin kluge is needed])], | |
| 701 | + [AC_MSG_RESULT(no) | |
| 702 | + AC_MSG_WARN([Do not manage to compile OpenMP.])])]) | |
| 703 | + CXXFLAGS=$SAVED_CXXFLAGS | |
| 704 | + fi | |
| 705 | + | |
| 667 | 706 | # Signal actual test |
| 668 | 707 | AC_MSG_CHECKING(whether to enable OpenMP) |
| 669 | 708 | |
| ... | ... | @@ -684,18 +723,18 @@ if test "x$openmp_ok" = "xyes" ; then |
| 684 | 723 | AC_MSG_RESULT(no) |
| 685 | 724 | fi |
| 686 | 725 | fi |
| 687 | -AM_CONDITIONAL(OPENMP,test "x$openmp_ok" = "xyes" && test "x$enable_openmp" = "xyes") | |
| 726 | +AM_CONDITIONAL(OPENMP, test "x$openmp_ok" = "xyes" && test "x$enable_openmp" = "xyes") | |
| 688 | 727 | AC_SUBST(OPENMP_CXXFLAGS) |
| 689 | 728 | |
| 690 | 729 | # Set system specific settings |
| 691 | 730 | OPENMP_LIB_LDFLAGS= |
| 692 | -if test "x$enable_openmp" = "xyes"; then | |
| 693 | - case $ac_sys_system/$ac_sys_release in | |
| 694 | - Darwin/*) | |
| 695 | - OPENMP_LIB_LDFLAGS=-lgomp | |
| 696 | - ;; | |
| 697 | - esac | |
| 698 | -fi | |
| 731 | +#if test "x$enable_openmp" = "xyes"; then | |
| 732 | +# case $ac_sys_system/$ac_sys_release in | |
| 733 | +# Darwin/*) | |
| 734 | +# OPENMP_LIB_LDFLAGS=-lgomp | |
| 735 | +# ;; | |
| 736 | +# esac | |
| 737 | +#fi | |
| 699 | 738 | AC_SUBST(OPENMP_LIB_LDFLAGS) |
| 700 | 739 | |
| 701 | 740 | |
| ... | ... | @@ -723,109 +762,106 @@ AC_ARG_ENABLE([python-binding], |
| 723 | 762 | if test "x$ac_enable_python_binding" = "xno"; then |
| 724 | 763 | AC_MSG_NOTICE([Python binding for gammalib will not be built]) |
| 725 | 764 | AC_MSG_NOTICE([Enable Python binding module building with --enable-python-binding]) |
| 726 | -fi | |
| 727 | - | |
| 728 | -# Do we have Python and Python.h? | |
| 729 | -AM_PATH_PYTHON([2.2], | |
| 730 | - [has_python="yes"], | |
| 731 | - [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])]) | |
| 732 | - | |
| 733 | -# It would really be weired if Python has not been found, as barely every system has Python. Maybe | |
| 734 | -# it was not found because the autoconf is so old, and in an early version of the AM_PATH_PYTHON | |
| 735 | -# there were no [Action-if-found] and [Action-if-not-found] arguments, hence $has_python is possibly | |
| 736 | -# badly set. However, the Python executable and version should be set correctly, and we can test | |
| 737 | -# for this to see whether Python is really there or not. | |
| 738 | -if test "x$has_python" = "xno"; then | |
| 739 | - AM_PYTHON_CHECK_VERSION([$PYTHON], [${PYTHON_VERSION}], | |
| 740 | - [has_python="yes" | |
| 741 | - AC_MSG_NOTICE([Wow! You're running a pretty old system. Found Python nevertheless:-)])], | |
| 742 | - [AC_MSG_WARN([Python not found.])]) | |
| 743 | -fi | |
| 744 | - | |
| 745 | -# If we have Python then verify the presence of the header and set some flags | |
| 746 | -if test "x$has_python" = "xyes"; then | |
| 765 | +else | |
| 747 | 766 | |
| 748 | - # Set opening and closing symbols to make setup.py compatible for versions 2 and 3 | |
| 749 | - if test ${PYTHON_VERSION} '<' 3; then | |
| 750 | - PYTHON_OPEN=" " | |
| 751 | - PYTHON_CLOSE="" | |
| 752 | - else | |
| 753 | - PYTHON_OPEN="(" | |
| 754 | - PYTHON_CLOSE=")" | |
| 755 | - fi | |
| 756 | - AC_SUBST(PYTHON_OPEN) | |
| 757 | - AC_SUBST(PYTHON_CLOSE) | |
| 758 | - | |
| 759 | - # Do we have distutils? | |
| 760 | - AC_MSG_CHECKING([for the distutils Python package]) | |
| 761 | - ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` | |
| 762 | - if test -z "$ac_distutils_result"; then | |
| 763 | - AC_MSG_RESULT([yes]) | |
| 764 | - else | |
| 765 | - AC_MSG_RESULT([no]) | |
| 767 | + # Do we have Python and Python.h? | |
| 768 | + AM_PATH_PYTHON([2.2], | |
| 769 | + [has_python="yes"], | |
| 770 | + [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])]) | |
| 771 | + | |
| 772 | + # It would really be weired if Python has not been found, as barely every system has Python. Maybe | |
| 773 | + # it was not found because the autoconf is so old, and in an early version of the AM_PATH_PYTHON | |
| 774 | + # there were no [Action-if-found] and [Action-if-not-found] arguments, hence $has_python is possibly | |
| 775 | + # badly set. However, the Python executable and version should be set correctly, and we can test | |
| 776 | + # for this to see whether Python is really there or not. | |
| 777 | + if test "x$has_python" = "xno"; then | |
| 778 | + AM_PYTHON_CHECK_VERSION([$PYTHON], [${PYTHON_VERSION}], | |
| 779 | + [has_python="yes" | |
| 780 | + AC_MSG_NOTICE([Wow! You're running a pretty old system. Found Python nevertheless:-)])], | |
| 781 | + [AC_MSG_WARN([Python not found.])]) | |
| 766 | 782 | fi |
| 767 | 783 | |
| 768 | - # If we have distutils then get python path from distutils ... | |
| 769 | - if test -z "$ac_distutils_result"; then | |
| 770 | - AC_MSG_CHECKING([for Python include path]) | |
| 784 | + # If we have Python then verify the presence of the header and set some flags | |
| 785 | + if test "x$has_python" = "xyes"; then | |
| 786 | + | |
| 787 | + # Set opening and closing symbols to make setup.py compatible for versions 2 and 3 | |
| 771 | 788 | if test ${PYTHON_VERSION} '<' 3; then |
| 772 | - python_path=`$PYTHON -c "import distutils.sysconfig; \ | |
| 773 | - print distutils.sysconfig.get_python_inc();"` | |
| 789 | + PYTHON_OPEN=" " | |
| 790 | + PYTHON_CLOSE="" | |
| 791 | + else | |
| 792 | + PYTHON_OPEN="(" | |
| 793 | + PYTHON_CLOSE=")" | |
| 794 | + fi | |
| 795 | + AC_SUBST(PYTHON_OPEN) | |
| 796 | + AC_SUBST(PYTHON_CLOSE) | |
| 797 | + | |
| 798 | + # Do we have distutils? | |
| 799 | + AC_MSG_CHECKING([for the distutils Python package]) | |
| 800 | + ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` | |
| 801 | + if test -z "$ac_distutils_result"; then | |
| 802 | + AC_MSG_RESULT([yes]) | |
| 774 | 803 | else |
| 775 | - python_path=`$PYTHON -c "import distutils.sysconfig; \ | |
| 776 | - print(distutils.sysconfig.get_python_inc());"` | |
| 777 | - fi | |
| 778 | - if test -n "${python_path}"; then | |
| 779 | - AC_CHECK_HEADERS($python_path/Python.h, [has_python_h="yes"], [has_python_h="no"]) | |
| 780 | - python_path="-I$python_path" | |
| 804 | + AC_MSG_RESULT([no]) | |
| 781 | 805 | fi |
| 782 | - PYTHON_CPPFLAGS=$python_path | |
| 783 | - CPPFLAGS="${CPPFLAGS} ${python_path}" | |
| 784 | - AC_SUBST([PYTHON_CPPFLAGS]) | |
| 785 | 806 | |
| 786 | - # ... otherwise check for includes relative to exectuable (obsolete?) | |
| 787 | - else | |
| 807 | + # If we have distutils then get python path from distutils ... | |
| 808 | + if test -z "$ac_distutils_result"; then | |
| 809 | + if test ${PYTHON_VERSION} '<' 3; then | |
| 810 | + python_path=`$PYTHON -c "import distutils.sysconfig; \ | |
| 811 | + print distutils.sysconfig.get_python_inc();"` | |
| 812 | + else | |
| 813 | + python_path=`$PYTHON -c "import distutils.sysconfig; \ | |
| 814 | + print(distutils.sysconfig.get_python_inc());"` | |
| 815 | + fi | |
| 816 | + if test -n "${python_path}"; then | |
| 817 | + AC_CHECK_HEADERS($python_path/Python.h, [has_python_h="yes"], [has_python_h="no"]) | |
| 818 | + python_path="-I$python_path" | |
| 819 | + fi | |
| 820 | + PYTHON_CPPFLAGS=$python_path | |
| 821 | + CPPFLAGS="${CPPFLAGS} ${python_path}" | |
| 822 | + AC_SUBST([PYTHON_CPPFLAGS]) | |
| 823 | + | |
| 824 | + # ... otherwise check for includes relative to exectuable (obsolete?) | |
| 825 | + else | |
| 788 | 826 | |
| 789 | - # Determine include path for python | |
| 790 | - AC_PATH_PROG(PY_INCLUDE, python) | |
| 791 | - PY_INCLUDE=`echo $PY_INCLUDE | sed -e "s/bin/include/"` | |
| 792 | - PY_INCLUDE="$PY_INCLUDE$PYTHON_VERSION" | |
| 827 | + # Determine include path for python | |
| 828 | + AC_PATH_PROG(PY_INCLUDE, python) | |
| 829 | + PY_INCLUDE=`echo $PY_INCLUDE | sed -e "s/bin/include/"` | |
| 830 | + PY_INCLUDE="$PY_INCLUDE$PYTHON_VERSION" | |
| 793 | 831 | |
| 794 | - # Check if we have Python.h | |
| 795 | - AC_CHECK_HEADERS($PY_INCLUDE/Python.h, [has_python_h="yes"], [has_python_h="no"]) | |
| 832 | + # Check if we have Python.h | |
| 833 | + AC_CHECK_HEADERS($PY_INCLUDE/Python.h, [has_python_h="yes"], [has_python_h="no"]) | |
| 796 | 834 | |
| 797 | - fi | |
| 835 | + fi | |
| 798 | 836 | |
| 799 | - # Signal missing Python headers | |
| 800 | - if test "x$has_python_h" = "xno"; then | |
| 801 | - AC_MSG_WARN([No Python header file "Python.h" found. Please install appropriate Python development package.]) | |
| 802 | - fi | |
| 837 | + # Signal missing Python headers | |
| 838 | + if test "x$has_python_h" = "xno"; then | |
| 839 | + AC_MSG_WARN([No Python header file "Python.h" found. Please install appropriate Python development package.]) | |
| 840 | + fi | |
| 803 | 841 | |
| 804 | -fi | |
| 842 | + fi | |
| 805 | 843 | |
| 806 | -# Do we have swig? | |
| 807 | -AC_PATH_PROG([SWIG], [swig]) | |
| 808 | -if test "$SWIG"; then | |
| 809 | - has_swig="yes" | |
| 810 | -fi | |
| 811 | -AM_CONDITIONAL(HAVE_SWIG, test "x$has_swig" = "xyes") | |
| 844 | + # Do we have swig? | |
| 845 | + AC_PATH_PROG([SWIG], [swig]) | |
| 846 | + if test "$SWIG"; then | |
| 847 | + has_swig="yes" | |
| 848 | + fi | |
| 812 | 849 | |
| 813 | -# Do we have Python wrappers | |
| 814 | -has_wrappers="yes" | |
| 815 | -AC_CHECK_FILES([pyext/gammalib/__init__.py | |
| 816 | - pyext/gammalib/app_wrap.cpp pyext/gammalib/app.py | |
| 817 | - pyext/gammalib/fits_wrap.cpp pyext/gammalib/fits.py | |
| 818 | - pyext/gammalib/linalg_wrap.cpp pyext/gammalib/linalg.py | |
| 819 | - pyext/gammalib/model_wrap.cpp pyext/gammalib/model.py | |
| 820 | - pyext/gammalib/mwl_wrap.cpp pyext/gammalib/mwl.py | |
| 821 | - pyext/gammalib/numerics_wrap.cpp pyext/gammalib/numerics.py | |
| 822 | - pyext/gammalib/obs_wrap.cpp pyext/gammalib/obs.py | |
| 823 | - pyext/gammalib/opt_wrap.cpp pyext/gammalib/opt.py | |
| 824 | - pyext/gammalib/sky_wrap.cpp pyext/gammalib/sky.py | |
| 825 | - pyext/gammalib/support_wrap.cpp pyext/gammalib/support.py | |
| 826 | - pyext/gammalib/test_wrap.cpp pyext/gammalib/test.py | |
| 827 | - pyext/gammalib/xml_wrap.cpp pyext/gammalib/xml.py],, | |
| 828 | - [has_wrappers="no"]) | |
| 850 | + # Do we have Python wrappers | |
| 851 | + has_wrappers="yes" | |
| 852 | + AC_CHECK_FILES([pyext/gammalib/app_wrap.cpp pyext/gammalib/app.py | |
| 853 | + pyext/gammalib/fits_wrap.cpp pyext/gammalib/fits.py | |
| 854 | + pyext/gammalib/linalg_wrap.cpp pyext/gammalib/linalg.py | |
| 855 | + pyext/gammalib/model_wrap.cpp pyext/gammalib/model.py | |
| 856 | + pyext/gammalib/mwl_wrap.cpp pyext/gammalib/mwl.py | |
| 857 | + pyext/gammalib/numerics_wrap.cpp pyext/gammalib/numerics.py | |
| 858 | + pyext/gammalib/obs_wrap.cpp pyext/gammalib/obs.py | |
| 859 | + pyext/gammalib/opt_wrap.cpp pyext/gammalib/opt.py | |
| 860 | + pyext/gammalib/sky_wrap.cpp pyext/gammalib/sky.py | |
| 861 | + pyext/gammalib/support_wrap.cpp pyext/gammalib/support.py | |
| 862 | + pyext/gammalib/test_wrap.cpp pyext/gammalib/test.py | |
| 863 | + pyext/gammalib/xml_wrap.cpp pyext/gammalib/xml.py],, | |
| 864 | + [has_wrappers="no"]) | |
| 829 | 865 | if test "x$with_mwl" = "xyes"; then |
| 830 | 866 | AC_CHECK_FILES([pyext/gammalib/mwl_wrap.cpp pyext/gammalib/mwl.py],, |
| 831 | 867 | [has_wrappers="no"]) |
| ... | ... | @@ -846,17 +882,21 @@ if test "x$has_wrappers" = "xno"; then |
| 846 | 882 | AC_MSG_WARN([Python wrapper(s) missing. Requires swig for wrapper generation.]) |
| 847 | 883 | fi |
| 848 | 884 | |
| 849 | -# Do we have wrappers or can we created wrappers? | |
| 850 | -can_wrappers="no" | |
| 851 | -if [test "x$has_wrappers" = "xyes" -o "x$has_swig" = "xyes"]; then | |
| 852 | - can_wrappers="yes" | |
| 853 | -fi | |
| 885 | + # Do we have wrappers or can we created wrappers? | |
| 886 | + can_wrappers="no" | |
| 887 | + if [test "x$has_wrappers" = "xyes" -o "x$has_swig" = "xyes"]; then | |
| 888 | + can_wrappers="yes" | |
| 889 | + fi | |
| 890 | + | |
| 891 | + # Signal if Python is enabled | |
| 892 | + if [test "x$ac_enable_python_binding" = "xyes" -a "x$has_python" = "xyes" -a "x$has_python_h" = "xyes" -a "x$can_wrappers" = "xyes"]; then | |
| 893 | + enable_python="yes" | |
| 894 | + AC_DEFINE([HAVE_PYTHON], [1], [Define if Python bindings are built]) | |
| 895 | + fi | |
| 896 | + | |
| 854 | 897 | |
| 855 | -# Signal if Python is enabled | |
| 856 | -if [test "x$ac_enable_python_binding" = "xyes" -a "x$has_python" = "xyes" -a "x$has_python_h" = "xyes" -a "x$can_wrappers" = "xyes"]; then | |
| 857 | - enable_python="yes" | |
| 858 | - AC_DEFINE([HAVE_PYTHON], [1], [Define if Python bindings are built]) | |
| 859 | 898 | fi |
| 899 | +AM_CONDITIONAL(HAVE_SWIG, test "x$has_swig" = "xyes") | |
| 860 | 900 | AM_CONDITIONAL(WITH_PYTHON, test "x$enable_python" = "xyes") |
| 861 | 901 | |
| 862 | 902 | # Set Python environment |
| ... | ... | @@ -1239,26 +1279,6 @@ else |
| 1239 | 1279 | echo " - Readline support (no) no ncurses library found" |
| 1240 | 1280 | fi |
| 1241 | 1281 | fi |
| 1242 | -if test "x$has_python" = "xyes"; then | |
| 1243 | - echo " * Python (yes)" | |
| 1244 | -else | |
| 1245 | - echo " - Python (no)" | |
| 1246 | -fi | |
| 1247 | -if test "x$has_python_h" = "xyes"; then | |
| 1248 | - echo " * Python.h (yes)" | |
| 1249 | -else | |
| 1250 | - echo " - Python.h (no)" | |
| 1251 | -fi | |
| 1252 | -if test "x$has_wrappers" = "xyes"; then | |
| 1253 | - echo " * Python wrappers (yes)" | |
| 1254 | -else | |
| 1255 | - echo " - Python wrappers (no)" | |
| 1256 | -fi | |
| 1257 | -if test "x$has_swig" = "xyes"; then | |
| 1258 | - echo " * swig (yes)" | |
| 1259 | -else | |
| 1260 | - echo " - swig (no)" | |
| 1261 | -fi | |
| 1262 | 1282 | |
| 1263 | 1283 | # Dump Python bindings information |
| 1264 | 1284 | if test "x$ac_enable_python_binding" = "xyes"; then |
| ... | ... | @@ -1283,6 +1303,26 @@ if test "x$ac_enable_python_binding" = "xyes"; then |
| 1283 | 1303 | else |
| 1284 | 1304 | echo " - Make Python binding (no) Python not installed" |
| 1285 | 1305 | fi |
| 1306 | + if test "x$has_python" = "xyes"; then | |
| 1307 | + echo " * Python (yes)" | |
| 1308 | + else | |
| 1309 | + echo " - Python (no)" | |
| 1310 | + fi | |
| 1311 | + if test "x$has_python_h" = "xyes"; then | |
| 1312 | + echo " * Python.h (yes)" | |
| 1313 | + else | |
| 1314 | + echo " - Python.h (no)" | |
| 1315 | + fi | |
| 1316 | + if test "x$has_wrappers" = "xyes"; then | |
| 1317 | + echo " * Python wrappers (yes)" | |
| 1318 | + else | |
| 1319 | + echo " - Python wrappers (no)" | |
| 1320 | + fi | |
| 1321 | + if test "x$has_swig" = "xyes"; then | |
| 1322 | + echo " * swig (yes)" | |
| 1323 | + else | |
| 1324 | + echo " - swig (no)" | |
| 1325 | + fi | |
| 1286 | 1326 | else |
| 1287 | 1327 | echo " - Make Python binding (no)" |
| 1288 | 1328 | fi | ... | ... |
doc/Doxyfile
| ... | ... | @@ -31,7 +31,7 @@ PROJECT_NAME = GammaLib |
| 31 | 31 | # This could be handy for archiving the generated documentation or |
| 32 | 32 | # if some version control system is used. |
| 33 | 33 | |
| 34 | -PROJECT_NUMBER = 00-06-00 | |
| 34 | +PROJECT_NUMBER = 00-06-02 | |
| 35 | 35 | |
| 36 | 36 | # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) |
| 37 | 37 | # base path where the generated documentation will be put. | ... | ... |
gammalib.pc.in
| ... | ... | @@ -6,7 +6,7 @@ includedir=${prefix}/include |
| 6 | 6 | Name: GammaLib |
| 7 | 7 | Description: Versatile toolbox for analysis of astronomical gamma-ray data |
| 8 | 8 | URL: http://gammalib.sourceforge.net/ |
| 9 | -Version: 0.6.0 | |
| 9 | +Version: 0.6.2 | |
| 10 | 10 | Requires: |
| 11 | 11 | Requires.private: @CFITSIO@ |
| 12 | 12 | Conflicts: | ... | ... |
pyext/Makefile.am
| ... | ... | @@ -78,13 +78,8 @@ all-local: build |
| 78 | 78 | build: $(BUILT_SOURCES) |
| 79 | 79 | @PYTHON_BUILD_PREFIX@ $(PYTHON) setup.py build_ext |
| 80 | 80 | |
| 81 | -# If 'make check' is invoked we build the extension modules inplace, so that | |
| 82 | -# putting the 'pyext' directory in the PYTHONPATH allows importing the gammalib | |
| 83 | -# module. We also catch this special build in the setup script to force static | |
| 84 | -# linking with libgamma, which will allow a successful 'make check' on systems | |
| 85 | -# (such as Mac OS X) that have fixed shared library paths. | |
| 86 | -check-local: | |
| 87 | - @PYTHON_BUILD_PREFIX@ $(PYTHON) setup.py build_ext --inplace | |
| 81 | +# Do nothing for 'make check' | |
| 82 | +#check-local: | |
| 88 | 83 | |
| 89 | 84 | # Install the gammalib extension module |
| 90 | 85 | install-exec-local: | ... | ... |
pyext/setup.py.in
| ... | ... | @@ -33,13 +33,6 @@ pkg_name = 'gammalib' |
| 33 | 33 | core_modules = ['app', 'fits', 'linalg', 'model', 'numerics', \ |
| 34 | 34 | 'obs', 'opt', 'sky', 'support', 'test', 'xml'] |
| 35 | 35 | |
| 36 | -# Detect execution mode | |
| 37 | -is_unit_test = False | |
| 38 | -if (len(sys.argv) >= 3): | |
| 39 | - if (sys.argv[2] == '--inplace'): | |
| 40 | - print@PYTHON_OPEN@"This build is for unit testing."@PYTHON_CLOSE@ | |
| 41 | - is_unit_test = True | |
| 42 | - | |
| 43 | 36 | # Darwin MacPorts kluge: Remove -L/opt/local/lib path from LDSHARED as this |
| 44 | 37 | # overrides the GammaLib settings. Otherwise, MacPorts libraries would be |
| 45 | 38 | # used instead of the libraries selected by GammaLib |
| ... | ... | @@ -58,43 +51,16 @@ if sys.platform.lower().startswith("darwin"): |
| 58 | 51 | else: |
| 59 | 52 | ldshared_rm += option + ' ' |
| 60 | 53 | if (len(ldshared_rm) > 0): |
| 61 | - print@PYTHON_OPEN@"Removed following option(s) from LDSHARED: "+ldshared_rm@PYTHON_CLOSE@ | |
| 62 | - | |
| 54 | + sys.stdout.write("Removed following option(s) from LDSHARED: "+ldshared_rm+"\n") | |
| 63 | 55 | # Set LDSHARED |
| 64 | 56 | cvars['LDSHARED'] = ldshared_new |
| 65 | 57 | |
| 66 | -# Set GammaLib library name. If we're about to make the test build then | |
| 67 | -# create a symbolic link to the static library to enforce static linking. | |
| 68 | -# This is required on some system (such as Mac OS X) to avoid problems | |
| 69 | -# with finding the shared library during unit testing. | |
| 70 | -libgamma='gamma' | |
| 71 | -#if is_unit_test: | |
| 72 | -if is_unit_test and sys.platform.lower().startswith("darwin"): | |
| 73 | - | |
| 74 | - # Remove any existing symbolic link to libgamma.a. This will | |
| 75 | - # prevent any exception in creating the symbolic link due to | |
| 76 | - # an already existing link. | |
| 77 | - try: | |
| 78 | - os.remove('../src/.libs/libgamma_python.a') | |
| 79 | - print@PYTHON_OPEN@"Removed ../src/.libs/libgamma_python.a"@PYTHON_CLOSE@ | |
| 80 | - except: | |
| 81 | - pass | |
| 82 | - | |
| 83 | - # Now create a symbolic link and set the library name to this | |
| 84 | - # symbolic link | |
| 85 | - try: | |
| 86 | - os.symlink('libgamma.a', '../src/.libs/libgamma_python.a') | |
| 87 | - print@PYTHON_OPEN@"Created ../src/.libs/libgamma_python.a"@PYTHON_CLOSE@ | |
| 88 | - libgamma='gamma_python' | |
| 89 | - except: | |
| 90 | - print@PYTHON_OPEN@"WARNING: Failed to create symbolic link to static library. Link dynamically."@PYTHON_CLOSE@ | |
| 91 | - | |
| 92 | 58 | # Set default include directories, install files, library paths and libraries |
| 93 | 59 | include_dirs = ['@top_srcdir@/include'] |
| 94 | 60 | install_files = glob.glob('@top_srcdir@/pyext/*.i') |
| 95 | 61 | library_dirs = ['../src/.libs'] |
| 96 | 62 | runtime_library_dirs = ['../src/.libs'] |
| 97 | -libraries = [libgamma] | |
| 63 | +libraries = ['gamma'] | |
| 98 | 64 | |
| 99 | 65 | # Add install directory to runtime library path |
| 100 | 66 | if os.path.exists('@prefix@/lib'): |
| ... | ... | @@ -102,12 +68,12 @@ if os.path.exists('@prefix@/lib'): |
| 102 | 68 | |
| 103 | 69 | # Add cfitsio library only if available |
| 104 | 70 | if '@WITH_CFITSIO_TRUE@' != '#': |
| 105 | - print@PYTHON_OPEN@"Link cfitsio into Python bindings."@PYTHON_CLOSE@ | |
| 71 | + sys.stdout.write("Link cfitsio into Python bindings.\n") | |
| 106 | 72 | libraries.append('cfitsio') |
| 107 | 73 | |
| 108 | 74 | # Add readline library only if available |
| 109 | 75 | if '@WITH_READLINE_TRUE@' != '#': |
| 110 | - print@PYTHON_OPEN@"Link readline into Python bindings."@PYTHON_CLOSE@ | |
| 76 | + sys.stdout.write("Link readline into Python bindings.\n") | |
| 111 | 77 | libraries.append('readline') |
| 112 | 78 | libraries.append('ncurses') |
| 113 | 79 | |
| ... | ... | @@ -137,13 +103,13 @@ for extra_inc_path in extra_inc_paths: |
| 137 | 103 | # Add definitions for instrument specific modules |
| 138 | 104 | inst_modules = [] |
| 139 | 105 | if '@WITH_INST_MWL_TRUE@' != '#': |
| 140 | - print@PYTHON_OPEN@"Include multi-wavelength interface in gammalib Python bindings."@PYTHON_CLOSE@ | |
| 106 | + sys.stdout.write("Include multi-wavelength interface in gammalib Python bindings.\n") | |
| 141 | 107 | inst_modules.append('mwl') |
| 142 | 108 | if '@WITH_INST_CTA_TRUE@' != '#': |
| 143 | - print@PYTHON_OPEN@"Include CTA instrument interface in gammalib Python bindings."@PYTHON_CLOSE@ | |
| 109 | + sys.stdout.write("Include CTA instrument interface in gammalib Python bindings.\n") | |
| 144 | 110 | inst_modules.append('cta') |
| 145 | 111 | if '@WITH_INST_LAT_TRUE@' != '#': |
| 146 | - print@PYTHON_OPEN@"Include Fermi/LAT instrument interface in gammalib Python bindings."@PYTHON_CLOSE@ | |
| 112 | + sys.stdout.write("Include Fermi/LAT instrument interface in gammalib Python bindings.\n") | |
| 147 | 113 | inst_modules.append('lat') |
| 148 | 114 | if '@WITH_INST_COM_TRUE@' != '#': |
| 149 | 115 | print "Include COMPTEL instrument interface in gammalib Python bindings." |
| ... | ... | @@ -260,14 +226,11 @@ for module in all_modules: |
| 260 | 226 | |
| 261 | 227 | # Dump reformulation statistics for actual module |
| 262 | 228 | if n_import > 0 or n_class > 0: |
| 263 | - print@PYTHON_OPEN@module+".py reformulation: "+str(n_import)+ \ | |
| 264 | - " imports, "+str(n_class)+" base class declarations."@PYTHON_CLOSE@ | |
| 229 | + sys.stdout.write(module+".py reformulation: "+str(n_import)+ \ | |
| 230 | + " imports, "+str(n_class)+" base class declarations.\n") | |
| 265 | 231 | |
| 266 | -# Set data files to install. Do not install data files in unit testing mode. | |
| 267 | -if is_unit_test: | |
| 268 | - data_files=[] | |
| 269 | -else: | |
| 270 | - data_files=[('@prefix@/share/gammalib/swig', install_files)] | |
| 232 | +# Set data files to install. | |
| 233 | +data_files=[('@prefix@/share/gammalib/swig', install_files)] | |
| 271 | 234 | |
| 272 | 235 | # Setup |
| 273 | 236 | setup(name='@PACKAGE_NAME@', |
| ... | ... | @@ -288,4 +251,18 @@ setup(name='@PACKAGE_NAME@', |
| 288 | 251 | platforms=["Linux", "Solaris", "Mac OS-X", "Unix", "BSD"], |
| 289 | 252 | ) |
| 290 | 253 | |
| 291 | -# Post-processing | |
| 254 | +# Post-processing. A symbolic link is created to the directory containing the | |
| 255 | +# shared wrapper libraries so that we can add this directory to the PYTHONPATH | |
| 256 | +# for testing. | |
| 257 | +try: | |
| 258 | + os.chdir('build') | |
| 259 | + os.remove('gammalib') | |
| 260 | + sys.stdout.write("Removed symbolic link build/gammalib.\n") | |
| 261 | +except: | |
| 262 | + pass | |
| 263 | +try: | |
| 264 | + path = glob.glob('lib.*/gammalib') | |
| 265 | + os.symlink(path[0], 'gammalib') | |
| 266 | + sys.stdout.write("Created symbolic link build/gammalib.\n") | |
| 267 | +except: | |
| 268 | + sys.stdout.write("WARNING: Failed to create symbolic link build/gammalib.\n") | ... | ... |
src/gammalib-setup.in
src/model/GModelSpectralNodes.cpp
| ... | ... | @@ -37,8 +37,8 @@ |
| 37 | 37 | /* __ Constants __________________________________________________________ */ |
| 38 | 38 | |
| 39 | 39 | /* __ Globals ____________________________________________________________ */ |
| 40 | -const GModelSpectralNodes g_spectral_func_seed; | |
| 41 | -const GModelSpectralRegistry g_spectral_func_registry(&g_spectral_func_seed); | |
| 40 | +const GModelSpectralNodes g_spectral_nodes_seed; | |
| 41 | +const GModelSpectralRegistry g_spectral_nodes_registry(&g_spectral_nodes_seed); | |
| 42 | 42 | |
| 43 | 43 | /* __ Method name definitions ____________________________________________ */ |
| 44 | 44 | #define G_FLUX "GModelSpectralNodes::flux(GEnergy&, GEnergy&)" | ... | ... |
src/test/GTestSuite.cpp
| ... | ... | @@ -36,13 +36,11 @@ |
| 36 | 36 | /* __ OpenMP section _____________________________________________________ */ |
| 37 | 37 | #ifdef _OPENMP |
| 38 | 38 | #include <omp.h> |
| 39 | -#ifdef __APPLE__ | |
| 40 | -#ifdef __MACH__ | |
| 39 | +#ifdef HAVE_OPENMP_DARWIN_KLUGE | |
| 41 | 40 | #include <pthread.h> |
| 42 | 41 | pthread_attr_t gomp_thread_attr; |
| 43 | 42 | #endif |
| 44 | 43 | #endif |
| 45 | -#endif | |
| 46 | 44 | |
| 47 | 45 | /* __ Method name definitions ____________________________________________ */ |
| 48 | 46 | #define G_OP_ACCESS "GTestSuite::operator[](int&)" | ... | ... |
test/Makefile.am
| ... | ... | @@ -45,7 +45,7 @@ endif |
| 45 | 45 | # Optional python bindings |
| 46 | 46 | if WITH_PYTHON |
| 47 | 47 | TEST_PYTHON_SCRIPT = test_python.py |
| 48 | - TEST_PYTHON_ENV = PYTHONPATH=$(top_builddir)/pyext$(TEST_MWL)$(TEST_CTA)$(TEST_LAT)$(TEST_COM):$(PYTHONPATH) | |
| 48 | + TEST_PYTHON_ENV = PYTHONPATH=$(top_builddir)/pyext:$(top_builddir)/pyext/build/gammalib$(TEST_MWL)$(TEST_CTA)$(TEST_LAT):$(PYTHONPATH) | |
| 49 | 49 | endif |
| 50 | 50 | |
| 51 | 51 | # Darwin support | ... | ... |
test/test_GApplication.py
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | from gammalib import * |
| 21 | 21 | from math import * |
| 22 | 22 | import os |
| 23 | - | |
| 23 | +import sys | |
| 24 | 24 | |
| 25 | 25 | # ========================================== # |
| 26 | 26 | # Test class for GammaLib application module # |
| ... | ... | @@ -54,6 +54,7 @@ class Test(GPythonTestSuite): |
| 54 | 54 | |
| 55 | 55 | # Append tests |
| 56 | 56 | self.append(self.test_log, "Test GLog") |
| 57 | + self.append(self.test_pars, "Test GPars") | |
| 57 | 58 | |
| 58 | 59 | # Return |
| 59 | 60 | return |
| ... | ... | @@ -152,3 +153,21 @@ class Test(GPythonTestSuite): |
| 152 | 153 | |
| 153 | 154 | # Return |
| 154 | 155 | return |
| 156 | + | |
| 157 | + # Test GPars | |
| 158 | + def test_pars(self): | |
| 159 | + """ | |
| 160 | + Test GPars. | |
| 161 | + """ | |
| 162 | + # Test GPars constructor with bad filename. | |
| 163 | + self.test_try("Test GPars constructor with bad filename") | |
| 164 | + try: | |
| 165 | + pars = GPars("testme.par") | |
| 166 | + self.test_try_failure("Exception not thrown.") | |
| 167 | + except: | |
| 168 | + self.test_try_success() | |
| 169 | + else: | |
| 170 | + self.test_try_failure("This should never happen.") | |
| 171 | + | |
| 172 | + # Return | |
| 173 | + return | ... | ... |
test/test_GObservation.cpp
| ... | ... | @@ -35,13 +35,11 @@ |
| 35 | 35 | /* __ OpenMP section _____________________________________________________ */ |
| 36 | 36 | #ifdef _OPENMP |
| 37 | 37 | #include <omp.h> |
| 38 | -#ifdef __APPLE__ | |
| 39 | -#ifdef __MACH__ | |
| 38 | +#ifdef HAVE_OPENMP_DARWIN_KLUGE | |
| 40 | 39 | #include <pthread.h> |
| 41 | 40 | pthread_attr_t gomp_thread_attr; |
| 42 | 41 | #endif |
| 43 | 42 | #endif |
| 44 | -#endif | |
| 45 | 43 | |
| 46 | 44 | /* __ Coding definitions _________________________________________________ */ |
| 47 | 45 | #define RATE 13.0 //!< Events per seconde. For events generation. | ... | ... |