gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 886967f 1/3: Minor updates in macros and confi


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 886967f 1/3: Minor updates in macros and configure
Date: Sun, 9 Oct 2016 14:55:57 +0000 (UTC)

branch: master
commit 886967f576f63fcf7012f4e54a109898c357edf9
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Minor updates in macros and configure
    
    Internally, Autoconf uses a `HAVE_' prefix for macros that keep the results
    of checks, however, we were using `HAS_' and `HAVE_' for this job. To make
    things homogeneous and consistent, they were all changed to the Autoconf
    style (starting with `HAVE_').
    
    In the process, the internal `HAVE_WCSLIBVERSION' has also been changed to
    `HAVE_WCSLIB_VERSION'. Also some further suggestions in the messages at the
    end of steps was added.
    
    User visible library changes:
    
     - `GAL_GNUASTRO_HAVE_PTHREAD_BARRIER' has replaced
       `GAL_GNUASTRO_PTHREAD_BARRIER'.
---
 Makefile.am             |    1 +
 bin/convertt/convertt.c |    2 +-
 bin/convertt/jpeg.c     |    6 +++---
 bin/convertt/ui.c       |    4 ++--
 configure.ac            |   20 ++++++++++++--------
 lib/fits.c              |   10 ++++++++--
 lib/gnuastro.h.in       |    2 +-
 lib/gnuastro/threads.h  |    8 ++++----
 lib/threads.c           |    4 ++--
 9 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 8d93660..6af8680 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -160,6 +160,7 @@ all-local:
         echo;                                                                  
     \
         echo "    make check";                                                 
     \
         echo;                                                                  
     \
+        echo "(Check faster on N threads with 'make check -jN'.)";             
     \
         echo "(The following \"Leaving directory\" notices can be ignored.)";  
     \
         echo 
"==================================================================="; \
         echo 
"==================================================================="; \
diff --git a/bin/convertt/convertt.c b/bin/convertt/convertt.c
index b587ef9..01096bd 100644
--- a/bin/convertt/convertt.c
+++ b/bin/convertt/convertt.c
@@ -403,7 +403,7 @@ convertt(struct converttparams *p)
       break;
     case JPEGFORMAT:
       doubleto8bit(p);
-#ifdef HAS_LIBJPEG
+#ifdef HAVE_LIBJPEG
       savejpeg(p);
 #else
       error(EXIT_FAILURE, 0, "you have asked for a JPEG output, however, "
diff --git a/bin/convertt/jpeg.c b/bin/convertt/jpeg.c
index ca2c3bf..27c2477 100644
--- a/bin/convertt/jpeg.c
+++ b/bin/convertt/jpeg.c
@@ -28,7 +28,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <stdlib.h>
 #include <setjmp.h>
 #include <string.h>
-#ifdef HAS_LIBJPEG
+#ifdef HAVE_LIBJPEG
   #include <jpeglib.h>
 #endif
 
@@ -101,7 +101,7 @@ nameisjpegsuffix(char *name)
 
 
 
-#ifdef HAS_LIBJPEG
+#ifdef HAVE_LIBJPEG
 /*************************************************************
  **************        Read a JPEG image        **************
  *************************************************************/
@@ -395,4 +395,4 @@ savejpeg(struct converttparams *p)
 
   free(jsr);
 }
-#endif  /* HAS_LIBJPEG */
+#endif  /* HAVE_LIBJPEG */
diff --git a/bin/convertt/ui.c b/bin/convertt/ui.c
index ab62f9f..1ba3209 100644
--- a/bin/convertt/ui.c
+++ b/bin/convertt/ui.c
@@ -469,7 +469,7 @@ sanitycheck(struct converttparams *p)
         }
       else if(nameisjpeg(cp->output))
         {
-#ifndef HAS_LIBJPEG
+#ifndef HAVE_LIBJPEG
           error(EXIT_FAILURE, 0, "you have asked for a JPEG output, "
                 "however, when %s was configured libjpeg was not "
                 "available. To write to JPEG files, libjpeg is required. "
@@ -605,7 +605,7 @@ preparearrays(struct converttparams *p)
       /* JPEG: */
       else if ( nameisjpeg(names[i]) )
         {
-#ifndef HAS_LIBJPEG
+#ifndef HAVE_LIBJPEG
           error(EXIT_FAILURE, 0, "you are giving a JPEG input, however, "
                 "when %s was configured libjpeg was not available. To read "
                 "from JPEG files, libjpeg is required. Please install it "
diff --git a/configure.ac b/configure.ac
index f4b9723..d38fae2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,13 +146,13 @@ AC_SEARCH_LIBS([wcspih], [wcs], [],
 # have already been checked. We don't need to add them to the LIBS
 # variable, so we are using AC_CHECK_LIB for these tests.
 AC_CHECK_LIB([wcs], [wcslib_version],
-             [AC_DEFINE([HAVE_WCSLIBVERSION], [1], [Has wcslib_version])],
+             [AC_DEFINE([HAVE_WCSLIB_VERSION], [1], [Has wcslib_version])],
              [], [-lcfitsio -lm])
 AC_CHECK_LIB([pthread], [pthread_barrier_wait], [has_pthread_barrier=1],
              [has_pthread_barrier=0])
-AC_DEFINE_UNQUOTED([GAL_GNUASTRO_PTHREAD_BARRIER], [$has_pthread_barrier],
+AC_DEFINE_UNQUOTED([GAL_GNUASTRO_HAVE_PTHREAD_BARRIER], [$has_pthread_barrier],
                    [System has pthread_barrier])
-AC_SUBST(HAS_PTHREAD_BARRIER, [$has_pthread_barrier])
+AC_SUBST(HAVE_PTHREAD_BARRIER, [$has_pthread_barrier])
 
 
 
@@ -193,7 +193,7 @@ AC_MSG_RESULT([done])
 AC_SEARCH_LIBS([jpeg_stdio_dest], [jpeg],
                [has_libjpeg=yes], [has_libjpeg=no])
 AS_IF([test "x$has_libjpeg" = "xyes"],
-      [AC_DEFINE([HAS_LIBJPEG], [], [Has libjpeg])],
+      [AC_DEFINE([HAVE_LIBJPEG], [], [Has libjpeg])],
       [anywarnings=yes])
 AM_CONDITIONAL([COND_HASLIBJPEG], [test "x$has_libjpeg" = "xyes"])
 
@@ -487,13 +487,12 @@ AS_IF([test x$enable_guide_message = xyes],
   
AS_ECHO([===================================================================])
   
AS_ECHO([===================================================================])
   AS_ECHO(["$PACKAGE_NAME (Gnuastro) $PACKAGE_VERSION is successfully"])
-  AS_ECHO(["configured for this machine. To build it please run:"])
-  AS_ECHO([])
-  AS_ECHO(["    make"])
+  AS_ECHO(["configured for this machine."])
   AS_ECHO([])
   AS_IF([test "x$anywarnings" = xyes],
       [
         AS_ECHO(["Configuration warning(s):"])
+        AS_ECHO([])
         AS_IF([test "x$has_libjpeg" = "xno"],
               [AS_ECHO(["  - libjpeg, could not be linked with in your library 
search path."])
                AS_ECHO(["    If JPEG outputs are desired from ConvertType, it 
will warn"])
@@ -502,11 +501,16 @@ AS_IF([test x$enable_guide_message = xyes],
               [AS_ECHO(["  - GPL GhostScript version 9.10 or later, with the 
executable"])
                AS_ECHO(["    name \`gs', was not found in your PATH 
environment variable."])
                AS_ECHO(["    If PDF outputs are desired from ConvertType, it 
will abort"])
-               AS_ECHO(["    with an EPS output which you can convert to PDF 
by other means."])])
+               AS_ECHO(["    with an EPS output which you can convert to PDF 
by other means."])
+               AS_ECHO([]) ])
         AS_ECHO(["  All checks related to the warning(s) will be skipped."])
         AS_ECHO([])
       ]
      )
+  AS_ECHO(["To build Gnuastro $PACKAGE_VERSION, please run:"])
+  AS_ECHO([])
+  AS_ECHO(["    make"])
+  AS_ECHO([])
   AS_ECHO(["(Build faster on N threads with 'make -jN'.)"])
   AS_ECHO(["(Configure with '--disable-guide-message' for no messages.)"])
   
AS_ECHO([===================================================================])
diff --git a/lib/fits.c b/lib/fits.c
index 55a82f4..c7feb13 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -1445,7 +1445,7 @@ gal_fits_write_keys_version(fitsfile *fptr, struct 
gal_fits_key_ll *headers,
      defined. Sometime in the future were everyone has moved to more
      recent versions of WCSLIB, we can remove this macro and its check
      in configure.ac.*/
-#ifdef HAVE_WCSLIBVERSION
+#ifdef HAVE_WCSLIB_VERSION
   int wcslibvers[3];
   char wcslibversion[20];
   const char *wcslibversion_const;
@@ -1473,14 +1473,20 @@ gal_fits_write_keys_version(fitsfile *fptr, struct 
gal_fits_key_ll *headers,
 
   /* Write all the information: */
   fits_write_date(fptr, &status);
+
+  /* Write the version of CFITSIO */
   fits_update_key(fptr, TSTRING, "CFITSIO", cfitsioversion,
                   "CFITSIO version.", &status);
-#ifdef HAVE_WCSLIBVERSION
+
+  /* Write the WCSLIB version */
+#ifdef HAVE_WCSLIB_VERSION
   wcslibversion_const=wcslib_version(wcslibvers);
   strcpy(wcslibversion, wcslibversion_const);
   fits_update_key(fptr, TSTRING, "WCSLIB", wcslibversion,
                   "WCSLIB version.", &status);
 #endif
+
+  /* Write the Gnuastro version. */
   fits_update_key(fptr, TSTRING, "GNUASTRO", PACKAGE_VERSION,
                   "GNU Astronomy Utilities version.", &status);
   fits_write_comment(fptr, PACKAGE_STRING, &status);
diff --git a/lib/gnuastro.h.in b/lib/gnuastro.h.in
index 15fdc9b..17bd25d 100644
--- a/lib/gnuastro.h.in
+++ b/lib/gnuastro.h.in
@@ -30,7 +30,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 /* Macros. In gnuastro.h.in, the values in `@' --- `@'', will be replaced
    with installation specific values. */
 #define GAL_GNUASTRO_VERSION "@VERSION@"
-#define GAL_GNUASTRO_PTHREAD_BARRIER @HAS_PTHREAD_BARRIER@
+#define GAL_GNUASTRO_HAVE_PTHREAD_BARRIER @HAVE_PTHREAD_BARRIER@
 
 
 
diff --git a/lib/gnuastro/threads.h b/lib/gnuastro/threads.h
index e2bcfc7..42e8bb8 100644
--- a/lib/gnuastro/threads.h
+++ b/lib/gnuastro/threads.h
@@ -29,8 +29,8 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 /* When this header is included within Gnuastro's building process,
    `IN_GNUASTRO_BUILD' is defined. In the build process, installation
-   information (in particular `GAL_GNUASTRO_PTHREAD_BARRIER' that we need
-   below) is kept in `config.h'. When building a user's programs, this
+   information (in particular `GAL_GNUASTRO_HAVE_PTHREAD_BARRIER' that we
+   need below) is kept in `config.h'. When building a user's programs, this
    information is kept in `gnuastro/gnuastro.h'. Note that all `.c' files
    must start with the inclusion of `config.h' and that
    `gnuastro/gnuastro.h' is only created at installation time (not present
@@ -66,7 +66,7 @@ __BEGIN_C_DECLS  /* From C++ preparations */
 /*****************************************************************/
 /*********    Implementation of pthread_barrier    ***************/
 /*****************************************************************/
-#if GAL_GNUASTRO_PTHREAD_BARRIER == 0
+#if GAL_GNUASTRO_HAVE_PTHREAD_BARRIER == 0
 
 /* Integer number of nano-seconds that `pthread_barrier_destroy' should
    wait for a check to see if all barriers have been reached. */
@@ -93,7 +93,7 @@ pthread_barrier_wait(pthread_barrier_t *b);
 int
 pthread_barrier_destroy(pthread_barrier_t *b);
 
-#endif  /* GAL_GNUASTRO_PTHREAD_BARRIER == 0 */
+#endif  /* GAL_GNUASTRO_HAVE_PTHREAD_BARRIER == 0 */
 
 
 
diff --git a/lib/threads.c b/lib/threads.c
index 6abd339..27575fa 100644
--- a/lib/threads.c
+++ b/lib/threads.c
@@ -42,7 +42,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 /* Re-implementation of the example code given in:
 http://blog.albertarmea.com/post/47089939939/using-pthread-barrier-on-mac-os-x
  */
-#if GAL_GNUASTRO_PTHREAD_BARRIER == 0
+#if GAL_GNUASTRO_HAVE_PTHREAD_BARRIER == 0
 
 /* Initialize the barrier structure. A barrier is a high-level way to wait
    until several threads have finished. */
@@ -144,7 +144,7 @@ pthread_barrier_destroy(pthread_barrier_t *b)
   return 0;
 }
 
-#endif  /* GAL_GNUASTRO_PTHREAD_BARRIER == 0 */
+#endif  /* GAL_GNUASTRO_HAVE_PTHREAD_BARRIER == 0 */
 
 
 



reply via email to

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