libtool
[Top][All Lists]
Advanced

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

Re: Supporting compilers that write to stderr


From: Scott Pakin
Subject: Re: Supporting compilers that write to stderr
Date: Sun, 27 Jan 2002 16:39:12 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1

On 23JAN2002, Erik Lindahl wrote:

I'm trying to add support for the Intel icc and ifc C and Fortran
compilers under linux,
but both these compilers have the nasty habit of writing the filename
and compile-time
remarks to stderr.

This means that libtool tests for the -static flag, -DPIC/-fpic, etc
fail since they all
interpret anything on stderr as a warning or error.


While it's true that writing to stderr is a nasty habit, I don't
believe that that's what's causing libtool to fail.  From what I can
tell, the problem is caused by libtool not recognizing icc as either
gcc or a vendor compiler.  It therefore sets can_build_shared to "no"
and refuses to build a shared library.

The kludge that I'm currently using is to detect the Intel compiler,
trick libtool into thinking it's running under Solaris -- Sun's
compiler uses similarly named flags to Intel's -- invoke
AM_PROG_LIBTOOL, and reset the host OS:

AC_PROG_CC_INTEL_LINUX
if test "$ac_cv_prog_cc_intel_linux" = yes; then
  true_host_os=$host_os
  host_os=solaris_no_just_kidding
fi
AM_PROG_LIBTOOL
if test "$ac_prog_cc_intel_linux" = yes; then
  host_os=$true_host_os
fi

...where I've defined AC_PROG_CC_INTEL_LINUX as follows:

dnl Determine if the C compiler is likely to be the Intel Linux compiler.
AC_DEFUN(AC_PROG_CC_INTEL_LINUX,
[AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for the Intel Linux C compiler],
  ac_cv_prog_cc_intel_linux,
  [ac_cv_prog_cc_intel_linux=no
   case "$host_os" in
    *linux*)
      test `$CC -V 2>&1 | egrep -c 'Intel.*C.*Compiler'` -gt 0 && 
ac_cv_prog_cc_intel_linux=yes
      ;;
   esac
  ])
if test "$ac_cv_prog_cc_intel_linux" = yes; then
  AC_DEFINE([INTEL_LINUX_CC], ,
    [Define if your C compiler is the Intel compiler for Linux.])
fi
])


So, do you guys have any ideas or opinions about this?

One possible way of doing it could be to scan the stderr output for the
option
we are testing, and only fail the test if there seems to be a report
about a flag.

By scanning for the flag we are testing, or one of the words "option" or
"flag" I'm
pretty sure we should cover everything.


Another way is to generate a wrapper script that filters out whatever
is written to stderr on a "clean" compile+link.  I started writing
some Autoconf code to do this, but abandoned it when I discovered
that the aforementioned kludge was all that was necessary to get icc
working.

I hope this helps,

-- Scott





reply via email to

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