gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 1ac084b4: Configure script: Gnulib checks igno


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 1ac084b4: Configure script: Gnulib checks ignore high-level check results
Date: Wed, 29 Dec 2021 11:26:11 -0500 (EST)

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

    Configure script: Gnulib checks ignore high-level check results
    
    Until now, Gnulib was simply inheriting its build environment after
    possible modifications by the higher-level (mostly astronomical software)
    checks. This would cause conflicts on some systems where the low-level
    software have the same names as the high-level ones (like WCSLIB, which
    shares the name 'libwcs' with the system's "wide character string"
    library!).
    
    In Gnuastro, the configure-time checks of the GNU Portability Library
    (Gnulib) are placed after the checks for the astronoimcal
    dependencies. This is because Gnulib is very low-level and has MANY checks!
    But Gnulib is designed to find ways to resolve those checks, so they will
    never crash. But if a user is missing an astronomical dependency, its best
    that the script crashes earlier.
    
    With this commit, the problem has been addressed by temporarily removing
    the edits to the environment before Gnulib, so it can check the low-level
    system settings without trouble.
    
    This bug was reported by Martin Guerrero Roncel.
---
 NEWS                         |  7 +++++--
 THANKS                       |  1 +
 configure.ac                 | 49 ++++++++++++++++++++++++++++++++++++++++++--
 doc/announce-acknowledge.txt |  1 +
 4 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index 2c5a1c0c..f5294767 100644
--- a/NEWS
+++ b/NEWS
@@ -147,8 +147,11 @@ See the end of the file for license conditions.
   bug #61698: Mean operator of Arithmetic (for stacking many images) not
               returning NaN for blank regions when input is integer. This
               fix also resolves the same problem in the 'sum', 'std',
-              'median' and all 'sigclip-*' operators). This bug was
-              reported by Zohre Ghaffari.
+              'median' and all 'sigclip-*' operators); reported by Zohre
+              Ghaffari.
+  bug #61740: WCSLIB conflicting with system's wide-character string (WCS)
+              library in Gnulib checks for some systems; reported by Martin
+              Guerrero Roncel.
 
 
 
diff --git a/THANKS b/THANKS
index 78ce059e..4fe23d60 100644
--- a/THANKS
+++ b/THANKS
@@ -52,6 +52,7 @@ support in Gnuastro. The list is ordered alphabetically (by 
family name).
     Zohreh Ghaffari                      zoh.ghaffari@gmail.com
     Thérèse Godefroy                     godef.th@free.fr
     Giulia Golini                        giulia.golini@gmail.com
+    Martin Guerrero Roncel               mar@iaa.es
     Madusha Gunawardhana                 gunawardhana@strw.leidenuniv.nl
     Bruno Haible                         bruno@clisp.org
     Stephen Hamer                        stephen.hamer@univ-lyon1.fr
diff --git a/configure.ac b/configure.ac
index 6ea559d9..6756725b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -499,6 +499,22 @@ AS_IF([test "x$enable_shared" = "xno"],
 # _all_ the libraries, because they may add elements to 'LIBS'/'LDADD' that
 # causes possibly different versions of the libraries to be read.
 
+
+# Set a new 'LDFLAGS' variable to use in these checks. The reason is that
+# 'LDFLAGS' is placed in the compile command _before_ the library (e.g.,
+# 'libwcs'). However, 'LDADD' (that we have been actively setting above!)
+# is placed _after_ the library in the compile command! As a result, when
+# 'LDADD' includes a '-L/path/to/library', it will only be seen after the
+# library (and therefore will be useless!).
+#
+# This is only necessary during the checking of the libraries at configure
+# time (here) because of the peculiar features of 'AC_LIB_HAVE_LINKFLAGS'
+# (which may use '-l' or '-L' depending on the situtation, which is very
+# good during checks.).
+orig_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $LDADD"
+
+
 # GSL's 'gsl_interp_steffen' isn't a function. So we'll need to use
 # 'AC_LINK_IFELSE'. However, AC_LINK_IFELSE doesn't use 'LDADD', so we'll
 # have to temporarily add 'LDADD' to LIBS, then set it back to the
@@ -525,7 +541,7 @@ AC_SUBST(HAVE_FITS_IS_REENTRANT, [$has_fits_is_reentrant])
 
 # If the WCS library has the 'wcslib_version' function.
 AC_CHECK_LIB([wcs], [wcslib_version], [has_wcslib_version=1],
-             [has_wcslib_version=0], [-lcfitsio -lm])
+             [has_wcslib_version=0; anywarnings=yes], [-lcfitsio -lm])
 AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_WCSLIB_VERSION], [$has_wcslib_version],
                    [WCSLIB comes with wcslib_version])
 AC_SUBST(HAVE_WCSLIB_VERSION, [$has_wcslib_version])
@@ -555,6 +571,7 @@ 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 WCS library has the 'wcsccs' function.
 AC_CHECK_LIB([wcs], [wcsccs], [has_wcslib_wcsccs=1],
              [has_wcslib_wcsccs=0; anywarnings=yes], [-lcfitsio -lm])
@@ -562,6 +579,7 @@ AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_WCSLIB_WCSCCS], 
[$has_wcslib_wcsccs],
                    [WCSLIB comes with wcsccs])
 AC_SUBST(HAVE_WCSLIB_WCSCCS, [$has_wcslib_wcsccs])
 
+
 # If the pthreads library has 'pthread_barrier_wait'.
 AC_CHECK_LIB([pthread], [pthread_barrier_wait], [has_pthread_barrier=1],
              [has_pthread_barrier=0])
@@ -570,6 +588,12 @@ AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_PTHREAD_BARRIER], 
[$has_pthread_barrier],
 AC_SUBST(HAVE_PTHREAD_BARRIER, [$has_pthread_barrier])
 
 
+# Reset LDFLAGS (see the comments above 'orig_LDFLAGS'). This SHOULD BE
+# PLACED AFTER ALL LIBRARIES ARE CHECKED.
+LDFLAGS="$orig_LDFLAGS"
+# ---------------------------------End of library checks
+
+
 
 
 
@@ -768,8 +792,18 @@ AS_IF([test "x$missing_mandatory" = "xyes"],
 
 
 
-# Gnulib checks:
+# Gnulib checks (which are many!). We are doing these after the main
+# Gnuastro dependencies so the configure script crashes early if the
+# mandatory dependencies aren't present. However, the Gnulib checks are
+# very low-level, and the changes in envornment that we made above (in
+# particular 'LIBS') can cause conflicts with Gnulib's checks (in
+# particular with WCSLIB, because on some systems, WCSLIB's library name:
+# 'libwcs' can cause conflicts with the standard wide-character-string
+# library: 'libwcs').
+new_LIBS="$LIBS"
+LIBS="$orig_LIBS"
 gl_INIT
+LIBS="$new_LIBS"
 
 
 
@@ -1124,6 +1158,17 @@ AS_IF([test x$enable_guide_message = xyes],
                AS_ECHO(["    can slow them down."])
                AS_ECHO([]) ])
 
+        AS_IF([test "x$has_wcslib_version" = "x0"],
+              [dependency_notice=yes
+               AS_ECHO(["  - WCSLIB 
(https://www.atnf.csiro.au/people/mcalabre/WCS) version"])
+               AS_ECHO(["    on this system doesn't report its own version 
(through the "])
+               AS_ECHO(["    function 'wcslib_version'). Therefore Gnuastro 
can't report "])
+               AS_ECHO(["    the version of WCSLIB in its outputs (which is 
just metadata, "])
+               AS_ECHO(["    it won't affect the operation of any of 
Gnuastro's programs). "])
+               AS_ECHO(["    This function was introduced in WCSLIB version 
5.0 (released "])
+               AS_ECHO(["    in April 2015)."])
+               AS_ECHO([]) ])
+
         AS_IF([test "x$has_wcslib_dis_h" = "x0"],
               [dependency_notice=yes
                AS_ECHO(["  - WCSLIB 
(https://www.atnf.csiro.au/people/mcalabre/WCS) version"])
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 45a9b2dc..de85911d 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -7,6 +7,7 @@ Alessandro Ederoclite
 Sepideh Eskandarlou
 Juan Antonio Fernández Ontiveros
 Zohreh Ghaffari
+Martin Guerrero Roncel
 Zahra Hosseini
 Raúl Infante-Sainz
 Alejandro Lumbreras Calle



reply via email to

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