Commit 4825ce6146c514ff43cfc062dd18c080721158da
1 parent
81a45bf9
Adjust according to GammaLib.
The files were adjusted according to the recent changes in GammaLib.
Showing
2 changed files
with
29 additions
and
30 deletions
autogen.sh
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | -aclocal -I m4 | ||
| 4 | if which libtoolize >/dev/null; then | 3 | if which libtoolize >/dev/null; then |
| 5 | libtoolize --copy | 4 | libtoolize --copy |
| 6 | else | 5 | else |
| @@ -8,7 +7,7 @@ else | @@ -8,7 +7,7 @@ else | ||
| 8 | glibtoolize --copy | 7 | glibtoolize --copy |
| 9 | fi | 8 | fi |
| 10 | fi | 9 | fi |
| 11 | -#libtoolize --copy | 10 | +aclocal -I m4 |
| 12 | autoconf | 11 | autoconf |
| 13 | autoheader | 12 | autoheader |
| 14 | automake --add-missing --copy | 13 | automake --add-missing --copy |
configure.ac
| @@ -64,10 +64,10 @@ AC_CANONICAL_HOST | @@ -64,10 +64,10 @@ AC_CANONICAL_HOST | ||
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | ############################################################################# | 66 | ############################################################################# |
| 67 | -# Determine the C and C++ compilers. This has to come before the check for # | 67 | +# Check for valid C++ compiler. This has to come before the check for # |
| 68 | # header files, otherwise we won't detect if the C++ compiler is missing. # | 68 | # header files, otherwise we won't detect if the C++ compiler is missing. # |
| 69 | ############################################################################# | 69 | ############################################################################# |
| 70 | -AC_PROG_CC | 70 | +AC_LANG(C++) |
| 71 | AC_PROG_CXX | 71 | AC_PROG_CXX |
| 72 | 72 | ||
| 73 | 73 | ||
| @@ -461,11 +461,11 @@ case $ac_sys_system/$ac_sys_release in | @@ -461,11 +461,11 @@ case $ac_sys_system/$ac_sys_release in | ||
| 461 | Darwin/*) | 461 | Darwin/*) |
| 462 | # Use -undefined dynamic_lookup whenever possible (10.3 and later). | 462 | # Use -undefined dynamic_lookup whenever possible (10.3 and later). |
| 463 | # This allows an extension to be used in any Python | 463 | # This allows an extension to be used in any Python |
| 464 | - if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2; then | 464 | + #if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2; then |
| 465 | if test "${enable_universalsdk}"; then | 465 | if test "${enable_universalsdk}"; then |
| 466 | LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" | 466 | LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" |
| 467 | fi | 467 | fi |
| 468 | - fi | 468 | + #fi |
| 469 | ;; | 469 | ;; |
| 470 | esac | 470 | esac |
| 471 | 471 | ||
| @@ -547,12 +547,11 @@ if test "x$has_python" = "xyes"; then | @@ -547,12 +547,11 @@ if test "x$has_python" = "xyes"; then | ||
| 547 | python_path=`$PYTHON -c "import distutils.sysconfig; \ | 547 | python_path=`$PYTHON -c "import distutils.sysconfig; \ |
| 548 | print distutils.sysconfig.get_python_inc();"` | 548 | print distutils.sysconfig.get_python_inc();"` |
| 549 | if test -n "${python_path}"; then | 549 | if test -n "${python_path}"; then |
| 550 | + AC_CHECK_HEADERS($python_path/Python.h, [has_python_h="yes"], [has_python_h="no"]) | ||
| 550 | python_path="-I$python_path" | 551 | python_path="-I$python_path" |
| 551 | - has_python_h="yes" | ||
| 552 | fi | 552 | fi |
| 553 | PYTHON_CPPFLAGS=$python_path | 553 | PYTHON_CPPFLAGS=$python_path |
| 554 | CPPFLAGS="${CPPFLAGS} ${python_path}" | 554 | CPPFLAGS="${CPPFLAGS} ${python_path}" |
| 555 | - AC_MSG_RESULT([$python_path]) | ||
| 556 | AC_SUBST([PYTHON_CPPFLAGS]) | 555 | AC_SUBST([PYTHON_CPPFLAGS]) |
| 557 | 556 | ||
| 558 | # ... otherwise check for includes relative to exectuable (obsolete?) | 557 | # ... otherwise check for includes relative to exectuable (obsolete?) |
| @@ -635,7 +634,6 @@ has_gammalib="no" | @@ -635,7 +634,6 @@ has_gammalib="no" | ||
| 635 | 634 | ||
| 636 | # First check for GammaLib in the standard path using the AC_LINK_IFELSE macro. | 635 | # First check for GammaLib in the standard path using the AC_LINK_IFELSE macro. |
| 637 | # This allows also search in paths that are eventually specified by LDFAGS. | 636 | # This allows also search in paths that are eventually specified by LDFAGS. |
| 638 | -AC_LANG(C++) | ||
| 639 | SAVED_LDFLAGS=$LDFLAGS | 637 | SAVED_LDFLAGS=$LDFLAGS |
| 640 | LDFLAGS="$LDFLAGS -lgamma" | 638 | LDFLAGS="$LDFLAGS -lgamma" |
| 641 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GammaLib.hpp>], | 639 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GammaLib.hpp>], |
| @@ -688,19 +686,16 @@ root directory of GammaLib.]) | @@ -688,19 +686,16 @@ root directory of GammaLib.]) | ||
| 688 | fi | 686 | fi |
| 689 | 687 | ||
| 690 | 688 | ||
| 691 | - | ||
| 692 | ############################################################################# | 689 | ############################################################################# |
| 693 | # Checks for OpenMP checking option (G_OPENMP) # | 690 | # Checks for OpenMP checking option (G_OPENMP) # |
| 694 | -############################################################################ | ||
| 695 | - | 691 | +############################################################################# |
| 692 | +# Initialise OpenMP availability | ||
| 696 | openmp_ok=no | 693 | openmp_ok=no |
| 697 | - | ||
| 698 | -# Check for C++ | ||
| 699 | -AC_LANG(C++) | 694 | +gammalib_with_openmp=no |
| 700 | 695 | ||
| 701 | # Detect if GammaLib has been compiled with OpenMP | 696 | # Detect if GammaLib has been compiled with OpenMP |
| 702 | -AC_MSG_CHECKING(if GammaLib has been compiled with OpenMP) | ||
| 703 | -AC_LINK_IFELSE(AC_LANG_PROGRAM([[#include <GObservations.hpp>]],,), | 697 | +AC_MSG_CHECKING(whether GammaLib has been compiled with OpenMP) |
| 698 | +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <GObservations.hpp>]],,)], | ||
| 704 | [gammalib_with_openmp=no;AC_MSG_RESULT(no)], | 699 | [gammalib_with_openmp=no;AC_MSG_RESULT(no)], |
| 705 | [gammalib_with_openmp=yes;AC_MSG_RESULT(yes)]) | 700 | [gammalib_with_openmp=yes;AC_MSG_RESULT(yes)]) |
| 706 | 701 | ||
| @@ -710,38 +705,43 @@ if test "x$ac_cv_prog_cxx_openmp" != "xunsupported" && test "x$ac_cv_prog_cxx_op | @@ -710,38 +705,43 @@ if test "x$ac_cv_prog_cxx_openmp" != "xunsupported" && test "x$ac_cv_prog_cxx_op | ||
| 710 | openmp_ok=yes | 705 | openmp_ok=yes |
| 711 | fi | 706 | fi |
| 712 | 707 | ||
| 713 | -AC_MSG_CHECKING(whether to enable openMP) | 708 | +# Signal actual test |
| 709 | +AC_MSG_CHECKING(whether to enable OpenMP) | ||
| 714 | 710 | ||
| 715 | -#openMP is available | 711 | +# If OpenMP is available |
| 716 | if test "x$openmp_ok" = "xyes"; then | 712 | if test "x$openmp_ok" = "xyes"; then |
| 717 | - #if gammalib is compiled with openMP, ctools must have it. | 713 | + # If gammalib is compiled with OpenMP, ctools must also be compiled with |
| 714 | + # openmp | ||
| 718 | if test "x$gammalib_with_openmp" = "xyes"; then | 715 | if test "x$gammalib_with_openmp" = "xyes"; then |
| 719 | enable_openmp="yes" | 716 | enable_openmp="yes" |
| 720 | else | 717 | else |
| 721 | - #Else, we propose the option | 718 | + # ... otherwise, we use it optionally |
| 722 | AC_ARG_ENABLE([openmp], | 719 | AC_ARG_ENABLE([openmp], |
| 723 | AS_HELP_STRING([--enable-openmp], | 720 | AS_HELP_STRING([--enable-openmp], |
| 724 | - [To active multi-threading [default=yes]]), | 721 | + [turn on OpenMP support [default=yes]]), |
| 725 | [enable_openmp="$enableval"], | 722 | [enable_openmp="$enableval"], |
| 726 | [enable_openmp="yes"]) | 723 | [enable_openmp="yes"]) |
| 727 | fi | 724 | fi |
| 728 | fi | 725 | fi |
| 729 | 726 | ||
| 727 | +# Set compiler flags accordingly | ||
| 730 | if test "x$enable_openmp" = "xyes"; then | 728 | if test "x$enable_openmp" = "xyes"; then |
| 731 | CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS" | 729 | CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS" |
| 732 | - AC_MSG_RESULT(yes) | ||
| 733 | - else | ||
| 734 | - enable_openmp=no | 730 | + AC_DEFINE([HAVE_OPENMP], [1], [Define if OpenMP is enabled]) |
| 731 | + AC_MSG_RESULT(yes) | ||
| 732 | +else | ||
| 733 | + enable_openmp=no | ||
| 735 | AC_MSG_RESULT(no) | 734 | AC_MSG_RESULT(no) |
| 736 | fi | 735 | fi |
| 737 | 736 | ||
| 737 | +# Signal if ctools cannot be compiled as gammalibe requires OpenMP but ctools | ||
| 738 | +# cannot be compiled with OpenMP | ||
| 738 | if test "x$enable_openmp" = "xno" && test "x$gammalib_with_openmp" = "xyes"; then | 739 | if test "x$enable_openmp" = "xno" && test "x$gammalib_with_openmp" = "xyes"; then |
| 739 | - #Error, we cannot compile. | ||
| 740 | - AC_MSG_ERROR([The GammaLib library has been built with openmp option but openmp is not available on this system. Please install the libarie or re-build gammalib.]) | 740 | + AC_MSG_ERROR([The GammaLib library has been built with openMP support but OpenMP is not available on this system. Please install OpenMP or re-build GammaLib without OpenMP support.]) |
| 741 | fi | 741 | fi |
| 742 | - | ||
| 743 | AM_CONDITIONAL(OPENMP,test "x$enable_openmp" = "xyes") | 742 | AM_CONDITIONAL(OPENMP,test "x$enable_openmp" = "xyes") |
| 744 | 743 | ||
| 744 | + | ||
| 745 | ############################################################################# | 745 | ############################################################################# |
| 746 | # Build static code? # | 746 | # Build static code? # |
| 747 | ############################################################################# | 747 | ############################################################################# |
| @@ -850,9 +850,9 @@ fi | @@ -850,9 +850,9 @@ fi | ||
| 850 | 850 | ||
| 851 | # Dump compile options | 851 | # Dump compile options |
| 852 | if test "x$enable_openmp" = "xyes"; then | 852 | if test "x$enable_openmp" = "xyes"; then |
| 853 | - echo " * Enable openMP (yes) (default)" | 853 | + echo " * Enable OpenMP (yes) (default)" |
| 854 | else | 854 | else |
| 855 | - echo " - Enable openMP (no)" | 855 | + echo " - Enable OpenMP (no)" |
| 856 | fi | 856 | fi |
| 857 | if test "x$enable_debug" = "xyes"; then | 857 | if test "x$enable_debug" = "xyes"; then |
| 858 | echo " * Compile in debug code (yes)" | 858 | echo " * Compile in debug code (yes)" |