libtool
[Top][All Lists]
Advanced

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

Re: Patch for XL C/C++ and Fortran on Linux


From: Ralf Wildenhues
Subject: Re: Patch for XL C/C++ and Fortran on Linux
Date: Fri, 7 Jul 2006 09:30:27 +0200
User-agent: Mutt/1.5.11-2006-07-05

Hello Roger,

* Roger Ferrer Ibáñez wrote on Fri, Jul 07, 2006 at 08:59:44AM CEST:
> 
> attached to the mail there is a patch against libtool 1.5.22 to make it 
> able to use XL C/C++ and Fortran on Linux.

Thanks for your work on this.

> As I've seen, currently libtool supports these compilers on AIX and 
> Darwin but not on Linux. This results in incorrect flags passed onto the 
> compiler (for instance, "-Wl," is not passed and "-shared" is always 
> assumed to be the "create shared object" flag for Linux compilers). In 
> Linux xlc and xlf use the GNU ld.
> 
> I'm not an expert in libtool and most of the work has involved 
> copy-pasting flags from other compilers in Linux. I assume that the 
> patch is nearer to a dirty hack than to a clean solution to be included 
> in the mainstream.

It doesn't look too bad.  It'd be good to see some test results with it,
though.  For these, you should download libtool-1.5.22 (or use CVS
branch-1-5), apply your changes to the libtool.m4 file in that tree, run
  ./bootstrap
and the usual ./configure && make, then follow the instructions in
README to run the test suite and report failures verbosely.

BTW, what is gxlc/gxlc++, and do they cause $GCC=yes (i.e., do they
define __GNUC__ unconditionally, or maybe just when some flag is or
is not given)?   This corresponds to:
| checking whether we are using the GNU C compiler... yes

> One interesting thing is the fact that xlf by itself is unable to create 
> a shared object but can create PIC objects, so I use LTCC to link a 
> shared object but I don't know how to get the proper "LTCC creation of 
> shared object command" in the script. Now there is a kludgy check. Is 
> using LTCC the correct way or another mechanism must be used?

Hmm.  One safe way would be to simply disable shared libraries for xlf
on GNU/Linux.  Or use $LD.  But I strongly assume the latter to open up
another can of worms ... maybe this way is rather reliable in practice.

> On the other hand, when using CC=gcc CXX=g++ and F77=xlf, "-fPIC" flag 
> "sticks" on the invocation of xlf (it should be -qpic), what I'm doing 
> wrong in this case?

Could you show an example exposing this issue?

Some very minor nits inline.

Cheers,
Ralf

> @@ -5237,6 +5268,21 @@
>          # All Alpha code is PIC.
>          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
>          ;;
> +      gxlc*) # IBM XL C for Linux - gcc compatible
> +        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
> +        _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
> +        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
> +        ;;
> +      xlc*) # IBM XL C for Linux
> +        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
> +        _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
> +        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)=''
> +        ;;
> +      xlf*) # IBM XL Fortran for Linux
> +        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
> +        _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
> +        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)=''
> +        ;;

Since these two cases are identical, you could merge them>
         xlc* | xlf*) # IBM XL C/Fortran for Linux

>        esac
>        ;;
>  
> @@ -5532,6 +5578,8 @@
>      linux*)
>        if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; 
> then
>       tmp_addflag=
> +    tmp_shared_flag=" -shared "

No need for the space after -shared.

> +    tmp_cc='$CC'
>       case $cc_basename,$host_cpu in
>       pgcc*)                          # Portland Group C compiler
>         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for 
> conv in $convenience\"\"; do test  -n \"$conv\" && 
> new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` 
> ${wl}--no-whole-archive'
> @@ -5546,8 +5594,24 @@
>         tmp_addflag=' -i_dynamic -nofor_main' ;;
>       ifc* | ifort*)                  # Intel Fortran compiler
>         tmp_addflag=' -nofor_main' ;;
> +    gxlc*)
> +      ;;
> +    xlc*) # IBM XL C for Linux
> +       tmp_shared_flag=" -qmkshrobj "

Likewise.

> +       ;;
> +    xlf*) # IBM XL Fortran for Linux
> +       # This is a kludge, is there any correct way to get the "shared" flag 
> for LTCC ?
> +       tmp_cc='$LTCC'
> +      case $LTCC in
> +        xlc*)
> +         tmp_shared_flag=" -qmkshrobj "

Likewise.

> +         ;;
> +        *)
> +         ;;

No need for the default match.

> +      esac
> +     ;;
>       esac
> -     _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs 
> $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
> +     _LT_AC_TAGVAR(archive_cmds, 
> $1)="$tmp_cc""$tmp_shared_flag""$tmp_addflag"' $libobjs $deplibs 
> $compiler_flags ${wl}-soname $wl$soname -o $lib'

No need for the "" pairs.

>  
>       if test $supports_anon_versioning = yes; then
>         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > 
> $output_objdir/$libname.ver~




reply via email to

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