gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master f8556a9: Building: added check for systems wit


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master f8556a9: Building: added check for systems without OBSFIX in their WCSLIB
Date: Tue, 1 Sep 2020 10:44:19 -0400 (EDT)

branch: master
commit f8556a9ccdb0f6f1f3ffbfe73fc78ac19580bc50
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Building: added check for systems without OBSFIX in their WCSLIB
    
    Until now, we were simply assuming that the host WCSLIB has the 'OBSFIX'
    keyword in the newly added step to run 'wcsfix' on the extracted WCS. But
    it is a relatively recent keyword in WCSLIB that isn't available on some
    systems, causing a crash.
    
    With this commit, a configure-time check has been added and if this macro
    isn't present, then the part that uses it won't be compiled.
---
 configure.ac                      | 8 ++++++++
 doc/gnuastro.texi                 | 4 ++++
 lib/Makefile.am                   | 8 +++++---
 lib/gnuastro-internal/config.h.in | 1 +
 lib/wcs.c                         | 2 ++
 5 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index a04cc50..1b803f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -461,6 +461,14 @@ AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_WCSLIB_MJDREF], 
[$has_wcslib_mjdref],
 AC_SUBST(HAVE_WCSLIB_MJDREF, [$has_wcslib_mjdref])
 
 
+# If the WCS library has the OBSFIX macro.
+AC_CHECK_DECL(OBSFIX, [has_wcslib_obsfix=1],
+              [has_wcslib_obsfix=0], [[#include <wcslib/wcsfix.h>]])
+AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_WCSLIB_OBSFIX], [$has_wcslib_obsfix],
+                   [WCSLIB comes with OBSFIX macro])
+AC_SUBST(HAVE_WCSLIB_OBSFIX, [$has_wcslib_obsfix])
+
+
 # If the pthreads library has 'pthread_barrier_wait'.
 AC_CHECK_LIB([pthread], [pthread_barrier_wait], [has_pthread_barrier=1],
              [has_pthread_barrier=0])
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 4fbff9f..0c70dc9 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -19006,6 +19006,10 @@ This macro has a value of 1 if the host's WCSLIB has 
the @file{wcslib/dis.h} hea
 This macro has a value of 1 if the host's WCSLIB reads and stores the 
@file{MJDREF} FITS header keyword as part of its core @code{wcsprm} structure.
 @end deffn
 
+@deffn Macro GAL_CONFIG_HAVE_WCSLIB_OBSFIX
+This macro has a value of 1 if the host's WCSLIB supports the @code{OBSFIX} 
feature (used by @code{wcsfix} function to parse the input WCS for known 
errors).
+@end deffn
+
 @deffn Macro GAL_CONFIG_HAVE_PTHREAD_BARRIER
 The POSIX threads standard define barriers as an optional requirement.
 Therefore, some operating systems choose to not include it.
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 2c5b7ba..d67a34b 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -140,14 +140,16 @@ gnuastro/config.h: Makefile $(internaldir)/config.h.in
        rm -f $@ $@.tmp
        $(MKDIR_P) gnuastro
        $(SED) -e 's|@VERSION[@]|$(VERSION)|g' \
+              -e 's|@SIZEOF_LONG[@]|$(SIZEOF_LONG)|g' \
               -e 's|@HAVE_LIBGIT2[@]|$(HAVE_LIBGIT2)|g' \
-              -e 's|@HAVE_WCSLIB_VERSION[@]|$(HAVE_WCSLIB_VERSION)|g' \
+              -e 's|@SIZEOF_SIZE_T[@]|$(SIZEOF_SIZE_T)|g' \
               -e 's|@HAVE_WCSLIB_DIS_H[@]|$(HAVE_WCSLIB_DIS_H)|g' \
               -e 's|@HAVE_WCSLIB_MJDREF[@]|$(HAVE_WCSLIB_MJDREF)|g' \
+              -e 's|@HAVE_WCSLIB_OBSFIX[@]|$(HAVE_WCSLIB_OBSFIX)|g' \
+              -e 's|@HAVE_WCSLIB_VERSION[@]|$(HAVE_WCSLIB_VERSION)|g' \
               -e 's|@HAVE_PTHREAD_BARRIER[@]|$(HAVE_PTHREAD_BARRIER)|g' \
-              -e 's|@SIZEOF_LONG[@]|$(SIZEOF_LONG)|g' \
-              -e 's|@SIZEOF_SIZE_T[@]|$(SIZEOF_SIZE_T)|g' \
               -e 's|@RESTRICT_REPLACEMENT[@]|$(RESTRICT_REPLACEMENT)|g' \
+              -e 's|@HAVE_FITS_IS_REENTRANT[@]|$(HAVE_FITS_IS_REENTRANT)|g' \
                $(internaldir)/config.h.in >> $@.tmp
        chmod a-w $@.tmp
        mv $@.tmp $@
diff --git a/lib/gnuastro-internal/config.h.in 
b/lib/gnuastro-internal/config.h.in
index 253b9a2..416e810 100644
--- a/lib/gnuastro-internal/config.h.in
+++ b/lib/gnuastro-internal/config.h.in
@@ -42,6 +42,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #define GAL_CONFIG_HAVE_WCSLIB_VERSION      @HAVE_WCSLIB_VERSION@
 #define GAL_CONFIG_HAVE_WCSLIB_DIS_H        @HAVE_WCSLIB_DIS_H@
 #define GAL_CONFIG_HAVE_WCSLIB_MJDREF       @HAVE_WCSLIB_MJDREF@
+#define GAL_CONFIG_HAVE_WCSLIB_OBSFIX       @HAVE_WCSLIB_MJDREF@
 
 #define GAL_CONFIG_HAVE_PTHREAD_BARRIER     @HAVE_PTHREAD_BARRIER@
 
diff --git a/lib/wcs.c b/lib/wcs.c
index 91ff028..93a1233 100644
--- a/lib/wcs.c
+++ b/lib/wcs.c
@@ -214,9 +214,11 @@ gal_wcs_read_fitsptr(fitsfile *fptr, size_t hstartwcs, 
size_t hendwcs,
               if(fixstatus[DATFIX])
                 error(0, 0, "%s: (warning) wcsfix status for datfix: %d",
                       __func__, fixstatus[DATFIX]);
+#if GAL_CONFIG_HAVE_WCSLIB_OBSFIX
               if(fixstatus[OBSFIX])
                 error(0, 0, "%s: (warning) wcsfix status for obsfix: %d",
                       __func__, fixstatus[OBSFIX]);
+#endif
               if(fixstatus[UNITFIX])
                 error(0, 0, "%s: (warning) wcsfix status for unitfix: %d",
                       __func__, fixstatus[UNITFIX]);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]