# CPL_CHECK_CFITSIO #------------------ # Checks for the cfitsio library and header files. AC_DEFUN([CPL_CHECK_CFITSIO], [ AC_MSG_CHECKING([for cfitsio]) cpl_cfitsio_check_header="fitsio.h" cpl_cfitsio_check_lib="libcfitsio.a" cpl_cfitsio_includes="" cpl_cfitsio_libraries="" AC_ARG_WITH(cfitsio, AC_HELP_STRING([--with-cfitsio], [location where cfitsio is installed]), [ cpl_with_cfitsio_includes=$withval/include cpl_with_cfitsio_libs=$withval/lib ]) # Check for the cfitsio includes if test -z "$cpl_with_cfitsio_includes"; then test -n "$CFITSIODIR" && cpl_cfitsio_incdirs="$CFITSIODIR/include" else cpl_cfitsio_incdirs="$cpl_with_cfitsio_includes" fi ESO_FIND_FILE($cpl_cfitsio_check_header, $cpl_cfitsio_incdirs, cpl_cfitsio_includes) # Check for the cfitsio library if test -z "$cpl_with_cfitsio_libs"; then test -n "$CFITSIODIR" && cpl_cfitsio_libdirs="$CFITSIODIR/lib" else cpl_cfitsio_libdirs="$cpl_with_cfitsio_libs" fi ESO_FIND_FILE($cpl_cfitsio_check_lib, $cpl_cfitsio_libdirs, cpl_cfitsio_libraries) if test x"$cpl_cfitsio_includes" = xno || test x"$cpl_cfitsio_libraries" = xno; then AC_MSG_ERROR([cfitsio was not found on your system. Please check!]) else AC_MSG_RESULT([libraries $cpl_cfitsio_libraries, headers $cpl_cfitsio_includes]) # Attempt to check the version by checking the include files cpl_cfitsio_check_vers=`grep "Version Info: This file is distributed with version 2.510 of CFITSIO" $cpl_cfitsio_includes/fitsio.h` if test -z "$cpl_cfitsio_check_vers" ; then AC_MSG_WARN([cfitsio version seems to be different from 2.510.]) fi fi # Set up the symbols CFITSIO_INCLUDES="-I$cpl_cfitsio_includes" CFITSIO_LDFLAGS="-L$cpl_cfitsio_libraries" LIBCFITSIO="-lcfitsio" AC_SUBST(CFITSIO_INCLUDES) AC_SUBST(CFITSIO_LDFLAGS) AC_SUBST(LIBCFITSIO) ]) # CPL_CHECK_WCS #-------------- # Checks for the wcs library and header files. AC_DEFUN([CPL_CHECK_WCS], [ AC_MSG_CHECKING([for wcs]) cpl_wcs_check_header="wcslib/wcslib.h" cpl_wcs_check_lib="libwcs.a" cpl_wcs_includes="" cpl_wcs_libraries="" AC_ARG_WITH(wcs, AC_HELP_STRING([--with-wcs], [location where wcs is installed]), [ cpl_with_wcs_includes=$withval/include cpl_with_wcs_libs=$withval/lib ]) # Check for the wcs includes if test -z "$cpl_with_wcs_includes"; then test -n "$WCSDIR" && cpl_wcs_incdirs="$WCSDIR/include" else cpl_wcs_incdirs="$cpl_with_wcs_includes" fi ESO_FIND_FILE($cpl_wcs_check_header, $cpl_wcs_incdirs, cpl_wcs_includes) # Check for the wcs library if test -z "$cpl_with_wcs_libs"; then test -n "$WCSDIR" && cpl_wcs_libdirs="$WCSDIR/lib" else cpl_wcs_libdirs="$cpl_with_wcs_libs" fi ESO_FIND_FILE($cpl_wcs_check_lib, $cpl_wcs_libdirs, cpl_wcs_libraries) if test x"$cpl_wcs_includes" = xno || test x"$cpl_wcs_libraries" = xno; then AC_MSG_WARN([wcs was not found on your system.]) else AC_MSG_RESULT([libraries $cpl_wcs_libraries, headers $cpl_wcs_includes]) # Attempt to check the version by checking the include files cpl_wcs_check_vers=`grep "WCSLIB 4.3 - an implementation of the FITS WCS standard" $cpl_wcs_includes/wcslib/wcslib.h` if test -z "$cpl_wcs_check_vers" ; then AC_MSG_WARN([wcs version seems to be different from 4.3]) fi AC_DEFINE_UNQUOTED(CPL_WCS_INSTALLED, 1, [Defined if WCS is available]) # Set up the symbols WCS_INCLUDES="-I$cpl_wcs_includes/wcslib" WCS_LDFLAGS="-L$cpl_wcs_libraries" LIBWCS="-lwcs" AC_SUBST(WCS_INCLUDES) AC_SUBST(WCS_LDFLAGS) AC_SUBST(LIBWCS) fi ]) # CHECK MEMORY MODE #------------------ AC_DEFUN([CPL_CHECK_MEMORYMODE], [ AC_MSG_CHECKING([for extended memory mode]) AC_ARG_ENABLE(memory-mode, AC_HELP_STRING([--enable-memory-mode=M], [where M=0 switches off the internal memory handling, M=1 exits the program whenever a memory allocation fails (default), M=2 switches on the internal memory handling]), [ cpl_memory_flag=yes # $enableval=yes when no argument is given cpl_memory_mode=$enableval ]) AC_ARG_ENABLE(max-ptrs, AC_HELP_STRING([--enable-max-ptrs=MAXPTRS], [MAXPTRS Set MAXPTRS as the maximum number of pointers allowed when using memory-mode=2 (200003)]), [ cpl_max_ptrs_flag=yes cpl_max_ptrs=$enableval ]) # Pending: check cpl_max_ptrs is numeric, otherwise AC_MSG_ERROR if test "x$cpl_max_ptrs_flag" = xyes ; then CPL_MAXPTRS_CFLAGS="-DCPL_XMEMORY_MAXPTRS=$cpl_max_ptrs" else CPL_MAXPTRS_CFLAGS="-DCPL_XMEMORY_MAXPTRS=200003" fi if test "x$cpl_memory_flag" = xyes ; then CPL_CFLAGS="-DCPL_XMEMORY_MODE=$cpl_memory_mode" case $cpl_memory_mode in yes) CPL_CFLAGS="-DCPL_XMEMORY_MODE=0 -DCPL_XMEMORY_MAXPTRS=1" break ;; 0|1) CPL_CFLAGS="-DCPL_XMEMORY_MODE=$cpl_memory_mode -DCPL_XMEMORY_MAXPTRS=1" break ;; 2) CPL_CFLAGS="-DCPL_XMEMORY_MODE=2 $CPL_MAXPTRS_CFLAGS" break ;; *) AC_MSG_ERROR([Option --enable-memory-mode=$cpl_memory_mode not valid. Please check!]) break ;; esac else CPL_CFLAGS="-DCPL_XMEMORY_MODE=1 -DCPL_XMEMORY_MAXPTRS=1" fi AC_MSG_RESULT([CPL_CFLAGS=$CPL_CFLAGS]) AC_SUBST(CPL_CFLAGS) ]) # # CPL_CREATE_SYMBOLS(build=[]) #----------------------------- # Sets the Makefile symbols for the CPL and C extension libraries. If an # argument is provided the symbols are setup for building CPL, if no # argument is given (default) the symbols are set for using the libraries # for external package development. AC_DEFUN([CPL_CREATE_SYMBOLS], [ if test -z "$1"; then LIBCPLCORE='-lcplcore' LIBCPLDRS='-lcpldrs' LIBCPLUI='-lcplui' LIBCPLDFS='-lcpldfs' # Third party libraries LIBCEXT='-lcext' else LIBCPLCORE='$(top_builddir)/cplcore/libcplcore.la' LIBCPLDRS='$(top_builddir)/cpldrs/libcpldrs.la' LIBCPLUI='$(top_builddir)/cplui/libcplui.la' LIBCPLDFS='$(top_builddir)/cpldfs/libcpldfs.la' # Third party libraries LIBCEXT='$(top_builddir)/libcext/cext/libcext.la' fi AC_SUBST(LIBCPLCORE) AC_SUBST(LIBCPLDRS) AC_SUBST(LIBCPLUI) AC_SUBST(LIBCPLDFS) AC_SUBST(LIBCEXT) ])