ltcf-cxx.sh 36.2 KB
Newer Older
bkoz's avatar
 
bkoz committed
1 2 3 4
#### This script is meant to be sourced by ltconfig.

# ltcf-cxx.sh - Create a C++ compiler specific configuration
#
5
# Copyright (C) 1996-1999, 2000, 2001, 2003 Free Software Foundation, Inc.
bkoz's avatar
 
bkoz committed
6 7
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
8
# Original C++ support by:Gary V. Vaughan <gvv@techie.com>
bkoz's avatar
 
bkoz committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
#    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 tests
lt_simple_compile_test_code="int some_variable = 0;"

# Code to be used in simple link tests
lt_simple_link_test_code='int main(int, char *[]) { return (0); }'

# C++ compiler
CXX=${CXX-c++}

# ltmain only uses $CC for tagged configurations so make sure $CC is set.
CC=${CC-"$CXX"}
CFLAGS=${CFLAGS-"$CXXFLAGS"}

# Allow CC to be a program name with arguments.
set dummy $CC
compiler=$2
cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`

# 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;
#endif
EOF
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
  with_gcc=yes

  # Set up default GNU C++ configuration

  # Check if GNU C++ uses GNU ld as the underlying linker, since the
71 72 73 74 75 76 77 78 79 80
  # archiving commands below assume that GNU ld is being used.  The
  # assumption here is that the linker is going to be the same as that
  # used by the C compiler.  For the purposes of GCC, this is ok, but
  # if someone uses g++ along with a non-GNU C compiler that doesn't
  # use GNU ld, we may lose.  This is ok for the toolchain tree, since
  # the only users of ltcf-cxx.sh are libstdc++-v3 and libjava,
  # anyway, and those use both gcc and g++, so the settings are bound
  # to be the same.

  if test "$with_gnu_ld" = yes; then
81 82
    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'
bkoz's avatar
 
bkoz committed
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112

    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
    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.
113
  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
bkoz's avatar
 
bkoz committed
114 115 116 117 118 119 120

else
  with_gcc=no
  wlarc=
fi

# PORTME: fill in a description of your system's C++ link characteristics
121
case $host_os in
bkoz's avatar
 
bkoz committed
122 123 124 125
  aix3*)
    # FIXME: insert proper C++ library support
    ld_shlibs=no
    ;;
dje's avatar
dje committed
126
  aix4* | aix5*)
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
    archive_cmds=''
    hardcode_direct=yes
    hardcode_libdir_separator=':'
    link_all_deplibs=yes
    # When large executables or shared objects are built, AIX ld can
    # have problems creating the table of contents.  If linking a library
    # or program results in "error TOC overflow" add -mminimal-toc to
    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
    if test "$with_gcc" = yes; then
      case $host_os in aix4.[012]|aix4.[012].*)
      # We only want to do this on AIX 4.2 and lower, the check
      # below for broken collect2 doesn't work under 4.3+
        collect2name=`${CC} -print-prog-name=collect2`
        if test -f "$collect2name" && \
	   strings "$collect2name" | grep resolve_lib_name >/dev/null
        then
	  # We have reworked collect2
	  hardcode_direct=yes
        else
	  # We have old collect2
	  hardcode_direct=unsupported
	  # It fails to find uninstalled libraries when the uninstalled
	  # path is not listed in the libpath.  Setting hardcode_minus_L
	  # to unsupported forces relinking
	  hardcode_minus_L=yes
	  hardcode_libdir_flag_spec='-L$libdir'
	  hardcode_libdir_separator=
        fi
      esac
      shared_flag='-shared'
    else
      # not using gcc
      if test "$host_cpu" = ia64; then
        shared_flag='${wl}-G'
      else
        shared_flag='${wl}-bM:SRE'
      fi
    fi

    if test "$host_cpu" = ia64; then
      # On IA64, the linker does run time linking by default, so we don't
      # have to do anything special.
      aix_use_runtimelinking=no
aoliva's avatar
aoliva committed
171 172 173 174
      if test $with_gnu_ld = no; then
        exp_sym_flag='-Bexport'
        no_entry_flag=""
      fi
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
    else
      # Test if we are trying to use run time linking, or normal AIX style linking.
      # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
      aix_use_runtimelinking=no
      for ld_flag in $LDFLAGS; do
        if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
          aix_use_runtimelinking=yes
          break
        fi
      done
      exp_sym_flag='-bexport'
      no_entry_flag='-bnoentry'
    fi
    # It seems that -bexpall does not export symbols beginning with
    # underscore (_), so it is better to generate a list of symbols to export.
190
    always_export_symbols=yes
191 192 193 194 195 196
    if test "$aix_use_runtimelinking" = yes; then
      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
      allow_undefined_flag=' -Wl,-G'
      archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}-brtl \${wl}$exp_sym_flag:\$export_symbols"
     else
      if test "$host_cpu" = ia64; then
aoliva's avatar
aoliva committed
197 198 199 200 201
        if test $with_gnu_ld = no; then
          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
          allow_undefined_flag="-z nodefs"
          archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
        fi
202 203 204 205
      else
        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
        # Warning - without using the other run time loading flags, -berok will
        #           link without error, but may produce a broken library.
206 207
        no_undefined_flag=' ${wl}-bnoerok'
        allow_undefined_flag=' ${wl}-berok'
208 209 210 211 212 213 214 215 216
        # -bexpall does not export symbols beginning with underscore (_)
        always_export_symbols=yes
        # Exported symbols can be pulled into shared objects from archives
        whole_archive_flag_spec=' '
        build_libtool_need_lc=yes
        # This is similar to how AIX traditionally builds it's shared libraries.
        archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
      fi
    fi
bkoz's avatar
 
bkoz committed
217 218
    ;;
  chorus*)
219
    case $cc_basename in
bkoz's avatar
 
bkoz committed
220 221 222 223
      *)
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
224
    esac
bkoz's avatar
 
bkoz committed
225 226
    ;;
  dgux*)
227
    case $cc_basename in
bkoz's avatar
 
bkoz committed
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
      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
    ;;
243 244
  freebsd[12]*)
    # C++ shared libraries reported to be fairly broken before switch to ELF
245
    ld_shlibs=no
bkoz's avatar
 
bkoz committed
246
    ;;
247 248 249 250 251
  freebsd*)
    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
    # conventions
    ld_shlibs=yes
    ;;
aoliva's avatar
aoliva committed
252 253
  gnu*)
    ;;
bkoz's avatar
 
bkoz committed
254
  hpux*)
255
    if test $with_gnu_ld = no; then
256 257 258 259 260 261 262 263
      case "$host_cpu" in
	ia64*)
	  hardcode_libdir_flag_spec='-L$libdir'
	  hardcode_shlibpath_var=no ;;
	*)
	  hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' ;;
      esac
      hardcode_direct=yes
264 265 266
      hardcode_libdir_separator=:
      export_dynamic_flag_spec='${wl}-E'
    fi
267 268 269 270
    hardcode_minus_L=yes # Not in the search PATH, but as the default
			 # location of the library.

    case $cc_basename in
bkoz's avatar
 
bkoz committed
271 272 273 274 275
      CC)
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
      aCC)
276
	case $host_os in
277 278
	hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_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 $compiler_flags' ;;
bkoz's avatar
 
bkoz committed
279 280 281 282 283 284 285 286 287
	esac
        # 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.
288
        output_verbose_link_cmd='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'
bkoz's avatar
 
bkoz committed
289 290
        ;;
      *)
291
        if test $with_gcc = yes; then
292 293
	  if test $with_gnu_ld = no; then
	    case "$host_os" in
294
	    hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
295 296 297 298 299 300 301 302
	    *)
	      case "$host_cpu" in
		ia64*)
		  archive_cmds='$LD -b +h $soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' ;;
		*)
		  archive_cmds='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
	      esac
	      ;;
303 304
	    esac
	  fi
305 306 307 308
	else
	  # FIXME: insert proper C++ library support
          ld_shlibs=no
	fi
bkoz's avatar
 
bkoz committed
309 310 311 312
        ;;
    esac
    ;;
  irix5* | irix6*)
313
    case $cc_basename in
bkoz's avatar
 
bkoz committed
314 315 316
      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'
317 318 319 320 321 322 323

	# Archives containing C++ object files must be created using
	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
	# necessary to make sure instantiated templates are included
	# in the archive.
	old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
	;;
bkoz's avatar
 
bkoz committed
324 325 326
      *)
        if test "$with_gcc" = yes; then
          if test "$with_gnu_ld" = no; then
327
            archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
bkoz's avatar
 
bkoz committed
328
          else
329
            archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
bkoz's avatar
 
bkoz committed
330 331 332 333 334 335 336 337 338
          fi
        fi
        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
        hardcode_libdir_separator=:
        link_all_deplibs=yes
        ;;
    esac
    ;;
  linux*)
339
    case $cc_basename in
bkoz's avatar
 
bkoz committed
340 341 342 343 344 345
      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.
346 347
        archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_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 $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
bkoz's avatar
 
bkoz committed
348 349 350 351 352 353 354 355 356

        # 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.
357
        output_verbose_link_cmd='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'
bkoz's avatar
 
bkoz committed
358 359 360 361 362 363 364 365 366 367

        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++
368 369
        archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
        archive_expsym_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
bkoz's avatar
 
bkoz committed
370 371 372 373 374 375 376 377 378 379 380 381 382

        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.
383
        output_verbose_link_cmd='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'
bkoz's avatar
 
bkoz committed
384 385 386 387 388 389 390 391 392 393 394 395
        ;;
    esac
    ;;
  lynxos*)
    # FIXME: insert proper C++ library support
    ld_shlibs=no
    ;;
  m88k*)
    # FIXME: insert proper C++ library support
    ld_shlibs=no
    ;;
  mvs*)
396
    case $cc_basename in
bkoz's avatar
 
bkoz committed
397 398 399 400 401 402 403 404
      cxx)
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
      *)
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
405
    esac
bkoz's avatar
 
bkoz committed
406 407
    ;;
  netbsd*)
408
    # NetBSD uses g++ - do we need to do anything?
bkoz's avatar
 
bkoz committed
409 410
    ;;
  osf3*)
411
    case $cc_basename in
bkoz's avatar
 
bkoz committed
412 413 414 415 416 417
      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.
418
        archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
bkoz's avatar
 
bkoz committed
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434

        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
        hardcode_libdir_separator=:

	# 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'

        ;;
      RCC)
        # Rational C++ 2.4.1
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
      cxx)
        allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
435
        archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
bkoz's avatar
 
bkoz committed
436 437 438 439 440 441 442 443 444 445 446 447

        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$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.
448
        output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "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'
bkoz's avatar
 
bkoz committed
449 450
        ;;
      *)
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
	if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
	  allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
	  archive_cmds='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'

	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$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.
	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
    else
          # FIXME: insert proper C++ library support
          ld_shlibs=no
    fi
bkoz's avatar
 
bkoz committed
466 467 468 469
        ;;
    esac
    ;;
  osf4* | osf5*)
470
    case $cc_basename in
bkoz's avatar
 
bkoz committed
471 472 473 474 475 476
      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.
477
        archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
bkoz's avatar
 
bkoz committed
478 479 480 481 482 483 484 485 486 487 488 489 490 491

        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
        hardcode_libdir_separator=:

	# Archives containing C++ object files must be created using
	# the KAI C++ compiler.
        old_archive_cmds='$CC -o $oldlib $oldobjs'
        ;;
      RCC)
        # Rational C++ 2.4.1
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
      cxx)
492 493
        allow_undefined_flag=' -expect_unresolved \*'
        archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
494 495 496 497
	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done~
	  echo "-hidden">> $lib.exp~
	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry $objdir/so_locations -o $lib~
	  $rm $lib.exp'
498 499

        hardcode_libdir_flag_spec='-rpath $libdir'
bkoz's avatar
 
bkoz committed
500 501 502 503 504 505 506 507 508 509
        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.
510
        output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "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'
bkoz's avatar
 
bkoz committed
511 512
        ;;
      *)
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527
	if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
	  allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
	  archive_cmds='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
	  
	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$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.
	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
    else
	  # FIXME: insert proper C++ library support
	  ld_shlibs=no
    fi
bkoz's avatar
 
bkoz committed
528 529 530 531 532 533 534 535
        ;;
    esac
    ;;
  psos*)
    # FIXME: insert proper C++ library support
    ld_shlibs=no
    ;;
  sco*)
536
    case $cc_basename in
bkoz's avatar
 
bkoz committed
537 538 539 540 541 542 543 544 545 546 547
      CC)
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
      *)
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
    esac
    ;;
  sunos4*)
548
    case $cc_basename in
bkoz's avatar
 
bkoz committed
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565
      CC)
        # Sun C++ 4.x
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
      lcc)
        # Lucid
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
      *)
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
    esac
    ;;
  solaris*)
566
    case $cc_basename in
bkoz's avatar
 
bkoz committed
567 568
      CC)
	# Sun C++ 4.2, 5.x and Centerline C++
569
        no_undefined_flag=' -zdefs'
570
        archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
bkoz's avatar
 
bkoz committed
571
        archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
572
        $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
bkoz's avatar
 
bkoz committed
573 574 575

        hardcode_libdir_flag_spec='-R$libdir'
        hardcode_shlibpath_var=no
576
        case $host_os in
bkoz's avatar
 
bkoz committed
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595
          solaris2.[0-5] | solaris2.[0-5].*) ;;
          *)
            # The C++ compiler is used as linker so we must use $wl
            # flag to pass the commands to the underlying system
            # linker.
            # Supported since Solaris 2.6 (maybe 2.5.1?)
            whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
            ;;
        esac
        link_all_deplibs=yes

        # 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.
596
        output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep "\-R|\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
bkoz's avatar
 
bkoz committed
597 598 599 600 601 602 603 604 605

	# Archives containing C++ object files must be created using
	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
        # necessary to make sure instantiated templates are included
        # in the archive.
        old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
        ;;
      gcx)
        # Green Hills C++ Compiler
606
        archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
bkoz's avatar
 
bkoz committed
607 608 609 610 611 612 613

        # The C++ compiler must be used to create the archive.
        old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
        ;;
      *)
        # GNU C++ compiler with Solaris linker
        if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
614
	  no_undefined_flag=' ${wl}-z ${wl}defs'
bkoz's avatar
 
bkoz committed
615
          if $CC --version | egrep -v '^2\.7' > /dev/null; then
616
            archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
bkoz's avatar
 
bkoz committed
617
            archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
618
		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
bkoz's avatar
 
bkoz committed
619 620 621 622

            # Commands to make compiler produce verbose output that lists
            # what "hidden" libraries, object files and flags are used when
            # linking a shared library.
623
            output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
bkoz's avatar
 
bkoz committed
624 625 626
          else
            # g++ 2.7 appears to require `-G' NOT `-shared' on this
            # platform.
627
            archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
bkoz's avatar
 
bkoz committed
628
            archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
629
		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
bkoz's avatar
 
bkoz committed
630 631 632 633

            # Commands to make compiler produce verbose output that lists
            # what "hidden" libraries, object files and flags are used when
            # linking a shared library.
634
            output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
bkoz's avatar
 
bkoz committed
635 636 637 638 639
          fi

          hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
        fi
        ;;
640
    esac
bkoz's avatar
 
bkoz committed
641 642
    ;;
  tandem*)
643
    case $cc_basename in
bkoz's avatar
 
bkoz committed
644 645 646 647 648 649 650 651 652
      NCC)
        # NonStop-UX NCC 3.20
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
      *)
        # FIXME: insert proper C++ library support
        ld_shlibs=no
        ;;
653
    esac
bkoz's avatar
 
bkoz committed
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680
    ;;
  unixware*)
    # FIXME: insert proper C++ library support
    ld_shlibs=no
    ;;
  vxworks*)
    # FIXME: insert proper C++ library support
    ld_shlibs=no
    ;;
  *)
    # FIXME: insert proper C++ library support
    ld_shlibs=no
    ;;
esac


## Compiler Characteristics: PIC flags, static flags, etc

# We don't use cached values here since only the C compiler
# characteristics should be cached.
ac_cv_prog_cc_pic=
ac_cv_prog_cc_shlib=
ac_cv_prog_cc_wl=
ac_cv_prog_cc_static=
ac_cv_prog_cc_no_builtin=
ac_cv_prog_cc_can_build_shared=$can_build_shared

681 682
ac_cv_prog_cc_pic_works=
ac_cv_prog_cc_static_works=
bkoz's avatar
 
bkoz committed
683 684 685 686 687

if test "$with_gcc" = yes; then
  ac_cv_prog_cc_wl='-Wl,'
  ac_cv_prog_cc_static='-static'

688
  case $host_os in
bkoz's avatar
 
bkoz committed
689
  aix*)
690 691 692 693 694 695 696
    # All AIX code is PIC.
    if test "$host_cpu" = ia64; then
      # AIX 5 now supports IA64 processor
      lt_cv_prog_cc_static='-Bstatic'
    else
      lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
    fi
697
    ;;
698 699 700 701 702 703 704 705
  amigaos*)
    # FIXME: we need at least 68020 code to build shared libraries, but
    # adding the `-m68020' flag to GCC prevents building anything better,
    # like `-m68040'.
    ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
    ;;
  beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
    # PIC is the default for these OSes.
aoliva's avatar
aoliva committed
706
    ;;
bkoz's avatar
 
bkoz committed
707 708 709 710 711
  cygwin* | mingw* | os2*)
    # This hack is so that the source file can tell whether it is being
    # built for inclusion in a dll (and should export symbols for example).
    ac_cv_prog_cc_pic='-DDLL_EXPORT'
    ;;
712 713 714 715 716 717 718 719
  darwin* | rhapsody*)
    # PIC is the default on this platform
    # Common symbols not allowed in MH_DYLIB files
    lt_cv_prog_cc_pic='-fno-common'
    ;;
  *djgpp*)
    # DJGPP does not support shared libraries at all
    ac_cv_prog_cc_pic=
bkoz's avatar
 
bkoz committed
720 721 722 723 724 725 726 727 728 729 730
    ;;
  sysv4*MP*)
    if test -d /usr/nec; then
      ac_cv_prog_cc_pic=-Kconform_pic
    fi
    ;;
  *)
    ac_cv_prog_cc_pic='-fPIC'
    ;;
  esac
else
731
  case $host_os in
dje's avatar
dje committed
732
    aix4* | aix5*)
bkoz's avatar
 
bkoz committed
733
      # All AIX code is PIC.
734 735 736 737 738 739
      if test "$host_cpu" = ia64; then
        # AIX 5 now supports IA64 processor
        lt_cv_prog_cc_static='-Bstatic'
      else
        lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
      fi
bkoz's avatar
 
bkoz committed
740 741
      ;;
    chorus*)
742
      case $cc_basename in
bkoz's avatar
 
bkoz committed
743 744 745 746
      cxch68)
        # Green Hills C++ Compiler
        # ac_cv_prog_cc_static="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
        ;;
747
      esac
bkoz's avatar
 
bkoz committed
748 749
      ;;
    dgux*)
750
      case $cc_basename in
bkoz's avatar
 
bkoz committed
751 752 753 754 755 756 757 758 759 760 761 762 763 764
        ec++)
          ac_cv_prog_cc_pic='-KPIC'
          ;;
        ghcx)
          # Green Hills C++ Compiler
          ac_cv_prog_cc_pic='-pic'
          ;;
        *)
          ;;
      esac
      ;;
    freebsd*)
      # FreeBSD uses GNU C++
      ;;
aoliva's avatar
aoliva committed
765 766
    gnu*)
      ;;
bkoz's avatar
 
bkoz committed
767
    hpux9* | hpux10* | hpux11*)
768
      case $cc_basename in
bkoz's avatar
 
bkoz committed
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783
        CC)
          ac_cv_prog_cc_wl='-Wl,'
          ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
          ac_cv_prog_cc_pic='+Z'
          ;;
        aCC)
          ac_cv_prog_cc_wl='-Wl,'
          ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
          ac_cv_prog_cc_pic='+Z'
          ;;
        *)
          ;;
      esac
      ;;
    irix5* | irix6*)
784
      case $cc_basename in
bkoz's avatar
 
bkoz committed
785 786 787 788 789 790 791 792 793 794
        CC)
          ac_cv_prog_cc_wl='-Wl,'
          ac_cv_prog_cc_static='-non_shared'
          ac_cv_prog_cc_pic='-KPIC'
          ;;
        *)
          ;;
      esac
      ;;
    linux*)
795
      case $cc_basename in
bkoz's avatar
 
bkoz committed
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816
        KCC)
          # KAI C++ Compiler
          ac_cv_prog_cc_wl='--backend -Wl,'
          ac_cv_prog_cc_pic='-fPIC'
          ;;
        cxx)
          # Compaq C++
          # Make sure the PIC flag is empty.  It appears that all Alpha
          # Linux and Compaq Tru64 Unix objects are PIC.
          ac_cv_prog_cc_pic=
          ac_cv_prog_cc_static='-non_shared'
          ;;
        *)
          ;;
      esac
      ;;
    lynxos*)
      ;;
    m88k*)
      ;;
    mvs*)
817
      case $cc_basename in
bkoz's avatar
 
bkoz committed
818 819 820 821 822
        cxx)
          ac_cv_prog_cc_pic='-W c,exportall'
          ;;
        *)
          ;;
823
      esac
bkoz's avatar
 
bkoz committed
824 825 826 827
      ;;
    netbsd*)
      ;;
    osf3* | osf4* | osf5*)
828
      case $cc_basename in
bkoz's avatar
 
bkoz committed
829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850
        KCC)
          ac_cv_prog_cc_wl='--backend -Wl,'
          ;;
        RCC)
          # Rational C++ 2.4.1
          ac_cv_prog_cc_pic='-pic'
          ;;
        cxx)
          # Digital/Compaq C++
          ac_cv_prog_cc_wl='-Wl,'
          # Make sure the PIC flag is empty.  It appears that all Alpha
          # Linux and Compaq Tru64 Unix objects are PIC.
          ac_cv_prog_cc_pic=
          ac_cv_prog_cc_static='-non_shared'
          ;;
        *)
          ;;
      esac
      ;;
    psos*)
      ;;
    sco*)
851
      case $cc_basename in
bkoz's avatar
 
bkoz committed
852 853 854 855 856 857 858 859
        CC)
          ac_cv_prog_cc_pic='-fPIC'
          ;;
        *)
          ;;
      esac
      ;;
    solaris*)
860
      case $cc_basename in
bkoz's avatar
 
bkoz committed
861 862 863 864 865 866 867 868 869 870 871 872
        CC)
          # Sun C++ 4.2, 5.x and Centerline C++
          ac_cv_prog_cc_pic='-KPIC'
          ac_cv_prog_cc_static='-Bstatic'
          ac_cv_prog_cc_wl='-Qoption ld '
          ;;
        gcx)
          # Green Hills C++ Compiler
          ac_cv_prog_cc_pic='-PIC'
          ;;
        *)
          ;;
873
      esac
bkoz's avatar
 
bkoz committed
874 875
      ;;
    sunos4*)
876
      case $cc_basename in
bkoz's avatar
 
bkoz committed
877 878 879 880 881 882 883 884 885 886 887 888 889 890
        CC)
          # Sun C++ 4.x
          ac_cv_prog_cc_pic='-pic'
          ac_cv_prog_cc_static='-Bstatic'
          ;;
        lcc)
          # Lucid
          ac_cv_prog_cc_pic='-pic'
          ;;
        *)
          ;;
      esac
      ;;
    tandem*)
891
      case $cc_basename in
bkoz's avatar
 
bkoz committed
892 893 894 895 896 897
        NCC)
          # NonStop-UX NCC 3.20
          ac_cv_prog_cc_pic='-KPIC'
          ;;
        *)
          ;;
898
      esac
bkoz's avatar
 
bkoz committed
899 900 901 902 903 904 905 906 907 908
      ;;
    unixware*)
      ;;
    vxworks*)
      ;;
    *)
      ac_cv_prog_cc_can_build_shared=no
      ;;
  esac
fi
aoliva's avatar
aoliva committed
909 910 911 912 913 914 915 916 917 918 919

case "$host_os" in
    # Platforms which do not suport PIC and -DPIC is meaningless
    # on them:
    *djgpp*)
      ac_cv_prog_cc_pic=
      ;;
    *)
      ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
      ;;
esac
bkoz's avatar
 
bkoz committed
920 921 922 923 924 925 926 927 928 929 930 931 932 933 934


# Figure out "hidden" C++ library dependencies from verbose
# compiler output whening linking a shared library.
cat > conftest.$ac_ext <<EOF
class Foo
{
public:
  Foo (void) { a = 0; }
private:
  int a;
};
EOF


935
if (eval $ac_compile) 2>&5; then
bkoz's avatar
 
bkoz committed
936 937 938 939 940 941 942
  # Parse the compiler output and extract the necessary
  # objects, libraries and library flags.

  # Sentinel used to keep track of whether or not we are before
  # the conftest object file.
  pre_test_object_deps_done=no

943
  for p in `eval $output_verbose_link_cmd`; do
bkoz's avatar
 
bkoz committed
944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017

    case $p in

    -L* | -R* | -l*)
       # Some compilers place space between "-{L,R}" and the path.
       # Remove the space.
       if test $p = "-L" \
          || test $p = "-R"; then
         prev=$p
         continue
       else
         prev=
       fi

       if test "$pre_test_object_deps_done" = no; then
         case $p in
	 -L* | -R*)
	   # Internal compiler library paths should come after those
	   # provided the user.  The postdeps already come after the
	   # user supplied libs so there is no need to process them.
           if test -z "$compiler_lib_search_path"; then
             compiler_lib_search_path="${prev}${p}"
           else
             compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
           fi
           ;;
         # The "-l" case would never come before the object being
         # linked, so don't bother handling this case.
         esac
       else
         if test -z "$postdeps"; then
           postdeps="${prev}${p}"
         else
           postdeps="${postdeps} ${prev}${p}"
         fi
       fi
       ;;

    *.$objext)
       # This assumes that the test object file only shows up
       # once in the compiler output.
       if test "$p" = "conftest.$objext"; then
         pre_test_object_deps_done=yes
         continue
       fi

       if test "$pre_test_object_deps_done" = no; then
         if test -z "$predep_objects"; then
           predep_objects="$p"
         else
           predep_objects="$predep_objects $p"
         fi
       else
         if test -z "$postdep_objects"; then
           postdep_objects="$p"
         else
           postdep_objects="$postdep_objects $p"
         fi
       fi
       ;;

    *) ;; # Ignore the rest.

    esac
  done

  # Clean up.
  rm -f a.out
else
  echo "ltcf-cxx.sh: error: problem compiling test program"
fi

$rm -f confest.$objext

1018 1019 1020 1021
case " $postdeps " in
*" -lc "*) need_lc=no ;;
*) need_lc=yes ;;
esac