libtool
[Top][All Lists]
Advanced

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

Re: PGI and C++ templates


From: Ralf Wildenhues
Subject: Re: PGI and C++ templates
Date: Tue, 15 Mar 2005 18:19:26 +0100
User-agent: Mutt/1.4.1i

Sorry for the self-reply,

* Ralf Wildenhues wrote on Mon, Mar 14, 2005 at 07:49:00PM CET:
> 
> This is a status update on "libtool/pgi/C++ with templates".

Now here's an improved patch against branch-2-0.  Should work for both
static and shared uninstalled libraries plus programs linked against
them, and seems to also work when relinking is required upon
installation.  It works with the example Markus provided a while ago.

Turns out pgCC is smart enough to recreate all that is needed with the
correct PICness all by itself, so we don't even need to adjust
Template.dir.  Nice compiler work!

What's missing is correct `make clean'ing, which will be addressed later
in reply to Jeff's macro.

Testing would be *great*, as would be reviewing.

Cheers,
Ralf

> ,-- ***experimental*** patch for PGI + templates ---
> 
>       * m4/libtool.m4 (_LT_COMPILER_C_O): The compiler may create
>       subdirectories which we have to remove here.
> 
>       * m4/libtool.m4 (_LT_LINKER_SHLIBS): New TAGDECL $prelink_cmds
>       intended for compilation of template instantiations for program
>       outputs.
>       * m4/libtool.m4 (_LT_LANG_CXX_CONFIG) [ linux ]: Enable template
>       compilation for Portland pgCC in prelink_cmds and old_archive_cmds.
>       * config/ltmain.m4sh (func_mode_link): execute $prelink_cmds if
>       nonempty.


Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.1.2.47
diff -u -r1.1.2.47 ltmain.m4sh
--- config/ltmain.m4sh  12 Mar 2005 08:50:45 -0000      1.1.2.47
+++ config/ltmain.m4sh  15 Mar 2005 16:55:37 -0000
@@ -5530,6 +5530,18 @@
 
       func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
 
+      # template prelinking step
+      if test -n "$prelink_cmds"; then
+       cmds=$prelink_cmds
+       save_ifs="$IFS"; IFS='~'
+       for cmd in $cmds; do
+         IFS="$save_ifs"
+         eval cmd=\"$cmd\"
+         $show "$cmd"
+         $run eval "$cmd"
+         test $? -eq 0 || exit $?
+       done
+      fi
 
       wrappers_required=yes
       case $host in
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.125.2.36
diff -u -r1.125.2.36 libtool.m4
--- m4/libtool.m4       14 Mar 2005 15:03:24 -0000      1.125.2.36
+++ m4/libtool.m4       15 Mar 2005 16:55:37 -0000
@@ -1482,7 +1482,7 @@
    test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
    $RM out/* && rmdir out
    cd ..
-   rmdir conftest
+   $RM -r conftest
    $RM conftest*
 ])
 _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
@@ -3112,7 +3112,7 @@
            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
            _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
            ;;
-         pgCC)
+         pgCC*)
            # Portland Group C++ compiler
            _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
@@ -4468,6 +4468,8 @@
     [Symbols that should not be listed in the preloaded symbols])
 _LT_TAGDECL([], [include_expsyms], [1],
     [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with 
templates])
 dnl FIXME: Not yet implemented
 dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
 dnl    [Compiler flag to generate thread safe objects])
@@ -5191,10 +5193,25 @@
            _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
            _LT_TAGVAR(whole_archive_flag_spec, 
$1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
            ;;
-          pgCC)
+          pgCC*)
             # Portland Group C++ compiler
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs 
$deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-            _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects 
$libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname 
${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+           _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+             rm -rf $tpldir~
+             $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs 
$compile_deplibs~
+             compile_command="$compile_command `ls $tpldir/*.o 2>/dev/null | 
tr '"'\n' ' '"'`"'
+            _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+             rm -rf $tpldir~
+             $CC --prelink_objects --instantiation_dir $tpldir 
$oldobjs$old_deplibs~
+             $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `ls $tpldir/*.o 
2>/dev/null | tr '"'\n' ' '"'`~
+             $RANLIB $oldlib'
+            _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+             rm -rf $tpldir~
+             $CC --prelink_objects --instantiation_dir $tpldir $predep_objects 
$libobjs $deplibs $postdep_objects~
+             $CC -shared $predep_objects $libobjs $deplibs `ls $tpldir/*.o 
2>/dev/null | tr '"'\n' ' '"'` $postdep_objects $compiler_flags ${wl}-soname 
${wl}$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+             rm -rf $tpldir~
+             $CC --prelink_objects --instantiation_dir $tpldir $predep_objects 
$libobjs $deplibs $postdep_objects~
+             $CC -shared $predep_objects $libobjs $deplibs `ls $tpldir/*.o 
2>/dev/null | tr '"'\n' ' '"'` $postdep_objects $compiler_flags ${wl}-soname 
${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 
            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath 
${wl}$libdir'
            _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'




reply via email to

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