gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master f0a4d1e 01/14: In configure, current directory


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master f0a4d1e 01/14: In configure, current directory removed from PATH
Date: Sun, 17 Dec 2017 11:31:17 -0500 (EST)

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

    In configure, current directory removed from PATH
    
    This is a followup of commit eaade0ba09b26fd: "Check for libtool rejects
    Gnuastro's own libtool implementation". There, I had used the last argument
    to AC_CHECK_PROG incorrectly. So following a similar issue that was
    reported by Nicolas Bouché, I am trying to solve the problem more
    elegantly.
    
    The main problem is that the PATH variable on some systems might contain
    the current directory in the form of `./' or `.'. In such cases, if
    Gnuastro's Libtool is already built, it will be found as `.//libtool' or
    `./libtool' respectively.
    
    With this commit, a more fundamental fix to the problem is implemented: to
    correct `PATH' (only for the configure script) so it doesn't look into the
    current directory for any program.
---
 configure.ac | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 455d9eb..f59d04a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,6 +60,22 @@ AC_SUBST(GAL_LT_VERSION)
 
 
 
+# Remove any occurance of `./' or `.' in PATH. The main problem is the
+# `libtool' executable which Gnuastro builds internally in the top build
+# directory. However, we also need to know if the system has libtool or
+# not.
+#
+# The first expression will remove occurance of `./' or `.'. If they are in
+# the middle of the path, then their removal will result in `::' (or
+# possibly more if they are immedately after each other). The second
+# expression will change `::' to `:'. If the removed paths are in the start
+# or end of the string, then an extra `:' will be present. So the third and
+# fourth expressions respectively remove them.
+PATH=$(AS_ECHO([$PATH]) | sed -e 's/\.\/*//g' -e 's/::*/:/g' -e 's/^://' -e 
's/:$//')
+
+
+
+
 # By default we assume no warnings
 anywarnings=no
 
@@ -253,9 +269,11 @@ AC_SUBST(HAVE_LIBGIT2, [$has_libgit2])
 
 
 
-# Check the libtool executable: needed by BuildProgram.
-AC_CHECK_PROG(has_libtool, libtool, [yes], [no], ,
-              ./libtool .//libtool $ac_pwd/libtool)
+# Check the libtool executable on the system. Note that Gnuastro also ships
+# with a version of Libtool. We don't want Gnuastro's Libtool, here we want
+# to see if the system has libtool independent of Gnuastro so BuildProgram
+# can use it later.
+AC_CHECK_PROG(has_libtool, libtool, [yes], [no])
 
 # If Libtool is present, make sure it is GNU Libtool
 AS_IF([test "x$has_libtool" = "xyes"],



reply via email to

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