summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2017-12-11 19:10:01 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2017-12-11 19:10:01 +0100
commitf0a4d1eec72ae85bf8d4f985864df8e706a18956 (patch)
treed9ccacd29b27fdd54ff2d94e78b426e5040a090e
parent589ca5290f976054ddf3b86919661e915fde0e48 (diff)
downloadgnuastro-f0a4d1eec72ae.tar.gz
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.
-rw-r--r--configure.ac24
1 files 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"],