ac-archive-maintainers
[Top][All Lists]
Advanced

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

Libtoolizing vendor specific compiler switches


From: Ludovic Courtès
Subject: Libtoolizing vendor specific compiler switches
Date: Thu, 9 Sep 2004 11:53:39 +0200
User-agent: Mutt/1.5.4i [Guile enabled]

Hi,

The following macro is a workaround against the current behavior of
Libtool.  Basically, Libtool removes any compiler/linker switch that it
is not aware of when invoking the compiler/linker.  As an example, using
aCC on HP-UX, the following Libtool invocation:

  ./libtool --mode=link aCC -AA -o ...

yields to `aCC' being invoked _without_ the `-AA' switch (actually,
unknown switches don't seem to be removed in `compile' mode).  However,
if `-Xcompiler -AA' is passed to Libtool, then `-AA' is actually passed as
is to the linker.  Note that `-Xcompiler' is to be used in this case,
_not_ `-Xlinker' since this would make Libtool try to pass `-AA' to the
underlying linker (via `-Wl,-AA' or some such) while `-AA' is recognized
and need by aCC at link time but is _not_ a linker switch (yes, this is
a bit complicated ;-)).

Unfortunately, at configure-time, it is still required to use
non-Libtool-prefixed compiler switches because `AC_COMPILE_IFELSE' and
the likes directly use the compiler, not Libtool.

dnl @synopsis AC_LIBTOOLIZE_CFLAGS(COMPILER-FLAGS-VAR)
dnl
dnl Change the contents of variable COMPILER-FLAGS-VAR so that they are Libtool
dnl friendly, ie. prefix each of them with `-Xcompiler' so that Libtool doesn't
dnl remove them.
dnl
dnl @version 20040907
dnl @author  Ludovic Courtès <address@hidden>
AC_DEFUN([AC_LIBTOOLIZE_CFLAGS],
  [ac_libtoolize_ldflags_temp=""
   for i in $$1
   do
     ac_libtoolize_ldflags_temp="$ac_libtoolize_ldflags_temp -Xcompiler $i"
   done
   $1="$ac_libtoolize_ldflags_temp"])dnl

Thanks,
Ludovic.




reply via email to

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