| 1 | #### This script is meant to be sourced by ltconfig.
|
|---|
| 2 |
|
|---|
| 3 | # ltcf-cxx.sh - Create a C++ compiler specific configuration
|
|---|
| 4 | #
|
|---|
| 5 | # Copyright (C) 1996-1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
|---|
| 6 | # Originally by Gordon Matzigkeit <[email protected]>, 1996
|
|---|
| 7 | #
|
|---|
| 8 | # Original C++ support by:Gary V. Vaughan <[email protected]>
|
|---|
| 9 | # Alexandre Oliva <[email protected]>
|
|---|
| 10 | # Ossama Othman <[email protected]>
|
|---|
| 11 | # Thomas Thanner <[email protected]>
|
|---|
| 12 | #
|
|---|
| 13 | # This file is free software; you can redistribute it and/or modify it
|
|---|
| 14 | # under the terms of the GNU General Public License as published by
|
|---|
| 15 | # the Free Software Foundation; either version 2 of the License, or
|
|---|
| 16 | # (at your option) any later version.
|
|---|
| 17 | #
|
|---|
| 18 | # This program is distributed in the hope that it will be useful, but
|
|---|
| 19 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 21 | # General Public License for more details.
|
|---|
| 22 | #
|
|---|
| 23 | # You should have received a copy of the GNU General Public License
|
|---|
| 24 | # along with this program; if not, write to the Free Software
|
|---|
| 25 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|---|
| 26 | #
|
|---|
| 27 | # As a special exception to the GNU General Public License, if you
|
|---|
| 28 | # distribute this file as part of a program that contains a
|
|---|
| 29 | # configuration script generated by Autoconf, you may include it under
|
|---|
| 30 | # the same distribution terms that you use for the rest of that program.
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | # Source file extension for C++ test sources.
|
|---|
| 34 | ac_ext=cc
|
|---|
| 35 |
|
|---|
| 36 | # Object file extension for compiled C++ test sources.
|
|---|
| 37 | objext=o
|
|---|
| 38 |
|
|---|
| 39 | # Code to be used in simple compile tests
|
|---|
| 40 | lt_simple_compile_test_code="int some_variable = 0;"
|
|---|
| 41 |
|
|---|
| 42 | # Code to be used in simple link tests
|
|---|
| 43 | lt_simple_link_test_code='int main(int, char *[]) { return (0); }'
|
|---|
| 44 |
|
|---|
| 45 | # C++ compiler
|
|---|
| 46 | CXX=${CXX-c++}
|
|---|
| 47 |
|
|---|
| 48 | # ltmain only uses $CC for tagged configurations so make sure $CC is set.
|
|---|
| 49 | CC=${CC-"$CXX"}
|
|---|
| 50 | CFLAGS=${CFLAGS-"$CXXFLAGS"}
|
|---|
| 51 |
|
|---|
| 52 | # Allow CC to be a program name with arguments.
|
|---|
| 53 | set dummy $CC
|
|---|
| 54 | compiler=$2
|
|---|
| 55 | cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
|
|---|
| 56 |
|
|---|
| 57 | # Check if we are using GNU gcc (taken/adapted from configure script)
|
|---|
| 58 | # We need to check here since "--with-gcc" is set at configure time,
|
|---|
| 59 | # not ltconfig time!
|
|---|
| 60 | cat > conftest.$ac_ext <<EOF
|
|---|
| 61 | #ifdef __GNUC__
|
|---|
| 62 | yes;
|
|---|
| 63 | #endif
|
|---|
| 64 | EOF
|
|---|
| 65 | if { 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
|
|---|
| 66 | with_gcc=yes
|
|---|
| 67 |
|
|---|
| 68 | # Set up default GNU C++ configuration
|
|---|
| 69 |
|
|---|
| 70 | # Check if GNU C++ uses GNU ld as the underlying linker, since the
|
|---|
| 71 | # archiving commands below assume that GNU ld is being used. The
|
|---|
| 72 | # assumption here is that the linker is going to be the same as that
|
|---|
| 73 | # used by the C compiler. For the purposes of GCC, this is ok, but
|
|---|
| 74 | # if someone uses g++ along with a non-GNU C compiler that doesn't
|
|---|
| 75 | # use GNU ld, we may lose. This is ok for the toolchain tree, since
|
|---|
| 76 | # the only users of ltcf-cxx.sh are libstdc++-v3 and libjava,
|
|---|
| 77 | # anyway, and those use both gcc and g++, so the settings are bound
|
|---|
| 78 | # to be the same.
|
|---|
| 79 |
|
|---|
| 80 | if test "$with_gnu_ld" = yes; then
|
|---|
| 81 | archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
|---|
| 82 | 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'
|
|---|
| 83 |
|
|---|
| 84 | hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
|
|---|
| 85 | export_dynamic_flag_spec='${wl}--export-dynamic'
|
|---|
| 86 |
|
|---|
| 87 | # If archive_cmds runs LD, not CC, wlarc should be empty
|
|---|
| 88 | # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
|
|---|
| 89 | # investigate it a little bit more. (MM)
|
|---|
| 90 | wlarc='${wl}'
|
|---|
| 91 |
|
|---|
| 92 | # ancient GNU ld didn't support --whole-archive et. al.
|
|---|
| 93 | if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
|
|---|
| 94 | egrep 'no-whole-archive' > /dev/null; then
|
|---|
| 95 | whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
|
|---|
| 96 | else
|
|---|
| 97 | whole_archive_flag_spec=
|
|---|
| 98 | fi
|
|---|
| 99 | else
|
|---|
| 100 | wlarc=
|
|---|
| 101 |
|
|---|
| 102 | # A generic and very simple default shared library creation
|
|---|
| 103 | # command for GNU C++ for the case where it uses the native
|
|---|
| 104 | # linker, instead of GNU ld. If possible, this setting should
|
|---|
| 105 | # overridden to take advantage of the native linker features on
|
|---|
| 106 | # the platform it is being used on.
|
|---|
| 107 | archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
|
|---|
| 108 | fi
|
|---|
| 109 |
|
|---|
| 110 | # Commands to make compiler produce verbose output that lists
|
|---|
| 111 | # what "hidden" libraries, object files and flags are used when
|
|---|
| 112 | # linking a shared library.
|
|---|
| 113 | output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
|
|---|
| 114 |
|
|---|
| 115 | else
|
|---|
| 116 | with_gcc=no
|
|---|
| 117 | wlarc=
|
|---|
| 118 | fi
|
|---|
| 119 |
|
|---|
| 120 | # PORTME: fill in a description of your system's C++ link characteristics
|
|---|
| 121 | case $host_os in
|
|---|
| 122 | aix3*)
|
|---|
| 123 | # FIXME: insert proper C++ library support
|
|---|
| 124 | ld_shlibs=no
|
|---|
| 125 | ;;
|
|---|
| 126 | aix4* | aix5*)
|
|---|
| 127 | archive_cmds=''
|
|---|
| 128 | hardcode_direct=yes
|
|---|
| 129 | hardcode_libdir_separator=':'
|
|---|
|
|---|