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