From 652709d6887c0bfaf227fdd6ec31523f5e9bd99b Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Thu, 7 Apr 2005 17:58:26 +0000 Subject: [PATCH] Improved Portland support: prelinking of C++ templates and whole_archive. * m4/libtool.m4 (_LT_COMPILER_PIC, _LT_LINKER_SHLIBS) [ linux ]: Reinstate formatted whole_archive_flag_spec for PGI compilers. * config/ltmain.m4sh (func_mode_link), m4/libtool.m4 (_LT_LINKER_SHLIBS): New tag prelink_cmds, to be executed before linking a program. (_LT_LANG_CXX_CONFIG) [ linux ]: Use for pgCC. (_LT_COMPILER_C_O): conftest might be nonempty, clean up more thoroughly. --- ChangeLog | 9 +++++++++ config/ltmain.m4sh | 11 +++++++++++ m4/libtool.m4 | 38 +++++++++++++++++++++++++++++++------- 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38dd041b..d6444b84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2005-04-07 Ralf Wildenhues + Improved Portland support: prelinking of C++ templates and whole_archive. + + * m4/libtool.m4 (_LT_COMPILER_PIC, _LT_LINKER_SHLIBS) [ linux ]: + Reinstate formatted whole_archive_flag_spec for PGI compilers. + * config/ltmain.m4sh (func_mode_link), m4/libtool.m4 (_LT_LINKER_SHLIBS): + New tag prelink_cmds, to be executed before linking a program. + (_LT_LANG_CXX_CONFIG) [ linux ]: Use for pgCC. + (_LT_COMPILER_C_O): conftest might be nonempty, clean up more thoroughly. + * tests/testsuite.at (LT_AT_BOOTSTRAP): Temporary fix for testing in-tree libtoolize. diff --git a/config/ltmain.m4sh b/config/ltmain.m4sh index 64c00d05..a188f767 100644 --- a/config/ltmain.m4sh +++ b/config/ltmain.m4sh @@ -5563,6 +5563,17 @@ EOF 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 + eval cmd=\"$cmd\" + IFS="$save_ifs" + func_show_eval "$cmd" 'exit $?' + done + IFS="$save_ifs" + fi wrappers_required=yes case $host in diff --git a/m4/libtool.m4 b/m4/libtool.m4 index eb2446e9..34af5411 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -1504,7 +1504,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], 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], @@ -3139,7 +3139,6 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - _LT_TAGVAR(whole_archive_flag_spec, $1)='' ;; cxx*) # Compaq C++ @@ -3702,10 +3701,10 @@ _LT_EOF tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)= + _LT_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' ;; pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)= + _LT_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' tmp_addflag=' -fpic -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -4501,6 +4500,8 @@ _LT_TAGDECL([], [exclude_expsyms], [1], [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]) @@ -5227,12 +5228,35 @@ if test "$_lt_caught_CXX_error" != yes; then ;; 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' + case `$CC -V` in + *pgCC\ [[1-5]]*) + _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 `find $tpldir -name \*.o | $NL2SP`"' + _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 `find $tpldir -name \*.o | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $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 $convenience $postdep_objects~ + $CC -shared $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 will use weak symbols + _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' + ;; + esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_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' ;; cxx*) # Compaq C++