libtool and gcj

2002-02-23 Thread Anthony Green

I've been using a hacked version of libtool to build shared libraries of
java code in with gcj.  The one problem I had to work around is that
libtool insists on adding "-DPIC" to the compilation line.  gcj's -D is
different from gcc and g++.  My hack is to simply strip out the "-D".
However - now my tree contains a mix of java and c code and I need to
use -DPIC with gcc.

How do we change libtool to only use -DPIC where appropriate?

Thanks,

AG



___
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool



Re: libtool and gcj

2002-03-01 Thread Anthony Green

On Fri, 2002-03-01 at 00:19, Per Bothner wrote:
> Of course the real fix involves fixing ltmain.sh, but that goes
> beyond my ability to peer into the bowels of libtool.

The other bad thing I should mention is the test to see if gcj can use
both -c and -o.  This test is failing for some unknown reason, causing
bad problems for my project.   I don't think libtool should even perform
this test.  gcj is known to always handle -c and -o.

I'm using the cvs libtool.  I'd really appreciate it if somebody who
understands the current implementation could fix these problems.

Thanks!

AG



___
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool



Re: libtool and gcj

2002-03-01 Thread Anthony Green

On Fri, 2002-03-01 at 07:15, Albert Chin wrote:
> What version of gcj are you using?

The trunk of the GCC tree (and the 3.1 branch).

AG



___
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool



Re: libtool and gcj (patch)

2002-03-01 Thread Anthony Green

On Fri, 2002-03-01 at 12:19, Per Bothner wrote:
> This patch to libtool.m4 fixes two problems:
> 
> (1) Set ac_compile so the proper compiler and flags are
> used when running tests.

Strangely, configure reports that the -c -o test still fails although
I'm not seeing the build failure I attributed to the problem anymore.

> (2) Does not set -DPIC is the TAG is GCJ.

This works perfectly.  Thanks!

AG




___
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool



No static libraries?

2002-03-01 Thread Anthony Green

I think this is my final real problem with the CVS version of libtool
(once Per's patch is applied).

Libtool isn't building static libraries for my project, although it does
try to install them (and fail).

Configuring with --disable-static is my work around.

Any ideas?

AG





___
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool



Re: libtool and gcj (patch)

2002-03-01 Thread Anthony Green

On Fri, 2002-03-01 at 12:19, Per Bothner wrote:
> (1) Set ac_compile so the proper compiler and flags are
> used when running tests.

I take what I previously said about this part of the patch back.  It
doesn't appear to fix anything for me.  Is there some other change which
is missing?

AG



___
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool



Re: No static libraries?

2002-03-01 Thread Anthony Green

On Fri, 2002-03-01 at 15:32, Albert Chin wrote:

> You need to be more specific.
>   1. Does it fail while configuration your application to detect
>  that static libraries can be built?

I don't know what you mean exactly.

>   2. For what compiler (C, C++, GCJ)?

GCJ (however, some of the libraries contain C as well).

> A snippet of the ./configure run would help too.

The fact that the gcj -c -o test results in "yes" doesn't mean
anything.  I've hacked libtool to always produce that result for gcj.

Thanks for your help!

AG



checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for mawk... no
checking for gawk... gawk
checking whether make sets ${MAKE}... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for executable suffix... 
checking for object suffix... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking dependency style of gcc... gcc3
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking for a sed that does not truncate output... 
checking whether ln -s works... yes
checking how to recognise dependant libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for dlfcn.h... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ranlib... ranlib
checking for strip... strip
checking if gcc static flag  works... yes
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
appending configuration tag "GCJ" to libtool
checking if gcj supports -fno-rtti -fno-exceptions... (cached) yes
checking for gcj option to produce PIC... -fPIC
checking if gcj PIC flag -fPIC works... no
checking if gcj supports -c -o file.o... yes
checking whether the gcj linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking for gcj... gcj
checking for gcjh... gcjh
checking dependency style of g++... gcc3
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for libraries needed for readline... -lreadline -ltermcap
configure: creating ./config.status
config.status: creating Makefile
config.status: creating pgsql-jdbc/Makefile
config.status: creating gnu.regexp/Makefile
config.status: creating cup/Makefile
config.status: creating BCEL/Makefile
config.status: creating xerces/Makefile
config.status: creating jakarta-regexp/Makefile
config.status: creating jakarta-oro/Makefile
config.status: creating jakarta-log4j/Makefile
config.status: creating xalan/Makefile
config.status: creating jakarta-servletapi/Makefile
config.status: creating jakarta-tomcat/Makefile
config.status: creating gnu.readline/Makefile
config.status: creating rhino/Makefile
config.status: creating bsf/Makefile
config.status: cre

gcj libtool patches so far

2002-03-01 Thread Anthony Green


This combination of Per's -DPIC change and Albert's -c -o change
appears to work best.  I've appended it below.  The only problem left
is the static library problem previously reported.

Thanks!

AG

2001-03-01  Anthony Green  <[EMAIL PROTECTED]>

* libtool.m4 (AC_LIBTOOL_PROG_CC_C_O): Albert Chin's gcj fix.
  (AC_LIBTOOL_PROG_COMPILER_PIC): Per Bothner's change for not
  using -DPIC with gcj.


Index: libtool.m4
===
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.248
diff -u -p -c -r1.248 libtool.m4
*** libtool.m4  7 Feb 2002 19:54:36 -   1.248
--- libtool.m4  2 Mar 2002 01:13:23 -
*** AC_CACHE_CHECK([if $compiler supports -c
*** 832,839 
   CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"],
  [$1],[CXX],[save_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS="$CXXFLAGS -o out/conftest2.$ac_objext"],
! [$1],[GCJ],[save_GCJFLAGS="$GCJFLAGS"
!  GCJFLAGS="$GCJFLAGS -o out/conftest2.$ac_objext"])
 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
  
 # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
--- 832,839 
   CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"],
  [$1],[CXX],[save_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS="$CXXFLAGS -o out/conftest2.$ac_objext"],
! [$1],[GCJ],[save_GCJFLAGS="$CFLAGS"
!  CFLAGS="$GCJFLAGS -o out/conftest2.$ac_objext"])
 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
  
 # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
*** AC_CACHE_CHECK([if $compiler supports -c
*** 856,862 
 fi
 ifelse([$1],[],[CFLAGS="$save_CFLAGS"],
  [$1],[CXX],[CXXFLAGS="$save_CXXFLAGS"],
! [$1],[GCJ],[GCJFLAGS="$save_GCJFLAGS"])
 chmod u+w .
 $rm conftest* out/*
 rmdir out
--- 856,862 
 fi
 ifelse([$1],[],[CFLAGS="$save_CFLAGS"],
  [$1],[CXX],[CXXFLAGS="$save_CXXFLAGS"],
! [$1],[GCJ],[CFLAGS="$save_CFLAGS"])
 chmod u+w .
 $rm conftest* out/*
 rmdir out
*** objext=o
*** 3155,3161 
  _LT_AC_TAGVAR(objext, $1)=$objext
  
  # Code to be used in simple compile tests
! lt_simple_compile_test_code="class foo {}"
  
  # Code to be used in simple link tests
  lt_simple_link_test_code='public class conftest { public static void main(String[] 
argv) {}; }'
--- 3155,3161 
  _LT_AC_TAGVAR(objext, $1)=$objext
  
  # Code to be used in simple compile tests
! lt_simple_compile_test_code="class foo {};"
  
  # Code to be used in simple link tests
  lt_simple_link_test_code='public class conftest { public static void main(String[] 
argv) {}; }'
*** AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_co
*** 4294,4300 
  if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag 
$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
  _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
! [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -DPIC], [],
  [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
   "" | " "*) ;;
   *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" 
$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
--- 4294,4300 
  if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag 
$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
  _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
! [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[GCJ],[],[ -DPIC])], [],
  [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
   "" | " "*) ;;
   *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" 
$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
*** case "$host_os" in
*** 4308,4314 
  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
  ;;
*)
! _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, 
$1) -DPIC"
  ;;
  esac
  ])
--- 4308,4314 
  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
  ;;
*)
! _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, 
$1)ifelse([$1],[GCJ],[],[ -DPIC])"
  ;;
  esac
  ])


___
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool