📄 ltcf-cxx.sh
字号:
#### This script is meant to be sourced by ltconfig.# $Id: ltcf-cxx.sh,v 1.24 2000/08/10 21:58:04 matz Exp $# ltcf-cxx.sh - Create a C++ compiler specific configuration## Copyright (C) 1996-1999,2000 Free Software Foundation, Inc.# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996## Original C++ support by:# Alexandre Oliva <oliva@lsd.ic.unicamp.br># Ossama Othman <ossama@debian.org># Thomas Thanner <tanner@gmx.de>## This file is free software; you can redistribute it and/or modify it# under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful, but# WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU# General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.## As a special exception to the GNU General Public License, if you# distribute this file as part of a program that contains a# configuration script generated by Autoconf, you may include it under# the same distribution terms that you use for the rest of that program.# Source file extension for C++ test sources.ac_ext=cc# Object file extension for compiled C++ test sources.objext=o# Code to be used in simple compile testslt_simple_compile_test_code="int some_variable = 0;"# Code to be used in simple link testslt_simple_link_test_code='int main(int, char *[]) { return (0); }'# C++ compilerCXX=${CXX-c++}# ltmain only uses $CC for tagged configurations so make sure $CC is set.CC=${CC-"$CXX"}CFLAGS=${CFLAGS-"$CXXFLAGS"}# Allow CC (or CXX) to be a program name with arguments.set dummy $CCcompiler=$2cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`# we are optimistic. (Too optimistic if you ask me, down there we switch it# off again for most platforms ;) (MM)ld_shlibs=yes# Check if we are using GNU gcc (taken/adapted from configure script)# We need to check here since "--with-gcc" is set at configure time,# not ltconfig time!cat > conftest.$ac_ext <<EOF#ifdef __GNUC__ yes;#endifEOFif { ac_try='${CC-c++} -E conftest.$ac_ext'; { (eval echo \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then with_gcc=yes # Set up default GNU C++ configuration # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if eval "`$CC -print-prog-name=ld` --version 2>&1" | \ egrep 'GNU ld' > /dev/null; then with_gnu_ld=yes archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ egrep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'else with_gcc=no with_gnu_ld=no wlarc=fiecho "ltcf-cxx: with_gcc=$with_gcc ; with_gnu_ld=$with_gnu_ld"# In general, the C++ compiler should always link C++ objects.LD="$CC"LDFLAGS="$LDFLAGS"# PORTME: fill in a description of your system's C++ link characteristicscase "$host_os" in aix3*) # FIXME: insert proper C++ library support ld_shlibs=no ;; aix4*) case "$cc_basename" in xlC) # IBM C++ compiler (xlC). Anything older than Visual Age C++ 5.0 probably won't work. archive_cmds='$CC -qmkshrobj $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G -o $lib' archive_expsym_cmds='$CC -qmkshrobj $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G ${wl}-bE:$export_symbols -o $lib' ;; *) if test "$with_gcc" = yes; then # GNU C++ compiler archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G -o $lib' archive_expsym_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G ${wl}-bE:$export_symbols -o $lib' fi ;; esac hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' hardcode_libdir_separator=':' hardcode_direct=unsupported link_all_deplibs=yes ;; chorus*) case "$cc_basename" in *) # FIXME: insert proper C++ library support ld_shlibs=no ;; esac ;; dgux*) case "$cc_basename" in ec++) # FIXME: insert proper C++ library support ld_shlibs=no ;; ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs=no ;; *) # FIXME: insert proper C++ library support ld_shlibs=no ;; esac ;; freebsd*) # FreeBSD uses GNU C++ and GNU ld ;; hpux*) case "$cc_basename" in CC) # FIXME: insert proper C++ library support ld_shlibs=no ;; aCC) case "$host_os" in hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' ;; esac hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_minus_L=yes # Not in the search PATH, but as the default # location of the library. export_dynamic_flag_spec='${wl}-E' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmds='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$with_gcc" = yes && test "$with_gnu_ld" = no ; then # MM: for HP-UX and g++ -fPIC is needed to link pic objects together archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' output_verbose_link_cmds='$CC -shared -fPIC $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' fi if test "$with_gcc" = no ; then # FIXME: insert proper C++ library support ld_shlibs=no fi ;; esac ;; irix5* | irix6*) case "$cc_basename" in CC) # SGI C++ archive_cmds='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' ;; *) if test "$with_gcc" = yes; then if test "$with_gnu_ld" = no; then archive_cmds='$CC -D_LANGUAGE_C_CPLUS_PLUS -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib' fi fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; esac ;; linux*) case "$cc_basename" in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $linker_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $linker_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmds='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest.so 2>&1 | egrep "ld"`; rm -f libconftest.so; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' hardcode_libdir_flag_spec='${wl}--rpath,$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs' ;; cxx) # Compaq C++ archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='-rpath $libdir' hardcode_libdir_separator=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; insure) if test "$with_gcc" = yes; then # Insure++ together with gcc probably means also GNU ld # only -whole-archive isn't supported whole_archive_flag_spec="" # and we can't use -nostdlib, because bloody insure has no way to # output the linkline (-Zvm isn't working as documented), so we don't # know the depending libs. So we hope, insure gets it right anyway. archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -