Diff

Differences From Artifact [269cb779e2]:

To Artifact [57e33ec54f]:


   235    235   		], [
   236    236   			LIBS="${SAVE_LIBS}"
   237    237   
   238    238   			$3
   239    239   		]
   240    240   	)
   241    241   ])
          242  +
          243  +AC_DEFUN(DC_DO_STATIC_LINK_LIB, [
          244  +	AC_MSG_CHECKING([for how to statically link to $1])
          245  +	 
          246  +	SAVELIBS="${LIBS}"
          247  +	staticlib=""
          248  +	found="0"
          249  +	dnl HP/UX uses -Wl,-a,archive -lstdc++ -Wl,-a,shared_archive
          250  +	dnl Linux and Solaris us -Wl,-Bstatic ... -Wl,-Bdynamic
          251  +	for trylink in "-Wl,-a,archive $2 -Wl,-a,shared_archive" "-Wl,-Bstatic $2 -Wl,-Bdynamic" "$2"; do
          252  +		LIBS="${SAVELIBS} ${trylink}"
          253  +	       
          254  +		AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [
          255  +			staticlib="${trylink}"
          256  +			found="1"
          257  +	       
          258  +			break
          259  +		])
          260  +	done   
          261  +	 
          262  +	if test "${found}" = "1"; then
          263  +		SAVELIBS=`echo "$SAVELIBS" | sed 's@ $2 @ @'`
          264  +		LIBS="${SAVELIBS} ${staticlib}"
          265  +
          266  +		AC_MSG_RESULT([${staticlib}])
          267  +
          268  +		AC_SUBST(LIBS)
          269  +
          270  +		$3
          271  +	else    
          272  +		LIBS="${SAVELIBS}"
          273  +		
          274  +		AC_MSG_RESULT([cant])
          275  +		
          276  +		$4
          277  +	fi
          278  +])
          279  +
          280  +AC_DEFUN(DC_DO_STATIC_LINK_LIBCXX, [
          281  +	dnl Sun Studio uses -lCstd -lCrun, most platforms use -lstdc++
          282  +	DC_DO_STATIC_LINK_LIB([C++ Library (Sun Studio)], [-lCstd -lCrun],, [
          283  +		DC_DO_STATIC_LINK_LIB([C++ Library (UNIX)], [-lstdc++])
          284  +	])
          285  +])
   242    286   
   243    287   AC_DEFUN(DC_FIND_TCLKIT_LIBS, [
   244    288   	DC_SETUP_TCL_PLAT_DEFS
   245    289   
   246    290   	WISH_CFLAGS=""
   247    291   
   248    292   	dnl We will need this for the Tcl project, which we will always have
   249    293   	DC_CHECK_FOR_WHOLE_ARCHIVE
   250    294   
   251         -	for proj in tcl tclvfs tk; do
          295  +	for proj in tcl tclvfs tk mk4tcl; do
   252    296   		AC_MSG_CHECKING([for libraries required for ${proj}])
   253    297   
   254    298   		libdir="../../../${proj}/inst"
   255    299   		libfiles="`find "${libdir}" -name '*.a' 2>/dev/null | tr "\n" ' '`"
   256    300   		libfilesnostub="`find "${libdir}" -name '*.a' 2>/dev/null | grep -v 'stub' | tr "\n" ' '`"
   257    301   
   258    302   		for libfile in ${libfiles}; do
................................................................................
   266    310   				DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $libfiles], [
   267    311   					libfiles="${libfiles}"
   268    312   				])
   269    313   			])
   270    314   		fi
   271    315   
   272    316   		if test "${proj}" = "mk4tcl"; then
   273         -			if test -n "$libfilesnostub"; then
          317  +			if test -n "$libfiles"; then
   274    318   				AC_DEFINE(KIT_INCLUDES_MK4TCL, [1], [Specify this if you link against mkt4tcl])
          319  +				DC_DO_STATIC_LINK_LIBCXX
   275    320   			fi
   276    321   		fi
   277    322   
   278    323   		if test "$proj" = "tk"; then
   279    324   			if test -n "$libfilesnostub"; then
   280    325   				DC_DO_TK
   281    326   				DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $libfilesnostub], [