In order to get pilot-link-0.9.5-pre5 to build shared libs when
building with Sun's WorkShop C compiler, I had to apply the attached
patch to scripts/ltconfig.

The problem is that when testing the C compiler to see whether the
configured "PIC" option works, ltconfig checks to see if any warnings
are generated, and if so, disables building of shared libraries.  The
comments in ltconfig say this is because the C compiler (cc & gcc) on
HP-UX accepts a PIC option--even though it doesn't generate real
position independent code--but issues a warning.  ltconfig thus uses
the presence of any warnings to indicate that PIC isn't supported
and/or doesn't work.  Unfortunately, the Sun C compiler also generates
a warning (the warning is due to the fact that the conftest.c program
use for testing is actually an empty file, and so the Sun compiler
warns about this) even though it has a functional PIC option.  Because
it sees the warning, however, ltconfig disables building of shared
libraries.

Since the comment in ltconfig says the warning check is needed for
HP-UX, I fixed this problem by enclosing the warning check in a test
to see whether ltconfig was running under HP-UX.  Alternate fixes may
be to create a non-empty conftest.c test program (so that the Sun
compiler doesn't complain that the file is empty), and/or include a
newer version of libtool in pilot-link which may already have fixed
this bug(?).

John
*** scripts/ltconfig.orig       Fri Oct 27 18:10:06 2000
--- scripts/ltconfig    Sun Mar  4 17:56:49 2001
***************
*** 549,565 ****
      # Append any warnings to the config.log.
      cat conftest.err 1>&5
  
!     # On HP-UX, both CC and GCC only warn that PIC is supported... then they
!     # create non-PIC objects.  So, if there were any warnings, we assume that
!     # PIC is not supported.
!     if test -s conftest.err; then
!       echo "$ac_t"no 1>&6
!       can_build_shared=no
!       pic_flag=
!     else
        echo "$ac_t"yes 1>&6
        pic_flag=" $pic_flag"
!     fi
    else
      # Append any errors to the config.log.
      cat conftest.err 1>&5
--- 549,570 ----
      # Append any warnings to the config.log.
      cat conftest.err 1>&5
  
!     case "$host_os" in
!     hpux*)
!       # On HP-UX, both CC and GCC only warn that PIC is supported... then they
!       # create non-PIC objects.  So, if there were any warnings, we assume that
!       # PIC is not supported.
!       if test -s conftest.err; then
!         echo "$ac_t"no 1>&6
!         can_build_shared=no
!         pic_flag=
!       fi
!       ;;
!     *)
        echo "$ac_t"yes 1>&6
        pic_flag=" $pic_flag"
!       ;;
!     esac
    else
      # Append any errors to the config.log.
      cat conftest.err 1>&5

Reply via email to