Subject: [PATCH] libtool: Use 'file' instead of '/usr/bin/file' on GNU systems.

From: [email-masked] (Ludovic Courtès)
Date: Mon, 23 Jun 2014 21:43:05 +0200

Hello,

The patch below changes occurrences of ‘/usr/bin/file’ to just ‘file’.

The impetus is that on systems using GNU Guix, NixOS, GoboLinux, and
others, the ‘file’ command is not available as /usr/bin/file, so it must
instead be taken from $PATH.

(I conservatively left ‘/usr/bin/file’ for more centralized systems such
as BSD, IRIX, etc. where it’s more likely to be a valid command.)

WDYT?

Ludo’.

>From 8b4c022281a7c86c2fa604fc76297ffc1ceb2644 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <[email-masked]>
Date: Mon, 23 Jun 2014 21:36:39 +0200
Subject: [PATCH] libtool: Use 'file' instead of '/usr/bin/file' on GNU
 systems.

* m4/libtool.m4 (_LT_ENABLE_LOCK): Use 'file' instead of '/usr/bin/file'
  on GNU- and Linux-based systems.
---
 m4/libtool.m4 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 320d8b3..6fb67b0 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1312,7 +1312,7 @@ mips64*-*linux*)
   echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     emul=elf
-    case `/usr/bin/file conftest.$ac_objext` in
+    case `file conftest.$ac_objext` in
       *32-bit*)
 	emul="${emul}32"
 	;;
@@ -1320,7 +1320,7 @@ mips64*-*linux*)
 	emul="${emul}64"
 	;;
     esac
-    case `/usr/bin/file conftest.$ac_objext` in
+    case `file conftest.$ac_objext` in
       *MSB*)
 	emul="${emul}btsmip"
 	;;
@@ -1328,7 +1328,7 @@ mips64*-*linux*)
 	emul="${emul}ltsmip"
 	;;
     esac
-    case `/usr/bin/file conftest.$ac_objext` in
+    case `file conftest.$ac_objext` in
       *N32*)
 	emul="${emul}n32"
 	;;
@@ -1348,14 +1348,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # not appear in the list.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.o` in
+    case `file conftest.o` in
       *32-bit*)
 	case $host in
 	  x86_64-*kfreebsd*-gnu)
 	    LD="${LD-ld} -m elf_i386_fbsd"
 	    ;;
 	  x86_64-*linux*)
-	    case `/usr/bin/file conftest.o` in
+	    case `file conftest.o` in
 	      *x86-64*)
 		LD="${LD-ld} -m elf32_x86_64"
 		;;
-- 
1.8.4