[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 1fdca6d: Checks for GNU Libtool, allowing libt
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 1fdca6d: Checks for GNU Libtool, allowing libtool or glibtool |
Date: |
Tue, 31 Oct 2017 13:41:43 -0400 (EDT) |
branch: master
commit 1fdca6d9decf52dd817b57edc6f5524ad8f9f0b8
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Checks for GNU Libtool, allowing libtool or glibtool
Until now, Gnuastro assumed that the `libtool' executable is GNU Libtool,
so it would use its options and etc. But thanks to Alan Lefor, I found out
that on Mac systems, the `libtool' executable may not be GNU Libtool, but
Mac's own implementation of it. Mac's implementation doesn't support long
options or the special behaviors we need in BuildProgram. I then found out
that people commonly call GNU Libtool on a Mac with `glibtool'.
With this commit, at configure time, it will be checked if the `libtool'
executable is GNU or not. If it isn't, or if there isn't any `libtool'
executable at all, it will check for `glibtool'. If `glibtool' also isn't
present, then In any case, BuildProgram will use the proper executable
name.
---
bin/buildprog/buildprog.c | 4 +--
configure.ac | 64 +++++++++++++++++++++++++++++++-------------
doc/announce-acknowledge.txt | 1 +
doc/gnuastro.texi | 35 +++++++++++++++++-------
tests/Makefile.am | 6 ++---
tests/buildprog/simpleio.sh | 5 +++-
6 files changed, 80 insertions(+), 35 deletions(-)
diff --git a/bin/buildprog/buildprog.c b/bin/buildprog/buildprog.c
index f35236d..a0fc85c 100644
--- a/bin/buildprog/buildprog.c
+++ b/bin/buildprog/buildprog.c
@@ -96,8 +96,8 @@ buildprog(struct buildprogparams *p)
else asprintf(&fullla, "%s/libgnuastro.la", LIBDIR);
/* Put the command to run into a string. */
- asprintf(&command, "libtool %s --mode=link gcc %s %s %s %s %s %s %s "
- "-I%s %s -o %s",
+ asprintf(&command, "%s %s --mode=link gcc %s %s %s %s %s %s %s "
+ "-I%s %s -o %s", GAL_CONFIG_GNULIBTOOL_EXEC,
p->cp.quiet ? "--quiet" : "",
warning ? warning : "",
p->debug ? "-g" : "",
diff --git a/configure.ac b/configure.ac
index 898770b..9bb1e44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -233,11 +233,30 @@ AC_SUBST(HAVE_LIBGIT2, [$has_libgit2])
-# Check libtool: need by BuildProgram.
+# Check the libtool executable: needed by BuildProgram.
AC_CHECK_PROG(has_libtool, libtool, [yes], [no])
-AS_IF([test "x$has_libtool" = "xno"], [anywarnings=yes])
-AM_CONDITIONAL([COND_HASLIBTOOL], [test "x$has_libtool" = "xyes"])
+# If Libtool is present, make sure it is GNU Libtool
+AS_IF([test "x$has_libtool" = "xyes"],
+ [ AC_MSG_CHECKING(if libtool executable is GNU)
+ AS_IF( libtool --version 2> /dev/null | grep GNU 2>&1 > /dev/null,
+ [has_gnulibtool=yes], [has_gnulibtool=no])
+ AC_MSG_RESULT( $has_gnulibtool )],
+ [ has_gnulibtool=no ])
+
+# When either the `libtool' executable isn't GNU or it doesn't exist, then
+# look for `glibtool'.
+AS_IF([test "x$has_gnulibtool" = "xyes"],
+ [ gnulibtool_exec=libtool ],
+ [ AC_CHECK_PROG(has_glibtool, glibtool, [yes], [no])
+ AS_IF( [test "x$has_glibtool" = "xyes"],
+ [has_gnulibtool=yes; gnulibtool_exec=glibtool],
+ [has_gnulibtool=no; anywarnings=yes] ) ])
+
+# Write the test results in the Makefiles and `config.h'.
+AM_CONDITIONAL([COND_HASGNULIBTOOL], [test "x$has_gnulibtool" = "xyes"])
+AC_DEFINE_UNQUOTED([GAL_CONFIG_GNULIBTOOL_EXEC], ["$gnulibtool_exec"],
+ [The executable to call GNU Libtool])
@@ -574,16 +593,11 @@ AC_ARG_ENABLE([warp],
-# If we had a "ano" variable to be "true" if there was a no, then we
-# would get. So we see we have no need for such a variable.
-#
-# if [ ano == true ]; then
-# every "notset" becomes yes. if [ ayes == true ]; then
-# elif [ ayes == true ]; then every "notset" becomes "no"
-# every "notset" becomes no. ==> else
-# else every "notset" becomes "yes"
-# every "notset" becomes yes. fi
-# fi
+
+# If we had a "ayes" variable to be "true" if there was a `yes'. So any
+# program that is not explicitly requested must be ignored and vice versa
+# (if no programs were explicly requested, the enable all that weren't
+# disabled).
AS_IF([test $ayes = true ],
[
AS_IF([test $enable_arithmetic = notset], [enable_arithmetic=no])
@@ -626,6 +640,14 @@ AS_IF([test $ayes = true ],
+# BuildProgram depends on the presence of GNU Libtool, if it isn't present,
+# then don't build it.
+AS_IF([test "x$has_gnulibtool" = "xno"], [enable_buildprog=no])
+
+
+
+
+
# Make the enable_package values available for the Makefile:
AM_CONDITIONAL([COND_ARITHMETIC], [test $enable_arithmetic = yes])
AM_CONDITIONAL([COND_BUILDPROG], [test $enable_buildprog = yes])
@@ -731,13 +753,17 @@ AS_IF([test x$enable_guide_message = xyes],
AS_ECHO([" output files if Gnuastro's programs were called
within a Git"])
AS_ECHO([" version controlled directory to help in
reproducibility."])
AS_ECHO([]) ])
- AS_IF([test "x$has_libtool" = "xno"],
+ AS_IF([test "x$has_gnulibtool" = "xno"],
[AS_ECHO([" - GNU Libtool, could not be found in your search
path."])
- AS_ECHO([" Gnuastro's BuildProgram uses libtool to link your
source code"])
- AS_ECHO([" with the various libraries (Gnuastro's
dependencies). Note that"])
- AS_ECHO([" not having libtool in your search path will not
harm Gnuastro's"])
- AS_ECHO([" building and installation process. This warning
is only for"])
- AS_ECHO([" using BuildProgram after Gnuastro has been built
and installed."])
+ AS_ECHO([" Gnuastro's BuildProgram uses GNU libtool to link
your source code"])
+ AS_ECHO([" with the various libraries (Gnuastro's
dependencies). Therefore"])
+ AS_ECHO([" BuildProgarm will not be built or installed.
Please note that"])
+ AS_ECHO([" not having GNU libtool in your search path will
not harm the rest"])
+ AS_ECHO([" of Gnuastro's building and installation. Gnuastro
has its own"])
+ AS_ECHO([" internal implementation of GNU Libtool to build
its self. This"])
+ AS_ECHO([" warning is only to let you know that BuildProgram
will not be"])
+ AS_ECHO([" built and installed. The executable names
searched were \`libtool'"])
+ AS_ECHO([" and \`glibtool'."])
AS_ECHO([]) ])
AS_IF([test "x$has_ghostscript" = "xno"],
[AS_ECHO([" - GPL GhostScript version 9.10 or later, with the
executable"])
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index ac2b000..a2f766a 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -4,4 +4,5 @@ acknowledged in the next release.
Leindert Boogaard
Aurélien Jarno
Takashi Ichikawa
+Alan Lefor
David Valls-Gabaud
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index aaf68d0..0b6068d 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -2607,18 +2607,25 @@ take effect.
@cindex GNU Libtool
GNU Libtool is a program to simplify managing of the libraries to build an
executable (program). It is used by @ref{BuildProgram} in Gnuastro to help
-you easily link to all the necessary libraries that Gnuastro's library
-depends on. Libtool is a low-level program that is probably already present
-on your system (and in your operating system package manager). However, if
-you want to install it's latest version from source, please visit its
+you when you are writing your own C code. It will enable easy linking to
+all the necessary libraries that Gnuastro's library depends on. If GNU
+Libtool isn't present on your system, then BuildProgram won't be built or
+installed. The configure script will look for GNU Libtool through the
+following executable names in your search path @command{libtool} (if it is
+GNU's implementation) or @command{glibtool}.
+
+Libtool is a low-level program that is probably already present on your
+system (and in your operating system package manager). However, if you want
+to install it's latest version from source, please visit its
@url{https://www.gnu.org/software/libtool/, webpage}.
-Gnuastro's tarball ships with Libtool and it is extensively used during its
-building and installing. Therefore, you can easily build Gnuastro even if
-you don't have Libtool installed on your system. However, this internal
-Libtool does not get installed. Hence, if you want to use the installed
-BuildProgram to compile and link your own source code later, you need to
-have Libtool on your system (independent of Gnuastro).
+Gnuastro's tarball ships with an internal implementation of GNU Libtool and
+it is extensively used while Gnuastro is being built and
+installed. Therefore, you can still build Gnuastro even if you don't have
+GNU Libtool installed on your system. However, this internal Libtool does
+not get installed. Hence, if you want to use BuildProgram to compile and
+link your own C source code later, you need to have GNU Libtool available
+on your system (independent of Gnuastro).
@item libgit2
@cindex Git
@@ -17257,6 +17264,14 @@ Gnuastro's prerequisite libraries change or other
libraries are added, you
don't have to worry, you can just run BuildProgram and internal linking
will be done correctly.
address@hidden
address@hidden
address@hidden requires GNU Libtool:} BuildProgram depends on GNU
+Libtool, therefore if GNU Libtool isn't available at Gnuastro's configure
+time, BuildProgram will not be built or installed. Please see @ref{Optional
+dependencies} for more information.
address@hidden cartouche
+
@menu
* Invoking astbuildprog:: Options and examples for using this program.
@end menu
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 195ed90..18ab4e4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -48,8 +48,8 @@ endif
if COND_HASLIBJPEG
MAYBE_HASLIBJPEG = "yes"
endif
-if COND_HASLIBTOOL
- MAYBE_HASLIBTOOL = "yes"
+if COND_HASGNULIBTOOL
+ MAYBE_HASGNULIBTOOL = "yes"
endif
if COND_ARITHMETIC
MAYBE_ARITHMETIC_TESTS = arithmetic/snimage.sh arithmetic/onlynumbers.sh \
@@ -188,7 +188,7 @@ AM_TESTS_ENVIRONMENT = \
export mkdir_p="$(MKDIR_P)"; \
export topsrc=$(top_srcdir); \
export haslibjpeg=$(MAYBE_HASLIBJPEG); \
-export haslibtool=$(MAYBE_HASLIBTOOL); \
+export hasgnulibtool=$(MAYBE_HASGNULIBTOOL); \
export hasghostscript=$(MAYBE_HASGHOSTSCRIPT);
diff --git a/tests/buildprog/simpleio.sh b/tests/buildprog/simpleio.sh
index 6fa9e83..499a56d 100755
--- a/tests/buildprog/simpleio.sh
+++ b/tests/buildprog/simpleio.sh
@@ -49,7 +49,10 @@ source=$topsrc/tests/$prog/simpleio.c
if [ ! -f $execname ]; then echo "$execname not created."; exit 77; fi
if [ ! -f $img ]; then echo "$img does not exist."; exit 77; fi
if [ ! -f $source ]; then echo "$source does not exist."; exit 77; fi
-if [ "x$haslibtool" != "xyes" ];then echo "libtool not present."; exit 77;fi
+if [ "x$hasgnulibtool" != "xyes" ];then
+ echo "GNU libtool not present.";
+ exit 77;
+fi
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 1fdca6d: Checks for GNU Libtool, allowing libtool or glibtool,
Mohammad Akhlaghi <=