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='${wl}-bM:SRE' 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 $linker_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 $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' 323 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' 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='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' 334 335 hardcode_libdir_flag_spec='${wl}--rpath,$libdir' 336 export_dynamic_flag_spec='${wl}--export-dynamic' 337 338 # Archives containing C++ object files must be created using 339 # "CC -Bstatic", where "CC" is the KAI C++ compiler. 340 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs' 341 ;; 342 cxx) 343 # Compaq C++ 344 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' 345 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' 346 347 runpath_var=LD_RUN_PATH 348 hardcode_libdir_flag_spec='-rpath $libdir' 349 hardcode_libdir_separator=: 350 351 # Commands to make compiler produce verbose output that lists 352 # what "hidden" libraries, object files and flags are used when 353 # linking a shared library. 354 # 355 # There doesn't appear to be a way to prevent this compiler from 356 # explicitly linking system object files so we need to strip them 357 # from the output so that they don't get included in the library 358 # dependencies. 359 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' 360 ;; 361 insure) 362 if test "$with_gcc" = yes; then 363 # Insure++ together with gcc probably means also GNU ld 364 # only -whole-archive isn't supported 365 whole_archive_flag_spec="" 366 # and we can't use -nostdlib, because bloody insure has no way to 367 # output the linkline (-Zvm isn't working as documented), so we don't 368 # know the depending libs. So we hope, insure gets it right anyway. 369 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' 370 runpath_var=LD_RUN_PATH 371 hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' 372 export_dynamic_flag_spec='${wl}--export-dynamic' 373 output_verbose_link_cmds="" 374 fi 375 esac 376 ;; 377 lynxos*) 378 # FIXME: insert proper C++ library support 379 ld_shlibs=no 380 ;; 381 m88k*) 382 # FIXME: insert proper C++ library support 383 ld_shlibs=no 384 ;; 385 mvs*) 386 case $cc_basename in 387 cxx) 388 # FIXME: insert proper C++ library support 389 ld_shlibs=no 390 ;; 391 *) 392 # FIXME: insert proper C++ library support 393 ld_shlibs=no 394 ;; 395 esac 396 ;; 397 netbsd*) 398 if test "$with_gcc" = no || test "$with_gnu_ld" = no; then 399 # This should only be triggered for NetBSD/a.out 400 # Add in C++ constructor/destructor support 401 if test -f /usr/pkg/lib/c++rt0/c++rt0.o.PIC; then 402 cppopts="/usr/pkg/lib/c++rt0/c++rt0.o.PIC" 403 elif test -f /usr/lib/c++rt0.o; then 404 cppopts="/usr/lib/c++rt0.o" 405 fi 406 archive_cmds='ld -Bshareable -o $lib '"$cppopts"' $libobjs $deplibs $linkopts' 407 fi 408 ;; 409 openbsd*) 410 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then 411 # MM: OpenBSD 2.7 uses G++, but not GNU ld 412 archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' 413 archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' 414 old_archive_cmds="$old_archive_cmds~"'$RANLIB $oldlib' 415 hardcode_libdir_flag_spec='${wl}-R$libdir' 416 hardcode_direct=yes 417 hardcode_shlibpath_var=no 418 whole_archive_flag_spec='${wl}-Bforcearchive' 419 remove_lgcc=yes 420 fi 421 ;; 422 osf3*) 423 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then 424 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' 425 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' 426 427 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 428 hardcode_libdir_separator=: 429 430 # Commands to make compiler produce verbose output that lists 431 # what "hidden" libraries, object files and flags are used when 432 # linking a shared library. 433 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' 434 else 435 case $cc_basename in 436 KCC) 437 # Kuck and Associates, Inc. (KAI) C++ Compiler 438 439 # KCC will only create a shared library if the output file 440 # ends with ".so" (or ".sl" for HP-UX), so rename the library 441 # to its proper name (with version) after linking. 442 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' 443 444 hardcode_libdir_flag_spec='${wl}-rpath,$libdir' 445 hardcode_libdir_separator=: 446 447 # Archives containing C++ object files must be created using 448 # "CC -Bstatic", where "CC" is the KAI C++ compiler. 449 old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs' 450 451 ;; 452 RCC) 453 # Rational C++ 2.4.1 454 # FIXME: insert proper C++ library support 455 ld_shlibs=no 456 ;; 457 cxx) 458 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' 459 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' 460 461 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 462 hardcode_libdir_separator=: 463 464 # Commands to make compiler produce verbose output that lists 465 # what "hidden" libraries, object files and flags are used when 466 # linking a shared library. 467 # 468 # There doesn't appear to be a way to prevent this compiler from 469 # explicitly linking system object files so we need to strip them 470 # from the output so that they don't get included in the library 471 # dependencies. 472 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' 473 ;; 474 *) 475 # FIXME: insert proper C++ library support 476 ld_shlibs=no 477 ;; 478 esac 479 fi 480 ;; 481 osf4* | osf5*) 482 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then 483 allow_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' 484 no_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' 485 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' 486 487 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 488 hardcode_libdir_separator=: 489 490 # Commands to make compiler produce verbose output that lists 491 # what "hidden" libraries, object files and flags are used when 492 # linking a shared library. 493 output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' 494 else 495 case $cc_basename in 496 KCC) 497 # Kuck and Associates, Inc. (KAI) C++ Compiler 498 499 # KCC will only create a shared library if the output file 500 # ends with ".so" (or ".sl" for HP-UX), so rename the library 501 # to its proper name (with version) after linking. 502 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' 503 504 hardcode_libdir_flag_spec='${wl}-rpath,$libdir' 505 hardcode_libdir_separator=: 506 507 # Archives containing C++ object files must be created using 508 # the KAI C++ compiler. 509 old_archive_cmds='$CC -o $oldlib $oldobjs' 510 ;; 511 RCC) 512 # Rational C++ 2.4.1 513 # FIXME: insert proper C++ library support 514 ld_shlibs=no 515 ;; 516 cxx) 517 allow_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' 518 no_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' 519 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' 520 521 hardcode_libdir_flag_spec='-rpath $libdir' 522 hardcode_libdir_separator=: 523 524 # Commands to make compiler produce verbose output that lists 525 # what "hidden" libraries, object files and flags are used when 526 # linking a shared library. 527 # 528 # There doesn't appear to be a way to prevent this compiler from 529 # explicitly linking system object files so we need to strip them 530 # from the output so that they don't get included in the library 531 # dependencies. 532 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' 533 ;; 534 *) 535 # FIXME: insert proper C++ library support 536 ld_shlibs=no 537 ;; 538 esac 539 fi 540 ;; 541 psos*) 542 # FIXME: insert proper C++ library support 543 ld_shlibs=no 544 ;; 545 sco*) 546 case $cc_basename in 547 CC) 548 # FIXME: insert proper C++ library support 549 ld_shlibs=no 550 ;; 551 *) 552 # FIXME: insert proper C++ library support 553 ld_shlibs=no 554 ;; 555 esac 556 ;; 557 sunos4*) 558 case $cc_basename in 559 CC) 560 # Sun C++ 4.x 561 # FIXME: insert proper C++ library support 562 ld_shlibs=no 563 ;; 564 lcc) 565 # Lucid 566 # FIXME: insert proper C++ library support 567 ld_shlibs=no 568 ;; 569 *) 570 # FIXME: insert proper C++ library support 571 ld_shlibs=no 572 ;; 573 esac 574 ;; 575 solaris*) 576 case $cc_basename in 577 CC) 578 # Sun C++ 4.2, 5.x and Centerline C++ 579 no_undefined_flag=' -ztext' 580 archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' 581 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ 582 $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' 583 584 hardcode_libdir_flag_spec='-R$libdir' 585 hardcode_shlibpath_var=no 586 case $host_os in 587 solaris2.[0-5] | solaris2.[0-5].*) ;; 588 *) 589 # The C++ compiler is used as linker so we must use $wl 590 # flag to pass the commands to the underlying system 591 # linker. 592 # Supported since Solaris 2.6 (maybe 2.5.1?) 593 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' 594 ;; 595 esac 596 link_all_deplibs=yes 597 598 # Commands to make compiler produce verbose output that lists 599 # what "hidden" libraries, object files and flags are used when 600 # linking a shared library. 601 # 602 # There doesn't appear to be a way to prevent this compiler from 603 # explicitly linking system object files so we need to strip them 604 # from the output so that they don't get included in the library 605 # dependencies. 606 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' 607 608 # Archives containing C++ object files must be created using 609 # "CC -xar", where "CC" is the Sun C++ compiler. This is 610 # necessary to make sure instantiated templates are included 611 # in the archive. 612 old_archive_cmds='$CC -xar -o $oldlib $oldobjs' 613 ;; 614 gcx) 615 # Green Hills C++ Compiler 616 archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' 617 618 # The C++ compiler must be used to create the archive. 619 old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs' 620 ;; 621 *) 622 # GNU C++ compiler with Solaris linker 623 if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then 624 if $CC --version | egrep -v '^2\.7' > /dev/null; then 625 archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' 626 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ 627 $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' 628 629 # Commands to make compiler produce verbose output that lists 630 # what "hidden" libraries, object files and flags are used when 631 # linking a shared library. 632 output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" 633 else 634 # g++ 2.7 appears to require `-G' NOT `-shared' on this 635 # platform. 636 archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' 637 archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ 638 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' 639 640 # Commands to make compiler produce verbose output that lists 641 # what "hidden" libraries, object files and flags are used when 642 # linking a shared library. 643 output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" 644 fi 645 646 hardcode_libdir_flag_spec='${wl}-R $wl$libdir' 647 fi 648 ;; 649 esac 650 ;; 651 tandem*) 652 case $cc_basename in 653 NCC) 654 # NonStop-UX NCC 3.20 655 # FIXME: insert proper C++ library support 656 ld_shlibs=no 657 ;; 658 *) 659 # FIXME: insert proper C++ library support 660 ld_shlibs=no 661 ;; 662 esac 663 ;; 664 unixware*) 665 # FIXME: insert proper C++ library support 666 ld_shlibs=no 667 ;; 668 vxworks*) 669 # FIXME: insert proper C++ library support 670 ld_shlibs=no 671 ;; 672 *) 673 # FIXME: insert proper C++ library support 674 ld_shlibs=no 675 ;; 676esac 677 678 679## Compiler Characteristics: PIC flags, static flags, etc 680 681# We don't use cached values here since only the C compiler 682# characteristics should be cached. 683ac_cv_prog_cc_pic= 684ac_cv_prog_cc_shlib= 685ac_cv_prog_cc_wl= 686ac_cv_prog_cc_static= 687ac_cv_prog_cc_no_builtin= 688ac_cv_prog_cc_can_build_shared=$can_build_shared 689 690ac_cv_prog_cc_pic_works= 691ac_cv_prog_cc_static_works= 692 693if test "$with_gcc" = yes; then 694 ac_cv_prog_cc_wl='-Wl,' 695 ac_cv_prog_cc_static='-static' 696 697 case $host_os in 698 aix*) 699 # All AIX code is PIC. 700 if test "$host_cpu" = ia64; then 701 # AIX 5 now supports IA64 processor 702 lt_cv_prog_cc_static='-Bstatic' 703 else 704 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' 705 fi 706 ;; 707 amigaos*) 708 # FIXME: we need at least 68020 code to build shared libraries, but 709 # adding the `-m68020' flag to GCC prevents building anything better, 710 # like `-m68040'. 711 ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' 712 ;; 713 beos* | irix5* | irix6* | osf3* | osf4* | osf5*) 714 # PIC is the default for these OSes. 715 ;; 716 cygwin* | mingw* | os2*) 717 # This hack is so that the source file can tell whether it is being 718 # built for inclusion in a dll (and should export symbols for example). 719 ac_cv_prog_cc_pic='-DDLL_EXPORT' 720 ;; 721 darwin* | rhapsody*) 722 # PIC is the default on this platform 723 # Common symbols not allowed in MH_DYLIB files 724 lt_cv_prog_cc_pic='-fno-common' 725 ;; 726 *djgpp*) 727 # DJGPP does not support shared libraries at all 728 ac_cv_prog_cc_pic= 729 ;; 730 sysv4*MP*) 731 if test -d /usr/nec; then 732 ac_cv_prog_cc_pic=-Kconform_pic 733 fi 734 ;; 735 *) 736 ac_cv_prog_cc_pic='-fPIC' 737 ;; 738 esac 739else 740 case $host_os in 741 aix4* | aix5*) 742 # All AIX code is PIC. 743 if test "$host_cpu" = ia64; then 744 # AIX 5 now supports IA64 processor 745 lt_cv_prog_cc_static='-Bstatic' 746 else 747 lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' 748 fi 749 ;; 750 chorus*) 751 case $cc_basename in 752 cxch68) 753 # Green Hills C++ Compiler 754 # 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" 755 ;; 756 esac 757 ;; 758 dgux*) 759 case $cc_basename in 760 ec++) 761 ac_cv_prog_cc_pic='-KPIC' 762 ;; 763 ghcx) 764 # Green Hills C++ Compiler 765 ac_cv_prog_cc_pic='-pic' 766 ;; 767 *) 768 ;; 769 esac 770 ;; 771 freebsd*) 772 # FreeBSD uses GNU C++ 773 ;; 774 hpux9* | hpux10* | hpux11*) 775 case $cc_basename in 776 CC) 777 ac_cv_prog_cc_wl='-Wl,' 778 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" 779 ac_cv_prog_cc_pic='+Z' 780 ;; 781 aCC) 782 ac_cv_prog_cc_wl='-Wl,' 783 ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" 784 ac_cv_prog_cc_pic='+Z' 785 ;; 786 *) 787 ;; 788 esac 789 ;; 790 irix5* | irix6*) 791 case $cc_basename in 792 CC) 793 ac_cv_prog_cc_wl='-Wl,' 794 ac_cv_prog_cc_static='-non_shared' 795 ac_cv_prog_cc_pic='-KPIC' 796 ;; 797 *) 798 ;; 799 esac 800 ;; 801 linux*) 802 case $cc_basename in 803 KCC) 804 # KAI C++ Compiler 805 ac_cv_prog_cc_wl='--backend -Wl,' 806 ac_cv_prog_cc_pic='-fPIC' 807 ;; 808 cxx) 809 # Compaq C++ 810 # Make sure the PIC flag is empty. It appears that all Alpha 811 # Linux and Compaq Tru64 Unix objects are PIC. 812 ac_cv_prog_cc_pic= 813 ac_cv_prog_cc_static='-non_shared' 814 ;; 815 *) 816 ;; 817 esac 818 ;; 819 lynxos*) 820 ;; 821 m88k*) 822 ;; 823 mvs*) 824 case $cc_basename in 825 cxx) 826 ac_cv_prog_cc_pic='-W c,exportall' 827 ;; 828 *) 829 ;; 830 esac 831 ;; 832 netbsd*) 833 ;; 834 osf3* | osf4* | osf5*) 835 case $cc_basename in 836 KCC) 837 ac_cv_prog_cc_wl='--backend -Wl,' 838 ;; 839 RCC) 840 # Rational C++ 2.4.1 841 ac_cv_prog_cc_pic='-pic' 842 ;; 843 cxx) 844 # Digital/Compaq C++ 845 ac_cv_prog_cc_wl='-Wl,' 846 # Make sure the PIC flag is empty. It appears that all Alpha 847 # Linux and Compaq Tru64 Unix objects are PIC. 848 ac_cv_prog_cc_pic= 849 ac_cv_prog_cc_static='-non_shared' 850 ;; 851 *) 852 ;; 853 esac 854 ;; 855 psos*) 856 ;; 857 sco*) 858 case $cc_basename in 859 CC) 860 ac_cv_prog_cc_pic='-fPIC' 861 ;; 862 *) 863 ;; 864 esac 865 ;; 866 solaris*) 867 case $cc_basename in 868 CC) 869 # Sun C++ 4.2, 5.x and Centerline C++ 870 ac_cv_prog_cc_pic='-KPIC' 871 ac_cv_prog_cc_static='-Bstatic' 872 ac_cv_prog_cc_wl='-Qoption ld ' 873 ;; 874 gcx) 875 # Green Hills C++ Compiler 876 ac_cv_prog_cc_pic='-PIC' 877 ;; 878 *) 879 ;; 880 esac 881 ;; 882 sunos4*) 883 case $cc_basename in 884 CC) 885 # Sun C++ 4.x 886 ac_cv_prog_cc_pic='-pic' 887 ac_cv_prog_cc_static='-Bstatic' 888 ;; 889 lcc) 890 # Lucid 891 ac_cv_prog_cc_pic='-pic' 892 ;; 893 *) 894 ;; 895 esac 896 ;; 897 tandem*) 898 case $cc_basename in 899 NCC) 900 # NonStop-UX NCC 3.20 901 ac_cv_prog_cc_pic='-KPIC' 902 ;; 903 *) 904 ;; 905 esac 906 ;; 907 unixware*) 908 ;; 909 vxworks*) 910 ;; 911 *) 912 ac_cv_prog_cc_can_build_shared=no 913 ;; 914 esac 915fi 916 917case "$host_os" in 918 # Platforms which do not suport PIC and -DPIC is meaningless 919 # on them: 920 *djgpp*) 921 ac_cv_prog_cc_pic= 922 ;; 923 *) 924 ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC" 925 ;; 926esac 927 928 929# Figure out "hidden" C++ library dependencies from verbose 930# compiler output whening linking a shared library. 931cat > conftest.$ac_ext <<EOF 932class Foo 933{ 934public: 935 Foo (void) { a = 0; } 936private: 937 int a; 938}; 939EOF 940 941 942if (eval $ac_compile) 2>&5; then 943 # Parse the compiler output and extract the necessary 944 # objects, libraries and library flags. 945 946 # Sentinel used to keep track of whether or not we are before 947 # the conftest object file. 948 pre_test_object_deps_done=no 949 950 for p in `eval $output_verbose_link_cmds`; do 951 952 case $p in 953 954 -L* | -R* | -l*) 955 # Some compilers place space between "-{L,R}" and the path. 956 # Remove the space. 957 if test $p = "-L" \ 958 || test $p = "-R"; then 959 prev=$p 960 continue 961 else 962 prev= 963 fi 964 965 if test "$pre_test_object_deps_done" = no; then 966 case $p in 967 -L* | -R*) 968 # Internal compiler library paths should come after those 969 # provided the user. The postdeps already come after the 970 # user supplied libs so there is no need to process them. 971 if test -z "$compiler_lib_search_path"; then 972 compiler_lib_search_path="${prev}${p}" 973 else 974 compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}" 975 fi 976 ;; 977 # The "-l" case would never come before the object being 978 # linked, so don't bother handling this case. 979 esac 980 else 981 add="${prev}${p}" 982 if test "x$remove_lgcc" = "xyes" ; then 983 case "$add" in 984 -lgcc ) add="" ;; 985 esac 986 fi 987 if test -n "$add" ; then 988 if test -z "$postdeps"; then 989 postdeps="$add" 990 else 991 postdeps="${postdeps} ${add}" 992 fi 993 fi 994 fi 995 ;; 996 997 *.$objext) 998 # This assumes that the test object file only shows up 999 # once in the compiler output. 1000 if test "$p" = "conftest.$objext"; then 1001 pre_test_object_deps_done=yes 1002 continue 1003 fi 1004 1005 if test "$pre_test_object_deps_done" = no; then 1006 if test -z "$predep_objects"; then 1007 predep_objects="$p" 1008 else 1009 predep_objects="$predep_objects $p" 1010 fi 1011 else 1012 if test -z "$postdep_objects"; then 1013 postdep_objects="$p" 1014 else 1015 postdep_objects="$postdep_objects $p" 1016 fi 1017 fi 1018 ;; 1019 1020 *) ;; # Ignore the rest. 1021 1022 esac 1023 done 1024 1025 # Clean up. 1026 rm -f a.out 1027else 1028 echo "ltcf-cxx.sh: error: problem compiling test program" 1029fi 1030 1031$rm -f confest.$objext 1032 1033if test "x$skip_need_lc_check" = "xyes" ; then 1034 need_lc=no 1035else 1036 case " $postdeps " in 1037 *" -lc "*) need_lc=no ;; 1038 *) need_lc=yes ;; 1039 esac 1040fi 1041