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 Free Software Foundation, Inc. 6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7# 8# Original C++ support by:Gary V. Vaughan <gvv@techie.com> 9# Alexandre Oliva <oliva@lsd.ic.unicamp.br> 10# Ossama Othman <ossama@debian.org> 11# Thomas Thanner <tanner@gmx.de> 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. 34ac_ext=cc 35 36# Object file extension for compiled C++ test sources. 37objext=o 38 39# Code to be used in simple compile tests 40lt_simple_compile_test_code="int some_variable = 0;" 41 42# Code to be used in simple link tests 43lt_simple_link_test_code='int main(int, char *[]) { return (0); }' 44 45# C++ compiler 46CXX=${CXX-c++} 47 48# ltmain only uses $CC for tagged configurations so make sure $CC is set. 49CC=${CC-"$CXX"} 50CFLAGS=${CFLAGS-"$CXXFLAGS"} 51 52# Allow CC (or CXX) to be a program name with arguments. 53set dummy $CC 54compiler=$2 55cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` 56 57# we are optimistic. (Too optimistic if you ask me, down there we switch it 58# off again for most platforms ;) (MM) 59ld_shlibs=yes 60 61# Check if we are using GNU gcc (taken/adapted from configure script) 62# We need to check here since "--with-gcc" is set at configure time, 63# not ltconfig time! 64cat > conftest.$ac_ext <<EOF 65#ifdef __GNUC__ 66 yes; 67#endif 68EOF 69if { 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 70 with_gcc=yes 71 72 # Set up default GNU C++ configuration 73 74 # Check if GNU C++ uses GNU ld as the underlying linker, since the 75 # archiving commands below assume that GNU ld is being used. 76 if eval "`$CC -print-prog-name=ld` --version 2>&1" | \ 77 egrep 'GNU ld' > /dev/null; then 78 with_gnu_ld=yes 79 80 archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' 81 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' 82 83 runpath_var=LD_RUN_PATH 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 with_gnu_ld=no 101 wlarc= 102 103 # A generic and very simple default shared library creation 104 # command for GNU C++ for the case where it uses the native 105 # linker, instead of GNU ld. If possible, this setting should 106 # overridden to take advantage of the native linker features on 107 # the platform it is being used on. 108 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' 109 fi 110 111 # Commands to make compiler produce verbose output that lists 112 # what "hidden" libraries, object files and flags are used when 113 # linking a shared library. 114 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' 115 116else 117 with_gcc=no 118 with_gnu_ld=no 119 wlarc= 120fi 121 122echo "ltcf-cxx: with_gcc=$with_gcc ; with_gnu_ld=$with_gnu_ld" 123 124# PORTME: fill in a description of your system's C++ link characteristics 125case $host_os in 126 aix3*) 127 # FIXME: insert proper C++ library support 128 ld_shlibs=no 129 ;; 130 aix4* | aix5*) 131 archive_cmds='' 132 hardcode_direct=yes 133 hardcode_libdir_separator=':' 134 link_all_deplibs=yes 135 # When large executables or shared objects are built, AIX ld can 136 # have problems creating the table of contents. If linking a library 137 # or program results in "error TOC overflow" add -mminimal-toc to 138 # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not 139 # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. 140 if test "$with_gcc" = yes; then 141 case $host_os in aix4.[012]|aix4.[012].*) 142 # We only want to do this on AIX 4.2 and lower, the check 143 # below for broken collect2 doesn't work under 4.3+ 144 collect2name=`${CC} -print-prog-name=collect2` 145 if test -f "$collect2name" && \ 146 strings "$collect2name" | grep resolve_lib_name >/dev/null 147 then 148 # We have reworked collect2 149 hardcode_direct=yes 150 else 151 # We have old collect2 152 hardcode_direct=unsupported 153 # It fails to find uninstalled libraries when the uninstalled 154 # path is not listed in the libpath. Setting hardcode_minus_L 155 # to unsupported forces relinking 156 hardcode_minus_L=yes 157 hardcode_libdir_flag_spec='-L$libdir' 158 hardcode_libdir_separator= 159 fi 160 esac 161 shared_flag='-shared' 162 else 163 # not using gcc 164 if test "$host_cpu" = ia64; then 165 shared_flag='${wl}-G' 166 else 167 shared_flag='-qmkshrobj' 168 fi 169 fi 170 171 if test "$host_cpu" = ia64; then 172 # On IA64, the linker does run time linking by default, so we don't 173 # have to do anything special. 174 aix_use_runtimelinking=no 175 exp_sym_flag='-Bexport' 176 no_entry_flag="" 177 else 178 # KDE requires run time linking. Make it the default. 179 aix_use_runtimelinking=yes 180 exp_sym_flag='-bexport' 181 no_entry_flag='-bnoentry' 182 fi 183 # Let the compiler handle the export list. 184 always_export_symbols=no 185 if test "$aix_use_runtimelinking" = yes; then 186 allow_undefined_flag=' ${wl}-berok' 187 # The following three lines along with hardcode_into_libs=yes put the correct path into libraries. 188 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir${libdir:+:}/usr/lib:/lib' 189 archive_cmds='$CC '"$shared_flag"' $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G '"$hardcode_libdir_flag_spec"' -o $lib' 190 archive_expsym_cmds='$CC '"$shared_flag"' $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G '"$hardcode_libdir_flag_spec"' ${wl}'"$exp_sym_flag"':$export_symbols -o $lib' 191 else 192 if test "$host_cpu" = ia64; then 193 hardcode_libdir_flag_spec='${wl}-R $libdir${libdir:+:}/usr/lib:/lib' 194 allow_undefined_flag="-z nodefs" 195 archive_cmds='$CC '"$shared_flag"' $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags '"$hardcode_libdir_flag_spec"' -o $lib' 196 archive_expsym_cmds='$CC '"$shared_flag"' $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags '"$hardcode_libdir_flag_spec"' ${wl}'"$exp_sym_flag"':$export_symbols -o $lib' 197 else 198 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' 199 # Warning - without using the other run time loading flags, -berok will 200 # link without error, but may produce a broken library. 201 no_undefined_flag='${wl}-bnoerok' 202 allow_undefined_flag='${wl}-berok" 203 # -bexpall does not export symbols beginning with underscore (_) 204 always_export_symbols=yes 205 # Exported symbols can be pulled into shared objects from archives 206 whole_archive_flag_spec=' ' 207 build_libtool_need_lc=yes 208 # This is similar to how AIX traditionally builds it's shared libraries. 209 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' 210 fi 211 fi 212 ;; 213 chorus*) 214 case $cc_basename in 215 *) 216 # FIXME: insert proper C++ library support 217 ld_shlibs=no 218 ;; 219 esac 220 ;; 221 dgux*) 222 case $cc_basename in 223 ec++) 224 # FIXME: insert proper C++ library support 225 ld_shlibs=no 226 ;; 227 ghcx) 228 # Green Hills C++ Compiler 229 # FIXME: insert proper C++ library support 230 ld_shlibs=no 231 ;; 232 *) 233 # FIXME: insert proper C++ library support 234 ld_shlibs=no 235 ;; 236 esac 237 ;; 238 freebsd*) 239 # FreeBSD uses GNU C++ and GNU ld 240 skip_need_lc_check=yes 241 remove_lgcc=yes 242 ;; 243 hpux*) 244 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' 245 hardcode_libdir_separator=: 246 hardcode_direct=yes 247 hardcode_minus_L=yes # Not in the search PATH, but as the default 248 # location of the library. 249 export_dynamic_flag_spec='${wl}-E' 250 251 case $cc_basename in 252 CC) 253 # FIXME: insert proper C++ library support 254 ld_shlibs=no 255 ;; 256 aCC) 257 case $host_os in 258 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' ;; 259 *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; 260 esac 261 # Commands to make compiler produce verbose output that lists 262 # what "hidden" libraries, object files and flags are used when 263 # linking a shared library. 264 # 265 # There doesn't appear to be a way to prevent this compiler from 266 # explicitly linking system object files so we need to strip them 267 # from the output so that they don't get included in the library 268 # dependencies. 269 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' 270 ;; 271 *) 272 if test "$with_gcc" = yes && test "$with_gnu_ld" = no ; then 273 # MM: for HP-UX and g++ -fPIC is needed to link pic objects together 274 case $host_os in 275 hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -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' ;; 276 *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; 277 esac 278 output_verbose_link_cmds='$CC -shared -fPIC $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' 279 remove_lgcc=yes 280 fi 281 if test "$with_gcc" = no ; then 282 # FIXME: insert proper C++ library support 283 ld_shlibs=no 284 fi 285 ;; 286 esac 287 ;; 288 irix5* | irix6*) 289 case $cc_basename in 290 CC) 291 # SGI C++ 292 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' 293 294 # Archives containing C++ object files must be created using 295 # "CC -ar", where "CC" is the IRIX C++ compiler. This is 296 # necessary to make sure instantiated templates are included 297 # in the archive. 298 old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs' 299 ;; 300 *) 301 if test "$with_gcc" = yes; then 302 if test "$with_gnu_ld" = no; then 303 archive_cmds='$CC -D_LANGUAGE_C_CPLUS_PLUS -shared $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' 304 else 305 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib' 306 fi 307 fi 308 ;; 309 esac 310 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 311 hardcode_libdir_separator=: 312 link_all_deplibs=yes 313 ;; 314 linux*) 315 case $cc_basename in 316 KCC) 317 # Kuck and Associates, Inc. (KAI) C++ Compiler 318 319 # KCC will only create a shared library if the output file 320 # ends with ".so" (or ".sl" for HP-UX), so rename the library 321 # to its proper name (with version) after linking. 322 archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $libobjs $deplibs $compiler_flags --soname $soname -o \$templib; test \$templib = $lib || mv \$templib $lib' 323 archive_expsym_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $libobjs $deplibs $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; test \$templib = $lib || mv \$templib $lib' 324 325 # Commands to make compiler produce verbose output that lists 326 # what "hidden" libraries, object files and flags are used when 327 # linking a shared library. 328 # 329 # There doesn't appear to be a way to prevent this compiler from 330 # explicitly linking system object files so we need to strip them 331 # from the output so that they don't get included in the library 332 # dependencies. 333 output_verbose_link_cmds='echo "go to hell"' 334 skip_need_lc_check=yes 335 336 hardcode_libdir_flag_spec='${wl}--rpath,$libdir' 337 export_dynamic_flag_spec='${wl}--export-dynamic' 338 339 # Archives containing C++ object files must be created using 340 # "CC -Bstatic", where "CC" is the KAI C++ compiler. 341 # We add also $compiler_flags, to evetually add any --thread_safe or 342 # --exceptions flags (which is also tested when building an .a 343 # archive. 344 old_archive_cmds='$CC -Bstatic $compiler_flags -o $oldlib $oldobjs' 345 ;; 346 cxx) 347 # Compaq C++ 348 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' 349 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' 350 351 runpath_var=LD_RUN_PATH 352 hardcode_libdir_flag_spec='-rpath $libdir' 353 hardcode_libdir_separator=: 354 355 # Commands to make compiler produce verbose output that lists 356 # what "hidden" libraries, object files and flags are used when 357 # linking a shared library. 358 # 359 # There doesn't appear to be a way to prevent this compiler from 360 # explicitly linking system object files so we need to strip them 361 # from the output so that they don't get included in the library 362 # dependencies. 363 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' 364 ;; 365 insure) 366 if test "$with_gcc" = yes; then 367 # Insure++ together with gcc probably means also GNU ld 368 # only -whole-archive isn't supported 369 whole_archive_flag_spec="" 370 # and we can't use -nostdlib, because bloody insure has no way to 371 # output the linkline (-Zvm isn't working as documented), so we don't 372 # know the depending libs. So we hope, insure gets it right anyway. 373 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' 374 runpath_var=LD_RUN_PATH 375 hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' 376 export_dynamic_flag_spec='${wl}--export-dynamic' 377 output_verbose_link_cmds="" 378 fi 379 esac 380 ;; 381 lynxos*) 382 # FIXME: insert proper C++ library support 383 ld_shlibs=no 384 ;; 385 m88k*) 386 # FIXME: insert proper C++ library support 387 ld_shlibs=no 388 ;; 389 mvs*) 390 case $cc_basename in 391 cxx) 392 # FIXME: insert proper C++ library support 393 ld_shlibs=no 394 ;; 395 *) 396 # FIXME: insert proper C++ library support 397 ld_shlibs=no 398 ;; 399 esac 400 ;; 401 netbsd*) 402 if test "$with_gcc" = no || test "$with_gnu_ld" = no; then 403 # This should only be triggered for NetBSD/a.out 404 # Add in C++ constructor/destructor support 405 if test -f /usr/pkg/lib/c++rt0/c++rt0.o.PIC; then 406 cppopts="/usr/pkg/lib/c++rt0/c++rt0.o.PIC" 407 elif test -f /usr/lib/c++rt0.o; then 408 cppopts="/usr/lib/c++rt0.o" 409 fi 410 archive_cmds='ld -Bshareable -o $lib '"$cppopts"' $libobjs $deplibs $linkopts' 411 fi 412 ;; 413 openbsd*) 414 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then 415 # MM: OpenBSD 2.7 uses G++, but not GNU ld 416 archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' 417 archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' 418 old_archive_cmds="$old_archive_cmds~"'$RANLIB $oldlib' 419 hardcode_libdir_flag_spec='${wl}-R$libdir' 420 hardcode_direct=yes 421 hardcode_shlibpath_var=no 422 whole_archive_flag_spec='${wl}-Bforcearchive' 423 remove_lgcc=yes 424 fi 425 ;; 426 osf3*) 427 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then 428 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' 429 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' 430 431 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 432 hardcode_libdir_separator=: 433 434 # Commands to make compiler produce verbose output that lists 435 # what "hidden" libraries, object files and flags are used when 436 # linking a shared library. 437 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' 438 else 439 case $cc_basename in 440 KCC) 441 # Kuck and Associates, Inc. (KAI) C++ Compiler 442 443 # KCC will only create a shared library if the output file 444 # ends with ".so" (or ".sl" for HP-UX), so rename the library 445 # to its proper name (with version) after linking. 446 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' 447 448 hardcode_libdir_flag_spec='${wl}-rpath,$libdir' 449 hardcode_libdir_separator=: 450 451 # Archives containing C++ object files must be created using 452 # "CC -Bstatic", where "CC" is the KAI C++ compiler. 453 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs' 454 455 ;; 456 RCC) 457 # Rational C++ 2.4.1 458 # FIXME: insert proper C++ library support 459 ld_shlibs=no 460 ;; 461 cxx) 462 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' 463 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' 464 465 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 466 hardcode_libdir_separator=: 467 468 # Commands to make compiler produce verbose output that lists 469 # what "hidden" libraries, object files and flags are used when 470 # linking a shared library. 471 # 472 # There doesn't appear to be a way to prevent this compiler from 473 # explicitly linking system object files so we need to strip them 474 # from the output so that they don't get included in the library 475 # dependencies. 476 output_verbose_link_cmds='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' 477 ;; 478 *) 479 # FIXME: insert proper C++ library support 480 ld_shlibs=no 481 ;; 482 esac 483 fi 484 ;; 485 osf4* | osf5*) 486 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then 487 allow_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' 488 no_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' 489 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' 490 491 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 492 hardcode_libdir_separator=: 493 494 # Commands to make compiler produce verbose output that lists 495 # what "hidden" libraries, object files and flags are used when 496 # linking a shared library. 497 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' 498 else 499 case $cc_basename in 500 KCC) 501 # Kuck and Associates, Inc. (KAI) C++ Compiler 502 503 # KCC will only create a shared library if the output file 504 # ends with ".so" (or ".sl" for HP-UX), so rename the library 505 # to its proper name (with version) after linking. 506 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' 507 508 hardcode_libdir_flag_spec='${wl}-rpath,$libdir' 509 hardcode_libdir_separator=: 510 511 # Archives containing C++ object files must be created using 512 # the KAI C++ compiler. 513 old_archive_cmds='$CC -o $oldlib $oldobjs' 514 ;; 515 RCC) 516 # Rational C++ 2.4.1 517 # FIXME: insert proper C++ library support 518 ld_shlibs=no 519 ;; 520 cxx) 521 allow_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' 522 no_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' 523 archive_cmds='$CC -shared${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` -update_registry ${objdir}/so_locations -o $lib' 524 525 hardcode_libdir_flag_spec='-rpath $libdir' 526 hardcode_libdir_separator=: 527 528 # Commands to make compiler produce verbose output that lists 529 # what "hidden" libraries, object files and flags are used when 530 # linking a shared library. 531 # 532 # There doesn't appear to be a way to prevent this compiler from 533 # explicitly linking system object files so we need to strip them 534 # from the output so that they don't get included in the library 535 # dependencies. 536 output_verbose_link_cmds='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' 537 ;; 538 *) 539 # FIXME: insert proper C++ library support 540 ld_shlibs=no 541 ;; 542 esac 543 fi 544 ;; 545 psos*) 546 # FIXME: insert proper C++ library support 547 ld_shlibs=no 548 ;; 549 sco*) 550 case $cc_basename in 551 CC) 552 # FIXME: insert proper C++ library support 553 ld_shlibs=no 554 ;; 555 *) 556 # FIXME: insert proper C++ library support 557 ld_shlibs=no 558 ;; 559 esac 560 ;; 561 sunos4*) 562 case $cc_basename in 563 CC) 564 # Sun C++ 4.x 565 # FIXME: insert proper C++ library support 566 ld_shlibs=no 567 ;; 568 lcc) 569 # Lucid 570 # FIXME: insert proper C++ library support 571 ld_shlibs=no 572 ;; 573 *) 574 # FIXME: insert proper C++ library support 575 ld_shlibs=no 576 ;; 577 esac 578 ;; 579 solaris*) 580 case $cc_basename in 581 CC) 582 # Sun C++ 4.2, 5.x and Centerline C++ 583 no_undefined_flag=' -ztext' 584 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' 585 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ 586 $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' 587 588 hardcode_libdir_flag_spec='-R$libdir' 589 hardcode_shlibpath_var=no 590 case $host_os in 591 solaris2.[0-5] | solaris2.[0-5].*) ;; 592 *) 593 # The C++ compiler is used as linker so we must use $wl 594 # flag to pass the commands to the underlying system 595 # linker. 596 # Supported since Solaris 2.6 (maybe 2.5.1?) 597 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' 598 ;; 599 esac 600 link_all_deplibs=yes 601 602 # Commands to make compiler produce verbose output that lists 603 # what "hidden" libraries, object files and flags are used when 604 # linking a shared library. 605 # 606 # There doesn't appear to be a way to prevent this compiler from 607 # explicitly linking system object files so we need to strip them 608 # from the output so that they don't get included in the library 609 # dependencies. 610 output_verbose_link_cmds='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' 611 612 # Archives containing C++ object files must be created using 613 # "CC -xar", where "CC" is the Sun C++ compiler. This is 614 # necessary to make sure instantiated templates are included 615 # in the archive. 616 old_archive_cmds='$CC -xar -o $oldlib $oldobjs' 617 ;; 618 gcx) 619 # Green Hills C++ Compiler 620 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' 621 622 # The C++ compiler must be used to create the archive. 623 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs' 624 ;; 625 *) 626 # GNU C++ compiler with Solaris linker 627 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then 628 if $CC --version | egrep -v '^2\.7' > /dev/null; then 629 archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' 630 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ 631 $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' 632 633 # Commands to make compiler produce verbose output that lists 634 # what "hidden" libraries, object files and flags are used when 635 # linking a shared library. 636 output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" 637 else 638 # g++ 2.7 appears to require `-G' NOT `-shared' on this 639 # platform. 640 archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' 641 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ 642 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' 643 644 # Commands to make compiler produce verbose output that lists 645 # what "hidden" libraries, object files and flags are used when 646 # linking a shared library. 647 output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" 648 fi 649 650 hardcode_libdir_flag_spec='${wl}-R $wl$libdir' 651 fi 652 ;; 653 esac 654 ;; 655 tandem*) 656 case $cc_basename in 657 NCC) 658 # NonStop-UX NCC 3.20 659 # FIXME: insert proper C++ library support 660 ld_shlibs=no 661 ;; 662 *) 663 # FIXME: insert proper C++ library support 664 ld_shlibs=no 665 ;; 666 esac 667 ;; 668 unixware*) 669 # FIXME: insert proper C++ library support 670 ld_shlibs=no 671 ;; 672 vxworks*) 673 # FIXME: insert proper C++ library support 674 ld_shlibs=no 675 ;; 676 *) 677 # FIXME: insert proper C++ library support 678 ld_shlibs=no 679 ;; 680esac 681 682 683## Compiler Characteristics: PIC flags, static flags, etc 684 685# We don't use cached values here since only the C compiler 686# characteristics should be cached. 687ac_cv_prog_cc_pic= 688ac_cv_prog_cc_shlib= 689ac_cv_prog_cc_wl= 690ac_cv_prog_cc_static= 691ac_cv_prog_cc_no_builtin= 692ac_cv_prog_cc_can_build_shared=$can_build_shared 693 694ac_cv_prog_cc_pic_works= 695ac_cv_prog_cc_static_works= 696 697if test "$with_gcc" = yes; then 698 ac_cv_prog_cc_wl='-Wl,' 699 ac_cv_prog_cc_static='-static' 700 701 case $host_os in 702 aix*) 703 # All AIX code is PIC. 704 if test "$host_cpu" = ia64; then 705 # AIX 5 now supports IA64 processor 706 lt_cv_prog_cc_static='-Bstatic' 707 else 708 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' 709 fi 710 ;; 711 amigaos*) 712 # FIXME: we need at least 68020 code to build shared libraries, but 713 # adding the `-m68020' flag to GCC prevents building anything better, 714 # like `-m68040'. 715 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' 716 ;; 717 beos* | irix5* | irix6* | osf3* | osf4* | osf5*) 718 # PIC is the default for these OSes. 719 ;; 720 cygwin* | mingw* | os2*) 721 # This hack is so that the source file can tell whether it is being 722 # built for inclusion in a dll (and should export symbols for example). 723 ac_cv_prog_cc_pic='-DDLL_EXPORT' 724 ;; 725 darwin* | rhapsody*) 726 # PIC is the default on this platform 727 # Common symbols not allowed in MH_DYLIB files 728 lt_cv_prog_cc_pic='-fno-common' 729 ;; 730 *djgpp*) 731 # DJGPP does not support shared libraries at all 732 ac_cv_prog_cc_pic= 733 ;; 734 sysv4*MP*) 735 if test -d /usr/nec; then 736 ac_cv_prog_cc_pic=-Kconform_pic 737 fi 738 ;; 739 *) 740 ac_cv_prog_cc_pic='-fPIC' 741 ;; 742 esac 743else 744 case $host_os in 745 aix4* | aix5*) 746 # All AIX code is PIC. 747 if test "$host_cpu" = ia64; then 748 # AIX 5 now supports IA64 processor 749 lt_cv_prog_cc_static='-Bstatic' 750 else 751 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' 752 fi 753 ;; 754 chorus*) 755 case $cc_basename in 756 cxch68) 757 # Green Hills C++ Compiler 758 # 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" 759 ;; 760 esac 761 ;; 762 dgux*) 763 case $cc_basename in 764 ec++) 765 ac_cv_prog_cc_pic='-KPIC' 766 ;; 767 ghcx) 768 # Green Hills C++ Compiler 769 ac_cv_prog_cc_pic='-pic' 770 ;; 771 *) 772 ;; 773 esac 774 ;; 775 freebsd*) 776 # FreeBSD uses GNU C++ 777 ;; 778 hpux9* | hpux10* | hpux11*) 779 case $cc_basename in 780 CC) 781 ac_cv_prog_cc_wl='-Wl,' 782 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" 783 ac_cv_prog_cc_pic='+Z' 784 ;; 785 aCC) 786 ac_cv_prog_cc_wl='-Wl,' 787 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" 788 ac_cv_prog_cc_pic='+Z' 789 ;; 790 *) 791 ;; 792 esac 793 ;; 794 irix5* | irix6*) 795 case $cc_basename in 796 CC) 797 ac_cv_prog_cc_wl='-Wl,' 798 ac_cv_prog_cc_static='-non_shared' 799 ac_cv_prog_cc_pic='-KPIC' 800 ;; 801 *) 802 ;; 803 esac 804 ;; 805 linux*) 806 case $cc_basename in 807 KCC) 808 # KAI C++ Compiler 809 ac_cv_prog_cc_wl='--backend -Wl,' 810 ac_cv_prog_cc_pic='-fPIC' 811 ac_cv_prog_cc_static='-Bstatic' 812 ;; 813 cxx) 814 # Compaq C++ 815 # Make sure the PIC flag is empty. It appears that all Alpha 816 # Linux and Compaq Tru64 Unix objects are PIC. 817 ac_cv_prog_cc_pic= 818 ac_cv_prog_cc_static='-non_shared' 819 ;; 820 *) 821 ;; 822 esac 823 ;; 824 lynxos*) 825 ;; 826 m88k*) 827 ;; 828 mvs*) 829 case $cc_basename in 830 cxx) 831 ac_cv_prog_cc_pic='-W c,exportall' 832 ;; 833 *) 834 ;; 835 esac 836 ;; 837 netbsd*) 838 ;; 839 osf3* | osf4* | osf5*) 840 case $cc_basename in 841 KCC) 842 ac_cv_prog_cc_wl='--backend -Wl,' 843 ;; 844 RCC) 845 # Rational C++ 2.4.1 846 ac_cv_prog_cc_pic='-pic' 847 ;; 848 cxx) 849 # Digital/Compaq C++ 850 ac_cv_prog_cc_wl='-Wl,' 851 # Make sure the PIC flag is empty. It appears that all Alpha 852 # Linux and Compaq Tru64 Unix objects are PIC. 853 ac_cv_prog_cc_pic= 854 ac_cv_prog_cc_static='-non_shared' 855 ;; 856 *) 857 ;; 858 esac 859 ;; 860 psos*) 861 ;; 862 sco*) 863 case $cc_basename in 864 CC) 865 ac_cv_prog_cc_pic='-fPIC' 866 ;; 867 *) 868 ;; 869 esac 870 ;; 871 solaris*) 872 case $cc_basename in 873 CC) 874 # Sun C++ 4.2, 5.x and Centerline C++ 875 ac_cv_prog_cc_pic='-KPIC' 876 ac_cv_prog_cc_static='-Bstatic' 877 ac_cv_prog_cc_wl='-Qoption ld ' 878 ;; 879 gcx) 880 # Green Hills C++ Compiler 881 ac_cv_prog_cc_pic='-PIC' 882 ;; 883 *) 884 ;; 885 esac 886 ;; 887 sunos4*) 888 case $cc_basename in 889 CC) 890 # Sun C++ 4.x 891 ac_cv_prog_cc_pic='-pic' 892 ac_cv_prog_cc_static='-Bstatic' 893 ;; 894 lcc) 895 # Lucid 896 ac_cv_prog_cc_pic='-pic' 897 ;; 898 *) 899 ;; 900 esac 901 ;; 902 tandem*) 903 case $cc_basename in 904 NCC) 905 # NonStop-UX NCC 3.20 906 ac_cv_prog_cc_pic='-KPIC' 907 ;; 908 *) 909 ;; 910 esac 911 ;; 912 unixware*) 913 ;; 914 vxworks*) 915 ;; 916 *) 917 ac_cv_prog_cc_can_build_shared=no 918 ;; 919 esac 920fi 921 922case "$host_os" in 923 # Platforms which do not suport PIC and -DPIC is meaningless 924 # on them: 925 *djgpp*) 926 ac_cv_prog_cc_pic= 927 ;; 928 *) 929 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC" 930 ;; 931esac 932 933 934# Figure out "hidden" C++ library dependencies from verbose 935# compiler output whening linking a shared library. 936cat > conftest.$ac_ext <<EOF 937class Foo 938{ 939public: 940 Foo (void) { a = 0; } 941private: 942 int a; 943}; 944EOF 945 946 947if (eval $ac_compile) 2>&5; then 948 # Parse the compiler output and extract the necessary 949 # objects, libraries and library flags. 950 951 # Sentinel used to keep track of whether or not we are before 952 # the conftest object file. 953 pre_test_object_deps_done=no 954 955 for p in `eval $output_verbose_link_cmds`; do 956 957 case $p in 958 959 -L* | -R* | -l*) 960 # Some compilers place space between "-{L,R}" and the path. 961 # Remove the space. 962 if test $p = "-L" \ 963 || test $p = "-R"; then 964 prev=$p 965 continue 966 else 967 prev= 968 fi 969 970 if test "$pre_test_object_deps_done" = no; then 971 case $p in 972 -L* | -R*) 973 # Internal compiler library paths should come after those 974 # provided the user. The postdeps already come after the 975 # user supplied libs so there is no need to process them. 976 if test -z "$compiler_lib_search_path"; then 977 compiler_lib_search_path="${prev}${p}" 978 else 979 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}" 980 fi 981 ;; 982 # The "-l" case would never come before the object being 983 # linked, so don't bother handling this case. 984 esac 985 else 986 add="${prev}${p}" 987 if test "x$remove_lgcc" = "xyes" ; then 988 case "$add" in 989 -lgcc ) add="" ;; 990 esac 991 fi 992 if test -n "$add" ; then 993 if test -z "$postdeps"; then 994 postdeps="$add" 995 else 996 postdeps="${postdeps} ${add}" 997 fi 998 fi 999 fi 1000 ;; 1001 1002 *.$objext) 1003 # This assumes that the test object file only shows up 1004 # once in the compiler output. 1005 if test "$p" = "conftest.$objext"; then 1006 pre_test_object_deps_done=yes 1007 continue 1008 fi 1009 1010 if test "$pre_test_object_deps_done" = no; then 1011 if test -z "$predep_objects"; then 1012 predep_objects="$p" 1013 else 1014 predep_objects="$predep_objects $p" 1015 fi 1016 else 1017 if test -z "$postdep_objects"; then 1018 postdep_objects="$p" 1019 else 1020 postdep_objects="$postdep_objects $p" 1021 fi 1022 fi 1023 ;; 1024 1025 *) ;; # Ignore the rest. 1026 1027 esac 1028 done 1029 1030 # Clean up. 1031 rm -f a.out 1032else 1033 echo "ltcf-cxx.sh: error: problem compiling test program" 1034fi 1035 1036$rm -f confest.$objext 1037 1038if test "x$skip_need_lc_check" = "xyes" ; then 1039 need_lc=no 1040else 1041 case " $postdeps " in 1042 *" -lc "*) need_lc=no ;; 1043 *) need_lc=yes ;; 1044 esac 1045fi 1046