os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/unix/tcl.m4
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/unix/tcl.m4	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,3230 @@
     1.4 +#------------------------------------------------------------------------
     1.5 +# SC_PATH_TCLCONFIG --
     1.6 +#
     1.7 +#	Locate the tclConfig.sh file and perform a sanity check on
     1.8 +#	the Tcl compile flags
     1.9 +#
    1.10 +# Arguments:
    1.11 +#	none
    1.12 +#
    1.13 +# Results:
    1.14 +#
    1.15 +#	Adds the following arguments to configure:
    1.16 +#		--with-tcl=...
    1.17 +#
    1.18 +#	Defines the following vars:
    1.19 +#		TCL_BIN_DIR	Full path to the directory containing
    1.20 +#				the tclConfig.sh file
    1.21 +#------------------------------------------------------------------------
    1.22 +
    1.23 +AC_DEFUN([SC_PATH_TCLCONFIG], [
    1.24 +    #
    1.25 +    # Ok, lets find the tcl configuration
    1.26 +    # First, look for one uninstalled.
    1.27 +    # the alternative search directory is invoked by --with-tcl
    1.28 +    #
    1.29 +
    1.30 +    if test x"${no_tcl}" = x ; then
    1.31 +	# we reset no_tcl in case something fails here
    1.32 +	no_tcl=true
    1.33 +	AC_ARG_WITH(tcl, [  --with-tcl              directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
    1.34 +	AC_MSG_CHECKING([for Tcl configuration])
    1.35 +	AC_CACHE_VAL(ac_cv_c_tclconfig,[
    1.36 +
    1.37 +	    # First check to see if --with-tcl was specified.
    1.38 +	    if test x"${with_tclconfig}" != x ; then
    1.39 +		if test -f "${with_tclconfig}/tclConfig.sh" ; then
    1.40 +		    ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
    1.41 +		else
    1.42 +		    AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
    1.43 +		fi
    1.44 +	    fi
    1.45 +
    1.46 +	    # then check for a private Tcl installation
    1.47 +	    if test x"${ac_cv_c_tclconfig}" = x ; then
    1.48 +		for i in \
    1.49 +			../tcl \
    1.50 +			`ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
    1.51 +			`ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
    1.52 +			`ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
    1.53 +			../../tcl \
    1.54 +			`ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
    1.55 +			`ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
    1.56 +			`ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
    1.57 +			../../../tcl \
    1.58 +			`ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
    1.59 +			`ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
    1.60 +			`ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
    1.61 +		    if test -f "$i/unix/tclConfig.sh" ; then
    1.62 +			ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
    1.63 +			break
    1.64 +		    fi
    1.65 +		done
    1.66 +	    fi
    1.67 +
    1.68 +	    # on Darwin, check in Framework installation locations
    1.69 +	    if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
    1.70 +		for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
    1.71 +			`ls -d /Library/Frameworks 2>/dev/null` \
    1.72 +			`ls -d /Network/Library/Frameworks 2>/dev/null` \
    1.73 +			`ls -d /System/Library/Frameworks 2>/dev/null` \
    1.74 +			; do
    1.75 +		    if test -f "$i/Tcl.framework/tclConfig.sh" ; then
    1.76 +			ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)`
    1.77 +			break
    1.78 +		    fi
    1.79 +		done
    1.80 +	    fi
    1.81 +
    1.82 +	    # check in a few common install locations
    1.83 +	    if test x"${ac_cv_c_tclconfig}" = x ; then
    1.84 +		for i in `ls -d ${libdir} 2>/dev/null` \
    1.85 +			`ls -d ${exec_prefix}/lib 2>/dev/null` \
    1.86 +			`ls -d ${prefix}/lib 2>/dev/null` \
    1.87 +			`ls -d /usr/local/lib 2>/dev/null` \
    1.88 +			`ls -d /usr/contrib/lib 2>/dev/null` \
    1.89 +			`ls -d /usr/lib 2>/dev/null` \
    1.90 +			; do
    1.91 +		    if test -f "$i/tclConfig.sh" ; then
    1.92 +			ac_cv_c_tclconfig=`(cd $i; pwd)`
    1.93 +			break
    1.94 +		    fi
    1.95 +		done
    1.96 +	    fi
    1.97 +
    1.98 +	    # check in a few other private locations
    1.99 +	    if test x"${ac_cv_c_tclconfig}" = x ; then
   1.100 +		for i in \
   1.101 +			${srcdir}/../tcl \
   1.102 +			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
   1.103 +			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
   1.104 +			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
   1.105 +		    if test -f "$i/unix/tclConfig.sh" ; then
   1.106 +		    ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
   1.107 +		    break
   1.108 +		fi
   1.109 +		done
   1.110 +	    fi
   1.111 +	])
   1.112 +
   1.113 +	if test x"${ac_cv_c_tclconfig}" = x ; then
   1.114 +	    TCL_BIN_DIR="# no Tcl configs found"
   1.115 +	    AC_MSG_WARN([Can't find Tcl configuration definitions])
   1.116 +	    exit 0
   1.117 +	else
   1.118 +	    no_tcl=
   1.119 +	    TCL_BIN_DIR=${ac_cv_c_tclconfig}
   1.120 +	    AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
   1.121 +	fi
   1.122 +    fi
   1.123 +])
   1.124 +
   1.125 +#------------------------------------------------------------------------
   1.126 +# SC_PATH_TKCONFIG --
   1.127 +#
   1.128 +#	Locate the tkConfig.sh file
   1.129 +#
   1.130 +# Arguments:
   1.131 +#	none
   1.132 +#
   1.133 +# Results:
   1.134 +#
   1.135 +#	Adds the following arguments to configure:
   1.136 +#		--with-tk=...
   1.137 +#
   1.138 +#	Defines the following vars:
   1.139 +#		TK_BIN_DIR	Full path to the directory containing
   1.140 +#				the tkConfig.sh file
   1.141 +#------------------------------------------------------------------------
   1.142 +
   1.143 +AC_DEFUN([SC_PATH_TKCONFIG], [
   1.144 +    #
   1.145 +    # Ok, lets find the tk configuration
   1.146 +    # First, look for one uninstalled.
   1.147 +    # the alternative search directory is invoked by --with-tk
   1.148 +    #
   1.149 +
   1.150 +    if test x"${no_tk}" = x ; then
   1.151 +	# we reset no_tk in case something fails here
   1.152 +	no_tk=true
   1.153 +	AC_ARG_WITH(tk, [  --with-tk               directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
   1.154 +	AC_MSG_CHECKING([for Tk configuration])
   1.155 +	AC_CACHE_VAL(ac_cv_c_tkconfig,[
   1.156 +
   1.157 +	    # First check to see if --with-tkconfig was specified.
   1.158 +	    if test x"${with_tkconfig}" != x ; then
   1.159 +		if test -f "${with_tkconfig}/tkConfig.sh" ; then
   1.160 +		    ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
   1.161 +		else
   1.162 +		    AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
   1.163 +		fi
   1.164 +	    fi
   1.165 +
   1.166 +	    # then check for a private Tk library
   1.167 +	    if test x"${ac_cv_c_tkconfig}" = x ; then
   1.168 +		for i in \
   1.169 +			../tk \
   1.170 +			`ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
   1.171 +			`ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
   1.172 +			`ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
   1.173 +			../../tk \
   1.174 +			`ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
   1.175 +			`ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
   1.176 +			`ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
   1.177 +			../../../tk \
   1.178 +			`ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
   1.179 +			`ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
   1.180 +			`ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
   1.181 +		    if test -f "$i/unix/tkConfig.sh" ; then
   1.182 +			ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
   1.183 +			break
   1.184 +		    fi
   1.185 +		done
   1.186 +	    fi
   1.187 +
   1.188 +	    # on Darwin, check in Framework installation locations
   1.189 +	    if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
   1.190 +		for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
   1.191 +			`ls -d /Library/Frameworks 2>/dev/null` \
   1.192 +			`ls -d /Network/Library/Frameworks 2>/dev/null` \
   1.193 +			`ls -d /System/Library/Frameworks 2>/dev/null` \
   1.194 +			; do
   1.195 +		    if test -f "$i/Tk.framework/tkConfig.sh" ; then
   1.196 +			ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)`
   1.197 +			break
   1.198 +		    fi
   1.199 +		done
   1.200 +	    fi
   1.201 +
   1.202 +	    # check in a few common install locations
   1.203 +	    if test x"${ac_cv_c_tkconfig}" = x ; then
   1.204 +		for i in `ls -d ${libdir} 2>/dev/null` \
   1.205 +			`ls -d ${exec_prefix}/lib 2>/dev/null` \
   1.206 +			`ls -d ${prefix}/lib 2>/dev/null` \
   1.207 +			`ls -d /usr/local/lib 2>/dev/null` \
   1.208 +			`ls -d /usr/contrib/lib 2>/dev/null` \
   1.209 +			`ls -d /usr/lib 2>/dev/null` \
   1.210 +			; do
   1.211 +		    if test -f "$i/tkConfig.sh" ; then
   1.212 +			ac_cv_c_tkconfig=`(cd $i; pwd)`
   1.213 +			break
   1.214 +		    fi
   1.215 +		done
   1.216 +	    fi
   1.217 +	    # check in a few other private locations
   1.218 +	    if test x"${ac_cv_c_tkconfig}" = x ; then
   1.219 +		for i in \
   1.220 +			${srcdir}/../tk \
   1.221 +			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
   1.222 +			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
   1.223 +			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
   1.224 +		    if test -f "$i/unix/tkConfig.sh" ; then
   1.225 +			ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
   1.226 +			break
   1.227 +		    fi
   1.228 +		done
   1.229 +	    fi
   1.230 +	])
   1.231 +
   1.232 +	if test x"${ac_cv_c_tkconfig}" = x ; then
   1.233 +	    TK_BIN_DIR="# no Tk configs found"
   1.234 +	    AC_MSG_WARN([Can't find Tk configuration definitions])
   1.235 +	    exit 0
   1.236 +	else
   1.237 +	    no_tk=
   1.238 +	    TK_BIN_DIR=${ac_cv_c_tkconfig}
   1.239 +	    AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
   1.240 +	fi
   1.241 +    fi
   1.242 +])
   1.243 +
   1.244 +#------------------------------------------------------------------------
   1.245 +# SC_LOAD_TCLCONFIG --
   1.246 +#
   1.247 +#	Load the tclConfig.sh file
   1.248 +#
   1.249 +# Arguments:
   1.250 +#	
   1.251 +#	Requires the following vars to be set:
   1.252 +#		TCL_BIN_DIR
   1.253 +#
   1.254 +# Results:
   1.255 +#
   1.256 +#	Subst the following vars:
   1.257 +#		TCL_BIN_DIR
   1.258 +#		TCL_SRC_DIR
   1.259 +#		TCL_LIB_FILE
   1.260 +#
   1.261 +#------------------------------------------------------------------------
   1.262 +
   1.263 +AC_DEFUN([SC_LOAD_TCLCONFIG], [
   1.264 +    AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
   1.265 +
   1.266 +    if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
   1.267 +        AC_MSG_RESULT([loading])
   1.268 +	. ${TCL_BIN_DIR}/tclConfig.sh
   1.269 +    else
   1.270 +        AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
   1.271 +    fi
   1.272 +
   1.273 +    # eval is required to do the TCL_DBGX substitution
   1.274 +    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
   1.275 +    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
   1.276 +
   1.277 +    # If the TCL_BIN_DIR is the build directory (not the install directory),
   1.278 +    # then set the common variable name to the value of the build variables.
   1.279 +    # For example, the variable TCL_LIB_SPEC will be set to the value
   1.280 +    # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
   1.281 +    # instead of TCL_BUILD_LIB_SPEC since it will work with both an
   1.282 +    # installed and uninstalled version of Tcl.
   1.283 +    if test -f ${TCL_BIN_DIR}/Makefile ; then
   1.284 +        TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
   1.285 +        TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
   1.286 +        TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
   1.287 +    elif test "`uname -s`" = "Darwin"; then
   1.288 +	# If Tcl was built as a framework, attempt to use the libraries
   1.289 +	# from the framework at the given location so that linking works
   1.290 +	# against Tcl.framework installed in an arbitary location.
   1.291 +	case ${TCL_DEFS} in
   1.292 +	    *TCL_FRAMEWORK*)
   1.293 +		if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then
   1.294 +		    for i in "`cd ${TCL_BIN_DIR}; pwd`" \
   1.295 +			     "`cd ${TCL_BIN_DIR}/../..; pwd`"; do
   1.296 +			if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
   1.297 +			    TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}"
   1.298 +			    break
   1.299 +			fi
   1.300 +		    done
   1.301 +		fi
   1.302 +		if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then
   1.303 +		    TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
   1.304 +		    TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
   1.305 +		fi
   1.306 +		;;
   1.307 +	esac
   1.308 +    fi
   1.309 +
   1.310 +    # eval is required to do the TCL_DBGX substitution
   1.311 +    eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
   1.312 +    eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
   1.313 +    eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
   1.314 +    eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
   1.315 +
   1.316 +    AC_SUBST(TCL_VERSION)
   1.317 +    AC_SUBST(TCL_PATCH_LEVEL)
   1.318 +    AC_SUBST(TCL_BIN_DIR)
   1.319 +    AC_SUBST(TCL_SRC_DIR)
   1.320 +
   1.321 +    AC_SUBST(TCL_LIB_FILE)
   1.322 +    AC_SUBST(TCL_LIB_FLAG)
   1.323 +    AC_SUBST(TCL_LIB_SPEC)
   1.324 +
   1.325 +    AC_SUBST(TCL_STUB_LIB_FILE)
   1.326 +    AC_SUBST(TCL_STUB_LIB_FLAG)
   1.327 +    AC_SUBST(TCL_STUB_LIB_SPEC)
   1.328 +])
   1.329 +
   1.330 +#------------------------------------------------------------------------
   1.331 +# SC_LOAD_TKCONFIG --
   1.332 +#
   1.333 +#	Load the tkConfig.sh file
   1.334 +#
   1.335 +# Arguments:
   1.336 +#	
   1.337 +#	Requires the following vars to be set:
   1.338 +#		TK_BIN_DIR
   1.339 +#
   1.340 +# Results:
   1.341 +#
   1.342 +#	Sets the following vars that should be in tkConfig.sh:
   1.343 +#		TK_BIN_DIR
   1.344 +#------------------------------------------------------------------------
   1.345 +
   1.346 +AC_DEFUN([SC_LOAD_TKCONFIG], [
   1.347 +    AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
   1.348 +
   1.349 +    if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
   1.350 +        AC_MSG_RESULT([loading])
   1.351 +	. ${TK_BIN_DIR}/tkConfig.sh
   1.352 +    else
   1.353 +        AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
   1.354 +    fi
   1.355 +
   1.356 +    # eval is required to do the TK_DBGX substitution
   1.357 +    eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
   1.358 +    eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
   1.359 +
   1.360 +    # If the TK_BIN_DIR is the build directory (not the install directory),
   1.361 +    # then set the common variable name to the value of the build variables.
   1.362 +    # For example, the variable TK_LIB_SPEC will be set to the value
   1.363 +    # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
   1.364 +    # instead of TK_BUILD_LIB_SPEC since it will work with both an
   1.365 +    # installed and uninstalled version of Tcl.
   1.366 +    if test -f ${TK_BIN_DIR}/Makefile ; then
   1.367 +        TK_LIB_SPEC=${TK_BUILD_LIB_SPEC}
   1.368 +        TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC}
   1.369 +        TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH}
   1.370 +    elif test "`uname -s`" = "Darwin"; then
   1.371 +	# If Tk was built as a framework, attempt to use the libraries
   1.372 +	# from the framework at the given location so that linking works
   1.373 +	# against Tk.framework installed in an arbitary location.
   1.374 +	case ${TK_DEFS} in
   1.375 +	    *TK_FRAMEWORK*)
   1.376 +		if test -f ${TK_BIN_DIR}/${TK_LIB_FILE}; then
   1.377 +		    for i in "`cd ${TK_BIN_DIR}; pwd`" \
   1.378 +			     "`cd ${TK_BIN_DIR}/../..; pwd`"; do
   1.379 +			if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
   1.380 +			    TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}"
   1.381 +			    break
   1.382 +			fi
   1.383 +		    done
   1.384 +		fi
   1.385 +		if test -f ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}; then
   1.386 +		    TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}"
   1.387 +		    TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
   1.388 +		fi
   1.389 +		;;
   1.390 +	esac
   1.391 +    fi
   1.392 +
   1.393 +    # eval is required to do the TK_DBGX substitution
   1.394 +    eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
   1.395 +    eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
   1.396 +    eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
   1.397 +    eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
   1.398 +
   1.399 +    AC_SUBST(TK_VERSION)
   1.400 +    AC_SUBST(TK_BIN_DIR)
   1.401 +    AC_SUBST(TK_SRC_DIR)
   1.402 +
   1.403 +    AC_SUBST(TK_LIB_FILE)
   1.404 +    AC_SUBST(TK_LIB_FLAG)
   1.405 +    AC_SUBST(TK_LIB_SPEC)
   1.406 +
   1.407 +    AC_SUBST(TK_STUB_LIB_FILE)
   1.408 +    AC_SUBST(TK_STUB_LIB_FLAG)
   1.409 +    AC_SUBST(TK_STUB_LIB_SPEC)
   1.410 +])
   1.411 +
   1.412 +#------------------------------------------------------------------------
   1.413 +# SC_PROG_TCLSH
   1.414 +#	Locate a tclsh shell installed on the system path. This macro
   1.415 +#	will only find a Tcl shell that already exists on the system.
   1.416 +#	It will not find a Tcl shell in the Tcl build directory or
   1.417 +#	a Tcl shell that has been installed from the Tcl build directory.
   1.418 +#	If a Tcl shell can't be located on the PATH, then TCLSH_PROG will
   1.419 +#	be set to "". Extensions should take care not to create Makefile
   1.420 +#	rules that are run by default and depend on TCLSH_PROG. An
   1.421 +#	extension can't assume that an executable Tcl shell exists at
   1.422 +#	build time.
   1.423 +#
   1.424 +# Arguments
   1.425 +#	none
   1.426 +#
   1.427 +# Results
   1.428 +#	Subst's the following values:
   1.429 +#		TCLSH_PROG
   1.430 +#------------------------------------------------------------------------
   1.431 +
   1.432 +AC_DEFUN([SC_PROG_TCLSH], [
   1.433 +    AC_MSG_CHECKING([for tclsh])
   1.434 +    AC_CACHE_VAL(ac_cv_path_tclsh, [
   1.435 +	search_path=`echo ${PATH} | sed -e 's/:/ /g'`
   1.436 +	for dir in $search_path ; do
   1.437 +	    for j in `ls -r $dir/tclsh[[8-9]]* 2> /dev/null` \
   1.438 +		    `ls -r $dir/tclsh* 2> /dev/null` ; do
   1.439 +		if test x"$ac_cv_path_tclsh" = x ; then
   1.440 +		    if test -f "$j" ; then
   1.441 +			ac_cv_path_tclsh=$j
   1.442 +			break
   1.443 +		    fi
   1.444 +		fi
   1.445 +	    done
   1.446 +	done
   1.447 +    ])
   1.448 +
   1.449 +    if test -f "$ac_cv_path_tclsh" ; then
   1.450 +	TCLSH_PROG="$ac_cv_path_tclsh"
   1.451 +	AC_MSG_RESULT([$TCLSH_PROG])
   1.452 +    else
   1.453 +	# It is not an error if an installed version of Tcl can't be located.
   1.454 +	TCLSH_PROG=""
   1.455 +	AC_MSG_RESULT([No tclsh found on PATH])
   1.456 +    fi
   1.457 +    AC_SUBST(TCLSH_PROG)
   1.458 +])
   1.459 +
   1.460 +#------------------------------------------------------------------------
   1.461 +# SC_BUILD_TCLSH
   1.462 +#	Determine the fully qualified path name of the tclsh executable
   1.463 +#	in the Tcl build directory. This macro will correctly determine
   1.464 +#	the name of the tclsh executable even if tclsh has not yet
   1.465 +#	been built in the build directory. The build tclsh must be used
   1.466 +#	when running tests from an extension build directory. It is not
   1.467 +#	correct to use the TCLSH_PROG in cases like this.
   1.468 +#
   1.469 +# Arguments
   1.470 +#	none
   1.471 +#
   1.472 +# Results
   1.473 +#	Subst's the following values:
   1.474 +#		BUILD_TCLSH
   1.475 +#------------------------------------------------------------------------
   1.476 +
   1.477 +AC_DEFUN([SC_BUILD_TCLSH], [
   1.478 +    AC_MSG_CHECKING([for tclsh in Tcl build directory])
   1.479 +    BUILD_TCLSH=${TCL_BIN_DIR}/tclsh
   1.480 +    AC_MSG_RESULT([$BUILD_TCLSH])
   1.481 +    AC_SUBST(BUILD_TCLSH)
   1.482 +])
   1.483 +
   1.484 +#------------------------------------------------------------------------
   1.485 +# SC_ENABLE_SHARED --
   1.486 +#
   1.487 +#	Allows the building of shared libraries
   1.488 +#
   1.489 +# Arguments:
   1.490 +#	none
   1.491 +#	
   1.492 +# Results:
   1.493 +#
   1.494 +#	Adds the following arguments to configure:
   1.495 +#		--enable-shared=yes|no
   1.496 +#
   1.497 +#	Defines the following vars:
   1.498 +#		STATIC_BUILD	Used for building import/export libraries
   1.499 +#				on Windows.
   1.500 +#
   1.501 +#	Sets the following vars:
   1.502 +#		SHARED_BUILD	Value of 1 or 0
   1.503 +#------------------------------------------------------------------------
   1.504 +
   1.505 +AC_DEFUN([SC_ENABLE_SHARED], [
   1.506 +    AC_MSG_CHECKING([how to build libraries])
   1.507 +    AC_ARG_ENABLE(shared,
   1.508 +	[  --enable-shared         build and link with shared libraries [--enable-shared]],
   1.509 +	[tcl_ok=$enableval], [tcl_ok=yes])
   1.510 +
   1.511 +    if test "${enable_shared+set}" = set; then
   1.512 +	enableval="$enable_shared"
   1.513 +	tcl_ok=$enableval
   1.514 +    else
   1.515 +	tcl_ok=yes
   1.516 +    fi
   1.517 +
   1.518 +    if test "$tcl_ok" = "yes" ; then
   1.519 +	AC_MSG_RESULT([shared])
   1.520 +	SHARED_BUILD=1
   1.521 +    else
   1.522 +	AC_MSG_RESULT([static])
   1.523 +	SHARED_BUILD=0
   1.524 +	AC_DEFINE(STATIC_BUILD)
   1.525 +    fi
   1.526 +])
   1.527 +
   1.528 +#------------------------------------------------------------------------
   1.529 +# SC_ENABLE_FRAMEWORK --
   1.530 +#
   1.531 +#	Allows the building of shared libraries into frameworks
   1.532 +#
   1.533 +# Arguments:
   1.534 +#	none
   1.535 +#	
   1.536 +# Results:
   1.537 +#
   1.538 +#	Adds the following arguments to configure:
   1.539 +#		--enable-framework=yes|no
   1.540 +#
   1.541 +#	Sets the following vars:
   1.542 +#		FRAMEWORK_BUILD	Value of 1 or 0
   1.543 +#------------------------------------------------------------------------
   1.544 +
   1.545 +AC_DEFUN([SC_ENABLE_FRAMEWORK], [
   1.546 +    if test "`uname -s`" = "Darwin" ; then
   1.547 +	AC_MSG_CHECKING([how to package libraries])
   1.548 +	AC_ARG_ENABLE(framework,
   1.549 +	    [  --enable-framework      package shared libraries in MacOSX frameworks [--disable-framework]],
   1.550 +	    [enable_framework=$enableval], [enable_framework=no])
   1.551 +	if test $enable_framework = yes; then
   1.552 +	    if test $SHARED_BUILD = 0; then
   1.553 +		AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes])
   1.554 +		enable_framework=no
   1.555 +	    fi
   1.556 +	    if test $tcl_corefoundation = no; then
   1.557 +		AC_MSG_WARN([Frameworks can only be used when CoreFoundation is available])
   1.558 +		enable_framework=no
   1.559 +	    fi
   1.560 +	fi
   1.561 +	if test $enable_framework = yes; then
   1.562 +	    AC_MSG_RESULT([framework])
   1.563 +	    FRAMEWORK_BUILD=1
   1.564 +	else
   1.565 +	    if test $SHARED_BUILD = 1; then
   1.566 +		AC_MSG_RESULT([shared library])
   1.567 +	    else
   1.568 +		AC_MSG_RESULT([static library])
   1.569 +	    fi
   1.570 +	    FRAMEWORK_BUILD=0
   1.571 +	fi
   1.572 +    fi
   1.573 +])
   1.574 +
   1.575 +#------------------------------------------------------------------------
   1.576 +# SC_ENABLE_THREADS --
   1.577 +#
   1.578 +#	Specify if thread support should be enabled.  TCL_THREADS is
   1.579 +#	checked so that if you are compiling an extension against a
   1.580 +#	threaded core, your extension must be compiled threaded as well.
   1.581 +#
   1.582 +# Arguments:
   1.583 +#	none
   1.584 +#	
   1.585 +# Results:
   1.586 +#
   1.587 +#	Adds the following arguments to configure:
   1.588 +#		--enable-threads
   1.589 +#
   1.590 +#	Sets the following vars:
   1.591 +#		THREADS_LIBS	Thread library(s)
   1.592 +#
   1.593 +#	Defines the following vars:
   1.594 +#		TCL_THREADS
   1.595 +#		_REENTRANT
   1.596 +#		_THREAD_SAFE
   1.597 +#
   1.598 +#------------------------------------------------------------------------
   1.599 +
   1.600 +AC_DEFUN([SC_ENABLE_THREADS], [
   1.601 +    AC_ARG_ENABLE(threads, [  --enable-threads        build with threads],
   1.602 +	[tcl_ok=$enableval], [tcl_ok=no])
   1.603 +
   1.604 +    if test "${TCL_THREADS}" = 1; then
   1.605 +	tcl_threaded_core=1;
   1.606 +    fi
   1.607 +
   1.608 +    if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
   1.609 +	TCL_THREADS=1
   1.610 +	# USE_THREAD_ALLOC tells us to try the special thread-based
   1.611 +	# allocator that significantly reduces lock contention
   1.612 +	AC_DEFINE(USE_THREAD_ALLOC)
   1.613 +	AC_DEFINE(_REENTRANT)
   1.614 +	if test "`uname -s`" = "SunOS" ; then
   1.615 +	    AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
   1.616 +	fi
   1.617 +	AC_DEFINE(_THREAD_SAFE)
   1.618 +	AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
   1.619 +	if test "$tcl_ok" = "no"; then
   1.620 +	    # Check a little harder for __pthread_mutex_init in the same
   1.621 +	    # library, as some systems hide it there until pthread.h is
   1.622 +	    # defined.  We could alternatively do an AC_TRY_COMPILE with
   1.623 +	    # pthread.h, but that will work with libpthread really doesn't
   1.624 +	    # exist, like AIX 4.2.  [Bug: 4359]
   1.625 +	    AC_CHECK_LIB(pthread, __pthread_mutex_init,
   1.626 +		tcl_ok=yes, tcl_ok=no)
   1.627 +	fi
   1.628 +
   1.629 +	if test "$tcl_ok" = "yes"; then
   1.630 +	    # The space is needed
   1.631 +	    THREADS_LIBS=" -lpthread"
   1.632 +	else
   1.633 +	    AC_CHECK_LIB(pthreads, pthread_mutex_init,
   1.634 +		tcl_ok=yes, tcl_ok=no)
   1.635 +	    if test "$tcl_ok" = "yes"; then
   1.636 +		# The space is needed
   1.637 +		THREADS_LIBS=" -lpthreads"
   1.638 +	    else
   1.639 +		AC_CHECK_LIB(c, pthread_mutex_init,
   1.640 +		    tcl_ok=yes, tcl_ok=no)
   1.641 +		if test "$tcl_ok" = "no"; then
   1.642 +		    AC_CHECK_LIB(c_r, pthread_mutex_init,
   1.643 +			tcl_ok=yes, tcl_ok=no)
   1.644 +		    if test "$tcl_ok" = "yes"; then
   1.645 +			# The space is needed
   1.646 +			THREADS_LIBS=" -pthread"
   1.647 +		    else
   1.648 +			TCL_THREADS=0
   1.649 +			AC_MSG_WARN([Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...])
   1.650 +		    fi
   1.651 +		fi
   1.652 +	    fi
   1.653 +	fi
   1.654 +
   1.655 +	# Does the pthread-implementation provide
   1.656 +	# 'pthread_attr_setstacksize' ?
   1.657 +
   1.658 +	ac_saved_libs=$LIBS
   1.659 +	LIBS="$LIBS $THREADS_LIBS"
   1.660 +	AC_CHECK_FUNCS(pthread_attr_setstacksize)
   1.661 +	AC_CHECK_FUNCS(pthread_atfork)
   1.662 +	LIBS=$ac_saved_libs
   1.663 +    else
   1.664 +	TCL_THREADS=0
   1.665 +    fi
   1.666 +    # Do checking message here to not mess up interleaved configure output
   1.667 +    AC_MSG_CHECKING([for building with threads])
   1.668 +    if test "${TCL_THREADS}" = 1; then
   1.669 +	AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
   1.670 +	if test "${tcl_threaded_core}" = 1; then
   1.671 +	    AC_MSG_RESULT([yes (threaded core)])
   1.672 +	else
   1.673 +	    AC_MSG_RESULT([yes])
   1.674 +	fi
   1.675 +    else
   1.676 +	AC_MSG_RESULT([no (default)])
   1.677 +    fi
   1.678 +
   1.679 +    AC_SUBST(TCL_THREADS)
   1.680 +])
   1.681 +
   1.682 +#------------------------------------------------------------------------
   1.683 +# SC_ENABLE_SYMBOLS --
   1.684 +#
   1.685 +#	Specify if debugging symbols should be used.
   1.686 +#	Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
   1.687 +#	can also be enabled.
   1.688 +#
   1.689 +# Arguments:
   1.690 +#	none
   1.691 +#	
   1.692 +#	Requires the following vars to be set in the Makefile:
   1.693 +#		CFLAGS_DEBUG
   1.694 +#		CFLAGS_OPTIMIZE
   1.695 +#		LDFLAGS_DEBUG
   1.696 +#		LDFLAGS_OPTIMIZE
   1.697 +#	
   1.698 +# Results:
   1.699 +#
   1.700 +#	Adds the following arguments to configure:
   1.701 +#		--enable-symbols
   1.702 +#
   1.703 +#	Defines the following vars:
   1.704 +#		CFLAGS_DEFAULT	Sets to $(CFLAGS_DEBUG) if true
   1.705 +#				Sets to $(CFLAGS_OPTIMIZE) if false
   1.706 +#		LDFLAGS_DEFAULT	Sets to $(LDFLAGS_DEBUG) if true
   1.707 +#				Sets to $(LDFLAGS_OPTIMIZE) if false
   1.708 +#		DBGX		Debug library extension
   1.709 +#
   1.710 +#------------------------------------------------------------------------
   1.711 +
   1.712 +AC_DEFUN([SC_ENABLE_SYMBOLS], [
   1.713 +    AC_MSG_CHECKING([for build with symbols])
   1.714 +    AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols [--disable-symbols]],    [tcl_ok=$enableval], [tcl_ok=no])
   1.715 +# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
   1.716 +    if test "$tcl_ok" = "no"; then
   1.717 +	CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
   1.718 +	LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
   1.719 +	DBGX=""
   1.720 +	AC_MSG_RESULT([no])
   1.721 +    else
   1.722 +	CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
   1.723 +	LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
   1.724 +	DBGX=g
   1.725 +	if test "$tcl_ok" = "yes"; then
   1.726 +	    AC_MSG_RESULT([yes (standard debugging)])
   1.727 +	fi
   1.728 +    fi
   1.729 +    AC_SUBST(CFLAGS_DEFAULT)
   1.730 +    AC_SUBST(LDFLAGS_DEFAULT)
   1.731 +
   1.732 +    if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
   1.733 +	AC_DEFINE(TCL_MEM_DEBUG)
   1.734 +    fi
   1.735 +
   1.736 +    if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
   1.737 +	AC_DEFINE(TCL_COMPILE_DEBUG)
   1.738 +	AC_DEFINE(TCL_COMPILE_STATS)
   1.739 +    fi
   1.740 +
   1.741 +    if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
   1.742 +	if test "$tcl_ok" = "all"; then
   1.743 +	    AC_MSG_RESULT([enabled symbols mem compile debugging])
   1.744 +	else
   1.745 +	    AC_MSG_RESULT([enabled $tcl_ok debugging])
   1.746 +	fi
   1.747 +    fi
   1.748 +])
   1.749 +
   1.750 +#------------------------------------------------------------------------
   1.751 +# SC_ENABLE_LANGINFO --
   1.752 +#
   1.753 +#	Allows use of modern nl_langinfo check for better l10n.
   1.754 +#	This is only relevant for Unix.
   1.755 +#
   1.756 +# Arguments:
   1.757 +#	none
   1.758 +#	
   1.759 +# Results:
   1.760 +#
   1.761 +#	Adds the following arguments to configure:
   1.762 +#		--enable-langinfo=yes|no (default is yes)
   1.763 +#
   1.764 +#	Defines the following vars:
   1.765 +#		HAVE_LANGINFO	Triggers use of nl_langinfo if defined.
   1.766 +#
   1.767 +#------------------------------------------------------------------------
   1.768 +
   1.769 +AC_DEFUN([SC_ENABLE_LANGINFO], [
   1.770 +    AC_ARG_ENABLE(langinfo,
   1.771 +	[  --enable-langinfo	  use nl_langinfo if possible to determine
   1.772 +			  encoding at startup, otherwise use old heuristic],
   1.773 +	[langinfo_ok=$enableval], [langinfo_ok=yes])
   1.774 +
   1.775 +    HAVE_LANGINFO=0
   1.776 +    if test "$langinfo_ok" = "yes"; then
   1.777 +	AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
   1.778 +    fi
   1.779 +    AC_MSG_CHECKING([whether to use nl_langinfo])
   1.780 +    if test "$langinfo_ok" = "yes"; then
   1.781 +	AC_CACHE_VAL(tcl_cv_langinfo_h, [
   1.782 +	    AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
   1.783 +		    [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
   1.784 +	AC_MSG_RESULT([$tcl_cv_langinfo_h])
   1.785 +	if test $tcl_cv_langinfo_h = yes; then
   1.786 +	    AC_DEFINE(HAVE_LANGINFO)
   1.787 +	fi
   1.788 +    else 
   1.789 +	AC_MSG_RESULT([$langinfo_ok])
   1.790 +    fi
   1.791 +])
   1.792 +
   1.793 +#--------------------------------------------------------------------
   1.794 +# SC_CONFIG_MANPAGES
   1.795 +#	
   1.796 +#	Decide whether to use symlinks for linking the manpages,
   1.797 +#	whether to compress the manpages after installation, and
   1.798 +#	whether to add a package name suffix to the installed
   1.799 +#	manpages to avoidfile name clashes.
   1.800 +#	If compression is enabled also find out what file name suffix
   1.801 +#	the given compression program is using.
   1.802 +#
   1.803 +# Arguments:
   1.804 +#	none
   1.805 +#
   1.806 +# Results:
   1.807 +#
   1.808 +#	Adds the following arguments to configure:
   1.809 +#		--enable-man-symlinks
   1.810 +#		--enable-man-compression=PROG
   1.811 +#		--enable-man-suffix[=STRING]
   1.812 +#
   1.813 +#	Defines the following variable:
   1.814 +#
   1.815 +#	MAN_FLAGS -	The apropriate flags for installManPage
   1.816 +#			according to the user's selection.
   1.817 +#
   1.818 +#--------------------------------------------------------------------
   1.819 +
   1.820 +AC_DEFUN([SC_CONFIG_MANPAGES], [
   1.821 +    AC_MSG_CHECKING([whether to use symlinks for manpages])
   1.822 +    AC_ARG_ENABLE(man-symlinks,
   1.823 +	    [  --enable-man-symlinks   use symlinks for the manpages],
   1.824 +	test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks",
   1.825 +	enableval="no")
   1.826 +    AC_MSG_RESULT([$enableval])
   1.827 +
   1.828 +    AC_MSG_CHECKING([whether to compress the manpages])
   1.829 +    AC_ARG_ENABLE(man-compression,
   1.830 +	    [  --enable-man-compression=PROG
   1.831 +		      compress the manpages with PROG],
   1.832 +	[case $enableval in
   1.833 +	    yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
   1.834 +	    no)  ;;
   1.835 +	    *)   MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
   1.836 +	esac],
   1.837 +	enableval="no")
   1.838 +    AC_MSG_RESULT([$enableval])
   1.839 +    if test "$enableval" != "no"; then
   1.840 +	AC_MSG_CHECKING([for compressed file suffix])
   1.841 +	touch TeST
   1.842 +	$enableval TeST
   1.843 +	Z=`ls TeST* | sed 's/^....//'`
   1.844 +	rm -f TeST*
   1.845 +	MAN_FLAGS="$MAN_FLAGS --extension $Z"
   1.846 +	AC_MSG_RESULT([$Z])
   1.847 +    fi
   1.848 +
   1.849 +    AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
   1.850 +    AC_ARG_ENABLE(man-suffix,
   1.851 +	    [  --enable-man-suffix=STRING
   1.852 +		      use STRING as a suffix to manpage file names
   1.853 +		      (default: $1)],
   1.854 +	[case $enableval in
   1.855 +	    yes) enableval="$1" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
   1.856 +	    no)  ;;
   1.857 +	    *)   MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
   1.858 +	esac],
   1.859 +	enableval="no")
   1.860 +    AC_MSG_RESULT([$enableval])
   1.861 +
   1.862 +    AC_SUBST(MAN_FLAGS)
   1.863 +])
   1.864 +
   1.865 +#--------------------------------------------------------------------
   1.866 +# SC_CONFIG_SYSTEM
   1.867 +#
   1.868 +#	Determine what the system is (some things cannot be easily checked
   1.869 +#	on a feature-driven basis, alas). This can usually be done via the
   1.870 +#	"uname" command, but there are a few systems, like Next, where
   1.871 +#	this doesn't work.
   1.872 +#
   1.873 +# Arguments:
   1.874 +#	none
   1.875 +#
   1.876 +# Results:
   1.877 +#	Defines the following var:
   1.878 +#
   1.879 +#	system -	System/platform/version identification code.
   1.880 +#
   1.881 +#--------------------------------------------------------------------
   1.882 +
   1.883 +AC_DEFUN([SC_CONFIG_SYSTEM], [
   1.884 +    AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
   1.885 +	if test -f /usr/lib/NextStep/software_version; then
   1.886 +	    tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
   1.887 +	else
   1.888 +	    tcl_cv_sys_version=`uname -s`-`uname -r`
   1.889 +	    if test "$?" -ne 0 ; then
   1.890 +		AC_MSG_WARN([can't find uname command])
   1.891 +		tcl_cv_sys_version=unknown
   1.892 +	    else
   1.893 +		# Special check for weird MP-RAS system (uname returns weird
   1.894 +		# results, and the version is kept in special file).
   1.895 +
   1.896 +		if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
   1.897 +		    tcl_cv_sys_version=MP-RAS-`awk '{print [$]3}' /etc/.relid`
   1.898 +		fi
   1.899 +		if test "`uname -s`" = "AIX" ; then
   1.900 +		    tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
   1.901 +		fi
   1.902 +	    fi
   1.903 +	fi
   1.904 +    ])
   1.905 +    system=$tcl_cv_sys_version
   1.906 +])
   1.907 +
   1.908 +#--------------------------------------------------------------------
   1.909 +# SC_CONFIG_CFLAGS
   1.910 +#
   1.911 +#	Try to determine the proper flags to pass to the compiler
   1.912 +#	for building shared libraries and other such nonsense.
   1.913 +#
   1.914 +# Arguments:
   1.915 +#	none
   1.916 +#
   1.917 +# Results:
   1.918 +#
   1.919 +#	Defines and substitutes the following vars:
   1.920 +#
   1.921 +#       DL_OBJS -       Name of the object file that implements dynamic
   1.922 +#                       loading for Tcl on this system.
   1.923 +#       DL_LIBS -       Library file(s) to include in tclsh and other base
   1.924 +#                       applications in order for the "load" command to work.
   1.925 +#       LDFLAGS -      Flags to pass to the compiler when linking object
   1.926 +#                       files into an executable application binary such
   1.927 +#                       as tclsh.
   1.928 +#       LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
   1.929 +#                       that tell the run-time dynamic linker where to look
   1.930 +#                       for shared libraries such as libtcl.so.  Depends on
   1.931 +#                       the variable LIB_RUNTIME_DIR in the Makefile. Could
   1.932 +#                       be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
   1.933 +#       CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
   1.934 +#                       that tell the run-time dynamic linker where to look
   1.935 +#                       for shared libraries such as libtcl.so.  Depends on
   1.936 +#                       the variable LIB_RUNTIME_DIR in the Makefile.
   1.937 +#       MAKE_LIB -      Command to execute to build the a library;
   1.938 +#                       differs when building shared or static.
   1.939 +#       MAKE_STUB_LIB -
   1.940 +#                       Command to execute to build a stub library.
   1.941 +#       INSTALL_LIB -   Command to execute to install a library;
   1.942 +#                       differs when building shared or static.
   1.943 +#       INSTALL_STUB_LIB -
   1.944 +#                       Command to execute to install a stub library.
   1.945 +#       STLIB_LD -      Base command to use for combining object files
   1.946 +#                       into a static library.
   1.947 +#       SHLIB_CFLAGS -  Flags to pass to cc when compiling the components
   1.948 +#                       of a shared library (may request position-independent
   1.949 +#                       code, among other things).
   1.950 +#       SHLIB_LD -      Base command to use for combining object files
   1.951 +#                       into a shared library.
   1.952 +#       SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
   1.953 +#                       creating shared libraries.  This symbol typically
   1.954 +#                       goes at the end of the "ld" commands that build
   1.955 +#                       shared libraries. The value of the symbol is
   1.956 +#                       "${LIBS}" if all of the dependent libraries should
   1.957 +#                       be specified when creating a shared library.  If
   1.958 +#                       dependent libraries should not be specified (as on
   1.959 +#                       SunOS 4.x, where they cause the link to fail, or in
   1.960 +#                       general if Tcl and Tk aren't themselves shared
   1.961 +#                       libraries), then this symbol has an empty string
   1.962 +#                       as its value.
   1.963 +#       SHLIB_SUFFIX -  Suffix to use for the names of dynamically loadable
   1.964 +#                       extensions.  An empty string means we don't know how
   1.965 +#                       to use shared libraries on this platform.
   1.966 +# TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
   1.967 +#  TK_SHLIB_LD_EXTRAS   for the build of Tcl and Tk, but not recorded in the
   1.968 +#                       tclConfig.sh, since they are only used for the build
   1.969 +#                       of Tcl and Tk. 
   1.970 +#                       Examples: MacOS X records the library version and
   1.971 +#                       compatibility version in the shared library.  But
   1.972 +#                       of course the Tcl version of this is only used for Tcl.
   1.973 +#       LIB_SUFFIX -    Specifies everything that comes after the "libfoo"
   1.974 +#                       in a static or shared library name, using the $VERSION variable
   1.975 +#                       to put the version in the right place.  This is used
   1.976 +#                       by platforms that need non-standard library names.
   1.977 +#                       Examples:  ${VERSION}.so.1.1 on NetBSD, since it needs
   1.978 +#                       to have a version after the .so, and ${VERSION}.a
   1.979 +#                       on AIX, since a shared library needs to have
   1.980 +#                       a .a extension whereas shared objects for loadable
   1.981 +#                       extensions have a .so extension.  Defaults to
   1.982 +#                       ${VERSION}${SHLIB_SUFFIX}.
   1.983 +#       TCL_NEEDS_EXP_FILE -
   1.984 +#                       1 means that an export file is needed to link to a
   1.985 +#                       shared library.
   1.986 +#       TCL_EXP_FILE -  The name of the installed export / import file which
   1.987 +#                       should be used to link to the Tcl shared library.
   1.988 +#                       Empty if Tcl is unshared.
   1.989 +#       TCL_BUILD_EXP_FILE -
   1.990 +#                       The name of the built export / import file which
   1.991 +#                       should be used to link to the Tcl shared library.
   1.992 +#                       Empty if Tcl is unshared.
   1.993 +#	CFLAGS_DEBUG -
   1.994 +#			Flags used when running the compiler in debug mode
   1.995 +#	CFLAGS_OPTIMIZE -
   1.996 +#			Flags used when running the compiler in optimize mode
   1.997 +#	CFLAGS -	Additional CFLAGS added as necessary (usually 64-bit)
   1.998 +#
   1.999 +#--------------------------------------------------------------------
  1.1000 +
  1.1001 +AC_DEFUN([SC_CONFIG_CFLAGS], [
  1.1002 +
  1.1003 +    # Step 0.a: Enable 64 bit support?
  1.1004 +
  1.1005 +    AC_MSG_CHECKING([if 64bit support is requested])
  1.1006 +    AC_ARG_ENABLE(64bit,[  --enable-64bit          enable 64bit support (where applicable)],
  1.1007 +	[do64bit=$enableval], [do64bit=no])
  1.1008 +    AC_MSG_RESULT([$do64bit])
  1.1009 +
  1.1010 +    # Step 0.b: Enable Solaris 64 bit VIS support?
  1.1011 +
  1.1012 +    AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
  1.1013 +    AC_ARG_ENABLE(64bit-vis,[  --enable-64bit-vis      enable 64bit Sparc VIS support],
  1.1014 +	[do64bitVIS=$enableval], [do64bitVIS=no])
  1.1015 +    AC_MSG_RESULT([$do64bitVIS])
  1.1016 +
  1.1017 +    if test "$do64bitVIS" = "yes"; then
  1.1018 +	# Force 64bit on with VIS
  1.1019 +	do64bit=yes
  1.1020 +    fi
  1.1021 +
  1.1022 +    # Step 1: set the variable "system" to hold the name and version number
  1.1023 +    # for the system.
  1.1024 +
  1.1025 +    SC_CONFIG_SYSTEM
  1.1026 +
  1.1027 +    # Step 2: check for existence of -ldl library.  This is needed because
  1.1028 +    # Linux can use either -ldl or -ldld for dynamic loading.
  1.1029 +
  1.1030 +    AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
  1.1031 +
  1.1032 +    # Require ranlib early so we can override it in special cases below.
  1.1033 +
  1.1034 +    AC_REQUIRE([AC_PROG_RANLIB])
  1.1035 +
  1.1036 +    # Step 3: set configuration options based on system name and version.
  1.1037 +
  1.1038 +    do64bit_ok=no
  1.1039 +    LDFLAGS_ORIG="$LDFLAGS"
  1.1040 +    TCL_EXPORT_FILE_SUFFIX=""
  1.1041 +    UNSHARED_LIB_SUFFIX=""
  1.1042 +    TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
  1.1043 +    ECHO_VERSION='`echo ${VERSION}`'
  1.1044 +    TCL_LIB_VERSIONS_OK=ok
  1.1045 +    CFLAGS_DEBUG=-g
  1.1046 +    CFLAGS_OPTIMIZE=-O
  1.1047 +    if test "$GCC" = "yes" ; then
  1.1048 +	CFLAGS_WARNING="-Wall -Wno-implicit-int -fno-strict-aliasing"
  1.1049 +    else
  1.1050 +	CFLAGS_WARNING=""
  1.1051 +    fi
  1.1052 +    TCL_NEEDS_EXP_FILE=0
  1.1053 +    TCL_BUILD_EXP_FILE=""
  1.1054 +    TCL_EXP_FILE=""
  1.1055 +dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
  1.1056 +dnl AC_CHECK_TOOL(AR, ar)
  1.1057 +    AC_CHECK_PROG(AR, ar, ar)
  1.1058 +    if test "${AR}" = "" ; then
  1.1059 +	AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
  1.1060 +    fi
  1.1061 +    STLIB_LD='${AR} cr'
  1.1062 +    LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
  1.1063 +    PLAT_OBJS=""
  1.1064 +    PLAT_SRCS=""
  1.1065 +    case $system in
  1.1066 +	AIX-*)
  1.1067 +	    if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
  1.1068 +		# AIX requires the _r compiler when gcc isn't being used
  1.1069 +		case "${CC}" in
  1.1070 +		    *_r)
  1.1071 +			# ok ...
  1.1072 +			;;
  1.1073 +		    *)
  1.1074 +			CC=${CC}_r
  1.1075 +			;;
  1.1076 +		esac
  1.1077 +		AC_MSG_RESULT([Using $CC for compiling with threads])
  1.1078 +	    fi
  1.1079 +	    LIBS="$LIBS -lc"
  1.1080 +	    SHLIB_CFLAGS=""
  1.1081 +	    # Note: need the LIBS below, otherwise Tk won't find Tcl's
  1.1082 +	    # symbols when dynamically loaded into tclsh.
  1.1083 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1084 +	    SHLIB_SUFFIX=".so"
  1.1085 +
  1.1086 +	    DL_OBJS="tclLoadDl.o"
  1.1087 +	    LD_LIBRARY_PATH_VAR="LIBPATH"
  1.1088 +
  1.1089 +	    # Check to enable 64-bit flags for compiler/linker on AIX 4+
  1.1090 +	    if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
  1.1091 +		if test "$GCC" = "yes" ; then
  1.1092 +		    AC_MSG_WARN([64bit mode not supported with GCC on $system])
  1.1093 +		else 
  1.1094 +		    do64bit_ok=yes
  1.1095 +		    CFLAGS="$CFLAGS -q64"
  1.1096 +		    LDFLAGS="$LDFLAGS -q64"
  1.1097 +		    RANLIB="${RANLIB} -X64"
  1.1098 +		    AR="${AR} -X64"
  1.1099 +		    SHLIB_LD_FLAGS="-b64"
  1.1100 +		fi
  1.1101 +	    fi
  1.1102 +
  1.1103 +	    if test "`uname -m`" = "ia64" ; then
  1.1104 +		# AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
  1.1105 +		SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  1.1106 +		# AIX-5 has dl* in libc.so
  1.1107 +		DL_LIBS=""
  1.1108 +		if test "$GCC" = "yes" ; then
  1.1109 +		    CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1.1110 +		else
  1.1111 +		    CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
  1.1112 +		fi
  1.1113 +		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  1.1114 +	    else
  1.1115 +		if test "$GCC" = "yes" ; then
  1.1116 +		    SHLIB_LD="gcc -shared"
  1.1117 +		else
  1.1118 +		    SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
  1.1119 +		fi
  1.1120 +		SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
  1.1121 +		DL_LIBS="-ldl"
  1.1122 +		CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1.1123 +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1124 +		TCL_NEEDS_EXP_FILE=1
  1.1125 +		TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
  1.1126 +	    fi
  1.1127 +
  1.1128 +	    # AIX v<=4.1 has some different flags than 4.2+
  1.1129 +	    if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
  1.1130 +		LIBOBJS="$LIBOBJS tclLoadAix.o"
  1.1131 +		DL_LIBS="-lld"
  1.1132 +	    fi
  1.1133 +
  1.1134 +	    # On AIX <=v4 systems, libbsd.a has to be linked in to support
  1.1135 +	    # non-blocking file IO.  This library has to be linked in after
  1.1136 +	    # the MATH_LIBS or it breaks the pow() function.  The way to
  1.1137 +	    # insure proper sequencing, is to add it to the tail of MATH_LIBS.
  1.1138 +	    # This library also supplies gettimeofday.
  1.1139 +	    #
  1.1140 +	    # AIX does not have a timezone field in struct tm. When the AIX
  1.1141 +	    # bsd library is used, the timezone global and the gettimeofday
  1.1142 +	    # methods are to be avoided for timezone deduction instead, we
  1.1143 +	    # deduce the timezone by comparing the localtime result on a
  1.1144 +	    # known GMT value.
  1.1145 +
  1.1146 +	    AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
  1.1147 +	    if test $libbsd = yes; then
  1.1148 +	    	MATH_LIBS="$MATH_LIBS -lbsd"
  1.1149 +	    	AC_DEFINE(USE_DELTA_FOR_TZ)
  1.1150 +	    fi
  1.1151 +	    ;;
  1.1152 +	BeOS*)
  1.1153 +	    SHLIB_CFLAGS="-fPIC"
  1.1154 +	    SHLIB_LD="${CC} -nostart"
  1.1155 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1156 +	    SHLIB_SUFFIX=".so"
  1.1157 +	    DL_OBJS="tclLoadDl.o"
  1.1158 +	    DL_LIBS="-ldl"
  1.1159 +
  1.1160 +	    #-----------------------------------------------------------
  1.1161 +	    # Check for inet_ntoa in -lbind, for BeOS (which also needs
  1.1162 +	    # -lsocket, even if the network functions are in -lnet which
  1.1163 +	    # is always linked to, for compatibility.
  1.1164 +	    #-----------------------------------------------------------
  1.1165 +	    AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
  1.1166 +	    ;;
  1.1167 +	BSD/OS-2.1*|BSD/OS-3*)
  1.1168 +	    SHLIB_CFLAGS=""
  1.1169 +	    SHLIB_LD="shlicc -r"
  1.1170 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1171 +	    SHLIB_SUFFIX=".so"
  1.1172 +	    DL_OBJS="tclLoadDl.o"
  1.1173 +	    DL_LIBS="-ldl"
  1.1174 +	    CC_SEARCH_FLAGS=""
  1.1175 +	    LD_SEARCH_FLAGS=""
  1.1176 +	    ;;
  1.1177 +	BSD/OS-4.*)
  1.1178 +	    SHLIB_CFLAGS="-export-dynamic -fPIC"
  1.1179 +	    SHLIB_LD="cc -shared"
  1.1180 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1181 +	    SHLIB_SUFFIX=".so"
  1.1182 +	    DL_OBJS="tclLoadDl.o"
  1.1183 +	    DL_LIBS="-ldl"
  1.1184 +	    LDFLAGS="$LDFLAGS -export-dynamic"
  1.1185 +	    CC_SEARCH_FLAGS=""
  1.1186 +	    LD_SEARCH_FLAGS=""
  1.1187 +	    ;;
  1.1188 +	dgux*)
  1.1189 +	    SHLIB_CFLAGS="-K PIC"
  1.1190 +	    SHLIB_LD="cc -G"
  1.1191 +	    SHLIB_LD_LIBS=""
  1.1192 +	    SHLIB_SUFFIX=".so"
  1.1193 +	    DL_OBJS="tclLoadDl.o"
  1.1194 +	    DL_LIBS="-ldl"
  1.1195 +	    CC_SEARCH_FLAGS=""
  1.1196 +	    LD_SEARCH_FLAGS=""
  1.1197 +	    ;;
  1.1198 +	HP-UX-*.11.*)
  1.1199 +	    # Use updated header definitions where possible
  1.1200 +	    AC_DEFINE(_XOPEN_SOURCE)          # Use the XOPEN network library
  1.1201 +	    AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library
  1.1202 +	    LIBS="$LIBS -lxnet"               # Use the XOPEN network library
  1.1203 +
  1.1204 +	    if test "`uname -m`" = "ia64" ; then
  1.1205 +		SHLIB_SUFFIX=".so"
  1.1206 +	    else
  1.1207 +		SHLIB_SUFFIX=".sl"
  1.1208 +	    fi
  1.1209 +	    AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
  1.1210 +	    if test "$tcl_ok" = yes; then
  1.1211 +		SHLIB_CFLAGS="+z"
  1.1212 +		SHLIB_LD="ld -b"
  1.1213 +		SHLIB_LD_LIBS='${LIBS}'
  1.1214 +		DL_OBJS="tclLoadShl.o"
  1.1215 +		DL_LIBS="-ldld"
  1.1216 +		LDFLAGS="$LDFLAGS -Wl,-E"
  1.1217 +		CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
  1.1218 +		LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
  1.1219 +		LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  1.1220 +	    fi
  1.1221 +	    if test "$GCC" = "yes" ; then
  1.1222 +		SHLIB_LD="gcc -shared"
  1.1223 +		SHLIB_LD_LIBS='${LIBS}'
  1.1224 +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1225 +	    fi
  1.1226 +
  1.1227 +	    # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
  1.1228 +	    #CFLAGS="$CFLAGS +DAportable"
  1.1229 +
  1.1230 +	    # Check to enable 64-bit flags for compiler/linker
  1.1231 +	    if test "$do64bit" = "yes" ; then
  1.1232 +		if test "$GCC" = "yes" ; then
  1.1233 +		    hpux_arch=`${CC} -dumpmachine`
  1.1234 +		    case $hpux_arch in
  1.1235 +			hppa64*)
  1.1236 +			    # 64-bit gcc in use.  Fix flags for GNU ld.
  1.1237 +			    do64bit_ok=yes
  1.1238 +			    SHLIB_LD="${CC} -shared"
  1.1239 +			    SHLIB_LD_LIBS='${LIBS}'
  1.1240 +			    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1.1241 +			    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1242 +			    ;;
  1.1243 +			*)
  1.1244 +			    AC_MSG_WARN([64bit mode not supported with GCC on $system])
  1.1245 +			    ;;
  1.1246 +		    esac
  1.1247 +		else
  1.1248 +		    do64bit_ok=yes
  1.1249 +		    CFLAGS="$CFLAGS +DD64"
  1.1250 +		    LDFLAGS="$LDFLAGS +DD64"
  1.1251 +		fi
  1.1252 +	    fi
  1.1253 +	    ;;
  1.1254 +	HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
  1.1255 +	    SHLIB_SUFFIX=".sl"
  1.1256 +	    AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
  1.1257 +	    if test "$tcl_ok" = yes; then
  1.1258 +		SHLIB_CFLAGS="+z"
  1.1259 +		SHLIB_LD="ld -b"
  1.1260 +		SHLIB_LD_LIBS=""
  1.1261 +		DL_OBJS="tclLoadShl.o"
  1.1262 +		DL_LIBS="-ldld"
  1.1263 +		LDFLAGS="$LDFLAGS -Wl,-E"
  1.1264 +		CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
  1.1265 +		LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
  1.1266 +		LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  1.1267 +	    fi
  1.1268 +	    ;;
  1.1269 +	IRIX-4.*)
  1.1270 +	    SHLIB_CFLAGS="-G 0"
  1.1271 +	    SHLIB_SUFFIX=".a"
  1.1272 +	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  1.1273 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1274 +	    DL_OBJS="tclLoadAout.o"
  1.1275 +	    DL_LIBS=""
  1.1276 +	    LDFLAGS="$LDFLAGS -Wl,-D,08000000"
  1.1277 +	    CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1.1278 +	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1279 +	    SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
  1.1280 +	    ;;
  1.1281 +	IRIX-5.*)
  1.1282 +	    SHLIB_CFLAGS=""
  1.1283 +	    SHLIB_LD="ld -shared -rdata_shared"
  1.1284 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1285 +	    SHLIB_SUFFIX=".so"
  1.1286 +	    DL_OBJS="tclLoadDl.o"
  1.1287 +	    DL_LIBS=""
  1.1288 +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1.1289 +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1.1290 +	    ;;
  1.1291 +	IRIX-6.*)
  1.1292 +	    SHLIB_CFLAGS=""
  1.1293 +	    SHLIB_LD="ld -n32 -shared -rdata_shared"
  1.1294 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1295 +	    SHLIB_SUFFIX=".so"
  1.1296 +	    DL_OBJS="tclLoadDl.o"
  1.1297 +	    DL_LIBS=""
  1.1298 +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1.1299 +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1.1300 +	    if test "$GCC" = "yes" ; then
  1.1301 +		CFLAGS="$CFLAGS -mabi=n32"
  1.1302 +		LDFLAGS="$LDFLAGS -mabi=n32"
  1.1303 +	    else
  1.1304 +		case $system in
  1.1305 +		    IRIX-6.3)
  1.1306 +			# Use to build 6.2 compatible binaries on 6.3.
  1.1307 +			CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
  1.1308 +			;;
  1.1309 +		    *)
  1.1310 +			CFLAGS="$CFLAGS -n32"
  1.1311 +			;;
  1.1312 +		esac
  1.1313 +		LDFLAGS="$LDFLAGS -n32"
  1.1314 +	    fi
  1.1315 +	    ;;
  1.1316 +	IRIX64-6.*)
  1.1317 +	    SHLIB_CFLAGS=""
  1.1318 +	    SHLIB_LD="ld -n32 -shared -rdata_shared"
  1.1319 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1320 +	    SHLIB_SUFFIX=".so"
  1.1321 +	    DL_OBJS="tclLoadDl.o"
  1.1322 +	    DL_LIBS=""
  1.1323 +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1.1324 +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1.1325 +
  1.1326 +	    # Check to enable 64-bit flags for compiler/linker
  1.1327 +
  1.1328 +	    if test "$do64bit" = "yes" ; then
  1.1329 +	        if test "$GCC" = "yes" ; then
  1.1330 +	            AC_MSG_WARN([64bit mode not supported by gcc])
  1.1331 +	        else
  1.1332 +	            do64bit_ok=yes
  1.1333 +	            SHLIB_LD="ld -64 -shared -rdata_shared"
  1.1334 +	            CFLAGS="$CFLAGS -64"
  1.1335 +	            LDFLAGS="$LDFLAGS -64"
  1.1336 +	        fi
  1.1337 +	    fi
  1.1338 +	    ;;
  1.1339 +	Linux*)
  1.1340 +	    SHLIB_CFLAGS="-fPIC"
  1.1341 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1342 +	    SHLIB_SUFFIX=".so"
  1.1343 +
  1.1344 +	    CFLAGS_OPTIMIZE=-O2
  1.1345 +	    # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings 
  1.1346 +	    # when you inline the string and math operations.  Turn this off to
  1.1347 +	    # get rid of the warnings.
  1.1348 +	    #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
  1.1349 +
  1.1350 +	    if test "$have_dl" = yes; then
  1.1351 +		SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
  1.1352 +		DL_OBJS="tclLoadDl.o"
  1.1353 +		DL_LIBS="-ldl"
  1.1354 +		LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  1.1355 +		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1.1356 +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1357 +	    else
  1.1358 +		AC_CHECK_HEADER(dld.h, [
  1.1359 +		    SHLIB_LD="ld -shared"
  1.1360 +		    DL_OBJS="tclLoadDld.o"
  1.1361 +		    DL_LIBS="-ldld"
  1.1362 +		    CC_SEARCH_FLAGS=""
  1.1363 +		    LD_SEARCH_FLAGS=""])
  1.1364 +	    fi
  1.1365 +	    if test "`uname -m`" = "alpha" ; then
  1.1366 +		CFLAGS="$CFLAGS -mieee"
  1.1367 +	    fi
  1.1368 +	    if test $do64bit = yes; then
  1.1369 +		AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
  1.1370 +		    hold_cflags=$CFLAGS
  1.1371 +		    CFLAGS="$CFLAGS -m64"
  1.1372 +		    AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
  1.1373 +		    CFLAGS=$hold_cflags])
  1.1374 +		if test $tcl_cv_cc_m64 = yes; then
  1.1375 +		    CFLAGS="$CFLAGS -m64"
  1.1376 +		    do64bit_ok=yes
  1.1377 +		fi
  1.1378 +	    fi
  1.1379 +
  1.1380 +	    # The combo of gcc + glibc has a bug related
  1.1381 +	    # to inlining of functions like strtod(). The
  1.1382 +	    # -fno-builtin flag should address this problem
  1.1383 +	    # but it does not work. The -fno-inline flag
  1.1384 +	    # is kind of overkill but it works.
  1.1385 +	    # Disable inlining only when one of the
  1.1386 +	    # files in compat/*.c is being linked in.
  1.1387 +	    if test x"${LIBOBJS}" != x ; then
  1.1388 +	        CFLAGS="$CFLAGS -fno-inline"
  1.1389 +	    fi
  1.1390 +
  1.1391 +	    # XIM peeking works under XFree86.
  1.1392 +	    AC_DEFINE(PEEK_XCLOSEIM)
  1.1393 +
  1.1394 +	    ;;
  1.1395 +	GNU*)
  1.1396 +	    SHLIB_CFLAGS="-fPIC"
  1.1397 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1398 +	    SHLIB_SUFFIX=".so"
  1.1399 +
  1.1400 +	    if test "$have_dl" = yes; then
  1.1401 +		SHLIB_LD="${CC} -shared"
  1.1402 +		DL_OBJS=""
  1.1403 +		DL_LIBS="-ldl"
  1.1404 +		LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  1.1405 +		CC_SEARCH_FLAGS=""
  1.1406 +		LD_SEARCH_FLAGS=""
  1.1407 +	    else
  1.1408 +		AC_CHECK_HEADER(dld.h, [
  1.1409 +		    SHLIB_LD="ld -shared"
  1.1410 +		    DL_OBJS=""
  1.1411 +		    DL_LIBS="-ldld"
  1.1412 +		    CC_SEARCH_FLAGS=""
  1.1413 +		    LD_SEARCH_FLAGS=""])
  1.1414 +	    fi
  1.1415 +	    if test "`uname -m`" = "alpha" ; then
  1.1416 +		CFLAGS="$CFLAGS -mieee"
  1.1417 +	    fi
  1.1418 +	    ;;
  1.1419 +	Lynx*)
  1.1420 +	    SHLIB_CFLAGS="-fPIC"
  1.1421 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1422 +	    SHLIB_SUFFIX=".so"
  1.1423 +	    CFLAGS_OPTIMIZE=-02
  1.1424 +	    SHLIB_LD="${CC} -shared "
  1.1425 +	    DL_OBJS="tclLoadDl.o"
  1.1426 +	    DL_LIBS="-mshared -ldl"
  1.1427 +	    LD_FLAGS="-Wl,--export-dynamic"
  1.1428 +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1.1429 +	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1.1430 +	    ;;
  1.1431 +	MP-RAS-02*)
  1.1432 +	    SHLIB_CFLAGS="-K PIC"
  1.1433 +	    SHLIB_LD="cc -G"
  1.1434 +	    SHLIB_LD_LIBS=""
  1.1435 +	    SHLIB_SUFFIX=".so"
  1.1436 +	    DL_OBJS="tclLoadDl.o"
  1.1437 +	    DL_LIBS="-ldl"
  1.1438 +	    CC_SEARCH_FLAGS=""
  1.1439 +	    LD_SEARCH_FLAGS=""
  1.1440 +	    ;;
  1.1441 +	MP-RAS-*)
  1.1442 +	    SHLIB_CFLAGS="-K PIC"
  1.1443 +	    SHLIB_LD="cc -G"
  1.1444 +	    SHLIB_LD_LIBS=""
  1.1445 +	    SHLIB_SUFFIX=".so"
  1.1446 +	    DL_OBJS="tclLoadDl.o"
  1.1447 +	    DL_LIBS="-ldl"
  1.1448 +	    LDFLAGS="$LDFLAGS -Wl,-Bexport"
  1.1449 +	    CC_SEARCH_FLAGS=""
  1.1450 +	    LD_SEARCH_FLAGS=""
  1.1451 +	    ;;
  1.1452 +	NetBSD-*|FreeBSD-[[1-2]].*)
  1.1453 +	    # Not available on all versions:  check for include file.
  1.1454 +	    AC_CHECK_HEADER(dlfcn.h, [
  1.1455 +		# NetBSD/SPARC needs -fPIC, -fpic will not do.
  1.1456 +		SHLIB_CFLAGS="-fPIC"
  1.1457 +		SHLIB_LD="ld -Bshareable -x"
  1.1458 +		SHLIB_LD_LIBS='${LIBS}'
  1.1459 +		SHLIB_SUFFIX=".so"
  1.1460 +		DL_OBJS="tclLoadDl.o"
  1.1461 +		DL_LIBS=""
  1.1462 +		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1.1463 +		LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1.1464 +		AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
  1.1465 +		    AC_EGREP_CPP(yes, [
  1.1466 +#ifdef __ELF__
  1.1467 +	yes
  1.1468 +#endif
  1.1469 +		    ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
  1.1470 +		if test $tcl_cv_ld_elf = yes; then
  1.1471 +		    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
  1.1472 +		else
  1.1473 +		    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
  1.1474 +		fi
  1.1475 +	    ], [
  1.1476 +		SHLIB_CFLAGS=""
  1.1477 +		SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
  1.1478 +		SHLIB_LD_LIBS='${LIBS}'
  1.1479 +		SHLIB_SUFFIX=".a"
  1.1480 +		DL_OBJS="tclLoadAout.o"
  1.1481 +		DL_LIBS=""
  1.1482 +		CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1.1483 +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1484 +		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
  1.1485 +	    ])
  1.1486 +
  1.1487 +	    # FreeBSD doesn't handle version numbers with dots.
  1.1488 +
  1.1489 +	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
  1.1490 +	    TCL_LIB_VERSIONS_OK=nodots
  1.1491 +	    ;;
  1.1492 +	OpenBSD-*)
  1.1493 +	    case `arch -s` in
  1.1494 +	    m88k|vax)
  1.1495 +		SHLIB_CFLAGS=""
  1.1496 +		SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
  1.1497 +		SHLIB_LD_LIBS='${LIBS}'
  1.1498 +		SHLIB_SUFFIX=".a"
  1.1499 +		DL_OBJS="tclLoadAout.o"
  1.1500 +		DL_LIBS=""
  1.1501 +		LDFLAGS=""
  1.1502 +		CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1.1503 +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1504 +		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
  1.1505 +		;;
  1.1506 +	    *)
  1.1507 +		# OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
  1.1508 +		case `machine` in
  1.1509 +		sparc|sparc64)
  1.1510 +		    SHLIB_CFLAGS="-fPIC";;
  1.1511 +	        *)
  1.1512 +		    SHLIB_CFLAGS="-fpic";;
  1.1513 +	        esac
  1.1514 +		SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
  1.1515 +		SHLIB_LD_LIBS='${LIBS}'
  1.1516 +		SHLIB_SUFFIX=".so"
  1.1517 +		DL_OBJS="tclLoadDl.o"
  1.1518 +		DL_LIBS=""
  1.1519 +		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1.1520 +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1521 +		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
  1.1522 +		AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
  1.1523 +		    AC_EGREP_CPP(yes, [
  1.1524 +#ifdef __ELF__
  1.1525 +	yes
  1.1526 +#endif
  1.1527 +		    ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
  1.1528 +		if test $tcl_cv_ld_elf = yes; then
  1.1529 +		    LDFLAGS=-Wl,-export-dynamic
  1.1530 +		else
  1.1531 +		    LDFLAGS=""
  1.1532 +	        fi
  1.1533 +		;;
  1.1534 +	    esac
  1.1535 +
  1.1536 +	    # OpenBSD doesn't do version numbers with dots.
  1.1537 +	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
  1.1538 +	    TCL_LIB_VERSIONS_OK=nodots
  1.1539 +	    ;;
  1.1540 +	FreeBSD-*)
  1.1541 +	    # FreeBSD 3.* and greater have ELF.
  1.1542 +	    SHLIB_CFLAGS="-fPIC"
  1.1543 +	    SHLIB_LD="ld -Bshareable -x"
  1.1544 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1545 +	    SHLIB_SUFFIX=".so"
  1.1546 +	    DL_OBJS="tclLoadDl.o"
  1.1547 +	    DL_LIBS=""
  1.1548 +	    LDFLAGS="$LDFLAGS -export-dynamic"
  1.1549 +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1.1550 +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1.1551 +	    if test "${TCL_THREADS}" = "1" ; then
  1.1552 +		# The -pthread needs to go in the CFLAGS, not LIBS
  1.1553 +		LIBS=`echo $LIBS | sed s/-pthread//`
  1.1554 +		CFLAGS="$CFLAGS -pthread"
  1.1555 +	    	LDFLAGS="$LDFLAGS -pthread"
  1.1556 +	    fi
  1.1557 +	    case $system in
  1.1558 +	    FreeBSD-3.*)
  1.1559 +	    	# FreeBSD-3 doesn't handle version numbers with dots.
  1.1560 +	    	UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
  1.1561 +	    	SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
  1.1562 +	    	TCL_LIB_VERSIONS_OK=nodots
  1.1563 +		;;
  1.1564 +	    esac
  1.1565 +	    ;;
  1.1566 +	Darwin-*)
  1.1567 +	    CFLAGS_OPTIMIZE="-Os"
  1.1568 +	    SHLIB_CFLAGS="-fno-common"
  1.1569 +	    # To avoid discrepancies between what headers configure sees during
  1.1570 +	    # preprocessing tests and compiling tests, move any -isysroot and
  1.1571 +	    # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
  1.1572 +	    CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
  1.1573 +		awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
  1.1574 +		if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
  1.1575 +	    CFLAGS="`echo " ${CFLAGS}" | \
  1.1576 +		awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
  1.1577 +		if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
  1.1578 +	    if test $do64bit = yes; then
  1.1579 +		case `arch` in
  1.1580 +		    ppc)
  1.1581 +			AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
  1.1582 +				tcl_cv_cc_arch_ppc64, [
  1.1583 +			    hold_cflags=$CFLAGS
  1.1584 +			    CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
  1.1585 +			    AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
  1.1586 +				    tcl_cv_cc_arch_ppc64=no)
  1.1587 +			    CFLAGS=$hold_cflags])
  1.1588 +			if test $tcl_cv_cc_arch_ppc64 = yes; then
  1.1589 +			    CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
  1.1590 +			    do64bit_ok=yes
  1.1591 +			fi;;
  1.1592 +		    i386)
  1.1593 +			AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
  1.1594 +				tcl_cv_cc_arch_x86_64, [
  1.1595 +			    hold_cflags=$CFLAGS
  1.1596 +			    CFLAGS="$CFLAGS -arch x86_64"
  1.1597 +			    AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
  1.1598 +				    tcl_cv_cc_arch_x86_64=no)
  1.1599 +			    CFLAGS=$hold_cflags])
  1.1600 +			if test $tcl_cv_cc_arch_x86_64 = yes; then
  1.1601 +			    CFLAGS="$CFLAGS -arch x86_64"
  1.1602 +			    do64bit_ok=yes
  1.1603 +			fi;;
  1.1604 +		    *)
  1.1605 +			AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
  1.1606 +		esac
  1.1607 +	    else
  1.1608 +		# Check for combined 32-bit and 64-bit fat build
  1.1609 +		echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \
  1.1610 +		    echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \
  1.1611 +		    fat_32_64=yes
  1.1612 +	    fi
  1.1613 +	    SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
  1.1614 +	    AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
  1.1615 +		hold_ldflags=$LDFLAGS
  1.1616 +		LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
  1.1617 +		AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
  1.1618 +		LDFLAGS=$hold_ldflags])
  1.1619 +	    if test $tcl_cv_ld_single_module = yes; then
  1.1620 +		SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
  1.1621 +	    fi
  1.1622 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1623 +	    SHLIB_SUFFIX=".dylib"
  1.1624 +	    DL_OBJS="tclLoadDyld.o"
  1.1625 +	    DL_LIBS=""
  1.1626 +	    # Don't use -prebind when building for Mac OS X 10.4 or later only:
  1.1627 +	    test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
  1.1628 +		"`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \
  1.1629 +		LDFLAGS="$LDFLAGS -prebind"
  1.1630 +	    LDFLAGS="$LDFLAGS -headerpad_max_install_names"
  1.1631 +	    AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
  1.1632 +		hold_ldflags=$LDFLAGS
  1.1633 +		LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
  1.1634 +		AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no)
  1.1635 +		LDFLAGS=$hold_ldflags])
  1.1636 +	    if test $tcl_cv_ld_search_paths_first = yes; then
  1.1637 +		LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
  1.1638 +	    fi
  1.1639 +	    CC_SEARCH_FLAGS=""
  1.1640 +	    LD_SEARCH_FLAGS=""
  1.1641 +	    LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
  1.1642 +	    PLAT_OBJS=\$\(MAC\_OSX_OBJS\)
  1.1643 +	    PLAT_SRCS=\$\(MAC\_OSX_SRCS\)
  1.1644 +	    AC_MSG_CHECKING([whether to use CoreFoundation])
  1.1645 +	    AC_ARG_ENABLE(corefoundation, [  --enable-corefoundation use CoreFoundation API [--enable-corefoundation]],
  1.1646 +		[tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
  1.1647 +	    AC_MSG_RESULT([$tcl_corefoundation])
  1.1648 +	    if test $tcl_corefoundation = yes; then
  1.1649 +		AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [
  1.1650 +		    hold_libs=$LIBS; hold_cflags=$CFLAGS
  1.1651 +		    if test "$fat_32_64" = yes; then
  1.1652 +			# On Tiger there is no 64-bit CF, so remove 64-bit archs
  1.1653 +			# from CFLAGS while testing for presence of CF.
  1.1654 +			# 64-bit CF is disabled in tclUnixPort.h if necessary.
  1.1655 +			CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc64 / /g' -e 's/-arch x86_64 / /g'`"
  1.1656 +		    fi
  1.1657 +		    LIBS="$LIBS -framework CoreFoundation"
  1.1658 +		    AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>], 
  1.1659 +			[CFBundleRef b = CFBundleGetMainBundle();], 
  1.1660 +			tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no)
  1.1661 +		    LIBS=$hold_libs; CFLAGS=$hold_cflags])
  1.1662 +		if test $tcl_cv_lib_corefoundation = yes; then
  1.1663 +		    LIBS="$LIBS -framework CoreFoundation"
  1.1664 +		    AC_DEFINE(HAVE_COREFOUNDATION)
  1.1665 +		else
  1.1666 +		    tcl_corefoundation=no
  1.1667 +		fi
  1.1668 +		if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then
  1.1669 +		    AC_CACHE_CHECK([for 64-bit CoreFoundation], tcl_cv_lib_corefoundation_64, [
  1.1670 +			hold_cflags=$CFLAGS
  1.1671 +			CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc / /g' -e 's/-arch i386 / /g'`"
  1.1672 +			AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>], 
  1.1673 +			    [CFBundleRef b = CFBundleGetMainBundle();], 
  1.1674 +			    tcl_cv_lib_corefoundation_64=yes, tcl_cv_lib_corefoundation_64=no)
  1.1675 +			CFLAGS=$hold_cflags])
  1.1676 +		    if test $tcl_cv_lib_corefoundation_64 = no; then
  1.1677 +			AC_DEFINE(NO_COREFOUNDATION_64)
  1.1678 +		    fi
  1.1679 +		fi
  1.1680 +	    fi
  1.1681 +	    AC_DEFINE(MAC_OSX_TCL)
  1.1682 +	    ;;
  1.1683 +	NEXTSTEP-*)
  1.1684 +	    SHLIB_CFLAGS=""
  1.1685 +	    SHLIB_LD="cc -nostdlib -r"
  1.1686 +	    SHLIB_LD_LIBS=""
  1.1687 +	    SHLIB_SUFFIX=".so"
  1.1688 +	    DL_OBJS="tclLoadNext.o"
  1.1689 +	    DL_LIBS=""
  1.1690 +	    CC_SEARCH_FLAGS=""
  1.1691 +	    LD_SEARCH_FLAGS=""
  1.1692 +	    ;;
  1.1693 +	OS/390-*)
  1.1694 +	    CFLAGS_OPTIMIZE=""		# Optimizer is buggy
  1.1695 +	    AC_DEFINE(_OE_SOCKETS)	# needed in sys/socket.h
  1.1696 +	    ;;      
  1.1697 +	OSF1-1.0|OSF1-1.1|OSF1-1.2)
  1.1698 +	    # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
  1.1699 +	    SHLIB_CFLAGS=""
  1.1700 +	    # Hack: make package name same as library name
  1.1701 +	    SHLIB_LD='ld -R -export $@:'
  1.1702 +	    SHLIB_LD_LIBS=""
  1.1703 +	    SHLIB_SUFFIX=".so"
  1.1704 +	    DL_OBJS="tclLoadOSF.o"
  1.1705 +	    DL_LIBS=""
  1.1706 +	    CC_SEARCH_FLAGS=""
  1.1707 +	    LD_SEARCH_FLAGS=""
  1.1708 +	    ;;
  1.1709 +	OSF1-1.*)
  1.1710 +	    # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
  1.1711 +	    SHLIB_CFLAGS="-fPIC"
  1.1712 +	    if test "$SHARED_BUILD" = "1" ; then
  1.1713 +	        SHLIB_LD="ld -shared"
  1.1714 +	    else
  1.1715 +	        SHLIB_LD="ld -non_shared"
  1.1716 +	    fi
  1.1717 +	    SHLIB_LD_LIBS=""
  1.1718 +	    SHLIB_SUFFIX=".so"
  1.1719 +	    DL_OBJS="tclLoadDl.o"
  1.1720 +	    DL_LIBS=""
  1.1721 +	    CC_SEARCH_FLAGS=""
  1.1722 +	    LD_SEARCH_FLAGS=""
  1.1723 +	    ;;
  1.1724 +	OSF1-V*)
  1.1725 +	    # Digital OSF/1
  1.1726 +	    SHLIB_CFLAGS=""
  1.1727 +	    if test "$SHARED_BUILD" = "1" ; then
  1.1728 +	        SHLIB_LD='ld -shared -expect_unresolved "*"'
  1.1729 +	    else
  1.1730 +	        SHLIB_LD='ld -non_shared -expect_unresolved "*"'
  1.1731 +	    fi
  1.1732 +	    SHLIB_LD_LIBS=""
  1.1733 +	    SHLIB_SUFFIX=".so"
  1.1734 +	    DL_OBJS="tclLoadDl.o"
  1.1735 +	    DL_LIBS=""
  1.1736 +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1.1737 +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1.1738 +	    if test "$GCC" = "yes" ; then
  1.1739 +		CFLAGS="$CFLAGS -mieee"
  1.1740 +            else
  1.1741 +		CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
  1.1742 +	    fi
  1.1743 +	    # see pthread_intro(3) for pthread support on osf1, k.furukawa
  1.1744 +	    if test "${TCL_THREADS}" = "1" ; then
  1.1745 +		CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
  1.1746 +		CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
  1.1747 +		LIBS=`echo $LIBS | sed s/-lpthreads//`
  1.1748 +		if test "$GCC" = "yes" ; then
  1.1749 +		    LIBS="$LIBS -lpthread -lmach -lexc"
  1.1750 +		else
  1.1751 +		    CFLAGS="$CFLAGS -pthread"
  1.1752 +		    LDFLAGS="$LDFLAGS -pthread"
  1.1753 +		fi
  1.1754 +	    fi
  1.1755 +
  1.1756 +	    ;;
  1.1757 +	QNX-6*)
  1.1758 +	    # QNX RTP
  1.1759 +	    # This may work for all QNX, but it was only reported for v6.
  1.1760 +	    SHLIB_CFLAGS="-fPIC"
  1.1761 +	    SHLIB_LD="ld -Bshareable -x"
  1.1762 +	    SHLIB_LD_LIBS=""
  1.1763 +	    SHLIB_SUFFIX=".so"
  1.1764 +	    DL_OBJS="tclLoadDl.o"
  1.1765 +	    # dlopen is in -lc on QNX
  1.1766 +	    DL_LIBS=""
  1.1767 +	    CC_SEARCH_FLAGS=""
  1.1768 +	    LD_SEARCH_FLAGS=""
  1.1769 +	    ;;
  1.1770 +	RISCos-*)
  1.1771 +	    SHLIB_CFLAGS="-G 0"
  1.1772 +	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  1.1773 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1774 +	    SHLIB_SUFFIX=".a"
  1.1775 +	    DL_OBJS="tclLoadAout.o"
  1.1776 +	    DL_LIBS=""
  1.1777 +	    LDFLAGS="$LDFLAGS -Wl,-D,08000000"
  1.1778 +	    CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1.1779 +	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1780 +	    ;;
  1.1781 +	SCO_SV-3.2*)
  1.1782 +	    # Note, dlopen is available only on SCO 3.2.5 and greater. However,
  1.1783 +	    # this test works, since "uname -s" was non-standard in 3.2.4 and
  1.1784 +	    # below.
  1.1785 +	    if test "$GCC" = "yes" ; then
  1.1786 +	    	SHLIB_CFLAGS="-fPIC -melf"
  1.1787 +	    	LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
  1.1788 +	    else
  1.1789 +	    	SHLIB_CFLAGS="-Kpic -belf"
  1.1790 +	    	LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
  1.1791 +	    fi
  1.1792 +	    SHLIB_LD="ld -G"
  1.1793 +	    SHLIB_LD_LIBS=""
  1.1794 +	    SHLIB_SUFFIX=".so"
  1.1795 +	    DL_OBJS="tclLoadDl.o"
  1.1796 +	    DL_LIBS=""
  1.1797 +	    CC_SEARCH_FLAGS=""
  1.1798 +	    LD_SEARCH_FLAGS=""
  1.1799 +	    ;;
  1.1800 +	SINIX*5.4*)
  1.1801 +	    SHLIB_CFLAGS="-K PIC"
  1.1802 +	    SHLIB_LD="cc -G"
  1.1803 +	    SHLIB_LD_LIBS=""
  1.1804 +	    SHLIB_SUFFIX=".so"
  1.1805 +	    DL_OBJS="tclLoadDl.o"
  1.1806 +	    DL_LIBS="-ldl"
  1.1807 +	    CC_SEARCH_FLAGS=""
  1.1808 +	    LD_SEARCH_FLAGS=""
  1.1809 +	    ;;
  1.1810 +	SunOS-4*)
  1.1811 +	    SHLIB_CFLAGS="-PIC"
  1.1812 +	    SHLIB_LD="ld"
  1.1813 +	    SHLIB_LD_LIBS=""
  1.1814 +	    SHLIB_SUFFIX=".so"
  1.1815 +	    DL_OBJS="tclLoadDl.o"
  1.1816 +	    DL_LIBS="-ldl"
  1.1817 +	    CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1.1818 +	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1819 +
  1.1820 +	    # SunOS can't handle version numbers with dots in them in library
  1.1821 +	    # specs, like -ltcl7.5, so use -ltcl75 instead.  Also, it
  1.1822 +	    # requires an extra version number at the end of .so file names.
  1.1823 +	    # So, the library has to have a name like libtcl75.so.1.0
  1.1824 +
  1.1825 +	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
  1.1826 +	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
  1.1827 +	    TCL_LIB_VERSIONS_OK=nodots
  1.1828 +	    ;;
  1.1829 +	SunOS-5.[[0-6]])
  1.1830 +	    # Careful to not let 5.10+ fall into this case
  1.1831 +
  1.1832 +	    # Note: If _REENTRANT isn't defined, then Solaris
  1.1833 +	    # won't define thread-safe library routines.
  1.1834 +
  1.1835 +	    AC_DEFINE(_REENTRANT)
  1.1836 +	    AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
  1.1837 +
  1.1838 +	    SHLIB_CFLAGS="-KPIC"
  1.1839 +
  1.1840 +	    # Note: need the LIBS below, otherwise Tk won't find Tcl's
  1.1841 +	    # symbols when dynamically loaded into tclsh.
  1.1842 +
  1.1843 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1844 +	    SHLIB_SUFFIX=".so"
  1.1845 +	    DL_OBJS="tclLoadDl.o"
  1.1846 +	    DL_LIBS="-ldl"
  1.1847 +	    if test "$GCC" = "yes" ; then
  1.1848 +		SHLIB_LD="$CC -shared"
  1.1849 +		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1.1850 +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1851 +	    else
  1.1852 +		SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  1.1853 +		CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  1.1854 +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1855 +	    fi
  1.1856 +	    ;;
  1.1857 +	SunOS-5*)
  1.1858 +	    # Note: If _REENTRANT isn't defined, then Solaris
  1.1859 +	    # won't define thread-safe library routines.
  1.1860 +
  1.1861 +	    AC_DEFINE(_REENTRANT)
  1.1862 +	    AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
  1.1863 +
  1.1864 +	    SHLIB_CFLAGS="-KPIC"
  1.1865 +
  1.1866 +	    # Check to enable 64-bit flags for compiler/linker
  1.1867 +	    if test "$do64bit" = "yes" ; then
  1.1868 +		arch=`isainfo`
  1.1869 +		if test "$arch" = "sparcv9 sparc" ; then
  1.1870 +			if test "$GCC" = "yes" ; then
  1.1871 +			    if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
  1.1872 +				AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
  1.1873 +			    else
  1.1874 +				do64bit_ok=yes
  1.1875 +				CFLAGS="$CFLAGS -m64 -mcpu=v9"
  1.1876 +				LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
  1.1877 +				SHLIB_CFLAGS="-fPIC"
  1.1878 +			    fi
  1.1879 +			else
  1.1880 +			    do64bit_ok=yes
  1.1881 +			    if test "$do64bitVIS" = "yes" ; then
  1.1882 +				CFLAGS="$CFLAGS -xarch=v9a"
  1.1883 +			    	LDFLAGS="$LDFLAGS -xarch=v9a"
  1.1884 +			    else
  1.1885 +				CFLAGS="$CFLAGS -xarch=v9"
  1.1886 +			    	LDFLAGS="$LDFLAGS -xarch=v9"
  1.1887 +			    fi
  1.1888 +			    # Solaris 64 uses this as well
  1.1889 +			    #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
  1.1890 +			fi
  1.1891 +		elif test "$arch" = "amd64 i386" ; then
  1.1892 +		    if test "$GCC" = "yes" ; then
  1.1893 +			AC_MSG_WARN([64bit mode not supported with GCC on $system])
  1.1894 +		    else
  1.1895 +			do64bit_ok=yes
  1.1896 +			CFLAGS="$CFLAGS -xarch=amd64"
  1.1897 +			LDFLAGS="$LDFLAGS -xarch=amd64"
  1.1898 +		    fi
  1.1899 +		else
  1.1900 +		    AC_MSG_WARN([64bit mode not supported for $arch])
  1.1901 +		fi
  1.1902 +	    fi
  1.1903 +	    
  1.1904 +	    # Note: need the LIBS below, otherwise Tk won't find Tcl's
  1.1905 +	    # symbols when dynamically loaded into tclsh.
  1.1906 +
  1.1907 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1908 +	    SHLIB_SUFFIX=".so"
  1.1909 +	    DL_OBJS="tclLoadDl.o"
  1.1910 +	    DL_LIBS="-ldl"
  1.1911 +	    if test "$GCC" = "yes" ; then
  1.1912 +		SHLIB_LD="$CC -shared"
  1.1913 +		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1.1914 +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1915 +		if test "$do64bit_ok" = "yes" ; then
  1.1916 +		    # We need to specify -static-libgcc or we need to
  1.1917 +		    # add the path to the sparv9 libgcc.
  1.1918 +		    SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
  1.1919 +		    # for finding sparcv9 libgcc, get the regular libgcc
  1.1920 +		    # path, remove so name and append 'sparcv9'
  1.1921 +		    #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
  1.1922 +		    #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
  1.1923 +		fi
  1.1924 +	    else
  1.1925 +		SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  1.1926 +		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1.1927 +		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  1.1928 +	    fi
  1.1929 +	    ;;
  1.1930 +	ULTRIX-4.*)
  1.1931 +	    SHLIB_CFLAGS="-G 0"
  1.1932 +	    SHLIB_SUFFIX=".a"
  1.1933 +	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  1.1934 +	    SHLIB_LD_LIBS='${LIBS}'
  1.1935 +	    DL_OBJS="tclLoadAout.o"
  1.1936 +	    DL_LIBS=""
  1.1937 +	    LDFLAGS="$LDFLAGS -Wl,-D,08000000"
  1.1938 +	    CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1.1939 +	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1.1940 +	    if test "$GCC" != "yes" ; then
  1.1941 +		CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
  1.1942 +	    fi
  1.1943 +	    ;;
  1.1944 +	UNIX_SV* | UnixWare-5*)
  1.1945 +	    SHLIB_CFLAGS="-KPIC"
  1.1946 +	    SHLIB_LD="cc -G"
  1.1947 +	    SHLIB_LD_LIBS=""
  1.1948 +	    SHLIB_SUFFIX=".so"
  1.1949 +	    DL_OBJS="tclLoadDl.o"
  1.1950 +	    DL_LIBS="-ldl"
  1.1951 +	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
  1.1952 +	    # that don't grok the -Bexport option.  Test that it does.
  1.1953 +	    AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
  1.1954 +		hold_ldflags=$LDFLAGS
  1.1955 +		LDFLAGS="$LDFLAGS -Wl,-Bexport"
  1.1956 +		AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
  1.1957 +	        LDFLAGS=$hold_ldflags])
  1.1958 +	    if test $tcl_cv_ld_Bexport = yes; then
  1.1959 +		LDFLAGS="$LDFLAGS -Wl,-Bexport"
  1.1960 +	    fi
  1.1961 +	    CC_SEARCH_FLAGS=""
  1.1962 +	    LD_SEARCH_FLAGS=""
  1.1963 +	    ;;
  1.1964 +    esac
  1.1965 +
  1.1966 +    if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
  1.1967 +	AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
  1.1968 +    fi
  1.1969 +
  1.1970 +dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
  1.1971 +dnl # until the end of configure, as configure's compile and link tests use
  1.1972 +dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
  1.1973 +dnl # preprocessing tests use only CPPFLAGS.
  1.1974 +    SC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
  1.1975 +
  1.1976 +    # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
  1.1977 +    # Loading for Tcl -- What Became of It?".  Proc. 2nd Tcl/Tk Workshop,
  1.1978 +    # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
  1.1979 +    # to determine which of several header files defines the a.out file
  1.1980 +    # format (a.out.h, sys/exec.h, or sys/exec_aout.h).  At present, we
  1.1981 +    # support only a file format that is more or less version-7-compatible. 
  1.1982 +    # In particular,
  1.1983 +    #	- a.out files must begin with `struct exec'.
  1.1984 +    #	- the N_TXTOFF on the `struct exec' must compute the seek address
  1.1985 +    #	  of the text segment
  1.1986 +    #	- The `struct exec' must contain a_magic, a_text, a_data, a_bss
  1.1987 +    #	  and a_entry fields.
  1.1988 +    # The following compilation should succeed if and only if either sys/exec.h
  1.1989 +    # or a.out.h is usable for the purpose.
  1.1990 +    #
  1.1991 +    # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
  1.1992 +    # `struct exec' includes a second header that contains information that
  1.1993 +    # duplicates the v7 fields that are needed.
  1.1994 +
  1.1995 +    if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
  1.1996 +	AC_CACHE_CHECK([sys/exec.h], tcl_cv_sysexec_h, [
  1.1997 +	AC_TRY_COMPILE([#include <sys/exec.h>],[
  1.1998 +	    struct exec foo;
  1.1999 +	    unsigned long seek;
  1.2000 +	    int flag;
  1.2001 +#if defined(__mips) || defined(mips)
  1.2002 +	    seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  1.2003 +#else
  1.2004 +	    seek = N_TXTOFF (foo);
  1.2005 +#endif
  1.2006 +	    flag = (foo.a_magic == OMAGIC);
  1.2007 +	    return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  1.2008 +    ], tcl_cv_sysexec_h=usable, tcl_cv_sysexec_h=unusable)])
  1.2009 +	if test $tcl_cv_sysexec_h = usable; then
  1.2010 +	    AC_DEFINE(USE_SYS_EXEC_H)
  1.2011 +	else
  1.2012 +	    AC_CACHE_CHECK([a.out.h], tcl_cv_aout_h, [
  1.2013 +	    AC_TRY_COMPILE([#include <a.out.h>],[
  1.2014 +		struct exec foo;
  1.2015 +		unsigned long seek;
  1.2016 +		int flag;
  1.2017 +#if defined(__mips) || defined(mips)
  1.2018 +		seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  1.2019 +#else
  1.2020 +		seek = N_TXTOFF (foo);
  1.2021 +#endif
  1.2022 +		flag = (foo.a_magic == OMAGIC);
  1.2023 +		return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  1.2024 +	    ], tcl_cv_aout_h=usable, tcl_cv_aout_h=unusable)])
  1.2025 +	    if test $tcl_cv_aout_h = usable; then
  1.2026 +		AC_DEFINE(USE_A_OUT_H)
  1.2027 +	    else
  1.2028 +		AC_CACHE_CHECK([sys/exec_aout.h], tcl_cv_sysexecaout_h, [
  1.2029 +		AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
  1.2030 +		    struct exec foo;
  1.2031 +		    unsigned long seek;
  1.2032 +		    int flag;
  1.2033 +#if defined(__mips) || defined(mips)
  1.2034 +		    seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  1.2035 +#else
  1.2036 +		    seek = N_TXTOFF (foo);
  1.2037 +#endif
  1.2038 +		    flag = (foo.a_midmag == OMAGIC);
  1.2039 +		    return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  1.2040 +		], tcl_cv_sysexecaout_h=usable, tcl_cv_sysexecaout_h=unusable)])
  1.2041 +		if test $tcl_cv_sysexecaout_h = usable; then
  1.2042 +		    AC_DEFINE(USE_SYS_EXEC_AOUT_H)
  1.2043 +		else
  1.2044 +		    DL_OBJS=""
  1.2045 +		fi
  1.2046 +	    fi
  1.2047 +	fi
  1.2048 +    fi
  1.2049 +
  1.2050 +    # Step 5: disable dynamic loading if requested via a command-line switch.
  1.2051 +
  1.2052 +    AC_ARG_ENABLE(load, [  --disable-load          disallow dynamic loading and "load" command],
  1.2053 +	[tcl_ok=$enableval], [tcl_ok=yes])
  1.2054 +    if test "$tcl_ok" = "no"; then
  1.2055 +	DL_OBJS=""
  1.2056 +    fi
  1.2057 +
  1.2058 +    if test "x$DL_OBJS" != "x" ; then
  1.2059 +	BUILD_DLTEST="\$(DLTEST_TARGETS)"
  1.2060 +    else
  1.2061 +	echo "Can't figure out how to do dynamic loading or shared libraries"
  1.2062 +	echo "on this system."
  1.2063 +	SHLIB_CFLAGS=""
  1.2064 +	SHLIB_LD=""
  1.2065 +	SHLIB_SUFFIX=""
  1.2066 +	DL_OBJS="tclLoadNone.o"
  1.2067 +	DL_LIBS=""
  1.2068 +	LDFLAGS="$LDFLAGS_ORIG"
  1.2069 +	CC_SEARCH_FLAGS=""
  1.2070 +	LD_SEARCH_FLAGS=""
  1.2071 +	BUILD_DLTEST=""
  1.2072 +    fi
  1.2073 +
  1.2074 +    # If we're running gcc, then change the C flags for compiling shared
  1.2075 +    # libraries to the right flags for gcc, instead of those for the
  1.2076 +    # standard manufacturer compiler.
  1.2077 +
  1.2078 +    if test "$DL_OBJS" != "tclLoadNone.o" ; then
  1.2079 +	if test "$GCC" = "yes" ; then
  1.2080 +	    case $system in
  1.2081 +		AIX-*)
  1.2082 +		    ;;
  1.2083 +		BSD/OS*)
  1.2084 +		    ;;
  1.2085 +		IRIX*)
  1.2086 +		    ;;
  1.2087 +		NetBSD-*|FreeBSD-*|OpenBSD-*)
  1.2088 +		    ;;
  1.2089 +		Darwin-*)
  1.2090 +		    ;;
  1.2091 +		RISCos-*)
  1.2092 +		    ;;
  1.2093 +		SCO_SV-3.2*)
  1.2094 +		    ;;
  1.2095 +		ULTRIX-4.*)
  1.2096 +		    ;;
  1.2097 +		*)
  1.2098 +		    SHLIB_CFLAGS="-fPIC"
  1.2099 +		    ;;
  1.2100 +	    esac
  1.2101 +	fi
  1.2102 +    fi
  1.2103 +
  1.2104 +    if test "$SHARED_LIB_SUFFIX" = "" ; then
  1.2105 +	SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
  1.2106 +    fi
  1.2107 +    if test "$UNSHARED_LIB_SUFFIX" = "" ; then
  1.2108 +	UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
  1.2109 +    fi
  1.2110 +
  1.2111 +    if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
  1.2112 +        LIB_SUFFIX=${SHARED_LIB_SUFFIX}
  1.2113 +        MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
  1.2114 +        INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
  1.2115 +    else
  1.2116 +        LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
  1.2117 +
  1.2118 +        if test "$RANLIB" = "" ; then
  1.2119 +            MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
  1.2120 +            INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
  1.2121 +        else
  1.2122 +            MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
  1.2123 +            INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
  1.2124 +        fi
  1.2125 +
  1.2126 +dnl        Not at all clear what this was doing in Tcl's configure.in
  1.2127 +dnl        or why it was needed was needed. In any event, this sort of
  1.2128 +dnl        things needs to be done in the big loop above.
  1.2129 +dnl        REMOVE THIS BLOCK LATER! (mdejong)
  1.2130 +dnl        case $system in
  1.2131 +dnl            BSD/OS*)
  1.2132 +dnl                ;;
  1.2133 +dnl            AIX-[[1-4]].*)
  1.2134 +dnl                ;;
  1.2135 +dnl            *)
  1.2136 +dnl                SHLIB_LD_LIBS=""
  1.2137 +dnl                ;;
  1.2138 +dnl        esac
  1.2139 +    fi
  1.2140 +
  1.2141 +
  1.2142 +    # Stub lib does not depend on shared/static configuration
  1.2143 +    if test "$RANLIB" = "" ; then
  1.2144 +        MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
  1.2145 +        INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
  1.2146 +    else
  1.2147 +        MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
  1.2148 +        INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
  1.2149 +    fi
  1.2150 +
  1.2151 +
  1.2152 +    AC_SUBST(DL_LIBS)
  1.2153 +
  1.2154 +    AC_SUBST(DL_OBJS)
  1.2155 +    AC_SUBST(PLAT_OBJS)
  1.2156 +    AC_SUBST(PLAT_SRCS)
  1.2157 +    AC_SUBST(CFLAGS)
  1.2158 +    AC_SUBST(CFLAGS_DEBUG)
  1.2159 +    AC_SUBST(CFLAGS_OPTIMIZE)
  1.2160 +    AC_SUBST(CFLAGS_WARNING)
  1.2161 +
  1.2162 +    AC_SUBST(LDFLAGS)
  1.2163 +    AC_SUBST(LDFLAGS_DEBUG)
  1.2164 +    AC_SUBST(LDFLAGS_OPTIMIZE)
  1.2165 +    AC_SUBST(CC_SEARCH_FLAGS)
  1.2166 +    AC_SUBST(LD_SEARCH_FLAGS)
  1.2167 +
  1.2168 +    AC_SUBST(STLIB_LD)
  1.2169 +    AC_SUBST(SHLIB_LD)
  1.2170 +    AC_SUBST(TCL_SHLIB_LD_EXTRAS)
  1.2171 +    AC_SUBST(TK_SHLIB_LD_EXTRAS)
  1.2172 +    AC_SUBST(SHLIB_LD_LIBS)
  1.2173 +    AC_SUBST(SHLIB_CFLAGS)
  1.2174 +    AC_SUBST(SHLIB_SUFFIX)
  1.2175 +
  1.2176 +    AC_SUBST(MAKE_LIB)
  1.2177 +    AC_SUBST(MAKE_STUB_LIB)
  1.2178 +    AC_SUBST(INSTALL_LIB)
  1.2179 +    AC_SUBST(INSTALL_STUB_LIB)
  1.2180 +    AC_SUBST(RANLIB)
  1.2181 +])
  1.2182 +
  1.2183 +#--------------------------------------------------------------------
  1.2184 +# SC_SERIAL_PORT
  1.2185 +#
  1.2186 +#	Determine which interface to use to talk to the serial port.
  1.2187 +#	Note that #include lines must begin in leftmost column for
  1.2188 +#	some compilers to recognize them as preprocessor directives,
  1.2189 +#	and some build environments have stdin not pointing at a
  1.2190 +#	pseudo-terminal (usually /dev/null instead.)
  1.2191 +#
  1.2192 +# Arguments:
  1.2193 +#	none
  1.2194 +#	
  1.2195 +# Results:
  1.2196 +#
  1.2197 +#	Defines only one of the following vars:
  1.2198 +#		HAVE_SYS_MODEM_H
  1.2199 +#		USE_TERMIOS
  1.2200 +#		USE_TERMIO
  1.2201 +#		USE_SGTTY
  1.2202 +#
  1.2203 +#--------------------------------------------------------------------
  1.2204 +
  1.2205 +AC_DEFUN([SC_SERIAL_PORT], [
  1.2206 +    AC_CHECK_HEADERS(sys/modem.h)
  1.2207 +    AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
  1.2208 +    AC_TRY_RUN([
  1.2209 +#include <termios.h>
  1.2210 +
  1.2211 +int main() {
  1.2212 +    struct termios t;
  1.2213 +    if (tcgetattr(0, &t) == 0) {
  1.2214 +	cfsetospeed(&t, 0);
  1.2215 +	t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
  1.2216 +	return 0;
  1.2217 +    }
  1.2218 +    return 1;
  1.2219 +}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
  1.2220 +    if test $tcl_cv_api_serial = no ; then
  1.2221 +	AC_TRY_RUN([
  1.2222 +#include <termio.h>
  1.2223 +
  1.2224 +int main() {
  1.2225 +    struct termio t;
  1.2226 +    if (ioctl(0, TCGETA, &t) == 0) {
  1.2227 +	t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
  1.2228 +	return 0;
  1.2229 +    }
  1.2230 +    return 1;
  1.2231 +}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
  1.2232 +    fi
  1.2233 +    if test $tcl_cv_api_serial = no ; then
  1.2234 +	AC_TRY_RUN([
  1.2235 +#include <sgtty.h>
  1.2236 +
  1.2237 +int main() {
  1.2238 +    struct sgttyb t;
  1.2239 +    if (ioctl(0, TIOCGETP, &t) == 0) {
  1.2240 +	t.sg_ospeed = 0;
  1.2241 +	t.sg_flags |= ODDP | EVENP | RAW;
  1.2242 +	return 0;
  1.2243 +    }
  1.2244 +    return 1;
  1.2245 +}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
  1.2246 +    fi
  1.2247 +    if test $tcl_cv_api_serial = no ; then
  1.2248 +	AC_TRY_RUN([
  1.2249 +#include <termios.h>
  1.2250 +#include <errno.h>
  1.2251 +
  1.2252 +int main() {
  1.2253 +    struct termios t;
  1.2254 +    if (tcgetattr(0, &t) == 0
  1.2255 +	|| errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
  1.2256 +	cfsetospeed(&t, 0);
  1.2257 +	t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
  1.2258 +	return 0;
  1.2259 +    }
  1.2260 +    return 1;
  1.2261 +}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
  1.2262 +    fi
  1.2263 +    if test $tcl_cv_api_serial = no; then
  1.2264 +	AC_TRY_RUN([
  1.2265 +#include <termio.h>
  1.2266 +#include <errno.h>
  1.2267 +
  1.2268 +int main() {
  1.2269 +    struct termio t;
  1.2270 +    if (ioctl(0, TCGETA, &t) == 0
  1.2271 +	|| errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
  1.2272 +	t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
  1.2273 +	return 0;
  1.2274 +    }
  1.2275 +    return 1;
  1.2276 +    }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
  1.2277 +    fi
  1.2278 +    if test $tcl_cv_api_serial = no; then
  1.2279 +	AC_TRY_RUN([
  1.2280 +#include <sgtty.h>
  1.2281 +#include <errno.h>
  1.2282 +
  1.2283 +int main() {
  1.2284 +    struct sgttyb t;
  1.2285 +    if (ioctl(0, TIOCGETP, &t) == 0
  1.2286 +	|| errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
  1.2287 +	t.sg_ospeed = 0;
  1.2288 +	t.sg_flags |= ODDP | EVENP | RAW;
  1.2289 +	return 0;
  1.2290 +    }
  1.2291 +    return 1;
  1.2292 +}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
  1.2293 +    fi])
  1.2294 +    case $tcl_cv_api_serial in
  1.2295 +	termios) AC_DEFINE(USE_TERMIOS);;
  1.2296 +	termio)  AC_DEFINE(USE_TERMIO);;
  1.2297 +	sgtty)   AC_DEFINE(USE_SGTTY);;
  1.2298 +    esac
  1.2299 +])
  1.2300 +
  1.2301 +#--------------------------------------------------------------------
  1.2302 +# SC_MISSING_POSIX_HEADERS
  1.2303 +#
  1.2304 +#	Supply substitutes for missing POSIX header files.  Special
  1.2305 +#	notes:
  1.2306 +#	    - stdlib.h doesn't define strtol, strtoul, or
  1.2307 +#	      strtod insome versions of SunOS
  1.2308 +#	    - some versions of string.h don't declare procedures such
  1.2309 +#	      as strstr
  1.2310 +#
  1.2311 +# Arguments:
  1.2312 +#	none
  1.2313 +#	
  1.2314 +# Results:
  1.2315 +#
  1.2316 +#	Defines some of the following vars:
  1.2317 +#		NO_DIRENT_H
  1.2318 +#		NO_ERRNO_H
  1.2319 +#		NO_VALUES_H
  1.2320 +#		HAVE_LIMITS_H or NO_LIMITS_H
  1.2321 +#		NO_STDLIB_H
  1.2322 +#		NO_STRING_H
  1.2323 +#		NO_SYS_WAIT_H
  1.2324 +#		NO_DLFCN_H
  1.2325 +#		HAVE_UNISTD_H
  1.2326 +#		HAVE_SYS_PARAM_H
  1.2327 +#
  1.2328 +#		HAVE_STRING_H ?
  1.2329 +#
  1.2330 +#--------------------------------------------------------------------
  1.2331 +
  1.2332 +AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
  1.2333 +    AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
  1.2334 +    AC_TRY_LINK([#include <sys/types.h>
  1.2335 +#include <dirent.h>], [
  1.2336 +#ifndef _POSIX_SOURCE
  1.2337 +#   ifdef __Lynx__
  1.2338 +	/*
  1.2339 +	 * Generate compilation error to make the test fail:  Lynx headers
  1.2340 +	 * are only valid if really in the POSIX environment.
  1.2341 +	 */
  1.2342 +
  1.2343 +	missing_procedure();
  1.2344 +#   endif
  1.2345 +#endif
  1.2346 +DIR *d;
  1.2347 +struct dirent *entryPtr;
  1.2348 +char *p;
  1.2349 +d = opendir("foobar");
  1.2350 +entryPtr = readdir(d);
  1.2351 +p = entryPtr->d_name;
  1.2352 +closedir(d);
  1.2353 +], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
  1.2354 +
  1.2355 +    if test $tcl_cv_dirent_h = no; then
  1.2356 +	AC_DEFINE(NO_DIRENT_H)
  1.2357 +    fi
  1.2358 +
  1.2359 +    AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
  1.2360 +    AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
  1.2361 +    AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
  1.2362 +    AC_CHECK_HEADER(limits.h,
  1.2363 +	[AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)])
  1.2364 +    AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
  1.2365 +    AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
  1.2366 +    AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
  1.2367 +    AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
  1.2368 +    if test $tcl_ok = 0; then
  1.2369 +	AC_DEFINE(NO_STDLIB_H)
  1.2370 +    fi
  1.2371 +    AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
  1.2372 +    AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
  1.2373 +    AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
  1.2374 +
  1.2375 +    # See also memmove check below for a place where NO_STRING_H can be
  1.2376 +    # set and why.
  1.2377 +
  1.2378 +    if test $tcl_ok = 0; then
  1.2379 +	AC_DEFINE(NO_STRING_H)
  1.2380 +    fi
  1.2381 +
  1.2382 +    AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
  1.2383 +    AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
  1.2384 +
  1.2385 +    # OS/390 lacks sys/param.h (and doesn't need it, by chance).
  1.2386 +    AC_HAVE_HEADERS(unistd.h sys/param.h)
  1.2387 +])
  1.2388 +
  1.2389 +#--------------------------------------------------------------------
  1.2390 +# SC_PATH_X
  1.2391 +#
  1.2392 +#	Locate the X11 header files and the X11 library archive.  Try
  1.2393 +#	the ac_path_x macro first, but if it doesn't find the X stuff
  1.2394 +#	(e.g. because there's no xmkmf program) then check through
  1.2395 +#	a list of possible directories.  Under some conditions the
  1.2396 +#	autoconf macro will return an include directory that contains
  1.2397 +#	no include files, so double-check its result just to be safe.
  1.2398 +#
  1.2399 +# Arguments:
  1.2400 +#	none
  1.2401 +#	
  1.2402 +# Results:
  1.2403 +#
  1.2404 +#	Sets the the following vars:
  1.2405 +#		XINCLUDES
  1.2406 +#		XLIBSW
  1.2407 +#
  1.2408 +#--------------------------------------------------------------------
  1.2409 +
  1.2410 +AC_DEFUN([SC_PATH_X], [
  1.2411 +    AC_PATH_X
  1.2412 +    not_really_there=""
  1.2413 +    if test "$no_x" = ""; then
  1.2414 +	if test "$x_includes" = ""; then
  1.2415 +	    AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
  1.2416 +	else
  1.2417 +	    if test ! -r $x_includes/X11/Intrinsic.h; then
  1.2418 +		not_really_there="yes"
  1.2419 +	    fi
  1.2420 +	fi
  1.2421 +    fi
  1.2422 +    if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
  1.2423 +	AC_MSG_CHECKING([for X11 header files])
  1.2424 +	found_xincludes="no"
  1.2425 +	AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
  1.2426 +	if test "$found_xincludes" = "no"; then
  1.2427 +	    dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
  1.2428 +	    for i in $dirs ; do
  1.2429 +		if test -r $i/X11/Intrinsic.h; then
  1.2430 +		    AC_MSG_RESULT([$i])
  1.2431 +		    XINCLUDES=" -I$i"
  1.2432 +		    found_xincludes="yes"
  1.2433 +		    break
  1.2434 +		fi
  1.2435 +	    done
  1.2436 +	fi
  1.2437 +    else
  1.2438 +	if test "$x_includes" != ""; then
  1.2439 +	    XINCLUDES="-I$x_includes"
  1.2440 +	    found_xincludes="yes"
  1.2441 +	fi
  1.2442 +    fi
  1.2443 +    if test found_xincludes = "no"; then
  1.2444 +	AC_MSG_RESULT([couldn't find any!])
  1.2445 +    fi
  1.2446 +
  1.2447 +    if test "$no_x" = yes; then
  1.2448 +	AC_MSG_CHECKING([for X11 libraries])
  1.2449 +	XLIBSW=nope
  1.2450 +	dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
  1.2451 +	for i in $dirs ; do
  1.2452 +	    if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
  1.2453 +		AC_MSG_RESULT([$i])
  1.2454 +		XLIBSW="-L$i -lX11"
  1.2455 +		x_libraries="$i"
  1.2456 +		break
  1.2457 +	    fi
  1.2458 +	done
  1.2459 +    else
  1.2460 +	if test "$x_libraries" = ""; then
  1.2461 +	    XLIBSW=-lX11
  1.2462 +	else
  1.2463 +	    XLIBSW="-L$x_libraries -lX11"
  1.2464 +	fi
  1.2465 +    fi
  1.2466 +    if test "$XLIBSW" = nope ; then
  1.2467 +	AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
  1.2468 +    fi
  1.2469 +    if test "$XLIBSW" = nope ; then
  1.2470 +	AC_MSG_RESULT([could not find any!  Using -lX11.])
  1.2471 +	XLIBSW=-lX11
  1.2472 +    fi
  1.2473 +])
  1.2474 +
  1.2475 +#--------------------------------------------------------------------
  1.2476 +# SC_BLOCKING_STYLE
  1.2477 +#
  1.2478 +#	The statements below check for systems where POSIX-style
  1.2479 +#	non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. 
  1.2480 +#	On these systems (mostly older ones), use the old BSD-style
  1.2481 +#	FIONBIO approach instead.
  1.2482 +#
  1.2483 +# Arguments:
  1.2484 +#	none
  1.2485 +#	
  1.2486 +# Results:
  1.2487 +#
  1.2488 +#	Defines some of the following vars:
  1.2489 +#		HAVE_SYS_IOCTL_H
  1.2490 +#		HAVE_SYS_FILIO_H
  1.2491 +#		USE_FIONBIO
  1.2492 +#		O_NONBLOCK
  1.2493 +#
  1.2494 +#--------------------------------------------------------------------
  1.2495 +
  1.2496 +AC_DEFUN([SC_BLOCKING_STYLE], [
  1.2497 +    AC_CHECK_HEADERS(sys/ioctl.h)
  1.2498 +    AC_CHECK_HEADERS(sys/filio.h)
  1.2499 +    SC_CONFIG_SYSTEM
  1.2500 +    AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
  1.2501 +    case $system in
  1.2502 +	# There used to be code here to use FIONBIO under AIX.  However, it
  1.2503 +	# was reported that FIONBIO doesn't work under AIX 3.2.5.  Since
  1.2504 +	# using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
  1.2505 +	# code (JO, 5/31/97).
  1.2506 +
  1.2507 +	OSF*)
  1.2508 +	    AC_DEFINE(USE_FIONBIO)
  1.2509 +	    AC_MSG_RESULT([FIONBIO])
  1.2510 +	    ;;
  1.2511 +	SunOS-4*)
  1.2512 +	    AC_DEFINE(USE_FIONBIO)
  1.2513 +	    AC_MSG_RESULT([FIONBIO])
  1.2514 +	    ;;
  1.2515 +	ULTRIX-4.*)
  1.2516 +	    AC_DEFINE(USE_FIONBIO)
  1.2517 +	    AC_MSG_RESULT([FIONBIO])
  1.2518 +	    ;;
  1.2519 +	*)
  1.2520 +	    AC_MSG_RESULT([O_NONBLOCK])
  1.2521 +	    ;;
  1.2522 +    esac
  1.2523 +])
  1.2524 +
  1.2525 +#--------------------------------------------------------------------
  1.2526 +# SC_TIME_HANLDER
  1.2527 +#
  1.2528 +#	Checks how the system deals with time.h, what time structures
  1.2529 +#	are used on the system, and what fields the structures have.
  1.2530 +#
  1.2531 +# Arguments:
  1.2532 +#	none
  1.2533 +#	
  1.2534 +# Results:
  1.2535 +#
  1.2536 +#	Defines some of the following vars:
  1.2537 +#		USE_DELTA_FOR_TZ
  1.2538 +#		HAVE_TM_GMTOFF
  1.2539 +#		HAVE_TM_TZADJ
  1.2540 +#		HAVE_TIMEZONE_VAR
  1.2541 +#
  1.2542 +#--------------------------------------------------------------------
  1.2543 +
  1.2544 +AC_DEFUN([SC_TIME_HANDLER], [
  1.2545 +    AC_CHECK_HEADERS(sys/time.h)
  1.2546 +    AC_HEADER_TIME
  1.2547 +    AC_STRUCT_TIMEZONE
  1.2548 +
  1.2549 +    AC_CHECK_FUNCS(gmtime_r localtime_r)
  1.2550 +
  1.2551 +    AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
  1.2552 +	AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
  1.2553 +	    tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
  1.2554 +    if test $tcl_cv_member_tm_tzadj = yes ; then
  1.2555 +	AC_DEFINE(HAVE_TM_TZADJ)
  1.2556 +    fi
  1.2557 +
  1.2558 +    AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
  1.2559 +	AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
  1.2560 +	    tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
  1.2561 +    if test $tcl_cv_member_tm_gmtoff = yes ; then
  1.2562 +	AC_DEFINE(HAVE_TM_GMTOFF)
  1.2563 +    fi
  1.2564 +
  1.2565 +    #
  1.2566 +    # Its important to include time.h in this check, as some systems
  1.2567 +    # (like convex) have timezone functions, etc.
  1.2568 +    #
  1.2569 +    AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
  1.2570 +	AC_TRY_COMPILE([#include <time.h>],
  1.2571 +	    [extern long timezone;
  1.2572 +	    timezone += 1;
  1.2573 +	    exit (0);],
  1.2574 +	    tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
  1.2575 +    if test $tcl_cv_timezone_long = yes ; then
  1.2576 +	AC_DEFINE(HAVE_TIMEZONE_VAR)
  1.2577 +    else
  1.2578 +	#
  1.2579 +	# On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
  1.2580 +	#
  1.2581 +	AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
  1.2582 +	    AC_TRY_COMPILE([#include <time.h>],
  1.2583 +		[extern time_t timezone;
  1.2584 +		timezone += 1;
  1.2585 +		exit (0);],
  1.2586 +		tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
  1.2587 +	if test $tcl_cv_timezone_time = yes ; then
  1.2588 +	    AC_DEFINE(HAVE_TIMEZONE_VAR)
  1.2589 +	fi
  1.2590 +    fi
  1.2591 +])
  1.2592 +
  1.2593 +#--------------------------------------------------------------------
  1.2594 +# SC_BUGGY_STRTOD
  1.2595 +#
  1.2596 +#	Under Solaris 2.4, strtod returns the wrong value for the
  1.2597 +#	terminating character under some conditions.  Check for this
  1.2598 +#	and if the problem exists use a substitute procedure
  1.2599 +#	"fixstrtod" (provided by Tcl) that corrects the error.
  1.2600 +#	Also, on Compaq's Tru64 Unix 5.0,
  1.2601 +#	strtod(" ") returns 0.0 instead of a failure to convert.
  1.2602 +#
  1.2603 +# Arguments:
  1.2604 +#	none
  1.2605 +#	
  1.2606 +# Results:
  1.2607 +#
  1.2608 +#	Might defines some of the following vars:
  1.2609 +#		strtod (=fixstrtod)
  1.2610 +#
  1.2611 +#--------------------------------------------------------------------
  1.2612 +
  1.2613 +AC_DEFUN([SC_BUGGY_STRTOD], [
  1.2614 +    AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
  1.2615 +    if test "$tcl_strtod" = 1; then
  1.2616 +	AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
  1.2617 +	    AC_TRY_RUN([
  1.2618 +		extern double strtod();
  1.2619 +		int main() {
  1.2620 +		    char *infString="Inf", *nanString="NaN", *spaceString=" ";
  1.2621 +		    char *term;
  1.2622 +		    double value;
  1.2623 +		    value = strtod(infString, &term);
  1.2624 +		    if ((term != infString) && (term[-1] == 0)) {
  1.2625 +			exit(1);
  1.2626 +		    }
  1.2627 +		    value = strtod(nanString, &term);
  1.2628 +		    if ((term != nanString) && (term[-1] == 0)) {
  1.2629 +			exit(1);
  1.2630 +		    }
  1.2631 +		    value = strtod(spaceString, &term);
  1.2632 +		    if (term == (spaceString+1)) {
  1.2633 +			exit(1);
  1.2634 +		    }
  1.2635 +		    exit(0);
  1.2636 +		}], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
  1.2637 +		    tcl_cv_strtod_buggy=buggy)])
  1.2638 +	if test "$tcl_cv_strtod_buggy" = buggy; then
  1.2639 +	    LIBOBJS="$LIBOBJS fixstrtod.o"
  1.2640 +	    AC_DEFINE(strtod, fixstrtod)
  1.2641 +	fi
  1.2642 +    fi
  1.2643 +])
  1.2644 +
  1.2645 +#--------------------------------------------------------------------
  1.2646 +# SC_TCL_LINK_LIBS
  1.2647 +#
  1.2648 +#	Search for the libraries needed to link the Tcl shell.
  1.2649 +#	Things like the math library (-lm) and socket stuff (-lsocket vs.
  1.2650 +#	-lnsl) are dealt with here.
  1.2651 +#
  1.2652 +# Arguments:
  1.2653 +#	Requires the following vars to be set in the Makefile:
  1.2654 +#		DL_LIBS
  1.2655 +#		LIBS
  1.2656 +#		MATH_LIBS
  1.2657 +#	
  1.2658 +# Results:
  1.2659 +#
  1.2660 +#	Subst's the following var:
  1.2661 +#		TCL_LIBS
  1.2662 +#		MATH_LIBS
  1.2663 +#
  1.2664 +#	Might append to the following vars:
  1.2665 +#		LIBS
  1.2666 +#
  1.2667 +#	Might define the following vars:
  1.2668 +#		HAVE_NET_ERRNO_H
  1.2669 +#
  1.2670 +#--------------------------------------------------------------------
  1.2671 +
  1.2672 +AC_DEFUN([SC_TCL_LINK_LIBS], [
  1.2673 +    #--------------------------------------------------------------------
  1.2674 +    # On a few very rare systems, all of the libm.a stuff is
  1.2675 +    # already in libc.a.  Set compiler flags accordingly.
  1.2676 +    # Also, Linux requires the "ieee" library for math to work
  1.2677 +    # right (and it must appear before "-lm").
  1.2678 +    #--------------------------------------------------------------------
  1.2679 +
  1.2680 +    AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
  1.2681 +    AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
  1.2682 +
  1.2683 +    #--------------------------------------------------------------------
  1.2684 +    # Interactive UNIX requires -linet instead of -lsocket, plus it
  1.2685 +    # needs net/errno.h to define the socket-related error codes.
  1.2686 +    #--------------------------------------------------------------------
  1.2687 +
  1.2688 +    AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
  1.2689 +    AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)])
  1.2690 +
  1.2691 +    #--------------------------------------------------------------------
  1.2692 +    #	Check for the existence of the -lsocket and -lnsl libraries.
  1.2693 +    #	The order here is important, so that they end up in the right
  1.2694 +    #	order in the command line generated by make.  Here are some
  1.2695 +    #	special considerations:
  1.2696 +    #	1. Use "connect" and "accept" to check for -lsocket, and
  1.2697 +    #	   "gethostbyname" to check for -lnsl.
  1.2698 +    #	2. Use each function name only once:  can't redo a check because
  1.2699 +    #	   autoconf caches the results of the last check and won't redo it.
  1.2700 +    #	3. Use -lnsl and -lsocket only if they supply procedures that
  1.2701 +    #	   aren't already present in the normal libraries.  This is because
  1.2702 +    #	   IRIX 5.2 has libraries, but they aren't needed and they're
  1.2703 +    #	   bogus:  they goof up name resolution if used.
  1.2704 +    #	4. On some SVR4 systems, can't use -lsocket without -lnsl too.
  1.2705 +    #	   To get around this problem, check for both libraries together
  1.2706 +    #	   if -lsocket doesn't work by itself.
  1.2707 +    #--------------------------------------------------------------------
  1.2708 +
  1.2709 +    tcl_checkBoth=0
  1.2710 +    AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
  1.2711 +    if test "$tcl_checkSocket" = 1; then
  1.2712 +	AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
  1.2713 +	    LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
  1.2714 +    fi
  1.2715 +    if test "$tcl_checkBoth" = 1; then
  1.2716 +	tk_oldLibs=$LIBS
  1.2717 +	LIBS="$LIBS -lsocket -lnsl"
  1.2718 +	AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
  1.2719 +    fi
  1.2720 +    AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
  1.2721 +	    [LIBS="$LIBS -lnsl"])])
  1.2722 +    
  1.2723 +    # Don't perform the eval of the libraries here because DL_LIBS
  1.2724 +    # won't be set until we call SC_CONFIG_CFLAGS
  1.2725 +
  1.2726 +    TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
  1.2727 +    AC_SUBST(TCL_LIBS)
  1.2728 +    AC_SUBST(MATH_LIBS)
  1.2729 +])
  1.2730 +
  1.2731 +#--------------------------------------------------------------------
  1.2732 +# SC_TCL_EARLY_FLAGS
  1.2733 +#
  1.2734 +#	Check for what flags are needed to be passed so the correct OS
  1.2735 +#	features are available.
  1.2736 +#
  1.2737 +# Arguments:
  1.2738 +#	None
  1.2739 +#	
  1.2740 +# Results:
  1.2741 +#
  1.2742 +#	Might define the following vars:
  1.2743 +#		_ISOC99_SOURCE
  1.2744 +#		_LARGEFILE64_SOURCE
  1.2745 +#		_LARGEFILE_SOURCE64
  1.2746 +#
  1.2747 +#--------------------------------------------------------------------
  1.2748 +
  1.2749 +AC_DEFUN([SC_TCL_EARLY_FLAG],[
  1.2750 +    AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
  1.2751 +	AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
  1.2752 +	    AC_TRY_COMPILE([[#define ]$1[ 1
  1.2753 +]$2], $3,
  1.2754 +		[tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
  1.2755 +		[tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
  1.2756 +    if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
  1.2757 +	AC_DEFINE($1)
  1.2758 +	tcl_flags="$tcl_flags $1"
  1.2759 +    fi
  1.2760 +])
  1.2761 +
  1.2762 +AC_DEFUN([SC_TCL_EARLY_FLAGS],[
  1.2763 +    AC_MSG_CHECKING([for required early compiler flags])
  1.2764 +    tcl_flags=""
  1.2765 +    SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
  1.2766 +	[char *p = (char *)strtoll; char *q = (char *)strtoull;])
  1.2767 +    SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
  1.2768 +	[struct stat64 buf; int i = stat64("/", &buf);])
  1.2769 +    SC_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
  1.2770 +	[char *p = (char *)open64;])
  1.2771 +    if test "x${tcl_flags}" = "x" ; then
  1.2772 +	AC_MSG_RESULT([none])
  1.2773 +    else
  1.2774 +	AC_MSG_RESULT([${tcl_flags}])
  1.2775 +    fi
  1.2776 +])
  1.2777 +
  1.2778 +#--------------------------------------------------------------------
  1.2779 +# SC_TCL_64BIT_FLAGS
  1.2780 +#
  1.2781 +#	Check for what is defined in the way of 64-bit features.
  1.2782 +#
  1.2783 +# Arguments:
  1.2784 +#	None
  1.2785 +#	
  1.2786 +# Results:
  1.2787 +#
  1.2788 +#	Might define the following vars:
  1.2789 +#		TCL_WIDE_INT_IS_LONG
  1.2790 +#		TCL_WIDE_INT_TYPE
  1.2791 +#		HAVE_STRUCT_DIRENT64
  1.2792 +#		HAVE_STRUCT_STAT64
  1.2793 +#		HAVE_TYPE_OFF64_T
  1.2794 +#
  1.2795 +#--------------------------------------------------------------------
  1.2796 +
  1.2797 +AC_DEFUN([SC_TCL_64BIT_FLAGS], [
  1.2798 +    AC_MSG_CHECKING([for 64-bit integer type])
  1.2799 +    AC_CACHE_VAL(tcl_cv_type_64bit,[
  1.2800 +	tcl_cv_type_64bit=none
  1.2801 +	# See if the compiler knows natively about __int64
  1.2802 +	AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
  1.2803 +	    tcl_type_64bit=__int64, tcl_type_64bit="long long")
  1.2804 +	# See if we should use long anyway  Note that we substitute in the
  1.2805 +	# type that is our current guess for a 64-bit type inside this check
  1.2806 +	# program, so it should be modified only carefully...
  1.2807 +        AC_TRY_COMPILE(,[switch (0) { 
  1.2808 +            case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; 
  1.2809 +        }],tcl_cv_type_64bit=${tcl_type_64bit})])
  1.2810 +    if test "${tcl_cv_type_64bit}" = none ; then
  1.2811 +	AC_DEFINE(TCL_WIDE_INT_IS_LONG)
  1.2812 +	AC_MSG_RESULT([using long])
  1.2813 +    else
  1.2814 +	AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
  1.2815 +	AC_MSG_RESULT([${tcl_cv_type_64bit}])
  1.2816 +
  1.2817 +	# Now check for auxiliary declarations
  1.2818 +	AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
  1.2819 +	    AC_TRY_COMPILE([#include <sys/types.h>
  1.2820 +#include <sys/dirent.h>],[struct dirent64 p;],
  1.2821 +		tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
  1.2822 +	if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
  1.2823 +	    AC_DEFINE(HAVE_STRUCT_DIRENT64)
  1.2824 +	fi
  1.2825 +
  1.2826 +	AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
  1.2827 +	    AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
  1.2828 +],
  1.2829 +		tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
  1.2830 +	if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
  1.2831 +	    AC_DEFINE(HAVE_STRUCT_STAT64)
  1.2832 +	fi
  1.2833 +
  1.2834 +	AC_CHECK_FUNCS(open64 lseek64)
  1.2835 +	AC_MSG_CHECKING([for off64_t])
  1.2836 +	AC_CACHE_VAL(tcl_cv_type_off64_t,[
  1.2837 +	    AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
  1.2838 +],
  1.2839 +		tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
  1.2840 +	dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
  1.2841 +	dnl functions lseek64 and open64 are defined.
  1.2842 +	if test "x${tcl_cv_type_off64_t}" = "xyes" && \
  1.2843 +	        test "x${ac_cv_func_lseek64}" = "xyes" && \
  1.2844 +	        test "x${ac_cv_func_open64}" = "xyes" ; then
  1.2845 +	    AC_DEFINE(HAVE_TYPE_OFF64_T)
  1.2846 +	    AC_MSG_RESULT([yes])
  1.2847 +	else
  1.2848 +	    AC_MSG_RESULT([no])
  1.2849 +	fi
  1.2850 +    fi
  1.2851 +])
  1.2852 +
  1.2853 +#--------------------------------------------------------------------
  1.2854 +# SC_TCL_GETHOSTBYADDR_R
  1.2855 +#
  1.2856 +#	Check if we have MT-safe variant of gethostbyaddr().
  1.2857 +#
  1.2858 +# Arguments:
  1.2859 +#	None
  1.2860 +#	
  1.2861 +# Results:
  1.2862 +#
  1.2863 +#	Might define the following vars:
  1.2864 +#		HAVE_GETHOSTBYADDR_R
  1.2865 +#		HAVE_GETHOSTBYADDR_R_7
  1.2866 +#		HAVE_GETHOSTBYADDR_R_8
  1.2867 +#
  1.2868 +#--------------------------------------------------------------------
  1.2869 +
  1.2870 +AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
  1.2871 +    AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
  1.2872 +    AC_TRY_COMPILE([
  1.2873 +	#include <netdb.h>
  1.2874 +    ], [
  1.2875 +	char *addr;
  1.2876 +	int length;
  1.2877 +	int type;
  1.2878 +	struct hostent *result;
  1.2879 +	char buffer[2048];
  1.2880 +	int buflen = 2048;
  1.2881 +	int h_errnop;
  1.2882 +
  1.2883 +	(void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
  1.2884 +			       &h_errnop);
  1.2885 +    ], tcl_cv_api_gethostbyaddr_r_7=yes, tcl_cv_api_gethostbyaddr_r_7=no)])
  1.2886 +    tcl_ok=$tcl_cv_api_gethostbyaddr_r_7
  1.2887 +    if test "$tcl_ok" = yes; then
  1.2888 +	AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
  1.2889 +    else
  1.2890 +	AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [
  1.2891 +	AC_TRY_COMPILE([
  1.2892 +	    #include <netdb.h>
  1.2893 +	], [
  1.2894 +	    char *addr;
  1.2895 +	    int length;
  1.2896 +	    int type;
  1.2897 +	    struct hostent *result, *resultp;
  1.2898 +	    char buffer[2048];
  1.2899 +	    int buflen = 2048;
  1.2900 +	    int h_errnop;
  1.2901 +
  1.2902 +	    (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
  1.2903 +				   &resultp, &h_errnop);
  1.2904 +	], tcl_cv_api_gethostbyaddr_r_8=yes, tcl_cv_api_gethostbyaddr_r_8=no)])
  1.2905 +	tcl_ok=$tcl_cv_api_gethostbyaddr_r_8
  1.2906 +	if test "$tcl_ok" = yes; then
  1.2907 +	    AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
  1.2908 +	fi
  1.2909 +    fi
  1.2910 +    if test "$tcl_ok" = yes; then
  1.2911 +	AC_DEFINE(HAVE_GETHOSTBYADDR_R)
  1.2912 +    fi
  1.2913 +])])
  1.2914 +
  1.2915 +#--------------------------------------------------------------------
  1.2916 +# SC_TCL_GETHOSTBYNAME_R
  1.2917 +#
  1.2918 +#	Check to see what variant of gethostbyname_r() we have.
  1.2919 +#	Based on David Arnold's example from the comp.programming.threads
  1.2920 +#	FAQ Q213
  1.2921 +#
  1.2922 +# Arguments:
  1.2923 +#	None
  1.2924 +#	
  1.2925 +# Results:
  1.2926 +#
  1.2927 +#	Might define the following vars:
  1.2928 +#		HAVE_GETHOSTBYADDR_R
  1.2929 +#		HAVE_GETHOSTBYADDR_R_3
  1.2930 +#		HAVE_GETHOSTBYADDR_R_5
  1.2931 +#		HAVE_GETHOSTBYADDR_R_6
  1.2932 +#
  1.2933 +#--------------------------------------------------------------------
  1.2934 +
  1.2935 +AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
  1.2936 +    AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
  1.2937 +    AC_TRY_COMPILE([
  1.2938 +	#include <netdb.h>
  1.2939 +    ], [
  1.2940 +	char *name;
  1.2941 +	struct hostent *he, *res;
  1.2942 +	char buffer[2048];
  1.2943 +	int buflen = 2048;
  1.2944 +	int h_errnop;
  1.2945 +
  1.2946 +	(void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop);
  1.2947 +    ], tcl_cv_api_gethostbyname_r_6=yes, tcl_cv_api_gethostbyname_r_6=no)])
  1.2948 +    tcl_ok=$tcl_cv_api_gethostbyname_r_6
  1.2949 +    if test "$tcl_ok" = yes; then
  1.2950 +	AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
  1.2951 +    else
  1.2952 +	AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [
  1.2953 +	AC_TRY_COMPILE([
  1.2954 +	    #include <netdb.h>
  1.2955 +	], [
  1.2956 +	    char *name;
  1.2957 +	    struct hostent *he;
  1.2958 +	    char buffer[2048];
  1.2959 +	    int buflen = 2048;
  1.2960 +	    int h_errnop;
  1.2961 +
  1.2962 +	    (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop);
  1.2963 +	], tcl_cv_api_gethostbyname_r_5=yes, tcl_cv_api_gethostbyname_r_5=no)])
  1.2964 +	tcl_ok=$tcl_cv_api_gethostbyname_r_5
  1.2965 +	if test "$tcl_ok" = yes; then
  1.2966 +	    AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
  1.2967 +	else
  1.2968 +	    AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [
  1.2969 +	    AC_TRY_COMPILE([
  1.2970 +		#include <netdb.h>
  1.2971 +	    ], [
  1.2972 +		char *name;
  1.2973 +		struct hostent *he;
  1.2974 +		struct hostent_data data;
  1.2975 +
  1.2976 +		(void) gethostbyname_r(name, he, &data);
  1.2977 +	    ], tcl_cv_api_gethostbyname_r_3=yes, tcl_cv_api_gethostbyname_r_3=no)])
  1.2978 +	    tcl_ok=$tcl_cv_api_gethostbyname_r_3
  1.2979 +	    if test "$tcl_ok" = yes; then
  1.2980 +		AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
  1.2981 +	    fi
  1.2982 +	fi
  1.2983 +    fi
  1.2984 +    if test "$tcl_ok" = yes; then
  1.2985 +	AC_DEFINE(HAVE_GETHOSTBYNAME_R)
  1.2986 +    fi
  1.2987 +])])
  1.2988 +
  1.2989 +#--------------------------------------------------------------------
  1.2990 +# SC_TCL_GETPWUID_R
  1.2991 +#
  1.2992 +#	Check if we have MT-safe variant of getpwuid() and if yes,
  1.2993 +#	which one exactly.
  1.2994 +#
  1.2995 +# Arguments:
  1.2996 +#	None
  1.2997 +#	
  1.2998 +# Results:
  1.2999 +#
  1.3000 +#	Might define the following vars:
  1.3001 +#		HAVE_GETPWUID_R
  1.3002 +#		HAVE_GETPWUID_R_4
  1.3003 +#		HAVE_GETPWUID_R_5
  1.3004 +#
  1.3005 +#--------------------------------------------------------------------
  1.3006 +
  1.3007 +AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [
  1.3008 +    AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [
  1.3009 +    AC_TRY_COMPILE([
  1.3010 +	#include <sys/types.h>
  1.3011 +	#include <pwd.h>
  1.3012 +    ], [
  1.3013 +	uid_t uid;
  1.3014 +	struct passwd pw, *pwp;
  1.3015 +	char buf[512];
  1.3016 +	int buflen = 512;
  1.3017 +
  1.3018 +	(void) getpwuid_r(uid, &pw, buf, buflen, &pwp);
  1.3019 +    ], tcl_cv_api_getpwuid_r_5=yes, tcl_cv_api_getpwuid_r_5=no)])
  1.3020 +    tcl_ok=$tcl_cv_api_getpwuid_r_5
  1.3021 +    if test "$tcl_ok" = yes; then
  1.3022 +	AC_DEFINE(HAVE_GETPWUID_R_5)
  1.3023 +    else
  1.3024 +	AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [
  1.3025 +	AC_TRY_COMPILE([
  1.3026 +	    #include <sys/types.h>
  1.3027 +	    #include <pwd.h>
  1.3028 +	], [
  1.3029 +	    uid_t uid;
  1.3030 +	    struct passwd pw;
  1.3031 +	    char buf[512];
  1.3032 +	    int buflen = 512;
  1.3033 +
  1.3034 +	    (void)getpwnam_r(uid, &pw, buf, buflen);
  1.3035 +	], tcl_cv_api_getpwuid_r_4=yes, tcl_cv_api_getpwuid_r_4=no)])
  1.3036 +	tcl_ok=$tcl_cv_api_getpwuid_r_4
  1.3037 +	if test "$tcl_ok" = yes; then
  1.3038 +	    AC_DEFINE(HAVE_GETPWUID_R_4)
  1.3039 +	fi
  1.3040 +    fi
  1.3041 +    if test "$tcl_ok" = yes; then
  1.3042 +	AC_DEFINE(HAVE_GETPWUID_R)
  1.3043 +    fi
  1.3044 +])])
  1.3045 +
  1.3046 +#--------------------------------------------------------------------
  1.3047 +# SC_TCL_GETPWNAM_R
  1.3048 +#
  1.3049 +#	Check if we have MT-safe variant of getpwnam() and if yes,
  1.3050 +#	which one exactly.
  1.3051 +#
  1.3052 +# Arguments:
  1.3053 +#	None
  1.3054 +#	
  1.3055 +# Results:
  1.3056 +#
  1.3057 +#	Might define the following vars:
  1.3058 +#		HAVE_GETPWNAM_R
  1.3059 +#		HAVE_GETPWNAM_R_4
  1.3060 +#		HAVE_GETPWNAM_R_5
  1.3061 +#
  1.3062 +#--------------------------------------------------------------------
  1.3063 +
  1.3064 +AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [
  1.3065 +    AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [
  1.3066 +    AC_TRY_COMPILE([
  1.3067 +	#include <sys/types.h>
  1.3068 +	#include <pwd.h>
  1.3069 +    ], [
  1.3070 +	char *name;
  1.3071 +	struct passwd pw, *pwp;
  1.3072 +	char buf[512];
  1.3073 +	int buflen = 512;
  1.3074 +
  1.3075 +	(void) getpwnam_r(name, &pw, buf, buflen, &pwp);
  1.3076 +    ], tcl_cv_api_getpwnam_r_5=yes, tcl_cv_api_getpwnam_r_5=no)])
  1.3077 +    tcl_ok=$tcl_cv_api_getpwnam_r_5
  1.3078 +    if test "$tcl_ok" = yes; then
  1.3079 +	AC_DEFINE(HAVE_GETPWNAM_R_5)
  1.3080 +    else
  1.3081 +	AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [
  1.3082 +	AC_TRY_COMPILE([
  1.3083 +	    #include <sys/types.h>
  1.3084 +	    #include <pwd.h>
  1.3085 +	], [
  1.3086 +	    char *name;
  1.3087 +	    struct passwd pw;
  1.3088 +	    char buf[512];
  1.3089 +	    int buflen = 512;
  1.3090 +
  1.3091 +	    (void)getpwnam_r(name, &pw, buf, buflen);
  1.3092 +	], tcl_cv_api_getpwnam_r_4=yes, tcl_cv_api_getpwnam_r_4=no)])
  1.3093 +	tcl_ok=$tcl_cv_api_getpwnam_r_4
  1.3094 +	if test "$tcl_ok" = yes; then
  1.3095 +	    AC_DEFINE(HAVE_GETPWNAM_R_4)
  1.3096 +	fi
  1.3097 +    fi
  1.3098 +    if test "$tcl_ok" = yes; then
  1.3099 +	AC_DEFINE(HAVE_GETPWNAM_R)
  1.3100 +    fi
  1.3101 +])])
  1.3102 +
  1.3103 +#--------------------------------------------------------------------
  1.3104 +# SC_TCL_GETGRGID_R
  1.3105 +#
  1.3106 +#	Check if we have MT-safe variant of getgrgid() and if yes,
  1.3107 +#	which one exactly.
  1.3108 +#
  1.3109 +# Arguments:
  1.3110 +#	None
  1.3111 +#	
  1.3112 +# Results:
  1.3113 +#
  1.3114 +#	Might define the following vars:
  1.3115 +#		HAVE_GETGRGID_R
  1.3116 +#		HAVE_GETGRGID_R_4
  1.3117 +#		HAVE_GETGRGID_R_5
  1.3118 +#
  1.3119 +#--------------------------------------------------------------------
  1.3120 +
  1.3121 +AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [
  1.3122 +    AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [
  1.3123 +    AC_TRY_COMPILE([
  1.3124 +	#include <sys/types.h>
  1.3125 +	#include <grp.h>
  1.3126 +    ], [
  1.3127 +	gid_t gid;
  1.3128 +	struct group gr, *grp;
  1.3129 +	char buf[512];
  1.3130 +	int buflen = 512;
  1.3131 +
  1.3132 +	(void) getgrgid_r(gid, &gr, buf, buflen, &grp);
  1.3133 +    ], tcl_cv_api_getgrgid_r_5=yes, tcl_cv_api_getgrgid_r_5=no)])
  1.3134 +    tcl_ok=$tcl_cv_api_getgrgid_r_5
  1.3135 +    if test "$tcl_ok" = yes; then
  1.3136 +	AC_DEFINE(HAVE_GETGRGID_R_5)
  1.3137 +    else
  1.3138 +	AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [
  1.3139 +	AC_TRY_COMPILE([
  1.3140 +	    #include <sys/types.h>
  1.3141 +	    #include <grp.h>
  1.3142 +	], [
  1.3143 +	    gid_t gid;
  1.3144 +	    struct group gr;
  1.3145 +	    char buf[512];
  1.3146 +	    int buflen = 512;
  1.3147 +
  1.3148 +	    (void)getgrgid_r(gid, &gr, buf, buflen);
  1.3149 +	], tcl_cv_api_getgrgid_r_4=yes, tcl_cv_api_getgrgid_r_4=no)])
  1.3150 +	tcl_ok=$tcl_cv_api_getgrgid_r_4
  1.3151 +	if test "$tcl_ok" = yes; then
  1.3152 +	    AC_DEFINE(HAVE_GETGRGID_R_4)
  1.3153 +	fi
  1.3154 +    fi
  1.3155 +    if test "$tcl_ok" = yes; then
  1.3156 +	AC_DEFINE(HAVE_GETGRGID_R)
  1.3157 +    fi
  1.3158 +])])
  1.3159 +
  1.3160 +#--------------------------------------------------------------------
  1.3161 +# SC_TCL_GETGRNAM_R
  1.3162 +#
  1.3163 +#	Check if we have MT-safe variant of getgrnam() and if yes,
  1.3164 +#	which one exactly.
  1.3165 +#
  1.3166 +# Arguments:
  1.3167 +#	None
  1.3168 +#	
  1.3169 +# Results:
  1.3170 +#
  1.3171 +#	Might define the following vars:
  1.3172 +#		HAVE_GETGRNAM_R
  1.3173 +#		HAVE_GETGRNAM_R_4
  1.3174 +#		HAVE_GETGRNAM_R_5
  1.3175 +#
  1.3176 +#--------------------------------------------------------------------
  1.3177 +
  1.3178 +AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
  1.3179 +    AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [
  1.3180 +    AC_TRY_COMPILE([
  1.3181 +	#include <sys/types.h>
  1.3182 +	#include <grp.h>
  1.3183 +    ], [
  1.3184 +	char *name;
  1.3185 +	struct group gr, *grp;
  1.3186 +	char buf[512];
  1.3187 +	int buflen = 512;
  1.3188 +
  1.3189 +	(void) getgrnam_r(name, &gr, buf, buflen, &grp);
  1.3190 +    ], tcl_cv_api_getgrnam_r_5=yes, tcl_cv_api_getgrnam_r_5=no)])
  1.3191 +    tcl_ok=$tcl_cv_api_getgrnam_r_5
  1.3192 +    if test "$tcl_ok" = yes; then
  1.3193 +	AC_DEFINE(HAVE_GETGRNAM_R_5)
  1.3194 +    else
  1.3195 +	AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [
  1.3196 +	AC_TRY_COMPILE([
  1.3197 +	    #include <sys/types.h>
  1.3198 +	    #include <grp.h>
  1.3199 +	], [
  1.3200 +	    char *name;
  1.3201 +	    struct group gr;
  1.3202 +	    char buf[512];
  1.3203 +	    int buflen = 512;
  1.3204 +
  1.3205 +	    (void)getgrnam_r(name, &gr, buf, buflen);
  1.3206 +	], tcl_cv_api_getgrnam_r_4=yes, tcl_cv_api_getgrnam_r_4=no)])
  1.3207 +	tcl_ok=$tcl_cv_api_getgrnam_r_4
  1.3208 +	if test "$tcl_ok" = yes; then
  1.3209 +	    AC_DEFINE(HAVE_GETGRNAM_R_4)
  1.3210 +	fi
  1.3211 +    fi
  1.3212 +    if test "$tcl_ok" = yes; then
  1.3213 +	AC_DEFINE(HAVE_GETGRNAM_R)
  1.3214 +    fi
  1.3215 +])])
  1.3216 +
  1.3217 +#--------------------------------------------------------------------
  1.3218 +# SC_CONFIG_COMMANDS_PRE(CMDS)
  1.3219 +#
  1.3220 +#	Replacement for autoconf 2.5x AC_COMMANDS_PRE:
  1.3221 +#		Commands to run right before config.status is
  1.3222 +#		created. Accumulates.
  1.3223 +#
  1.3224 +#	Requires presence of SC_OUTPUT_COMMANDS_PRE at the end
  1.3225 +#	of configure.in (right before AC_OUTPUT).
  1.3226 +#
  1.3227 +#--------------------------------------------------------------------
  1.3228 +
  1.3229 +AC_DEFUN([SC_CONFIG_COMMANDS_PRE], [
  1.3230 +    define([SC_OUTPUT_COMMANDS_PRE], defn([SC_OUTPUT_COMMANDS_PRE])[$1
  1.3231 +])])
  1.3232 +AC_DEFUN([SC_OUTPUT_COMMANDS_PRE])
  1.3233 +