commit:     18cb2b5b6b5538b9aa1680181eb36e3c5e7b30c7
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 18 16:42:14 2020 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Dec 18 16:42:14 2020 +0000
URL:        https://gitweb.gentoo.org/proj/eselect.git/commit/?id=18cb2b5b

Prefer realpath in configure check.

* configure.ac (REALPATH, READLINK): Prefer realpath to readlink,
because the former is included with Coreutils since version 8.15.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 ChangeLog    |  5 +++++
 configure.ac | 34 +++++++++++++++++-----------------
 2 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e15e521..90109e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-12-18  Ulrich Müller  <u...@gentoo.org>
+
+       * configure.ac (REALPATH, READLINK): Prefer realpath to readlink,
+       because the former is included with Coreutils since version 8.15.
+
 2020-12-16  Ulrich Müller  <u...@gentoo.org>
 
        * configure.ac: Update version to 1.4.17.

diff --git a/configure.ac b/configure.ac
index 79cb10b..48522e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,25 +34,25 @@ fi
 AC_PATH_PROG(ENV_UPDATE, env-update, /usr/sbin/env-update,
   [$PATH:$prefix/sbin:/usr/sbin])
 
-AC_CHECK_PROGS(READLINK, [greadlink readlink])
-if test x$READLINK != x; then
-    AC_MSG_CHECKING([whether $READLINK supports -f])
-    if $READLINK -f . >/dev/null 2>&1; then
-        AC_MSG_RESULT(yes)
-    else
-        AC_MSG_RESULT(no)
-        READLINK=""
-    fi
-fi
-if test x$READLINK = x; then
-    AC_CHECK_PROGS(REALPATH, realpath)
-fi
-if test x$READLINK != x; then
-    CANONICALISE="$READLINK -f"
-elif test x$REALPATH != x; then
+CANONICALISE=""
+# realpath is included with Coreutils since version 8.15 (2012)
+AC_CHECK_PROGS(REALPATH, [grealpath realpath])
+if test x$REALPATH != x; then
     CANONICALISE="$REALPATH"
 else
-    AC_MSG_ERROR([Either GNU readlink or realpath is required])
+    AC_CHECK_PROGS(READLINK, [greadlink readlink])
+    if test x$READLINK != x; then
+        AC_MSG_CHECKING([whether $READLINK supports -f])
+        if $READLINK -f . >/dev/null 2>&1; then
+            AC_MSG_RESULT(yes)
+            CANONICALISE="$READLINK -f"
+        else
+            AC_MSG_RESULT(no)
+        fi
+    fi
+fi
+if test "x$CANONICALISE" = x; then
+    AC_MSG_ERROR([Either realpath or GNU readlink is required])
 fi
 AC_SUBST(CANONICALISE)
 

Reply via email to