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