Commit 019377bd authored by Emmanuel Bertin's avatar Emmanuel Bertin
Browse files

Link with CFITSIO is now the default.

parent b2cfd631
Loading
Loading
Loading
Loading
+21 −21
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#	You should have received a copy of the GNU General Public License
#	along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
#
#	Last modified:		19/02/2020
#	Last modified:		23/09/2020
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

@@ -31,7 +31,7 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],)

# This is your standard AstrOmatic source code...
AC_INIT(SExtractor, 2.25.2, [astromatic@astromatic.net],
AC_INIT(SExtractor, 2.27.0, [astromatic@astromatic.net],
	sextractor, [http://astromatic.net/software/sextractor])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR(autoconf)
@@ -182,18 +182,22 @@ AC_ARG_WITH(openblas-incdir,
	[Provide an alternative path to the OpenBLAS header directory])])

# Provide special option for CFITSIO
AC_MSG_CHECKING([whether CFITSIO support is enabled])
AC_MSG_CHECKING([whether CFITSIO support should be disabled (default=enabled)])
AC_ARG_ENABLE(cfitsio,
	[AS_HELP_STRING([--enable-cfitsio],
	[Enable support for compressed FITS files through the CFITSIO library (default = no)])],
	AC_MSG_RESULT([yes]),
	[AS_HELP_STRING([--disable-cfitsio],
	[Disable support for compressed FITS files through the CFITSIO library (default=enabled)])],
	if test "$enable_cfitsio" = "no"; then
	  AC_MSG_RESULT([yes])
	else
	  AC_MSG_RESULT([no])
	fi,
	AC_MSG_RESULT([no]))
AC_ARG_WITH(cfitsio-libdir,
	[AS_HELP_STRING([--with-cfitsio-libdir=<CFITSIO library path>],
	[Provide an alternative path to the CFITSIO library])])
AC_ARG_WITH(cfitsio-incdir,
	[AS_HELP_STRING([--with-cfitsio-incdir=<CFITSIO header dir>],
	[Provide an alternative path to the CFITSIO header directory])])
	[AS_HELP_STRING([--with-cfitsio-incdir=<CFITSIO include dir>],
	[Provide an alternative path to the CFITSIO include directory])])

# Provide a special option for the default XSLT URL
with_xsl_url="file://"$(URBI_RESOLVE_DIR([$datadir]))"/$PACKAGE_TARNAME/$PACKAGE_TARNAME.xsl"
@@ -320,19 +324,15 @@ if test "$enable_model_fitting" != "no"; then
  fi
fi

AS_IF([test "x$enable_cfitsio" = "xyes"], [
	ACX_CFITSIO($with_cfitsio_libdir, $with_cfitsio_incdir,, no,
    [
      AM_CFLAGS="$AM_CFLAGS $CFITSIO_CFLAGS "
      AM_LDFLAGS="$AM_LDFLAGS $CFITSIO_LDFLAGS "
      LIBS="$CFITSIO_LIBS $LIBS"
########################## handle the CFITSIO library ########################
if test "$enable_cfitsio" != "no"; then
  ACX_CFITSIO($with_cfitsio_libdir, $with_cfitsio_incdir,
	[LIBS="$CFITSIO_LIBS $LIBS"]
	if test "$CFITSIO_WARN" != ""; then
	  AC_MSG_WARN([$CFITSIO_WARN])
	fi,
	AC_MSG_ERROR([$CFITSIO_ERROR Exiting.]))
fi
    ],
    AC_MSG_ERROR([$CFITSIO_ERROR Exiting.])
    )
])

AM_CONDITIONAL(USE_MODEL, [test "$enable_model_fitting" != "no"])

+4 −4
Original line number Diff line number Diff line
@@ -67,9 +67,9 @@ author = u'E. Bertin'
# built documents.
#
# The short X.Y version.
version = '2.25.2'
version = '2.27.0'
# The full version, including alpha/beta/rc tags.
release = '2.25.2'
release = '2.27.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -81,7 +81,7 @@ language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#
today = 'Wed Aug 12 2020'
today = 'Tue Sep 06 2022'
#
# Else, today_fmt is used as the format for a strftime call.
#
@@ -144,7 +144,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = u'SExtractor v2.25.2'
# html_title = u'SExtractor v2.27.0'

# A shorter title for the navigation bar.  Default is the same as html_title.
#
+58 −64
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl
dnl	This file part of:	AstrOmatic software
dnl
dnl	Copyright:		(C) 2019 IAP/CNRS/UPMC
dnl	Copyright:		(C) 2013 Emmanuel Bertin -- IAP/CNRS/UPMC
dnl
dnl	License:		GNU General Public License
dnl
@@ -23,19 +23,24 @@ dnl You should have received a copy of the GNU General Public License
dnl	along with AstrOmatic software.
dnl	If not, see <http://www.gnu.org/licenses/>.
dnl
dnl	Last modified:		16/07/2019
dnl	Last modified:		27/02/2013
dnl
dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl
dnl @synopsis ACX_CFITSIO([CFITSIO_LIBSDIR, CFITSIO_INCDIR, CFITSIO_PFLAG,
dnl                  ILP64_FLAG, [ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]])
dnl
dnl You may wish to use these variables in your default LIBS:
dnl @synopsis ACX_CFITSIO([CFITSIO_DIR, CFITSIO_INCDIR,
dnl                    [ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]])
dnl This macro figures out if the CFITSIO libraries and header
dnl files are installed.
dnl You may wish to use these variables in your default LIBS and CFLAGS:
dnl
dnl        LIBS="$CFITSIO_LIBS $LIBS"
dnl
dnl You may wish to use these variables in your default CFLAGS:
dnl
dnl        CFLAGS="$CFLAGS $CFITSIO_CFLAGS"
dnl
dnl ACTION-IF-FOUND is a list of shell commands to run if CFITSIO
dnl is found (HAVE_CFITSIO is defined first), and ACTION-IF-NOT-FOUND
dnl is found (HAVE_CFITSIO are defined first), and ACTION-IF-NOT-FOUND
dnl is a list of commands to run it if it is not found.

AC_DEFUN([ACX_CFITSIO], [
@@ -45,77 +50,66 @@ dnl --------------------
dnl Search include files
dnl --------------------

CFITSIO_ERROR=""
acx_cfitsio_ok=no
if test x$2 = x; then
  [acx_cfitsio_incdir="/"]
  AC_CHECK_HEADERS(
    [${acx_cfitsio_incdir}fitsio.h],,
    [
      [acx_cfitsio_incdir=""]
      AC_CHECK_HEADER(
        [fitsio.h],,
        [CFITSIO_ERROR="CFITSIO header files not found!"]
      )
    ]
  )
  AC_CHECK_HEADER(fitsio.h,[acx_cfitsio_ok=yes])
  if test x$acx_cfitsio_ok = xyes; then
    AC_DEFINE(CFITSIO_H, "fitsio.h", [CFITSIO header filename.])
  else
  acx_cfitsio_incdir="$2/"
  AC_CHECK_HEADER(
    [${acx_cfitsio_incdir}fitsio.h],,
    [
      [acx_cfitsio_incdir="$2/include/"]
      AC_CHECK_HEADERS(
        [${acx_cfitsio_incdir}fitsio.h],,
        [CFITSIO_ERROR="CFITSIO header files not found in "$2"!"]
    )]
  )
    AC_CHECK_HEADER(cfitsio/fitsio.h,[acx_cfitsio_ok=yes])
    if test x$acx_cfitsio_ok = xyes; then
      AC_DEFINE(CFITSIO_H, "cfitsio/fitsio.h", [CFITSIO header filename.])
    else
      CFITSIO_ERROR="CFITSIO include files not found at default location!"
    fi
  fi
else
  AC_CHECK_HEADER($2/fitsio.h,[acx_cfitsio_ok=yes])
  if test x$acx_cfitsio_ok = xyes; then
    AC_DEFINE_UNQUOTED(CFITSIO_H, "$2/fitsio.h", [CFITSIO header filename.])
  else
    CFITSIO_ERROR="CFITSIO include files not found in $2!"
  fi
fi

if test "x$CFITSIO_ERROR" = "x"; then
  AC_DEFINE_UNQUOTED(FITSIO_H, "${acx_cfitsio_incdir}fitsio.h", [CFITSIO header filename.])

dnl ----------------------------
dnl Search CFITSIO library file
dnl ----------------------------
dnl --------------------
dnl Search library files
dnl --------------------

CFITSIO_LIBS=""
OLIBS="$LIBS"
LIBS=""
  if test x$4 = xyes; then
    acx_cfitsio_suffix="64"
    CFITSIO_CFLAGS="-DCFITSIO_USE64BITINT -DLAPACK_ILP64"

if test x$acx_cfitsio_ok = xyes; then
  if test x$1 = x; then
    AC_CHECK_LIB(cfitsio, ffopen, [acx_cfitsio_ok=yes], [acx_cfitsio_ok=no])
    if test x$acx_cfitsio_ok = xyes; then
      AC_DEFINE(HAVE_CFITSIO,1, [Define if you have the CFITSIO libraries and header files.])
      CFITSIO_LIBS="-lcfitsio"
    else
    acx_cfitsio_suffix=""
    CFITSIO_CFLAGS=""
      CFITSIO_ERROR="CFITSIO library files not found at usual locations!"
    fi
  if test x$1 = x; then
    acx_cfitsio_libopt=""
  else
    acx_cfitsio_libopt="-L$1"
dnl -------------------------
dnl Specific libdir specified
dnl -------------------------
    AC_CHECK_LIB(cfitsio, ffopen, [acx_cfitsio_ok=yes], [acx_cfitsio_ok=no], [-L$1])
    if test x$acx_cfitsio_ok = xyes; then
      AC_DEFINE(HAVE_CFITSIO,1, [Define if you have the CFITSIO libraries and header files.])
        CFITSIO_LIBS="-L$1 -lcfitsio"
    else
      CFITSIO_ERROR="CFITSIO library files not found in $1!"
    fi
  fi
  AC_SEARCH_LIBS(
      [ffmahd], ["cfitsio"$acx_cfitsio_suffix],,
      [CFITSIO_ERROR="CFITSIO"$acx_cfitsio_suffix" library file not found!"],
      $acx_cfitsio_libopt
    )
  LIBS="$OLIBS"
fi

dnl -------------------------------------------------------------------------
dnl Finally execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND
dnl -------------------------------------------------------------------------

if test "x$CFITSIO_ERROR" = "x"; then
  AC_DEFINE(HAVE_CFITSIO,1, [Define if you have the CFITSIO library and header files.])
  CFITSIO_LIBS="$acx_cfitsio_libopt $ac_cv_search_ffmahd"
  AC_SUBST(CFITSIO_CFLAGS)
  AC_SUBST(CFITSIO_LDFLAGS, "")
LIBS="$OLIBS"
if test x$acx_cfitsio_ok = xyes; then
  AC_SUBST(CFITSIO_LIBS)
  AC_SUBST(CFITSIO_WARN)
  $5
  $3
else
  AC_SUBST(CFITSIO_ERROR)
  $6
  $4
fi

])dnl ACX_CFITSIO
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
*
*	This file part of:	SExtractor
*
*	Copyright:		(C) 1993-2016 Emmanuel Bertin -- IAP/CNRS/UPMC
*	Copyright:		(C) 1993-2016 IAP/CNRS/UPMC
*
*	License:		GNU General Public License
*
+40 −21
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
*
*	This file part of:	SExtractor
*
*	Copyright:		(C) 1993-2014 Emmanuel Bertin -- IAP/CNRS/UPMC
*	Copyright:		(C) 1993-2020 IAP/CNRS/SorbonneU
*
*	License:		GNU General Public License
*
@@ -22,7 +22,7 @@
*	You should have received a copy of the GNU General Public License
*	along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
*	Last modified:		17/06/2014
*	Last modified:		23/09/2020
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@@ -89,12 +89,15 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)

  wfcurpos = wfcurpos2 = 0;		/* to avoid gcc -Wall warnings */
  QFTELL(field->file, fcurpos, field->filename);
  currentElement = (tab->currentElement == 0) ? 1 : tab->currentElement; // CFITSIO
#ifdef HAVE_CFITSIO
  currentElement = (tab->currentElement == 0) ? 1 : tab->currentElement;
#endif

  if (wfield)
    {
  if (wfield) {
    QFTELL(wfield->file, wfcurpos, wfield->filename);
    wcurrentElement = (wtab->currentElement == 0) ? 1 : wtab->currentElement; // CFITSIO
#ifdef HAVE_CFITSIO
    wcurrentElement = (wtab->currentElement == 0) ? 1 : wtab->currentElement;
#endif
  }

/* Allocate a correct amount of memory to store pixels */
@@ -183,10 +186,14 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
      {
/*---- Image size too big, we have to skip a few data !*/
      QFTELL(field->file, fcurpos2, field->filename);
      currentElement2 = (tab->currentElement == 0) ? 1 : tab->currentElement; // CFITSIO
 #ifdef HAVE_CFITSIO
     currentElement2 = (tab->currentElement == 0) ? 1 : tab->currentElement;
#endif
      if (wfield){
        QFTELL(wfield->file, wfcurpos2, wfield->filename);
        wcurrentElement2 = (wtab->currentElement == 0) ? 1 : wtab->currentElement; // CFITSIO
#ifdef HAVE_CFITSIO
        wcurrentElement2 = (wtab->currentElement == 0) ? 1 : wtab->currentElement;
#endif
      }
      if (j == ny-1 && (n=field->height%field->backh))
        {
@@ -208,8 +215,9 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
/*---- Read and skip, read and skip, etc... */
      QFSEEK(field->file, bufshift*(OFF_T2)field->bytepix, SEEK_CUR,
		field->filename);
      tab->currentElement += bufshift; // CFITSIO

#ifdef HAVE_CFITSIO
      tab->currentElement += bufshift;
#endif
      buft = buf;
      for (i=nlines; i--; buft += w)
        {
@@ -217,7 +225,9 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
        if (i) {
          QFSEEK(field->file, jumpsize*(OFF_T2)field->bytepix, SEEK_CUR,
		field->filename);
          tab->currentElement += jumpsize; // CFITSIO
#ifdef HAVE_CFITSIO
          tab->currentElement += jumpsize;
#endif
        }
        }

@@ -226,8 +236,9 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
/*------ Read and skip, read and skip, etc... now on the weight-map */
        QFSEEK(wfield->file, bufshift*(OFF_T2)wfield->bytepix, SEEK_CUR,
		wfield->filename);
        wtab->currentElement += bufshift; // CFITSIO

#ifdef HAVE_CFITSIO
        wtab->currentElement += bufshift;
#endif
        wbuft = wbuf;
        for (i=nlines; i--; wbuft += w)
          {
@@ -236,16 +247,18 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
          if (i){
            QFSEEK(wfield->file, jumpsize*(OFF_T2)wfield->bytepix, SEEK_CUR,
		wfield->filename);
            wtab->currentElement += jumpsize; // CFITSIO

#ifdef HAVE_CFITSIO
            wtab->currentElement += jumpsize;
#endif
          }
          }
        }
      backstat(backmesh, wbackmesh, buf, wbuf, bufsize, nx, w, bw,
	wfield?wfield->weight_thresh:0.0);
      QFSEEK(field->file, fcurpos2, SEEK_SET, field->filename);
      tab->currentElement = currentElement2; // CFITSIO

#ifdef HAVE_CFITSIO
      tab->currentElement = currentElement2;
#endif
      bm = backmesh;
      for (m=nx; m--; bm++)
        if (bm->mean <= -BIG)
@@ -255,7 +268,9 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
      if (wfield)
        {
        QFSEEK(wfield->file, wfcurpos2, SEEK_SET, wfield->filename);
        wtab->currentElement = wcurrentElement2; // CFITSIO
#ifdef HAVE_CFITSIO
        wtab->currentElement = wcurrentElement2;
#endif
        wbm = wbackmesh;
        for (m=nx; m--; wbm++)
          if (wbm->mean <= -BIG)
@@ -310,10 +325,14 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)

/* Go back to the original position */
  QFSEEK(field->file, fcurpos, SEEK_SET, field->filename);
  tab->currentElement = currentElement; // CFITSIO
#ifdef HAVE_CFITSIO
  tab->currentElement = currentElement;
#endif
  if (wfield) {
    QFSEEK(wfield->file, wfcurpos, SEEK_SET, wfield->filename);
    wfield->tab->currentElement =  wcurrentElement; // CFITSIO
#ifdef HAVE_CFITSIO
    wfield->tab->currentElement =  wcurrentElement;
#endif
  }

/* Median-filter and check suitability of the background map */
Loading