bug-libtool
[Top][All Lists]
Advanced

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

Re: Re: libtool assumes that "file" is in /usr/bin


From: Vincent Lefevre
Subject: Re: Re: libtool assumes that "file" is in /usr/bin
Date: Sun, 18 May 2008 13:49:31 +0200
User-agent: Mutt/1.5.17-vl-r21552 (2008-04-09)

On 2008-05-18 11:17:58 +0200, Ralf Wildenhues wrote:
> * Bob Friesenhahn wrote on Sat, May 10, 2008 at 02:39:02AM CEST:
> > File is used to identify the type of object-code produced.  Sometimes  
> > this is the only way to know for sure what came out of the compiler or  
> > linker.
> 
> Shouldn't it be possible to set LD accordingly if 'file' is not present?
> 
> Not that this is a nice (documented) workaround, but it should work just
> fine.

This is more or less what I suggested (LD in general, HPUX_IA64_MODE
for ia64-*-hpux*).

For instance, for Linux, one has:

    case `/usr/bin/file conftest.o` in
    *32-bit*)
      case $host in
        x86_64-*kfreebsd*-gnu)
          LD="${LD-ld} -m elf_i386_fbsd"
          ;;
        x86_64-*linux*)
          LD="${LD-ld} -m elf_i386"
          ;;
        ppc64-*linux*|powerpc64-*linux*)
          LD="${LD-ld} -m elf32ppclinux"
          ;;
        s390x-*linux*)
          LD="${LD-ld} -m elf_s390"
          ;;
        sparc64-*linux*)
          LD="${LD-ld} -m elf32_sparc"
          ;;
      esac
      ;;
    *64-bit*)
      case $host in
        x86_64-*kfreebsd*-gnu)
          LD="${LD-ld} -m elf_x86_64_fbsd"
          ;;
        x86_64-*linux*)
          LD="${LD-ld} -m elf_x86_64"
          ;;
        ppc*-*linux*|powerpc*-*linux*)
          LD="${LD-ld} -m elf64ppc"
          ;;
        s390*-*linux*)
          LD="${LD-ld} -m elf64_s390"
          ;;
        sparc*-*linux*)
          LD="${LD-ld} -m elf64_sparc"
          ;;
      esac
      ;;
    esac

If "file" isn't available, the user gets an error message, but the
build goes on (then it may fail or not, depending on whether a -m
option is needed or not with his platform and variables). In fact,
when building MPFR under Mac OS X, the user may need to add -m64
to CFLAGS; libtool won't detect this automatically (I'm not sure
that it should be fixed).

BTW, a * pattern could be added in order to output a message telling
the user what happened (/usr/bin/file doesn't exist or returned an
unexpected result) and what he could do: set "LD" (or "LDFLAGS", or
"CFLAGS"?) manually if the build fails.

-- 
Vincent Lefèvre <address@hidden> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)




reply via email to

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