gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 10ada86: Installation: new --without-libNAME o


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 10ada86: Installation: new --without-libNAME options in configure script
Date: Fri, 26 Jul 2019 15:34:51 -0400 (EDT)

branch: master
commit 10ada86dddab35ced29c592943c72437419c5b48
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Installation: new --without-libNAME options in configure script
    
    Until now, if an optional dependency library was present on a computer,
    Gnuastro would link with it anyway. But its an optional dependency, and
    some users may not want to link with it when they don't use it. In
    particular, the library may have run-time problems, causing all Gnuastro
    programs to crash. This actually happened. It is thus beneficial build
    Gnuastro without the problematic library, but there was no way to do this
    without modifying the code.
    
    With this commit, we now have the `--without-libNAME' options to disable
    optional libraries at configure time and let Gnuastro build without them.
    
    This was suggested by David Valls-Gabaud.
---
 NEWS              |  6 ++++++
 configure.ac      | 53 +++++++++++++++++++++++++++++++++++------------------
 doc/gnuastro.texi | 40 ++++++++++++++++++++++++++++++++--------
 3 files changed, 73 insertions(+), 26 deletions(-)

diff --git a/NEWS b/NEWS
index 9756ca1..3f1247c 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,12 @@ See the end of the file for license conditions.
 
 ** New features
 
+  Installation:
+   - With the the following options at configure time, its possible to
+     build Gnuastro without the optional libraries (even if they are
+     present on the host system): `--without-libjpeg', `--without-libtiff',
+     `--without-libgit2'.
+
   All programs:
    - When an array is memory-mapped to non-volatile space (like the
      HDD/SSD), a warning/message is printed that shows the file name and
diff --git a/configure.ac b/configure.ac
index 4ea240a..8b7f17c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -340,14 +340,19 @@ AS_IF([test "x$LIBWCS" = x],
       [LDADD="$LTLIBWCS $LDADD"; LIBS="$LIBWCS $LIBS"])
 
 
-AC_LIB_HAVE_LINKFLAGS([jpeg], [], [
+AC_ARG_WITH([libjpeg],
+            [AS_HELP_STRING([--without-libjpeg],
+                            [disable support for libjpeg])],
+            [], [with_libjpeg=yes])
+AS_IF([test "x$with_libjpeg" != xno],
+      [ AC_LIB_HAVE_LINKFLAGS([jpeg], [], [
 #include <stdio.h>
 #include <stdlib.h>
 #include <jpeglib.h>
 void junk(void) {
   struct jpeg_decompress_struct cinfo;
   jpeg_create_decompress(&cinfo);
-}  ])
+} ]) ])
 AS_IF([test "x$LIBJPEG" = x],
       [missing_optional_lib=yes; has_libjpeg=no; anywarnings=yes],
       [LDADD="$LTLIBJPEG $LDADD"; LIBS="$LIBJPEG $LIBS"])
@@ -359,14 +364,18 @@ AM_CONDITIONAL([COND_HASLIBJPEG], [test "x$has_libjpeg" = 
"xyes"])
 # the LZMA library. But if libtiff hasn't been linked with it and its
 # present, there is no problem, the linker will just pass over it. So we
 # don't need to stop the build if this fails.
-AC_LIB_HAVE_LINKFLAGS([lzma], [], [#include <lzma.h>])
+AC_ARG_WITH([libtiff],
+            [AS_HELP_STRING([--without-libtiff],
+                            [disable support for libtiff])],
+            [], [with_libtiff=yes])
+AS_IF([test "x$with_libtiff" != xno],
+      [ AC_LIB_HAVE_LINKFLAGS([lzma], [], [#include <lzma.h>])
+        AC_LIB_HAVE_LINKFLAGS([tiff], [], [
+#include <tiffio.h>
+void junk(void) {TIFF *tif=TIFFOpen("junk", "r");} ])
+      ])
 AS_IF([test "x$LIBLZMA" = x], [],
       [LDADD="$LTLIBLZMA $LDADD"; LIBS="$LIBLZMA $LIBS"])
-
-AC_LIB_HAVE_LINKFLAGS([tiff], [], [
-#include <tiffio.h>
-void junk(void) {TIFF *tif=TIFFOpen("junk", "r");}
-])
 AS_IF([test "x$LIBTIFF" = x],
       [missing_optional_lib=yes; has_libtiff=no; anywarnings=yes],
       [LDADD="$LTLIBTIFF $LDADD"; LIBS="$LIBTIFF $LIBS"])
@@ -375,10 +384,15 @@ AM_CONDITIONAL([COND_HASLIBTIFF], [test "x$has_libtiff" = 
"xyes"])
 
 # Check libgit2. Note that very old versions of libgit2 don't have the
 # `git_libgit2_init' function.
-AC_LIB_HAVE_LINKFLAGS([git2], [], [
+AC_ARG_WITH([libgit2],
+            [AS_HELP_STRING([--without-libgit2],
+                            [disable support for libgit2])],
+            [], [with_libgit2=yes])
+AS_IF([test "x$with_libgit2" != xno],
+      [ AC_LIB_HAVE_LINKFLAGS([git2], [], [
 #include <git2.h>
-void junk(void) {git_libgit2_init();}
-])
+void junk(void) {git_libgit2_init();} ])
+      ])
 AS_IF([test "x$LIBGIT2" = x],
       [missing_optional_lib=yes; has_libgit2=0],
       [LDADD="$LTLIBGIT2 $LDADD"; LIBS="$LIBGIT2 $LIBS"])
@@ -966,23 +980,26 @@ AS_IF([test x$enable_guide_message = xyes],
         AS_IF([test "x$has_libjpeg" = "xno"],
               [dependency_notice=yes
                AS_ECHO(["  - libjpeg (http://ijg.org), could not be linked 
with in your library"])
-               AS_ECHO(["    search path. If JPEG inputs/outputs are 
requested, the respective"])
-               AS_ECHO(["    tool will inform you and abort with an error."])
+               AS_ECHO(["    search path, or is manually disabled. If JPEG 
inputs/outputs are"])
+               AS_ECHO(["    requested, the respective tool will inform you 
and abort with an"])
+               AS_ECHO(["    error."])
                AS_ECHO([]) ])
 
         AS_IF([test "x$has_libtiff" = "xno"],
               [dependency_notice=yes
                AS_ECHO(["  - libtiff (http://libtiff.maptools.org), could not 
be linked with in"])
-               AS_ECHO(["    your library search path. If TIFF inputs/outputs 
are requested, the"])
-               AS_ECHO(["    respective tool will inform you and abort with an 
error."])
+               AS_ECHO(["    your library search path, or is manually 
disabled. If TIFF"])
+               AS_ECHO(["    inputs/outputs are requested, the respective tool 
will inform"])
+               AS_ECHO(["    you and abort with an error."])
                AS_ECHO([]) ])
 
         AS_IF([test "x$has_libgit2" = "x0"],
               [dependency_notice=yes
                AS_ECHO(["  - libgit2 (https://libgit2.org), could not be 
linked with in your"])
-               AS_ECHO(["    library search path. When present, Git's describe 
output will be"])
-               AS_ECHO(["    stored in the output files if Gnuastro's programs 
were called"])
-               AS_ECHO(["    within a Gitversion controlled directory to help 
in reproducibility."])
+               AS_ECHO(["    library search path, or is manually disabled. 
When present, Git's"])
+               AS_ECHO(["    describe output will be stored in the output 
files if Gnuastro's"])
+               AS_ECHO(["    programs were called within a Gitversion 
controlled directory to"])
+               AS_ECHO(["    help in reproducibility."])
                AS_ECHO([]) ])
 
         AS_IF([test "x$usable_libtool" = "xno"],
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index fcf482f..32a2768 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -5345,7 +5345,7 @@ to learn more about libraries.
 
 @item libgit2
 @cindex Git
-@cindex libgit2
+@pindex libgit2
 @cindex Version control systems
 Git is one of the most common version control systems (see @ref{Version
 controlled source}). When @file{libgit2} is present, and Gnuastro's
@@ -6312,6 +6312,13 @@ Do not build or install the program named 
@file{progname}. This is
 very similar to the @option{--enable-progname}, but will build and
 install all the other programs except this one.
 
+@cartouche
+@noindent
+@strong{Note:} If some programs are enabled and some are disabled, it
+is equivalent to simply enabling those that were enabled. Listing the
+disabled programs is redundant.
+@end cartouche
+
 @item --enable-gnulibcheck
 @cindex GNU C library
 @cindex Gnulib: GNU Portability Library
@@ -6344,15 +6351,32 @@ programs). For people who are not yet fully accustomed 
to this build
 system, these guidelines can be very useful and encouraging. However, if
 you find those messages annoying, use this option.
 
+@item --without-libgit2
+@cindex Git
+@pindex libgit2
+@cindex Version control systems
+Build Gnuastro without libgit2 (for including Git commit hashes in output
+files), see @ref{Optional dependencies}. libgit2 is an optional dependency,
+with this option, Gnuastro will ignore any possibly existing libgit2 that
+may already be on the system.
 
-@end vtable
+@item --without-libjpeg
+@pindex libjpeg
+@cindex JPEG format
+Build Gnuastro without libjpeg (for reading/writing to JPEG files), see
+@ref{Optional dependencies}. libjpeg is an optional dependency, with this
+option, Gnuastro will ignore any possibly existing libjpeg that may already
+be on the system.
 
-@cartouche
-@noindent
-@strong{Note:} If some programs are enabled and some are disabled, it
-is equivalent to simply enabling those that were enabled. Listing the
-disabled programs is redundant.
-@end cartouche
+@item --without-libtiff
+@pindex libtiff
+@cindex TIFF format
+Build Gnuastro without libtiff (for reading/writing to TIFF files), see
+@ref{Optional dependencies}. libtiff is an optional dependency, with this
+option, Gnuastro will ignore any possibly existing libtiff that may already
+be on the system.
+
+@end vtable
 
 The tests of some programs might depend on the outputs of the tests of
 other programs. For example MakeProfiles is one the first programs to be



reply via email to

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