Commit 4825ce6146c514ff43cfc062dd18c080721158da

Authored by Jürgen Knödlseder
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 1 #!/bin/sh
2 2  
3   -aclocal -I m4
4 3 if which libtoolize >/dev/null; then
5 4 libtoolize --copy
6 5 else
... ... @@ -8,7 +7,7 @@ else
8 7 glibtoolize --copy
9 8 fi
10 9 fi
11   -#libtoolize --copy
  10 +aclocal -I m4
12 11 autoconf
13 12 autoheader
14 13 automake --add-missing --copy
... ...
configure.ac
... ... @@ -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 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 71 AC_PROG_CXX
72 72  
73 73  
... ... @@ -461,11 +461,11 @@ case $ac_sys_system/$ac_sys_release in
461 461 Darwin/*)
462 462 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
463 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 465 if test "${enable_universalsdk}"; then
466 466 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
467 467 fi
468   - fi
  468 + #fi
469 469 ;;
470 470 esac
471 471  
... ... @@ -547,12 +547,11 @@ if test "x$has_python" = "xyes"; then
547 547 python_path=`$PYTHON -c "import distutils.sysconfig; \
548 548 print distutils.sysconfig.get_python_inc();"`
549 549 if test -n "${python_path}"; then
  550 + AC_CHECK_HEADERS($python_path/Python.h, [has_python_h="yes"], [has_python_h="no"])
550 551 python_path="-I$python_path"
551   - has_python_h="yes"
552 552 fi
553 553 PYTHON_CPPFLAGS=$python_path
554 554 CPPFLAGS="${CPPFLAGS} ${python_path}"
555   - AC_MSG_RESULT([$python_path])
556 555 AC_SUBST([PYTHON_CPPFLAGS])
557 556  
558 557 # ... otherwise check for includes relative to exectuable (obsolete?)
... ... @@ -635,7 +634,6 @@ has_gammalib="no"
635 634  
636 635 # First check for GammaLib in the standard path using the AC_LINK_IFELSE macro.
637 636 # This allows also search in paths that are eventually specified by LDFAGS.
638   -AC_LANG(C++)
639 637 SAVED_LDFLAGS=$LDFLAGS
640 638 LDFLAGS="$LDFLAGS -lgamma"
641 639 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GammaLib.hpp>],
... ... @@ -688,19 +686,16 @@ root directory of GammaLib.])
688 686 fi
689 687  
690 688  
691   -
692 689 #############################################################################
693 690 # Checks for OpenMP checking option (G_OPENMP) #
694   -############################################################################
695   -
  691 +#############################################################################
  692 +# Initialise OpenMP availability
696 693 openmp_ok=no
697   -
698   -# Check for C++
699   -AC_LANG(C++)
  694 +gammalib_with_openmp=no
700 695  
701 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 699 [gammalib_with_openmp=no;AC_MSG_RESULT(no)],
705 700 [gammalib_with_openmp=yes;AC_MSG_RESULT(yes)])
706 701  
... ... @@ -710,38 +705,43 @@ if test &quot;x$ac_cv_prog_cxx_openmp&quot; != &quot;xunsupported&quot; &amp;&amp; test &quot;x$ac_cv_prog_cxx_op
710 705 openmp_ok=yes
711 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 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 715 if test "x$gammalib_with_openmp" = "xyes"; then
719 716 enable_openmp="yes"
720 717 else
721   - #Else, we propose the option
  718 + # ... otherwise, we use it optionally
722 719 AC_ARG_ENABLE([openmp],
723 720 AS_HELP_STRING([--enable-openmp],
724   - [To active multi-threading [default=yes]]),
  721 + [turn on OpenMP support [default=yes]]),
725 722 [enable_openmp="$enableval"],
726 723 [enable_openmp="yes"])
727 724 fi
728 725 fi
729 726  
  727 +# Set compiler flags accordingly
730 728 if test "x$enable_openmp" = "xyes"; then
731 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 734 AC_MSG_RESULT(no)
736 735 fi
737 736  
  737 +# Signal if ctools cannot be compiled as gammalibe requires OpenMP but ctools
  738 +# cannot be compiled with OpenMP
738 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 741 fi
742   -
743 742 AM_CONDITIONAL(OPENMP,test "x$enable_openmp" = "xyes")
744 743  
  744 +
745 745 #############################################################################
746 746 # Build static code? #
747 747 #############################################################################
... ... @@ -850,9 +850,9 @@ fi
850 850  
851 851 # Dump compile options
852 852 if test "x$enable_openmp" = "xyes"; then
853   - echo " * Enable openMP (yes) (default)"
  853 + echo " * Enable OpenMP (yes) (default)"
854 854 else
855   - echo " - Enable openMP (no)"
  855 + echo " - Enable OpenMP (no)"
856 856 fi
857 857 if test "x$enable_debug" = "xyes"; then
858 858 echo " * Compile in debug code (yes)"
... ...