sl@0: #------------------------------------------------------------------------ sl@0: # SC_PATH_TCLCONFIG -- sl@0: # sl@0: # Locate the tclConfig.sh file and perform a sanity check on sl@0: # the Tcl compile flags sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Adds the following arguments to configure: sl@0: # --with-tcl=... sl@0: # sl@0: # Defines the following vars: sl@0: # TCL_BIN_DIR Full path to the directory containing sl@0: # the tclConfig.sh file sl@0: #------------------------------------------------------------------------ sl@0: sl@0: AC_DEFUN([SC_PATH_TCLCONFIG], [ sl@0: # sl@0: # Ok, lets find the tcl configuration sl@0: # First, look for one uninstalled. sl@0: # the alternative search directory is invoked by --with-tcl sl@0: # sl@0: sl@0: if test x"${no_tcl}" = x ; then sl@0: # we reset no_tcl in case something fails here sl@0: no_tcl=true sl@0: AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval}) sl@0: AC_MSG_CHECKING([for Tcl configuration]) sl@0: AC_CACHE_VAL(ac_cv_c_tclconfig,[ sl@0: sl@0: # First check to see if --with-tcl was specified. sl@0: if test x"${with_tclconfig}" != x ; then sl@0: if test -f "${with_tclconfig}/tclConfig.sh" ; then sl@0: ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` sl@0: else sl@0: AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) sl@0: fi sl@0: fi sl@0: sl@0: # then check for a private Tcl installation sl@0: if test x"${ac_cv_c_tclconfig}" = x ; then sl@0: for i in \ sl@0: ../tcl \ sl@0: `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ sl@0: `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ sl@0: `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ sl@0: ../../tcl \ sl@0: `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ sl@0: `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ sl@0: `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ sl@0: ../../../tcl \ sl@0: `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ sl@0: `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ sl@0: `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do sl@0: if test -f "$i/unix/tclConfig.sh" ; then sl@0: ac_cv_c_tclconfig=`(cd $i/unix; pwd)` sl@0: break sl@0: fi sl@0: done sl@0: fi sl@0: sl@0: # on Darwin, check in Framework installation locations sl@0: if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then sl@0: for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ sl@0: `ls -d /Library/Frameworks 2>/dev/null` \ sl@0: `ls -d /Network/Library/Frameworks 2>/dev/null` \ sl@0: `ls -d /System/Library/Frameworks 2>/dev/null` \ sl@0: ; do sl@0: if test -f "$i/Tcl.framework/tclConfig.sh" ; then sl@0: ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)` sl@0: break sl@0: fi sl@0: done sl@0: fi sl@0: sl@0: # check in a few common install locations sl@0: if test x"${ac_cv_c_tclconfig}" = x ; then sl@0: for i in `ls -d ${libdir} 2>/dev/null` \ sl@0: `ls -d ${exec_prefix}/lib 2>/dev/null` \ sl@0: `ls -d ${prefix}/lib 2>/dev/null` \ sl@0: `ls -d /usr/local/lib 2>/dev/null` \ sl@0: `ls -d /usr/contrib/lib 2>/dev/null` \ sl@0: `ls -d /usr/lib 2>/dev/null` \ sl@0: ; do sl@0: if test -f "$i/tclConfig.sh" ; then sl@0: ac_cv_c_tclconfig=`(cd $i; pwd)` sl@0: break sl@0: fi sl@0: done sl@0: fi sl@0: sl@0: # check in a few other private locations sl@0: if test x"${ac_cv_c_tclconfig}" = x ; then sl@0: for i in \ sl@0: ${srcdir}/../tcl \ sl@0: `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ sl@0: `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ sl@0: `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do sl@0: if test -f "$i/unix/tclConfig.sh" ; then sl@0: ac_cv_c_tclconfig=`(cd $i/unix; pwd)` sl@0: break sl@0: fi sl@0: done sl@0: fi sl@0: ]) sl@0: sl@0: if test x"${ac_cv_c_tclconfig}" = x ; then sl@0: TCL_BIN_DIR="# no Tcl configs found" sl@0: AC_MSG_WARN([Can't find Tcl configuration definitions]) sl@0: exit 0 sl@0: else sl@0: no_tcl= sl@0: TCL_BIN_DIR=${ac_cv_c_tclconfig} sl@0: AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh]) sl@0: fi sl@0: fi sl@0: ]) sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # SC_PATH_TKCONFIG -- sl@0: # sl@0: # Locate the tkConfig.sh file sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Adds the following arguments to configure: sl@0: # --with-tk=... sl@0: # sl@0: # Defines the following vars: sl@0: # TK_BIN_DIR Full path to the directory containing sl@0: # the tkConfig.sh file sl@0: #------------------------------------------------------------------------ sl@0: sl@0: AC_DEFUN([SC_PATH_TKCONFIG], [ sl@0: # sl@0: # Ok, lets find the tk configuration sl@0: # First, look for one uninstalled. sl@0: # the alternative search directory is invoked by --with-tk sl@0: # sl@0: sl@0: if test x"${no_tk}" = x ; then sl@0: # we reset no_tk in case something fails here sl@0: no_tk=true sl@0: AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval}) sl@0: AC_MSG_CHECKING([for Tk configuration]) sl@0: AC_CACHE_VAL(ac_cv_c_tkconfig,[ sl@0: sl@0: # First check to see if --with-tkconfig was specified. sl@0: if test x"${with_tkconfig}" != x ; then sl@0: if test -f "${with_tkconfig}/tkConfig.sh" ; then sl@0: ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)` sl@0: else sl@0: AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh]) sl@0: fi sl@0: fi sl@0: sl@0: # then check for a private Tk library sl@0: if test x"${ac_cv_c_tkconfig}" = x ; then sl@0: for i in \ sl@0: ../tk \ sl@0: `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ sl@0: `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \ sl@0: `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \ sl@0: ../../tk \ sl@0: `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ sl@0: `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \ sl@0: `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \ sl@0: ../../../tk \ sl@0: `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ sl@0: `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \ sl@0: `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do sl@0: if test -f "$i/unix/tkConfig.sh" ; then sl@0: ac_cv_c_tkconfig=`(cd $i/unix; pwd)` sl@0: break sl@0: fi sl@0: done sl@0: fi sl@0: sl@0: # on Darwin, check in Framework installation locations sl@0: if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then sl@0: for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ sl@0: `ls -d /Library/Frameworks 2>/dev/null` \ sl@0: `ls -d /Network/Library/Frameworks 2>/dev/null` \ sl@0: `ls -d /System/Library/Frameworks 2>/dev/null` \ sl@0: ; do sl@0: if test -f "$i/Tk.framework/tkConfig.sh" ; then sl@0: ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)` sl@0: break sl@0: fi sl@0: done sl@0: fi sl@0: sl@0: # check in a few common install locations sl@0: if test x"${ac_cv_c_tkconfig}" = x ; then sl@0: for i in `ls -d ${libdir} 2>/dev/null` \ sl@0: `ls -d ${exec_prefix}/lib 2>/dev/null` \ sl@0: `ls -d ${prefix}/lib 2>/dev/null` \ sl@0: `ls -d /usr/local/lib 2>/dev/null` \ sl@0: `ls -d /usr/contrib/lib 2>/dev/null` \ sl@0: `ls -d /usr/lib 2>/dev/null` \ sl@0: ; do sl@0: if test -f "$i/tkConfig.sh" ; then sl@0: ac_cv_c_tkconfig=`(cd $i; pwd)` sl@0: break sl@0: fi sl@0: done sl@0: fi sl@0: # check in a few other private locations sl@0: if test x"${ac_cv_c_tkconfig}" = x ; then sl@0: for i in \ sl@0: ${srcdir}/../tk \ sl@0: `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ sl@0: `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \ sl@0: `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do sl@0: if test -f "$i/unix/tkConfig.sh" ; then sl@0: ac_cv_c_tkconfig=`(cd $i/unix; pwd)` sl@0: break sl@0: fi sl@0: done sl@0: fi sl@0: ]) sl@0: sl@0: if test x"${ac_cv_c_tkconfig}" = x ; then sl@0: TK_BIN_DIR="# no Tk configs found" sl@0: AC_MSG_WARN([Can't find Tk configuration definitions]) sl@0: exit 0 sl@0: else sl@0: no_tk= sl@0: TK_BIN_DIR=${ac_cv_c_tkconfig} sl@0: AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh]) sl@0: fi sl@0: fi sl@0: ]) sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # SC_LOAD_TCLCONFIG -- sl@0: # sl@0: # Load the tclConfig.sh file sl@0: # sl@0: # Arguments: sl@0: # sl@0: # Requires the following vars to be set: sl@0: # TCL_BIN_DIR sl@0: # sl@0: # Results: sl@0: # sl@0: # Subst the following vars: sl@0: # TCL_BIN_DIR sl@0: # TCL_SRC_DIR sl@0: # TCL_LIB_FILE sl@0: # sl@0: #------------------------------------------------------------------------ sl@0: sl@0: AC_DEFUN([SC_LOAD_TCLCONFIG], [ sl@0: AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh]) sl@0: sl@0: if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then sl@0: AC_MSG_RESULT([loading]) sl@0: . ${TCL_BIN_DIR}/tclConfig.sh sl@0: else sl@0: AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh]) sl@0: fi sl@0: sl@0: # eval is required to do the TCL_DBGX substitution sl@0: eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" sl@0: eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" sl@0: sl@0: # If the TCL_BIN_DIR is the build directory (not the install directory), sl@0: # then set the common variable name to the value of the build variables. sl@0: # For example, the variable TCL_LIB_SPEC will be set to the value sl@0: # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC sl@0: # instead of TCL_BUILD_LIB_SPEC since it will work with both an sl@0: # installed and uninstalled version of Tcl. sl@0: if test -f ${TCL_BIN_DIR}/Makefile ; then sl@0: TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} sl@0: TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} sl@0: TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} sl@0: elif test "`uname -s`" = "Darwin"; then sl@0: # If Tcl was built as a framework, attempt to use the libraries sl@0: # from the framework at the given location so that linking works sl@0: # against Tcl.framework installed in an arbitary location. sl@0: case ${TCL_DEFS} in sl@0: *TCL_FRAMEWORK*) sl@0: if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then sl@0: for i in "`cd ${TCL_BIN_DIR}; pwd`" \ sl@0: "`cd ${TCL_BIN_DIR}/../..; pwd`"; do sl@0: if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then sl@0: TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}" sl@0: break sl@0: fi sl@0: done sl@0: fi sl@0: if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then sl@0: TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}" sl@0: TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}" sl@0: fi sl@0: ;; sl@0: esac sl@0: fi sl@0: sl@0: # eval is required to do the TCL_DBGX substitution sl@0: eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" sl@0: eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" sl@0: eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" sl@0: eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" sl@0: sl@0: AC_SUBST(TCL_VERSION) sl@0: AC_SUBST(TCL_PATCH_LEVEL) sl@0: AC_SUBST(TCL_BIN_DIR) sl@0: AC_SUBST(TCL_SRC_DIR) sl@0: sl@0: AC_SUBST(TCL_LIB_FILE) sl@0: AC_SUBST(TCL_LIB_FLAG) sl@0: AC_SUBST(TCL_LIB_SPEC) sl@0: sl@0: AC_SUBST(TCL_STUB_LIB_FILE) sl@0: AC_SUBST(TCL_STUB_LIB_FLAG) sl@0: AC_SUBST(TCL_STUB_LIB_SPEC) sl@0: ]) sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # SC_LOAD_TKCONFIG -- sl@0: # sl@0: # Load the tkConfig.sh file sl@0: # sl@0: # Arguments: sl@0: # sl@0: # Requires the following vars to be set: sl@0: # TK_BIN_DIR sl@0: # sl@0: # Results: sl@0: # sl@0: # Sets the following vars that should be in tkConfig.sh: sl@0: # TK_BIN_DIR sl@0: #------------------------------------------------------------------------ sl@0: sl@0: AC_DEFUN([SC_LOAD_TKCONFIG], [ sl@0: AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh]) sl@0: sl@0: if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then sl@0: AC_MSG_RESULT([loading]) sl@0: . ${TK_BIN_DIR}/tkConfig.sh sl@0: else sl@0: AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh]) sl@0: fi sl@0: sl@0: # eval is required to do the TK_DBGX substitution sl@0: eval "TK_LIB_FILE=\"${TK_LIB_FILE}\"" sl@0: eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\"" sl@0: sl@0: # If the TK_BIN_DIR is the build directory (not the install directory), sl@0: # then set the common variable name to the value of the build variables. sl@0: # For example, the variable TK_LIB_SPEC will be set to the value sl@0: # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC sl@0: # instead of TK_BUILD_LIB_SPEC since it will work with both an sl@0: # installed and uninstalled version of Tcl. sl@0: if test -f ${TK_BIN_DIR}/Makefile ; then sl@0: TK_LIB_SPEC=${TK_BUILD_LIB_SPEC} sl@0: TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC} sl@0: TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH} sl@0: elif test "`uname -s`" = "Darwin"; then sl@0: # If Tk was built as a framework, attempt to use the libraries sl@0: # from the framework at the given location so that linking works sl@0: # against Tk.framework installed in an arbitary location. sl@0: case ${TK_DEFS} in sl@0: *TK_FRAMEWORK*) sl@0: if test -f ${TK_BIN_DIR}/${TK_LIB_FILE}; then sl@0: for i in "`cd ${TK_BIN_DIR}; pwd`" \ sl@0: "`cd ${TK_BIN_DIR}/../..; pwd`"; do sl@0: if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then sl@0: TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}" sl@0: break sl@0: fi sl@0: done sl@0: fi sl@0: if test -f ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}; then sl@0: TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}" sl@0: TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}" sl@0: fi sl@0: ;; sl@0: esac sl@0: fi sl@0: sl@0: # eval is required to do the TK_DBGX substitution sl@0: eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\"" sl@0: eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\"" sl@0: eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\"" sl@0: eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\"" sl@0: sl@0: AC_SUBST(TK_VERSION) sl@0: AC_SUBST(TK_BIN_DIR) sl@0: AC_SUBST(TK_SRC_DIR) sl@0: sl@0: AC_SUBST(TK_LIB_FILE) sl@0: AC_SUBST(TK_LIB_FLAG) sl@0: AC_SUBST(TK_LIB_SPEC) sl@0: sl@0: AC_SUBST(TK_STUB_LIB_FILE) sl@0: AC_SUBST(TK_STUB_LIB_FLAG) sl@0: AC_SUBST(TK_STUB_LIB_SPEC) sl@0: ]) sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # SC_PROG_TCLSH sl@0: # Locate a tclsh shell installed on the system path. This macro sl@0: # will only find a Tcl shell that already exists on the system. sl@0: # It will not find a Tcl shell in the Tcl build directory or sl@0: # a Tcl shell that has been installed from the Tcl build directory. sl@0: # If a Tcl shell can't be located on the PATH, then TCLSH_PROG will sl@0: # be set to "". Extensions should take care not to create Makefile sl@0: # rules that are run by default and depend on TCLSH_PROG. An sl@0: # extension can't assume that an executable Tcl shell exists at sl@0: # build time. sl@0: # sl@0: # Arguments sl@0: # none sl@0: # sl@0: # Results sl@0: # Subst's the following values: sl@0: # TCLSH_PROG sl@0: #------------------------------------------------------------------------ sl@0: sl@0: AC_DEFUN([SC_PROG_TCLSH], [ sl@0: AC_MSG_CHECKING([for tclsh]) sl@0: AC_CACHE_VAL(ac_cv_path_tclsh, [ sl@0: search_path=`echo ${PATH} | sed -e 's/:/ /g'` sl@0: for dir in $search_path ; do sl@0: for j in `ls -r $dir/tclsh[[8-9]]* 2> /dev/null` \ sl@0: `ls -r $dir/tclsh* 2> /dev/null` ; do sl@0: if test x"$ac_cv_path_tclsh" = x ; then sl@0: if test -f "$j" ; then sl@0: ac_cv_path_tclsh=$j sl@0: break sl@0: fi sl@0: fi sl@0: done sl@0: done sl@0: ]) sl@0: sl@0: if test -f "$ac_cv_path_tclsh" ; then sl@0: TCLSH_PROG="$ac_cv_path_tclsh" sl@0: AC_MSG_RESULT([$TCLSH_PROG]) sl@0: else sl@0: # It is not an error if an installed version of Tcl can't be located. sl@0: TCLSH_PROG="" sl@0: AC_MSG_RESULT([No tclsh found on PATH]) sl@0: fi sl@0: AC_SUBST(TCLSH_PROG) sl@0: ]) sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # SC_BUILD_TCLSH sl@0: # Determine the fully qualified path name of the tclsh executable sl@0: # in the Tcl build directory. This macro will correctly determine sl@0: # the name of the tclsh executable even if tclsh has not yet sl@0: # been built in the build directory. The build tclsh must be used sl@0: # when running tests from an extension build directory. It is not sl@0: # correct to use the TCLSH_PROG in cases like this. sl@0: # sl@0: # Arguments sl@0: # none sl@0: # sl@0: # Results sl@0: # Subst's the following values: sl@0: # BUILD_TCLSH sl@0: #------------------------------------------------------------------------ sl@0: sl@0: AC_DEFUN([SC_BUILD_TCLSH], [ sl@0: AC_MSG_CHECKING([for tclsh in Tcl build directory]) sl@0: BUILD_TCLSH=${TCL_BIN_DIR}/tclsh sl@0: AC_MSG_RESULT([$BUILD_TCLSH]) sl@0: AC_SUBST(BUILD_TCLSH) sl@0: ]) sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # SC_ENABLE_SHARED -- sl@0: # sl@0: # Allows the building of shared libraries sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Adds the following arguments to configure: sl@0: # --enable-shared=yes|no sl@0: # sl@0: # Defines the following vars: sl@0: # STATIC_BUILD Used for building import/export libraries sl@0: # on Windows. sl@0: # sl@0: # Sets the following vars: sl@0: # SHARED_BUILD Value of 1 or 0 sl@0: #------------------------------------------------------------------------ sl@0: sl@0: AC_DEFUN([SC_ENABLE_SHARED], [ sl@0: AC_MSG_CHECKING([how to build libraries]) sl@0: AC_ARG_ENABLE(shared, sl@0: [ --enable-shared build and link with shared libraries [--enable-shared]], sl@0: [tcl_ok=$enableval], [tcl_ok=yes]) sl@0: sl@0: if test "${enable_shared+set}" = set; then sl@0: enableval="$enable_shared" sl@0: tcl_ok=$enableval sl@0: else sl@0: tcl_ok=yes sl@0: fi sl@0: sl@0: if test "$tcl_ok" = "yes" ; then sl@0: AC_MSG_RESULT([shared]) sl@0: SHARED_BUILD=1 sl@0: else sl@0: AC_MSG_RESULT([static]) sl@0: SHARED_BUILD=0 sl@0: AC_DEFINE(STATIC_BUILD) sl@0: fi sl@0: ]) sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # SC_ENABLE_FRAMEWORK -- sl@0: # sl@0: # Allows the building of shared libraries into frameworks sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Adds the following arguments to configure: sl@0: # --enable-framework=yes|no sl@0: # sl@0: # Sets the following vars: sl@0: # FRAMEWORK_BUILD Value of 1 or 0 sl@0: #------------------------------------------------------------------------ sl@0: sl@0: AC_DEFUN([SC_ENABLE_FRAMEWORK], [ sl@0: if test "`uname -s`" = "Darwin" ; then sl@0: AC_MSG_CHECKING([how to package libraries]) sl@0: AC_ARG_ENABLE(framework, sl@0: [ --enable-framework package shared libraries in MacOSX frameworks [--disable-framework]], sl@0: [enable_framework=$enableval], [enable_framework=no]) sl@0: if test $enable_framework = yes; then sl@0: if test $SHARED_BUILD = 0; then sl@0: AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes]) sl@0: enable_framework=no sl@0: fi sl@0: if test $tcl_corefoundation = no; then sl@0: AC_MSG_WARN([Frameworks can only be used when CoreFoundation is available]) sl@0: enable_framework=no sl@0: fi sl@0: fi sl@0: if test $enable_framework = yes; then sl@0: AC_MSG_RESULT([framework]) sl@0: FRAMEWORK_BUILD=1 sl@0: else sl@0: if test $SHARED_BUILD = 1; then sl@0: AC_MSG_RESULT([shared library]) sl@0: else sl@0: AC_MSG_RESULT([static library]) sl@0: fi sl@0: FRAMEWORK_BUILD=0 sl@0: fi sl@0: fi sl@0: ]) sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # SC_ENABLE_THREADS -- sl@0: # sl@0: # Specify if thread support should be enabled. TCL_THREADS is sl@0: # checked so that if you are compiling an extension against a sl@0: # threaded core, your extension must be compiled threaded as well. sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Adds the following arguments to configure: sl@0: # --enable-threads sl@0: # sl@0: # Sets the following vars: sl@0: # THREADS_LIBS Thread library(s) sl@0: # sl@0: # Defines the following vars: sl@0: # TCL_THREADS sl@0: # _REENTRANT sl@0: # _THREAD_SAFE sl@0: # sl@0: #------------------------------------------------------------------------ sl@0: sl@0: AC_DEFUN([SC_ENABLE_THREADS], [ sl@0: AC_ARG_ENABLE(threads, [ --enable-threads build with threads], sl@0: [tcl_ok=$enableval], [tcl_ok=no]) sl@0: sl@0: if test "${TCL_THREADS}" = 1; then sl@0: tcl_threaded_core=1; sl@0: fi sl@0: sl@0: if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then sl@0: TCL_THREADS=1 sl@0: # USE_THREAD_ALLOC tells us to try the special thread-based sl@0: # allocator that significantly reduces lock contention sl@0: AC_DEFINE(USE_THREAD_ALLOC) sl@0: AC_DEFINE(_REENTRANT) sl@0: if test "`uname -s`" = "SunOS" ; then sl@0: AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) sl@0: fi sl@0: AC_DEFINE(_THREAD_SAFE) sl@0: AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) sl@0: if test "$tcl_ok" = "no"; then sl@0: # Check a little harder for __pthread_mutex_init in the same sl@0: # library, as some systems hide it there until pthread.h is sl@0: # defined. We could alternatively do an AC_TRY_COMPILE with sl@0: # pthread.h, but that will work with libpthread really doesn't sl@0: # exist, like AIX 4.2. [Bug: 4359] sl@0: AC_CHECK_LIB(pthread, __pthread_mutex_init, sl@0: tcl_ok=yes, tcl_ok=no) sl@0: fi sl@0: sl@0: if test "$tcl_ok" = "yes"; then sl@0: # The space is needed sl@0: THREADS_LIBS=" -lpthread" sl@0: else sl@0: AC_CHECK_LIB(pthreads, pthread_mutex_init, sl@0: tcl_ok=yes, tcl_ok=no) sl@0: if test "$tcl_ok" = "yes"; then sl@0: # The space is needed sl@0: THREADS_LIBS=" -lpthreads" sl@0: else sl@0: AC_CHECK_LIB(c, pthread_mutex_init, sl@0: tcl_ok=yes, tcl_ok=no) sl@0: if test "$tcl_ok" = "no"; then sl@0: AC_CHECK_LIB(c_r, pthread_mutex_init, sl@0: tcl_ok=yes, tcl_ok=no) sl@0: if test "$tcl_ok" = "yes"; then sl@0: # The space is needed sl@0: THREADS_LIBS=" -pthread" sl@0: else sl@0: TCL_THREADS=0 sl@0: 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...]) sl@0: fi sl@0: fi sl@0: fi sl@0: fi sl@0: sl@0: # Does the pthread-implementation provide sl@0: # 'pthread_attr_setstacksize' ? sl@0: sl@0: ac_saved_libs=$LIBS sl@0: LIBS="$LIBS $THREADS_LIBS" sl@0: AC_CHECK_FUNCS(pthread_attr_setstacksize) sl@0: AC_CHECK_FUNCS(pthread_atfork) sl@0: LIBS=$ac_saved_libs sl@0: else sl@0: TCL_THREADS=0 sl@0: fi sl@0: # Do checking message here to not mess up interleaved configure output sl@0: AC_MSG_CHECKING([for building with threads]) sl@0: if test "${TCL_THREADS}" = 1; then sl@0: AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?]) sl@0: if test "${tcl_threaded_core}" = 1; then sl@0: AC_MSG_RESULT([yes (threaded core)]) sl@0: else sl@0: AC_MSG_RESULT([yes]) sl@0: fi sl@0: else sl@0: AC_MSG_RESULT([no (default)]) sl@0: fi sl@0: sl@0: AC_SUBST(TCL_THREADS) sl@0: ]) sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # SC_ENABLE_SYMBOLS -- sl@0: # sl@0: # Specify if debugging symbols should be used. sl@0: # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging sl@0: # can also be enabled. sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Requires the following vars to be set in the Makefile: sl@0: # CFLAGS_DEBUG sl@0: # CFLAGS_OPTIMIZE sl@0: # LDFLAGS_DEBUG sl@0: # LDFLAGS_OPTIMIZE sl@0: # sl@0: # Results: sl@0: # sl@0: # Adds the following arguments to configure: sl@0: # --enable-symbols sl@0: # sl@0: # Defines the following vars: sl@0: # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true sl@0: # Sets to $(CFLAGS_OPTIMIZE) if false sl@0: # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true sl@0: # Sets to $(LDFLAGS_OPTIMIZE) if false sl@0: # DBGX Debug library extension sl@0: # sl@0: #------------------------------------------------------------------------ sl@0: sl@0: AC_DEFUN([SC_ENABLE_SYMBOLS], [ sl@0: AC_MSG_CHECKING([for build with symbols]) sl@0: AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no]) sl@0: # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT. sl@0: if test "$tcl_ok" = "no"; then sl@0: CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)' sl@0: LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)' sl@0: DBGX="" sl@0: AC_MSG_RESULT([no]) sl@0: else sl@0: CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' sl@0: LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' sl@0: DBGX=g sl@0: if test "$tcl_ok" = "yes"; then sl@0: AC_MSG_RESULT([yes (standard debugging)]) sl@0: fi sl@0: fi sl@0: AC_SUBST(CFLAGS_DEFAULT) sl@0: AC_SUBST(LDFLAGS_DEFAULT) sl@0: sl@0: if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then sl@0: AC_DEFINE(TCL_MEM_DEBUG) sl@0: fi sl@0: sl@0: if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then sl@0: AC_DEFINE(TCL_COMPILE_DEBUG) sl@0: AC_DEFINE(TCL_COMPILE_STATS) sl@0: fi sl@0: sl@0: if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then sl@0: if test "$tcl_ok" = "all"; then sl@0: AC_MSG_RESULT([enabled symbols mem compile debugging]) sl@0: else sl@0: AC_MSG_RESULT([enabled $tcl_ok debugging]) sl@0: fi sl@0: fi sl@0: ]) sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # SC_ENABLE_LANGINFO -- sl@0: # sl@0: # Allows use of modern nl_langinfo check for better l10n. sl@0: # This is only relevant for Unix. sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Adds the following arguments to configure: sl@0: # --enable-langinfo=yes|no (default is yes) sl@0: # sl@0: # Defines the following vars: sl@0: # HAVE_LANGINFO Triggers use of nl_langinfo if defined. sl@0: # sl@0: #------------------------------------------------------------------------ sl@0: sl@0: AC_DEFUN([SC_ENABLE_LANGINFO], [ sl@0: AC_ARG_ENABLE(langinfo, sl@0: [ --enable-langinfo use nl_langinfo if possible to determine sl@0: encoding at startup, otherwise use old heuristic], sl@0: [langinfo_ok=$enableval], [langinfo_ok=yes]) sl@0: sl@0: HAVE_LANGINFO=0 sl@0: if test "$langinfo_ok" = "yes"; then sl@0: AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no]) sl@0: fi sl@0: AC_MSG_CHECKING([whether to use nl_langinfo]) sl@0: if test "$langinfo_ok" = "yes"; then sl@0: AC_CACHE_VAL(tcl_cv_langinfo_h, [ sl@0: AC_TRY_COMPILE([#include ], [nl_langinfo(CODESET);], sl@0: [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])]) sl@0: AC_MSG_RESULT([$tcl_cv_langinfo_h]) sl@0: if test $tcl_cv_langinfo_h = yes; then sl@0: AC_DEFINE(HAVE_LANGINFO) sl@0: fi sl@0: else sl@0: AC_MSG_RESULT([$langinfo_ok]) sl@0: fi sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_CONFIG_MANPAGES sl@0: # sl@0: # Decide whether to use symlinks for linking the manpages, sl@0: # whether to compress the manpages after installation, and sl@0: # whether to add a package name suffix to the installed sl@0: # manpages to avoidfile name clashes. sl@0: # If compression is enabled also find out what file name suffix sl@0: # the given compression program is using. sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Adds the following arguments to configure: sl@0: # --enable-man-symlinks sl@0: # --enable-man-compression=PROG sl@0: # --enable-man-suffix[=STRING] sl@0: # sl@0: # Defines the following variable: sl@0: # sl@0: # MAN_FLAGS - The apropriate flags for installManPage sl@0: # according to the user's selection. sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_CONFIG_MANPAGES], [ sl@0: AC_MSG_CHECKING([whether to use symlinks for manpages]) sl@0: AC_ARG_ENABLE(man-symlinks, sl@0: [ --enable-man-symlinks use symlinks for the manpages], sl@0: test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks", sl@0: enableval="no") sl@0: AC_MSG_RESULT([$enableval]) sl@0: sl@0: AC_MSG_CHECKING([whether to compress the manpages]) sl@0: AC_ARG_ENABLE(man-compression, sl@0: [ --enable-man-compression=PROG sl@0: compress the manpages with PROG], sl@0: [case $enableval in sl@0: yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);; sl@0: no) ;; sl@0: *) MAN_FLAGS="$MAN_FLAGS --compress $enableval";; sl@0: esac], sl@0: enableval="no") sl@0: AC_MSG_RESULT([$enableval]) sl@0: if test "$enableval" != "no"; then sl@0: AC_MSG_CHECKING([for compressed file suffix]) sl@0: touch TeST sl@0: $enableval TeST sl@0: Z=`ls TeST* | sed 's/^....//'` sl@0: rm -f TeST* sl@0: MAN_FLAGS="$MAN_FLAGS --extension $Z" sl@0: AC_MSG_RESULT([$Z]) sl@0: fi sl@0: sl@0: AC_MSG_CHECKING([whether to add a package name suffix for the manpages]) sl@0: AC_ARG_ENABLE(man-suffix, sl@0: [ --enable-man-suffix=STRING sl@0: use STRING as a suffix to manpage file names sl@0: (default: $1)], sl@0: [case $enableval in sl@0: yes) enableval="$1" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; sl@0: no) ;; sl@0: *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; sl@0: esac], sl@0: enableval="no") sl@0: AC_MSG_RESULT([$enableval]) sl@0: sl@0: AC_SUBST(MAN_FLAGS) sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_CONFIG_SYSTEM sl@0: # sl@0: # Determine what the system is (some things cannot be easily checked sl@0: # on a feature-driven basis, alas). This can usually be done via the sl@0: # "uname" command, but there are a few systems, like Next, where sl@0: # this doesn't work. sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # Defines the following var: sl@0: # sl@0: # system - System/platform/version identification code. sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_CONFIG_SYSTEM], [ sl@0: AC_CACHE_CHECK([system version], tcl_cv_sys_version, [ sl@0: if test -f /usr/lib/NextStep/software_version; then sl@0: tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` sl@0: else sl@0: tcl_cv_sys_version=`uname -s`-`uname -r` sl@0: if test "$?" -ne 0 ; then sl@0: AC_MSG_WARN([can't find uname command]) sl@0: tcl_cv_sys_version=unknown sl@0: else sl@0: # Special check for weird MP-RAS system (uname returns weird sl@0: # results, and the version is kept in special file). sl@0: sl@0: if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then sl@0: tcl_cv_sys_version=MP-RAS-`awk '{print [$]3}' /etc/.relid` sl@0: fi sl@0: if test "`uname -s`" = "AIX" ; then sl@0: tcl_cv_sys_version=AIX-`uname -v`.`uname -r` sl@0: fi sl@0: fi sl@0: fi sl@0: ]) sl@0: system=$tcl_cv_sys_version sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_CONFIG_CFLAGS sl@0: # sl@0: # Try to determine the proper flags to pass to the compiler sl@0: # for building shared libraries and other such nonsense. sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Defines and substitutes the following vars: sl@0: # sl@0: # DL_OBJS - Name of the object file that implements dynamic sl@0: # loading for Tcl on this system. sl@0: # DL_LIBS - Library file(s) to include in tclsh and other base sl@0: # applications in order for the "load" command to work. sl@0: # LDFLAGS - Flags to pass to the compiler when linking object sl@0: # files into an executable application binary such sl@0: # as tclsh. sl@0: # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib", sl@0: # that tell the run-time dynamic linker where to look sl@0: # for shared libraries such as libtcl.so. Depends on sl@0: # the variable LIB_RUNTIME_DIR in the Makefile. Could sl@0: # be the same as CC_SEARCH_FLAGS if ${CC} is used to link. sl@0: # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib", sl@0: # that tell the run-time dynamic linker where to look sl@0: # for shared libraries such as libtcl.so. Depends on sl@0: # the variable LIB_RUNTIME_DIR in the Makefile. sl@0: # MAKE_LIB - Command to execute to build the a library; sl@0: # differs when building shared or static. sl@0: # MAKE_STUB_LIB - sl@0: # Command to execute to build a stub library. sl@0: # INSTALL_LIB - Command to execute to install a library; sl@0: # differs when building shared or static. sl@0: # INSTALL_STUB_LIB - sl@0: # Command to execute to install a stub library. sl@0: # STLIB_LD - Base command to use for combining object files sl@0: # into a static library. sl@0: # SHLIB_CFLAGS - Flags to pass to cc when compiling the components sl@0: # of a shared library (may request position-independent sl@0: # code, among other things). sl@0: # SHLIB_LD - Base command to use for combining object files sl@0: # into a shared library. sl@0: # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when sl@0: # creating shared libraries. This symbol typically sl@0: # goes at the end of the "ld" commands that build sl@0: # shared libraries. The value of the symbol is sl@0: # "${LIBS}" if all of the dependent libraries should sl@0: # be specified when creating a shared library. If sl@0: # dependent libraries should not be specified (as on sl@0: # SunOS 4.x, where they cause the link to fail, or in sl@0: # general if Tcl and Tk aren't themselves shared sl@0: # libraries), then this symbol has an empty string sl@0: # as its value. sl@0: # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable sl@0: # extensions. An empty string means we don't know how sl@0: # to use shared libraries on this platform. sl@0: # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS sl@0: # TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the sl@0: # tclConfig.sh, since they are only used for the build sl@0: # of Tcl and Tk. sl@0: # Examples: MacOS X records the library version and sl@0: # compatibility version in the shared library. But sl@0: # of course the Tcl version of this is only used for Tcl. sl@0: # LIB_SUFFIX - Specifies everything that comes after the "libfoo" sl@0: # in a static or shared library name, using the $VERSION variable sl@0: # to put the version in the right place. This is used sl@0: # by platforms that need non-standard library names. sl@0: # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs sl@0: # to have a version after the .so, and ${VERSION}.a sl@0: # on AIX, since a shared library needs to have sl@0: # a .a extension whereas shared objects for loadable sl@0: # extensions have a .so extension. Defaults to sl@0: # ${VERSION}${SHLIB_SUFFIX}. sl@0: # TCL_NEEDS_EXP_FILE - sl@0: # 1 means that an export file is needed to link to a sl@0: # shared library. sl@0: # TCL_EXP_FILE - The name of the installed export / import file which sl@0: # should be used to link to the Tcl shared library. sl@0: # Empty if Tcl is unshared. sl@0: # TCL_BUILD_EXP_FILE - sl@0: # The name of the built export / import file which sl@0: # should be used to link to the Tcl shared library. sl@0: # Empty if Tcl is unshared. sl@0: # CFLAGS_DEBUG - sl@0: # Flags used when running the compiler in debug mode sl@0: # CFLAGS_OPTIMIZE - sl@0: # Flags used when running the compiler in optimize mode sl@0: # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit) sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_CONFIG_CFLAGS], [ sl@0: sl@0: # Step 0.a: Enable 64 bit support? sl@0: sl@0: AC_MSG_CHECKING([if 64bit support is requested]) sl@0: AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], sl@0: [do64bit=$enableval], [do64bit=no]) sl@0: AC_MSG_RESULT([$do64bit]) sl@0: sl@0: # Step 0.b: Enable Solaris 64 bit VIS support? sl@0: sl@0: AC_MSG_CHECKING([if 64bit Sparc VIS support is requested]) sl@0: AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support], sl@0: [do64bitVIS=$enableval], [do64bitVIS=no]) sl@0: AC_MSG_RESULT([$do64bitVIS]) sl@0: sl@0: if test "$do64bitVIS" = "yes"; then sl@0: # Force 64bit on with VIS sl@0: do64bit=yes sl@0: fi sl@0: sl@0: # Step 1: set the variable "system" to hold the name and version number sl@0: # for the system. sl@0: sl@0: SC_CONFIG_SYSTEM sl@0: sl@0: # Step 2: check for existence of -ldl library. This is needed because sl@0: # Linux can use either -ldl or -ldld for dynamic loading. sl@0: sl@0: AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no) sl@0: sl@0: # Require ranlib early so we can override it in special cases below. sl@0: sl@0: AC_REQUIRE([AC_PROG_RANLIB]) sl@0: sl@0: # Step 3: set configuration options based on system name and version. sl@0: sl@0: do64bit_ok=no sl@0: LDFLAGS_ORIG="$LDFLAGS" sl@0: TCL_EXPORT_FILE_SUFFIX="" sl@0: UNSHARED_LIB_SUFFIX="" sl@0: TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`' sl@0: ECHO_VERSION='`echo ${VERSION}`' sl@0: TCL_LIB_VERSIONS_OK=ok sl@0: CFLAGS_DEBUG=-g sl@0: CFLAGS_OPTIMIZE=-O sl@0: if test "$GCC" = "yes" ; then sl@0: CFLAGS_WARNING="-Wall -Wno-implicit-int -fno-strict-aliasing" sl@0: else sl@0: CFLAGS_WARNING="" sl@0: fi sl@0: TCL_NEEDS_EXP_FILE=0 sl@0: TCL_BUILD_EXP_FILE="" sl@0: TCL_EXP_FILE="" sl@0: dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed. sl@0: dnl AC_CHECK_TOOL(AR, ar) sl@0: AC_CHECK_PROG(AR, ar, ar) sl@0: if test "${AR}" = "" ; then sl@0: AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.]) sl@0: fi sl@0: STLIB_LD='${AR} cr' sl@0: LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" sl@0: PLAT_OBJS="" sl@0: PLAT_SRCS="" sl@0: case $system in sl@0: AIX-*) sl@0: if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then sl@0: # AIX requires the _r compiler when gcc isn't being used sl@0: case "${CC}" in sl@0: *_r) sl@0: # ok ... sl@0: ;; sl@0: *) sl@0: CC=${CC}_r sl@0: ;; sl@0: esac sl@0: AC_MSG_RESULT([Using $CC for compiling with threads]) sl@0: fi sl@0: LIBS="$LIBS -lc" sl@0: SHLIB_CFLAGS="" sl@0: # Note: need the LIBS below, otherwise Tk won't find Tcl's sl@0: # symbols when dynamically loaded into tclsh. sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: sl@0: DL_OBJS="tclLoadDl.o" sl@0: LD_LIBRARY_PATH_VAR="LIBPATH" sl@0: sl@0: # Check to enable 64-bit flags for compiler/linker on AIX 4+ sl@0: if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then sl@0: if test "$GCC" = "yes" ; then sl@0: AC_MSG_WARN([64bit mode not supported with GCC on $system]) sl@0: else sl@0: do64bit_ok=yes sl@0: CFLAGS="$CFLAGS -q64" sl@0: LDFLAGS="$LDFLAGS -q64" sl@0: RANLIB="${RANLIB} -X64" sl@0: AR="${AR} -X64" sl@0: SHLIB_LD_FLAGS="-b64" sl@0: fi sl@0: fi sl@0: sl@0: if test "`uname -m`" = "ia64" ; then sl@0: # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC sl@0: SHLIB_LD="/usr/ccs/bin/ld -G -z text" sl@0: # AIX-5 has dl* in libc.so sl@0: DL_LIBS="" sl@0: if test "$GCC" = "yes" ; then sl@0: CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' sl@0: else sl@0: CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' sl@0: fi sl@0: LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' sl@0: else sl@0: if test "$GCC" = "yes" ; then sl@0: SHLIB_LD="gcc -shared" sl@0: else sl@0: SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" sl@0: fi sl@0: SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}" sl@0: DL_LIBS="-ldl" sl@0: CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: TCL_NEEDS_EXP_FILE=1 sl@0: TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp' sl@0: fi sl@0: sl@0: # AIX v<=4.1 has some different flags than 4.2+ sl@0: if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then sl@0: LIBOBJS="$LIBOBJS tclLoadAix.o" sl@0: DL_LIBS="-lld" sl@0: fi sl@0: sl@0: # On AIX <=v4 systems, libbsd.a has to be linked in to support sl@0: # non-blocking file IO. This library has to be linked in after sl@0: # the MATH_LIBS or it breaks the pow() function. The way to sl@0: # insure proper sequencing, is to add it to the tail of MATH_LIBS. sl@0: # This library also supplies gettimeofday. sl@0: # sl@0: # AIX does not have a timezone field in struct tm. When the AIX sl@0: # bsd library is used, the timezone global and the gettimeofday sl@0: # methods are to be avoided for timezone deduction instead, we sl@0: # deduce the timezone by comparing the localtime result on a sl@0: # known GMT value. sl@0: sl@0: AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no) sl@0: if test $libbsd = yes; then sl@0: MATH_LIBS="$MATH_LIBS -lbsd" sl@0: AC_DEFINE(USE_DELTA_FOR_TZ) sl@0: fi sl@0: ;; sl@0: BeOS*) sl@0: SHLIB_CFLAGS="-fPIC" sl@0: SHLIB_LD="${CC} -nostart" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: sl@0: #----------------------------------------------------------- sl@0: # Check for inet_ntoa in -lbind, for BeOS (which also needs sl@0: # -lsocket, even if the network functions are in -lnet which sl@0: # is always linked to, for compatibility. sl@0: #----------------------------------------------------------- sl@0: AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"]) sl@0: ;; sl@0: BSD/OS-2.1*|BSD/OS-3*) sl@0: SHLIB_CFLAGS="" sl@0: SHLIB_LD="shlicc -r" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: BSD/OS-4.*) sl@0: SHLIB_CFLAGS="-export-dynamic -fPIC" sl@0: SHLIB_LD="cc -shared" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: LDFLAGS="$LDFLAGS -export-dynamic" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: dgux*) sl@0: SHLIB_CFLAGS="-K PIC" sl@0: SHLIB_LD="cc -G" sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: HP-UX-*.11.*) sl@0: # Use updated header definitions where possible sl@0: AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library sl@0: AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library sl@0: LIBS="$LIBS -lxnet" # Use the XOPEN network library sl@0: sl@0: if test "`uname -m`" = "ia64" ; then sl@0: SHLIB_SUFFIX=".so" sl@0: else sl@0: SHLIB_SUFFIX=".sl" sl@0: fi sl@0: AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) sl@0: if test "$tcl_ok" = yes; then sl@0: SHLIB_CFLAGS="+z" sl@0: SHLIB_LD="ld -b" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: DL_OBJS="tclLoadShl.o" sl@0: DL_LIBS="-ldld" sl@0: LDFLAGS="$LDFLAGS -Wl,-E" sl@0: CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' sl@0: LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' sl@0: LD_LIBRARY_PATH_VAR="SHLIB_PATH" sl@0: fi sl@0: if test "$GCC" = "yes" ; then sl@0: SHLIB_LD="gcc -shared" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: fi sl@0: sl@0: # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc sl@0: #CFLAGS="$CFLAGS +DAportable" sl@0: sl@0: # Check to enable 64-bit flags for compiler/linker sl@0: if test "$do64bit" = "yes" ; then sl@0: if test "$GCC" = "yes" ; then sl@0: hpux_arch=`${CC} -dumpmachine` sl@0: case $hpux_arch in sl@0: hppa64*) sl@0: # 64-bit gcc in use. Fix flags for GNU ld. sl@0: do64bit_ok=yes sl@0: SHLIB_LD="${CC} -shared" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: ;; sl@0: *) sl@0: AC_MSG_WARN([64bit mode not supported with GCC on $system]) sl@0: ;; sl@0: esac sl@0: else sl@0: do64bit_ok=yes sl@0: CFLAGS="$CFLAGS +DD64" sl@0: LDFLAGS="$LDFLAGS +DD64" sl@0: fi sl@0: fi sl@0: ;; sl@0: HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) sl@0: SHLIB_SUFFIX=".sl" sl@0: AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) sl@0: if test "$tcl_ok" = yes; then sl@0: SHLIB_CFLAGS="+z" sl@0: SHLIB_LD="ld -b" sl@0: SHLIB_LD_LIBS="" sl@0: DL_OBJS="tclLoadShl.o" sl@0: DL_LIBS="-ldld" sl@0: LDFLAGS="$LDFLAGS -Wl,-E" sl@0: CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' sl@0: LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' sl@0: LD_LIBRARY_PATH_VAR="SHLIB_PATH" sl@0: fi sl@0: ;; sl@0: IRIX-4.*) sl@0: SHLIB_CFLAGS="-G 0" sl@0: SHLIB_SUFFIX=".a" sl@0: SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: DL_OBJS="tclLoadAout.o" sl@0: DL_LIBS="" sl@0: LDFLAGS="$LDFLAGS -Wl,-D,08000000" sl@0: CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a' sl@0: ;; sl@0: IRIX-5.*) sl@0: SHLIB_CFLAGS="" sl@0: SHLIB_LD="ld -shared -rdata_shared" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' sl@0: ;; sl@0: IRIX-6.*) sl@0: SHLIB_CFLAGS="" sl@0: SHLIB_LD="ld -n32 -shared -rdata_shared" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' sl@0: if test "$GCC" = "yes" ; then sl@0: CFLAGS="$CFLAGS -mabi=n32" sl@0: LDFLAGS="$LDFLAGS -mabi=n32" sl@0: else sl@0: case $system in sl@0: IRIX-6.3) sl@0: # Use to build 6.2 compatible binaries on 6.3. sl@0: CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" sl@0: ;; sl@0: *) sl@0: CFLAGS="$CFLAGS -n32" sl@0: ;; sl@0: esac sl@0: LDFLAGS="$LDFLAGS -n32" sl@0: fi sl@0: ;; sl@0: IRIX64-6.*) sl@0: SHLIB_CFLAGS="" sl@0: SHLIB_LD="ld -n32 -shared -rdata_shared" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' sl@0: sl@0: # Check to enable 64-bit flags for compiler/linker sl@0: sl@0: if test "$do64bit" = "yes" ; then sl@0: if test "$GCC" = "yes" ; then sl@0: AC_MSG_WARN([64bit mode not supported by gcc]) sl@0: else sl@0: do64bit_ok=yes sl@0: SHLIB_LD="ld -64 -shared -rdata_shared" sl@0: CFLAGS="$CFLAGS -64" sl@0: LDFLAGS="$LDFLAGS -64" sl@0: fi sl@0: fi sl@0: ;; sl@0: Linux*) sl@0: SHLIB_CFLAGS="-fPIC" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: sl@0: CFLAGS_OPTIMIZE=-O2 sl@0: # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings sl@0: # when you inline the string and math operations. Turn this off to sl@0: # get rid of the warnings. sl@0: #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" sl@0: sl@0: if test "$have_dl" = yes; then sl@0: SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}' sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: LDFLAGS="$LDFLAGS -Wl,--export-dynamic" sl@0: CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: else sl@0: AC_CHECK_HEADER(dld.h, [ sl@0: SHLIB_LD="ld -shared" sl@0: DL_OBJS="tclLoadDld.o" sl@0: DL_LIBS="-ldld" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS=""]) sl@0: fi sl@0: if test "`uname -m`" = "alpha" ; then sl@0: CFLAGS="$CFLAGS -mieee" sl@0: fi sl@0: if test $do64bit = yes; then sl@0: AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [ sl@0: hold_cflags=$CFLAGS sl@0: CFLAGS="$CFLAGS -m64" sl@0: AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no) sl@0: CFLAGS=$hold_cflags]) sl@0: if test $tcl_cv_cc_m64 = yes; then sl@0: CFLAGS="$CFLAGS -m64" sl@0: do64bit_ok=yes sl@0: fi sl@0: fi sl@0: sl@0: # The combo of gcc + glibc has a bug related sl@0: # to inlining of functions like strtod(). The sl@0: # -fno-builtin flag should address this problem sl@0: # but it does not work. The -fno-inline flag sl@0: # is kind of overkill but it works. sl@0: # Disable inlining only when one of the sl@0: # files in compat/*.c is being linked in. sl@0: if test x"${LIBOBJS}" != x ; then sl@0: CFLAGS="$CFLAGS -fno-inline" sl@0: fi sl@0: sl@0: # XIM peeking works under XFree86. sl@0: AC_DEFINE(PEEK_XCLOSEIM) sl@0: sl@0: ;; sl@0: GNU*) sl@0: SHLIB_CFLAGS="-fPIC" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: sl@0: if test "$have_dl" = yes; then sl@0: SHLIB_LD="${CC} -shared" sl@0: DL_OBJS="" sl@0: DL_LIBS="-ldl" sl@0: LDFLAGS="$LDFLAGS -Wl,--export-dynamic" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: else sl@0: AC_CHECK_HEADER(dld.h, [ sl@0: SHLIB_LD="ld -shared" sl@0: DL_OBJS="" sl@0: DL_LIBS="-ldld" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS=""]) sl@0: fi sl@0: if test "`uname -m`" = "alpha" ; then sl@0: CFLAGS="$CFLAGS -mieee" sl@0: fi sl@0: ;; sl@0: Lynx*) sl@0: SHLIB_CFLAGS="-fPIC" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: CFLAGS_OPTIMIZE=-02 sl@0: SHLIB_LD="${CC} -shared " sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-mshared -ldl" sl@0: LD_FLAGS="-Wl,--export-dynamic" sl@0: CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' sl@0: ;; sl@0: MP-RAS-02*) sl@0: SHLIB_CFLAGS="-K PIC" sl@0: SHLIB_LD="cc -G" sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: MP-RAS-*) sl@0: SHLIB_CFLAGS="-K PIC" sl@0: SHLIB_LD="cc -G" sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: LDFLAGS="$LDFLAGS -Wl,-Bexport" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: NetBSD-*|FreeBSD-[[1-2]].*) sl@0: # Not available on all versions: check for include file. sl@0: AC_CHECK_HEADER(dlfcn.h, [ sl@0: # NetBSD/SPARC needs -fPIC, -fpic will not do. sl@0: SHLIB_CFLAGS="-fPIC" sl@0: SHLIB_LD="ld -Bshareable -x" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' sl@0: AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [ sl@0: AC_EGREP_CPP(yes, [ sl@0: #ifdef __ELF__ sl@0: yes sl@0: #endif sl@0: ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)]) sl@0: if test $tcl_cv_ld_elf = yes; then sl@0: SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' sl@0: else sl@0: SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' sl@0: fi sl@0: ], [ sl@0: SHLIB_CFLAGS="" sl@0: SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".a" sl@0: DL_OBJS="tclLoadAout.o" sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' sl@0: ]) sl@0: sl@0: # FreeBSD doesn't handle version numbers with dots. sl@0: sl@0: UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' sl@0: TCL_LIB_VERSIONS_OK=nodots sl@0: ;; sl@0: OpenBSD-*) sl@0: case `arch -s` in sl@0: m88k|vax) sl@0: SHLIB_CFLAGS="" sl@0: SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".a" sl@0: DL_OBJS="tclLoadAout.o" sl@0: DL_LIBS="" sl@0: LDFLAGS="" sl@0: CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' sl@0: ;; sl@0: *) sl@0: # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do. sl@0: case `machine` in sl@0: sparc|sparc64) sl@0: SHLIB_CFLAGS="-fPIC";; sl@0: *) sl@0: SHLIB_CFLAGS="-fpic";; sl@0: esac sl@0: SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' sl@0: AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [ sl@0: AC_EGREP_CPP(yes, [ sl@0: #ifdef __ELF__ sl@0: yes sl@0: #endif sl@0: ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)]) sl@0: if test $tcl_cv_ld_elf = yes; then sl@0: LDFLAGS=-Wl,-export-dynamic sl@0: else sl@0: LDFLAGS="" sl@0: fi sl@0: ;; sl@0: esac sl@0: sl@0: # OpenBSD doesn't do version numbers with dots. sl@0: UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' sl@0: TCL_LIB_VERSIONS_OK=nodots sl@0: ;; sl@0: FreeBSD-*) sl@0: # FreeBSD 3.* and greater have ELF. sl@0: SHLIB_CFLAGS="-fPIC" sl@0: SHLIB_LD="ld -Bshareable -x" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="" sl@0: LDFLAGS="$LDFLAGS -export-dynamic" sl@0: CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' sl@0: if test "${TCL_THREADS}" = "1" ; then sl@0: # The -pthread needs to go in the CFLAGS, not LIBS sl@0: LIBS=`echo $LIBS | sed s/-pthread//` sl@0: CFLAGS="$CFLAGS -pthread" sl@0: LDFLAGS="$LDFLAGS -pthread" sl@0: fi sl@0: case $system in sl@0: FreeBSD-3.*) sl@0: # FreeBSD-3 doesn't handle version numbers with dots. sl@0: UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' sl@0: SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' sl@0: TCL_LIB_VERSIONS_OK=nodots sl@0: ;; sl@0: esac sl@0: ;; sl@0: Darwin-*) sl@0: CFLAGS_OPTIMIZE="-Os" sl@0: SHLIB_CFLAGS="-fno-common" sl@0: # To avoid discrepancies between what headers configure sees during sl@0: # preprocessing tests and compiling tests, move any -isysroot and sl@0: # -mmacosx-version-min flags from CFLAGS to CPPFLAGS: sl@0: CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \ sl@0: awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ sl@0: if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`" sl@0: CFLAGS="`echo " ${CFLAGS}" | \ sl@0: awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ sl@0: if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`" sl@0: if test $do64bit = yes; then sl@0: case `arch` in sl@0: ppc) sl@0: AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag], sl@0: tcl_cv_cc_arch_ppc64, [ sl@0: hold_cflags=$CFLAGS sl@0: CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" sl@0: AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes, sl@0: tcl_cv_cc_arch_ppc64=no) sl@0: CFLAGS=$hold_cflags]) sl@0: if test $tcl_cv_cc_arch_ppc64 = yes; then sl@0: CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" sl@0: do64bit_ok=yes sl@0: fi;; sl@0: i386) sl@0: AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag], sl@0: tcl_cv_cc_arch_x86_64, [ sl@0: hold_cflags=$CFLAGS sl@0: CFLAGS="$CFLAGS -arch x86_64" sl@0: AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes, sl@0: tcl_cv_cc_arch_x86_64=no) sl@0: CFLAGS=$hold_cflags]) sl@0: if test $tcl_cv_cc_arch_x86_64 = yes; then sl@0: CFLAGS="$CFLAGS -arch x86_64" sl@0: do64bit_ok=yes sl@0: fi;; sl@0: *) sl@0: AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);; sl@0: esac sl@0: else sl@0: # Check for combined 32-bit and 64-bit fat build sl@0: echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \ sl@0: echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \ sl@0: fat_32_64=yes sl@0: fi sl@0: SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}' sl@0: AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [ sl@0: hold_ldflags=$LDFLAGS sl@0: LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module" sl@0: AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no) sl@0: LDFLAGS=$hold_ldflags]) sl@0: if test $tcl_cv_ld_single_module = yes; then sl@0: SHLIB_LD="${SHLIB_LD} -Wl,-single_module" sl@0: fi sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".dylib" sl@0: DL_OBJS="tclLoadDyld.o" sl@0: DL_LIBS="" sl@0: # Don't use -prebind when building for Mac OS X 10.4 or later only: sl@0: test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \ sl@0: "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \ sl@0: LDFLAGS="$LDFLAGS -prebind" sl@0: LDFLAGS="$LDFLAGS -headerpad_max_install_names" sl@0: AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [ sl@0: hold_ldflags=$LDFLAGS sl@0: LDFLAGS="$LDFLAGS -Wl,-search_paths_first" sl@0: AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no) sl@0: LDFLAGS=$hold_ldflags]) sl@0: if test $tcl_cv_ld_search_paths_first = yes; then sl@0: LDFLAGS="$LDFLAGS -Wl,-search_paths_first" sl@0: fi sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" sl@0: PLAT_OBJS=\$\(MAC\_OSX_OBJS\) sl@0: PLAT_SRCS=\$\(MAC\_OSX_SRCS\) sl@0: AC_MSG_CHECKING([whether to use CoreFoundation]) sl@0: AC_ARG_ENABLE(corefoundation, [ --enable-corefoundation use CoreFoundation API [--enable-corefoundation]], sl@0: [tcl_corefoundation=$enableval], [tcl_corefoundation=yes]) sl@0: AC_MSG_RESULT([$tcl_corefoundation]) sl@0: if test $tcl_corefoundation = yes; then sl@0: AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [ sl@0: hold_libs=$LIBS; hold_cflags=$CFLAGS sl@0: if test "$fat_32_64" = yes; then sl@0: # On Tiger there is no 64-bit CF, so remove 64-bit archs sl@0: # from CFLAGS while testing for presence of CF. sl@0: # 64-bit CF is disabled in tclUnixPort.h if necessary. sl@0: CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc64 / /g' -e 's/-arch x86_64 / /g'`" sl@0: fi sl@0: LIBS="$LIBS -framework CoreFoundation" sl@0: AC_TRY_LINK([#include ], sl@0: [CFBundleRef b = CFBundleGetMainBundle();], sl@0: tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no) sl@0: LIBS=$hold_libs; CFLAGS=$hold_cflags]) sl@0: if test $tcl_cv_lib_corefoundation = yes; then sl@0: LIBS="$LIBS -framework CoreFoundation" sl@0: AC_DEFINE(HAVE_COREFOUNDATION) sl@0: else sl@0: tcl_corefoundation=no sl@0: fi sl@0: if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then sl@0: AC_CACHE_CHECK([for 64-bit CoreFoundation], tcl_cv_lib_corefoundation_64, [ sl@0: hold_cflags=$CFLAGS sl@0: CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc / /g' -e 's/-arch i386 / /g'`" sl@0: AC_TRY_LINK([#include ], sl@0: [CFBundleRef b = CFBundleGetMainBundle();], sl@0: tcl_cv_lib_corefoundation_64=yes, tcl_cv_lib_corefoundation_64=no) sl@0: CFLAGS=$hold_cflags]) sl@0: if test $tcl_cv_lib_corefoundation_64 = no; then sl@0: AC_DEFINE(NO_COREFOUNDATION_64) sl@0: fi sl@0: fi sl@0: fi sl@0: AC_DEFINE(MAC_OSX_TCL) sl@0: ;; sl@0: NEXTSTEP-*) sl@0: SHLIB_CFLAGS="" sl@0: SHLIB_LD="cc -nostdlib -r" sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadNext.o" sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: OS/390-*) sl@0: CFLAGS_OPTIMIZE="" # Optimizer is buggy sl@0: AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h sl@0: ;; sl@0: OSF1-1.0|OSF1-1.1|OSF1-1.2) sl@0: # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 sl@0: SHLIB_CFLAGS="" sl@0: # Hack: make package name same as library name sl@0: SHLIB_LD='ld -R -export $@:' sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadOSF.o" sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: OSF1-1.*) sl@0: # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 sl@0: SHLIB_CFLAGS="-fPIC" sl@0: if test "$SHARED_BUILD" = "1" ; then sl@0: SHLIB_LD="ld -shared" sl@0: else sl@0: SHLIB_LD="ld -non_shared" sl@0: fi sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: OSF1-V*) sl@0: # Digital OSF/1 sl@0: SHLIB_CFLAGS="" sl@0: if test "$SHARED_BUILD" = "1" ; then sl@0: SHLIB_LD='ld -shared -expect_unresolved "*"' sl@0: else sl@0: SHLIB_LD='ld -non_shared -expect_unresolved "*"' sl@0: fi sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' sl@0: if test "$GCC" = "yes" ; then sl@0: CFLAGS="$CFLAGS -mieee" sl@0: else sl@0: CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" sl@0: fi sl@0: # see pthread_intro(3) for pthread support on osf1, k.furukawa sl@0: if test "${TCL_THREADS}" = "1" ; then sl@0: CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" sl@0: CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" sl@0: LIBS=`echo $LIBS | sed s/-lpthreads//` sl@0: if test "$GCC" = "yes" ; then sl@0: LIBS="$LIBS -lpthread -lmach -lexc" sl@0: else sl@0: CFLAGS="$CFLAGS -pthread" sl@0: LDFLAGS="$LDFLAGS -pthread" sl@0: fi sl@0: fi sl@0: sl@0: ;; sl@0: QNX-6*) sl@0: # QNX RTP sl@0: # This may work for all QNX, but it was only reported for v6. sl@0: SHLIB_CFLAGS="-fPIC" sl@0: SHLIB_LD="ld -Bshareable -x" sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: # dlopen is in -lc on QNX sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: RISCos-*) sl@0: SHLIB_CFLAGS="-G 0" sl@0: SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".a" sl@0: DL_OBJS="tclLoadAout.o" sl@0: DL_LIBS="" sl@0: LDFLAGS="$LDFLAGS -Wl,-D,08000000" sl@0: CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: ;; sl@0: SCO_SV-3.2*) sl@0: # Note, dlopen is available only on SCO 3.2.5 and greater. However, sl@0: # this test works, since "uname -s" was non-standard in 3.2.4 and sl@0: # below. sl@0: if test "$GCC" = "yes" ; then sl@0: SHLIB_CFLAGS="-fPIC -melf" sl@0: LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" sl@0: else sl@0: SHLIB_CFLAGS="-Kpic -belf" sl@0: LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" sl@0: fi sl@0: SHLIB_LD="ld -G" sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: SINIX*5.4*) sl@0: SHLIB_CFLAGS="-K PIC" sl@0: SHLIB_LD="cc -G" sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: SunOS-4*) sl@0: SHLIB_CFLAGS="-PIC" sl@0: SHLIB_LD="ld" sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: sl@0: # SunOS can't handle version numbers with dots in them in library sl@0: # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it sl@0: # requires an extra version number at the end of .so file names. sl@0: # So, the library has to have a name like libtcl75.so.1.0 sl@0: sl@0: SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' sl@0: UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' sl@0: TCL_LIB_VERSIONS_OK=nodots sl@0: ;; sl@0: SunOS-5.[[0-6]]) sl@0: # Careful to not let 5.10+ fall into this case sl@0: sl@0: # Note: If _REENTRANT isn't defined, then Solaris sl@0: # won't define thread-safe library routines. sl@0: sl@0: AC_DEFINE(_REENTRANT) sl@0: AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) sl@0: sl@0: SHLIB_CFLAGS="-KPIC" sl@0: sl@0: # Note: need the LIBS below, otherwise Tk won't find Tcl's sl@0: # symbols when dynamically loaded into tclsh. sl@0: sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: if test "$GCC" = "yes" ; then sl@0: SHLIB_LD="$CC -shared" sl@0: CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: else sl@0: SHLIB_LD="/usr/ccs/bin/ld -G -z text" sl@0: CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: fi sl@0: ;; sl@0: SunOS-5*) sl@0: # Note: If _REENTRANT isn't defined, then Solaris sl@0: # won't define thread-safe library routines. sl@0: sl@0: AC_DEFINE(_REENTRANT) sl@0: AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) sl@0: sl@0: SHLIB_CFLAGS="-KPIC" sl@0: sl@0: # Check to enable 64-bit flags for compiler/linker sl@0: if test "$do64bit" = "yes" ; then sl@0: arch=`isainfo` sl@0: if test "$arch" = "sparcv9 sparc" ; then sl@0: if test "$GCC" = "yes" ; then sl@0: if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then sl@0: AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system]) sl@0: else sl@0: do64bit_ok=yes sl@0: CFLAGS="$CFLAGS -m64 -mcpu=v9" sl@0: LDFLAGS="$LDFLAGS -m64 -mcpu=v9" sl@0: SHLIB_CFLAGS="-fPIC" sl@0: fi sl@0: else sl@0: do64bit_ok=yes sl@0: if test "$do64bitVIS" = "yes" ; then sl@0: CFLAGS="$CFLAGS -xarch=v9a" sl@0: LDFLAGS="$LDFLAGS -xarch=v9a" sl@0: else sl@0: CFLAGS="$CFLAGS -xarch=v9" sl@0: LDFLAGS="$LDFLAGS -xarch=v9" sl@0: fi sl@0: # Solaris 64 uses this as well sl@0: #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" sl@0: fi sl@0: elif test "$arch" = "amd64 i386" ; then sl@0: if test "$GCC" = "yes" ; then sl@0: AC_MSG_WARN([64bit mode not supported with GCC on $system]) sl@0: else sl@0: do64bit_ok=yes sl@0: CFLAGS="$CFLAGS -xarch=amd64" sl@0: LDFLAGS="$LDFLAGS -xarch=amd64" sl@0: fi sl@0: else sl@0: AC_MSG_WARN([64bit mode not supported for $arch]) sl@0: fi sl@0: fi sl@0: sl@0: # Note: need the LIBS below, otherwise Tk won't find Tcl's sl@0: # symbols when dynamically loaded into tclsh. sl@0: sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: if test "$GCC" = "yes" ; then sl@0: SHLIB_LD="$CC -shared" sl@0: CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: if test "$do64bit_ok" = "yes" ; then sl@0: # We need to specify -static-libgcc or we need to sl@0: # add the path to the sparv9 libgcc. sl@0: SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc" sl@0: # for finding sparcv9 libgcc, get the regular libgcc sl@0: # path, remove so name and append 'sparcv9' sl@0: #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..." sl@0: #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir" sl@0: fi sl@0: else sl@0: SHLIB_LD="/usr/ccs/bin/ld -G -z text" sl@0: CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' sl@0: fi sl@0: ;; sl@0: ULTRIX-4.*) sl@0: SHLIB_CFLAGS="-G 0" sl@0: SHLIB_SUFFIX=".a" sl@0: SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" sl@0: SHLIB_LD_LIBS='${LIBS}' sl@0: DL_OBJS="tclLoadAout.o" sl@0: DL_LIBS="" sl@0: LDFLAGS="$LDFLAGS -Wl,-D,08000000" sl@0: CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' sl@0: LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} sl@0: if test "$GCC" != "yes" ; then sl@0: CFLAGS="$CFLAGS -DHAVE_TZSET -std1" sl@0: fi sl@0: ;; sl@0: UNIX_SV* | UnixWare-5*) sl@0: SHLIB_CFLAGS="-KPIC" sl@0: SHLIB_LD="cc -G" sl@0: SHLIB_LD_LIBS="" sl@0: SHLIB_SUFFIX=".so" sl@0: DL_OBJS="tclLoadDl.o" sl@0: DL_LIBS="-ldl" sl@0: # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers sl@0: # that don't grok the -Bexport option. Test that it does. sl@0: AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [ sl@0: hold_ldflags=$LDFLAGS sl@0: LDFLAGS="$LDFLAGS -Wl,-Bexport" sl@0: AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no) sl@0: LDFLAGS=$hold_ldflags]) sl@0: if test $tcl_cv_ld_Bexport = yes; then sl@0: LDFLAGS="$LDFLAGS -Wl,-Bexport" sl@0: fi sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: ;; sl@0: esac sl@0: sl@0: if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then sl@0: AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform]) sl@0: fi sl@0: sl@0: dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so sl@0: dnl # until the end of configure, as configure's compile and link tests use sl@0: dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's sl@0: dnl # preprocessing tests use only CPPFLAGS. sl@0: SC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""]) sl@0: sl@0: # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic sl@0: # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop, sl@0: # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need sl@0: # to determine which of several header files defines the a.out file sl@0: # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we sl@0: # support only a file format that is more or less version-7-compatible. sl@0: # In particular, sl@0: # - a.out files must begin with `struct exec'. sl@0: # - the N_TXTOFF on the `struct exec' must compute the seek address sl@0: # of the text segment sl@0: # - The `struct exec' must contain a_magic, a_text, a_data, a_bss sl@0: # and a_entry fields. sl@0: # The following compilation should succeed if and only if either sys/exec.h sl@0: # or a.out.h is usable for the purpose. sl@0: # sl@0: # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the sl@0: # `struct exec' includes a second header that contains information that sl@0: # duplicates the v7 fields that are needed. sl@0: sl@0: if test "x$DL_OBJS" = "xtclLoadAout.o" ; then sl@0: AC_CACHE_CHECK([sys/exec.h], tcl_cv_sysexec_h, [ sl@0: AC_TRY_COMPILE([#include ],[ sl@0: struct exec foo; sl@0: unsigned long seek; sl@0: int flag; sl@0: #if defined(__mips) || defined(mips) sl@0: seek = N_TXTOFF (foo.ex_f, foo.ex_o); sl@0: #else sl@0: seek = N_TXTOFF (foo); sl@0: #endif sl@0: flag = (foo.a_magic == OMAGIC); sl@0: return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; sl@0: ], tcl_cv_sysexec_h=usable, tcl_cv_sysexec_h=unusable)]) sl@0: if test $tcl_cv_sysexec_h = usable; then sl@0: AC_DEFINE(USE_SYS_EXEC_H) sl@0: else sl@0: AC_CACHE_CHECK([a.out.h], tcl_cv_aout_h, [ sl@0: AC_TRY_COMPILE([#include ],[ sl@0: struct exec foo; sl@0: unsigned long seek; sl@0: int flag; sl@0: #if defined(__mips) || defined(mips) sl@0: seek = N_TXTOFF (foo.ex_f, foo.ex_o); sl@0: #else sl@0: seek = N_TXTOFF (foo); sl@0: #endif sl@0: flag = (foo.a_magic == OMAGIC); sl@0: return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; sl@0: ], tcl_cv_aout_h=usable, tcl_cv_aout_h=unusable)]) sl@0: if test $tcl_cv_aout_h = usable; then sl@0: AC_DEFINE(USE_A_OUT_H) sl@0: else sl@0: AC_CACHE_CHECK([sys/exec_aout.h], tcl_cv_sysexecaout_h, [ sl@0: AC_TRY_COMPILE([#include ],[ sl@0: struct exec foo; sl@0: unsigned long seek; sl@0: int flag; sl@0: #if defined(__mips) || defined(mips) sl@0: seek = N_TXTOFF (foo.ex_f, foo.ex_o); sl@0: #else sl@0: seek = N_TXTOFF (foo); sl@0: #endif sl@0: flag = (foo.a_midmag == OMAGIC); sl@0: return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; sl@0: ], tcl_cv_sysexecaout_h=usable, tcl_cv_sysexecaout_h=unusable)]) sl@0: if test $tcl_cv_sysexecaout_h = usable; then sl@0: AC_DEFINE(USE_SYS_EXEC_AOUT_H) sl@0: else sl@0: DL_OBJS="" sl@0: fi sl@0: fi sl@0: fi sl@0: fi sl@0: sl@0: # Step 5: disable dynamic loading if requested via a command-line switch. sl@0: sl@0: AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command], sl@0: [tcl_ok=$enableval], [tcl_ok=yes]) sl@0: if test "$tcl_ok" = "no"; then sl@0: DL_OBJS="" sl@0: fi sl@0: sl@0: if test "x$DL_OBJS" != "x" ; then sl@0: BUILD_DLTEST="\$(DLTEST_TARGETS)" sl@0: else sl@0: echo "Can't figure out how to do dynamic loading or shared libraries" sl@0: echo "on this system." sl@0: SHLIB_CFLAGS="" sl@0: SHLIB_LD="" sl@0: SHLIB_SUFFIX="" sl@0: DL_OBJS="tclLoadNone.o" sl@0: DL_LIBS="" sl@0: LDFLAGS="$LDFLAGS_ORIG" sl@0: CC_SEARCH_FLAGS="" sl@0: LD_SEARCH_FLAGS="" sl@0: BUILD_DLTEST="" sl@0: fi sl@0: sl@0: # If we're running gcc, then change the C flags for compiling shared sl@0: # libraries to the right flags for gcc, instead of those for the sl@0: # standard manufacturer compiler. sl@0: sl@0: if test "$DL_OBJS" != "tclLoadNone.o" ; then sl@0: if test "$GCC" = "yes" ; then sl@0: case $system in sl@0: AIX-*) sl@0: ;; sl@0: BSD/OS*) sl@0: ;; sl@0: IRIX*) sl@0: ;; sl@0: NetBSD-*|FreeBSD-*|OpenBSD-*) sl@0: ;; sl@0: Darwin-*) sl@0: ;; sl@0: RISCos-*) sl@0: ;; sl@0: SCO_SV-3.2*) sl@0: ;; sl@0: ULTRIX-4.*) sl@0: ;; sl@0: *) sl@0: SHLIB_CFLAGS="-fPIC" sl@0: ;; sl@0: esac sl@0: fi sl@0: fi sl@0: sl@0: if test "$SHARED_LIB_SUFFIX" = "" ; then sl@0: SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}' sl@0: fi sl@0: if test "$UNSHARED_LIB_SUFFIX" = "" ; then sl@0: UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a' sl@0: fi sl@0: sl@0: if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then sl@0: LIB_SUFFIX=${SHARED_LIB_SUFFIX} sl@0: MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' sl@0: INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)' sl@0: else sl@0: LIB_SUFFIX=${UNSHARED_LIB_SUFFIX} sl@0: sl@0: if test "$RANLIB" = "" ; then sl@0: MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}' sl@0: INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)' sl@0: else sl@0: MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@' sl@0: INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))' sl@0: fi sl@0: sl@0: dnl Not at all clear what this was doing in Tcl's configure.in sl@0: dnl or why it was needed was needed. In any event, this sort of sl@0: dnl things needs to be done in the big loop above. sl@0: dnl REMOVE THIS BLOCK LATER! (mdejong) sl@0: dnl case $system in sl@0: dnl BSD/OS*) sl@0: dnl ;; sl@0: dnl AIX-[[1-4]].*) sl@0: dnl ;; sl@0: dnl *) sl@0: dnl SHLIB_LD_LIBS="" sl@0: dnl ;; sl@0: dnl esac sl@0: fi sl@0: sl@0: sl@0: # Stub lib does not depend on shared/static configuration sl@0: if test "$RANLIB" = "" ; then sl@0: MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}' sl@0: INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)' sl@0: else sl@0: MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@' sl@0: INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))' sl@0: fi sl@0: sl@0: sl@0: AC_SUBST(DL_LIBS) sl@0: sl@0: AC_SUBST(DL_OBJS) sl@0: AC_SUBST(PLAT_OBJS) sl@0: AC_SUBST(PLAT_SRCS) sl@0: AC_SUBST(CFLAGS) sl@0: AC_SUBST(CFLAGS_DEBUG) sl@0: AC_SUBST(CFLAGS_OPTIMIZE) sl@0: AC_SUBST(CFLAGS_WARNING) sl@0: sl@0: AC_SUBST(LDFLAGS) sl@0: AC_SUBST(LDFLAGS_DEBUG) sl@0: AC_SUBST(LDFLAGS_OPTIMIZE) sl@0: AC_SUBST(CC_SEARCH_FLAGS) sl@0: AC_SUBST(LD_SEARCH_FLAGS) sl@0: sl@0: AC_SUBST(STLIB_LD) sl@0: AC_SUBST(SHLIB_LD) sl@0: AC_SUBST(TCL_SHLIB_LD_EXTRAS) sl@0: AC_SUBST(TK_SHLIB_LD_EXTRAS) sl@0: AC_SUBST(SHLIB_LD_LIBS) sl@0: AC_SUBST(SHLIB_CFLAGS) sl@0: AC_SUBST(SHLIB_SUFFIX) sl@0: sl@0: AC_SUBST(MAKE_LIB) sl@0: AC_SUBST(MAKE_STUB_LIB) sl@0: AC_SUBST(INSTALL_LIB) sl@0: AC_SUBST(INSTALL_STUB_LIB) sl@0: AC_SUBST(RANLIB) sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_SERIAL_PORT sl@0: # sl@0: # Determine which interface to use to talk to the serial port. sl@0: # Note that #include lines must begin in leftmost column for sl@0: # some compilers to recognize them as preprocessor directives, sl@0: # and some build environments have stdin not pointing at a sl@0: # pseudo-terminal (usually /dev/null instead.) sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Defines only one of the following vars: sl@0: # HAVE_SYS_MODEM_H sl@0: # USE_TERMIOS sl@0: # USE_TERMIO sl@0: # USE_SGTTY sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_SERIAL_PORT], [ sl@0: AC_CHECK_HEADERS(sys/modem.h) sl@0: AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [ sl@0: AC_TRY_RUN([ sl@0: #include sl@0: sl@0: int main() { sl@0: struct termios t; sl@0: if (tcgetattr(0, &t) == 0) { sl@0: cfsetospeed(&t, 0); sl@0: t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; sl@0: return 0; sl@0: } sl@0: return 1; sl@0: }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) sl@0: if test $tcl_cv_api_serial = no ; then sl@0: AC_TRY_RUN([ sl@0: #include sl@0: sl@0: int main() { sl@0: struct termio t; sl@0: if (ioctl(0, TCGETA, &t) == 0) { sl@0: t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; sl@0: return 0; sl@0: } sl@0: return 1; sl@0: }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) sl@0: fi sl@0: if test $tcl_cv_api_serial = no ; then sl@0: AC_TRY_RUN([ sl@0: #include sl@0: sl@0: int main() { sl@0: struct sgttyb t; sl@0: if (ioctl(0, TIOCGETP, &t) == 0) { sl@0: t.sg_ospeed = 0; sl@0: t.sg_flags |= ODDP | EVENP | RAW; sl@0: return 0; sl@0: } sl@0: return 1; sl@0: }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no) sl@0: fi sl@0: if test $tcl_cv_api_serial = no ; then sl@0: AC_TRY_RUN([ sl@0: #include sl@0: #include sl@0: sl@0: int main() { sl@0: struct termios t; sl@0: if (tcgetattr(0, &t) == 0 sl@0: || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { sl@0: cfsetospeed(&t, 0); sl@0: t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; sl@0: return 0; sl@0: } sl@0: return 1; sl@0: }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) sl@0: fi sl@0: if test $tcl_cv_api_serial = no; then sl@0: AC_TRY_RUN([ sl@0: #include sl@0: #include sl@0: sl@0: int main() { sl@0: struct termio t; sl@0: if (ioctl(0, TCGETA, &t) == 0 sl@0: || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { sl@0: t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; sl@0: return 0; sl@0: } sl@0: return 1; sl@0: }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) sl@0: fi sl@0: if test $tcl_cv_api_serial = no; then sl@0: AC_TRY_RUN([ sl@0: #include sl@0: #include sl@0: sl@0: int main() { sl@0: struct sgttyb t; sl@0: if (ioctl(0, TIOCGETP, &t) == 0 sl@0: || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { sl@0: t.sg_ospeed = 0; sl@0: t.sg_flags |= ODDP | EVENP | RAW; sl@0: return 0; sl@0: } sl@0: return 1; sl@0: }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none) sl@0: fi]) sl@0: case $tcl_cv_api_serial in sl@0: termios) AC_DEFINE(USE_TERMIOS);; sl@0: termio) AC_DEFINE(USE_TERMIO);; sl@0: sgtty) AC_DEFINE(USE_SGTTY);; sl@0: esac sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_MISSING_POSIX_HEADERS sl@0: # sl@0: # Supply substitutes for missing POSIX header files. Special sl@0: # notes: sl@0: # - stdlib.h doesn't define strtol, strtoul, or sl@0: # strtod insome versions of SunOS sl@0: # - some versions of string.h don't declare procedures such sl@0: # as strstr sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Defines some of the following vars: sl@0: # NO_DIRENT_H sl@0: # NO_ERRNO_H sl@0: # NO_VALUES_H sl@0: # HAVE_LIMITS_H or NO_LIMITS_H sl@0: # NO_STDLIB_H sl@0: # NO_STRING_H sl@0: # NO_SYS_WAIT_H sl@0: # NO_DLFCN_H sl@0: # HAVE_UNISTD_H sl@0: # HAVE_SYS_PARAM_H sl@0: # sl@0: # HAVE_STRING_H ? sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_MISSING_POSIX_HEADERS], [ sl@0: AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [ sl@0: AC_TRY_LINK([#include sl@0: #include ], [ sl@0: #ifndef _POSIX_SOURCE sl@0: # ifdef __Lynx__ sl@0: /* sl@0: * Generate compilation error to make the test fail: Lynx headers sl@0: * are only valid if really in the POSIX environment. sl@0: */ sl@0: sl@0: missing_procedure(); sl@0: # endif sl@0: #endif sl@0: DIR *d; sl@0: struct dirent *entryPtr; sl@0: char *p; sl@0: d = opendir("foobar"); sl@0: entryPtr = readdir(d); sl@0: p = entryPtr->d_name; sl@0: closedir(d); sl@0: ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)]) sl@0: sl@0: if test $tcl_cv_dirent_h = no; then sl@0: AC_DEFINE(NO_DIRENT_H) sl@0: fi sl@0: sl@0: AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)]) sl@0: AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)]) sl@0: AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)]) sl@0: AC_CHECK_HEADER(limits.h, sl@0: [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)]) sl@0: AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) sl@0: AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) sl@0: AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) sl@0: AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0) sl@0: if test $tcl_ok = 0; then sl@0: AC_DEFINE(NO_STDLIB_H) sl@0: fi sl@0: AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0) sl@0: AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0) sl@0: AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0) sl@0: sl@0: # See also memmove check below for a place where NO_STRING_H can be sl@0: # set and why. sl@0: sl@0: if test $tcl_ok = 0; then sl@0: AC_DEFINE(NO_STRING_H) sl@0: fi sl@0: sl@0: AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)]) sl@0: AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)]) sl@0: sl@0: # OS/390 lacks sys/param.h (and doesn't need it, by chance). sl@0: AC_HAVE_HEADERS(unistd.h sys/param.h) sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_PATH_X sl@0: # sl@0: # Locate the X11 header files and the X11 library archive. Try sl@0: # the ac_path_x macro first, but if it doesn't find the X stuff sl@0: # (e.g. because there's no xmkmf program) then check through sl@0: # a list of possible directories. Under some conditions the sl@0: # autoconf macro will return an include directory that contains sl@0: # no include files, so double-check its result just to be safe. sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Sets the the following vars: sl@0: # XINCLUDES sl@0: # XLIBSW sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_PATH_X], [ sl@0: AC_PATH_X sl@0: not_really_there="" sl@0: if test "$no_x" = ""; then sl@0: if test "$x_includes" = ""; then sl@0: AC_TRY_CPP([#include ], , not_really_there="yes") sl@0: else sl@0: if test ! -r $x_includes/X11/Intrinsic.h; then sl@0: not_really_there="yes" sl@0: fi sl@0: fi sl@0: fi sl@0: if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then sl@0: AC_MSG_CHECKING([for X11 header files]) sl@0: found_xincludes="no" sl@0: AC_TRY_CPP([#include ], found_xincludes="yes", found_xincludes="no") sl@0: if test "$found_xincludes" = "no"; then sl@0: 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" sl@0: for i in $dirs ; do sl@0: if test -r $i/X11/Intrinsic.h; then sl@0: AC_MSG_RESULT([$i]) sl@0: XINCLUDES=" -I$i" sl@0: found_xincludes="yes" sl@0: break sl@0: fi sl@0: done sl@0: fi sl@0: else sl@0: if test "$x_includes" != ""; then sl@0: XINCLUDES="-I$x_includes" sl@0: found_xincludes="yes" sl@0: fi sl@0: fi sl@0: if test found_xincludes = "no"; then sl@0: AC_MSG_RESULT([couldn't find any!]) sl@0: fi sl@0: sl@0: if test "$no_x" = yes; then sl@0: AC_MSG_CHECKING([for X11 libraries]) sl@0: XLIBSW=nope sl@0: 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" sl@0: for i in $dirs ; do sl@0: if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then sl@0: AC_MSG_RESULT([$i]) sl@0: XLIBSW="-L$i -lX11" sl@0: x_libraries="$i" sl@0: break sl@0: fi sl@0: done sl@0: else sl@0: if test "$x_libraries" = ""; then sl@0: XLIBSW=-lX11 sl@0: else sl@0: XLIBSW="-L$x_libraries -lX11" sl@0: fi sl@0: fi sl@0: if test "$XLIBSW" = nope ; then sl@0: AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow) sl@0: fi sl@0: if test "$XLIBSW" = nope ; then sl@0: AC_MSG_RESULT([could not find any! Using -lX11.]) sl@0: XLIBSW=-lX11 sl@0: fi sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_BLOCKING_STYLE sl@0: # sl@0: # The statements below check for systems where POSIX-style sl@0: # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. sl@0: # On these systems (mostly older ones), use the old BSD-style sl@0: # FIONBIO approach instead. sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Defines some of the following vars: sl@0: # HAVE_SYS_IOCTL_H sl@0: # HAVE_SYS_FILIO_H sl@0: # USE_FIONBIO sl@0: # O_NONBLOCK sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_BLOCKING_STYLE], [ sl@0: AC_CHECK_HEADERS(sys/ioctl.h) sl@0: AC_CHECK_HEADERS(sys/filio.h) sl@0: SC_CONFIG_SYSTEM sl@0: AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O]) sl@0: case $system in sl@0: # There used to be code here to use FIONBIO under AIX. However, it sl@0: # was reported that FIONBIO doesn't work under AIX 3.2.5. Since sl@0: # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO sl@0: # code (JO, 5/31/97). sl@0: sl@0: OSF*) sl@0: AC_DEFINE(USE_FIONBIO) sl@0: AC_MSG_RESULT([FIONBIO]) sl@0: ;; sl@0: SunOS-4*) sl@0: AC_DEFINE(USE_FIONBIO) sl@0: AC_MSG_RESULT([FIONBIO]) sl@0: ;; sl@0: ULTRIX-4.*) sl@0: AC_DEFINE(USE_FIONBIO) sl@0: AC_MSG_RESULT([FIONBIO]) sl@0: ;; sl@0: *) sl@0: AC_MSG_RESULT([O_NONBLOCK]) sl@0: ;; sl@0: esac sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_TIME_HANLDER sl@0: # sl@0: # Checks how the system deals with time.h, what time structures sl@0: # are used on the system, and what fields the structures have. sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Defines some of the following vars: sl@0: # USE_DELTA_FOR_TZ sl@0: # HAVE_TM_GMTOFF sl@0: # HAVE_TM_TZADJ sl@0: # HAVE_TIMEZONE_VAR sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_TIME_HANDLER], [ sl@0: AC_CHECK_HEADERS(sys/time.h) sl@0: AC_HEADER_TIME sl@0: AC_STRUCT_TIMEZONE sl@0: sl@0: AC_CHECK_FUNCS(gmtime_r localtime_r) sl@0: sl@0: AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [ sl@0: AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_tzadj;], sl@0: tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)]) sl@0: if test $tcl_cv_member_tm_tzadj = yes ; then sl@0: AC_DEFINE(HAVE_TM_TZADJ) sl@0: fi sl@0: sl@0: AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [ sl@0: AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_gmtoff;], sl@0: tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)]) sl@0: if test $tcl_cv_member_tm_gmtoff = yes ; then sl@0: AC_DEFINE(HAVE_TM_GMTOFF) sl@0: fi sl@0: sl@0: # sl@0: # Its important to include time.h in this check, as some systems sl@0: # (like convex) have timezone functions, etc. sl@0: # sl@0: AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [ sl@0: AC_TRY_COMPILE([#include ], sl@0: [extern long timezone; sl@0: timezone += 1; sl@0: exit (0);], sl@0: tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)]) sl@0: if test $tcl_cv_timezone_long = yes ; then sl@0: AC_DEFINE(HAVE_TIMEZONE_VAR) sl@0: else sl@0: # sl@0: # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. sl@0: # sl@0: AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [ sl@0: AC_TRY_COMPILE([#include ], sl@0: [extern time_t timezone; sl@0: timezone += 1; sl@0: exit (0);], sl@0: tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)]) sl@0: if test $tcl_cv_timezone_time = yes ; then sl@0: AC_DEFINE(HAVE_TIMEZONE_VAR) sl@0: fi sl@0: fi sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_BUGGY_STRTOD sl@0: # sl@0: # Under Solaris 2.4, strtod returns the wrong value for the sl@0: # terminating character under some conditions. Check for this sl@0: # and if the problem exists use a substitute procedure sl@0: # "fixstrtod" (provided by Tcl) that corrects the error. sl@0: # Also, on Compaq's Tru64 Unix 5.0, sl@0: # strtod(" ") returns 0.0 instead of a failure to convert. sl@0: # sl@0: # Arguments: sl@0: # none sl@0: # sl@0: # Results: sl@0: # sl@0: # Might defines some of the following vars: sl@0: # strtod (=fixstrtod) sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_BUGGY_STRTOD], [ sl@0: AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0) sl@0: if test "$tcl_strtod" = 1; then sl@0: AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[ sl@0: AC_TRY_RUN([ sl@0: extern double strtod(); sl@0: int main() { sl@0: char *infString="Inf", *nanString="NaN", *spaceString=" "; sl@0: char *term; sl@0: double value; sl@0: value = strtod(infString, &term); sl@0: if ((term != infString) && (term[-1] == 0)) { sl@0: exit(1); sl@0: } sl@0: value = strtod(nanString, &term); sl@0: if ((term != nanString) && (term[-1] == 0)) { sl@0: exit(1); sl@0: } sl@0: value = strtod(spaceString, &term); sl@0: if (term == (spaceString+1)) { sl@0: exit(1); sl@0: } sl@0: exit(0); sl@0: }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy, sl@0: tcl_cv_strtod_buggy=buggy)]) sl@0: if test "$tcl_cv_strtod_buggy" = buggy; then sl@0: LIBOBJS="$LIBOBJS fixstrtod.o" sl@0: AC_DEFINE(strtod, fixstrtod) sl@0: fi sl@0: fi sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_TCL_LINK_LIBS sl@0: # sl@0: # Search for the libraries needed to link the Tcl shell. sl@0: # Things like the math library (-lm) and socket stuff (-lsocket vs. sl@0: # -lnsl) are dealt with here. sl@0: # sl@0: # Arguments: sl@0: # Requires the following vars to be set in the Makefile: sl@0: # DL_LIBS sl@0: # LIBS sl@0: # MATH_LIBS sl@0: # sl@0: # Results: sl@0: # sl@0: # Subst's the following var: sl@0: # TCL_LIBS sl@0: # MATH_LIBS sl@0: # sl@0: # Might append to the following vars: sl@0: # LIBS sl@0: # sl@0: # Might define the following vars: sl@0: # HAVE_NET_ERRNO_H sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_TCL_LINK_LIBS], [ sl@0: #-------------------------------------------------------------------- sl@0: # On a few very rare systems, all of the libm.a stuff is sl@0: # already in libc.a. Set compiler flags accordingly. sl@0: # Also, Linux requires the "ieee" library for math to work sl@0: # right (and it must appear before "-lm"). sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm") sl@0: AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Interactive UNIX requires -linet instead of -lsocket, plus it sl@0: # needs net/errno.h to define the socket-related error codes. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]) sl@0: AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Check for the existence of the -lsocket and -lnsl libraries. sl@0: # The order here is important, so that they end up in the right sl@0: # order in the command line generated by make. Here are some sl@0: # special considerations: sl@0: # 1. Use "connect" and "accept" to check for -lsocket, and sl@0: # "gethostbyname" to check for -lnsl. sl@0: # 2. Use each function name only once: can't redo a check because sl@0: # autoconf caches the results of the last check and won't redo it. sl@0: # 3. Use -lnsl and -lsocket only if they supply procedures that sl@0: # aren't already present in the normal libraries. This is because sl@0: # IRIX 5.2 has libraries, but they aren't needed and they're sl@0: # bogus: they goof up name resolution if used. sl@0: # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. sl@0: # To get around this problem, check for both libraries together sl@0: # if -lsocket doesn't work by itself. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: tcl_checkBoth=0 sl@0: AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1) sl@0: if test "$tcl_checkSocket" = 1; then sl@0: AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt, sl@0: LIBS="$LIBS -lsocket", tcl_checkBoth=1)]) sl@0: fi sl@0: if test "$tcl_checkBoth" = 1; then sl@0: tk_oldLibs=$LIBS sl@0: LIBS="$LIBS -lsocket -lnsl" sl@0: AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) sl@0: fi sl@0: AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, sl@0: [LIBS="$LIBS -lnsl"])]) sl@0: sl@0: # Don't perform the eval of the libraries here because DL_LIBS sl@0: # won't be set until we call SC_CONFIG_CFLAGS sl@0: sl@0: TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' sl@0: AC_SUBST(TCL_LIBS) sl@0: AC_SUBST(MATH_LIBS) sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_TCL_EARLY_FLAGS sl@0: # sl@0: # Check for what flags are needed to be passed so the correct OS sl@0: # features are available. sl@0: # sl@0: # Arguments: sl@0: # None sl@0: # sl@0: # Results: sl@0: # sl@0: # Might define the following vars: sl@0: # _ISOC99_SOURCE sl@0: # _LARGEFILE64_SOURCE sl@0: # _LARGEFILE_SOURCE64 sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_TCL_EARLY_FLAG],[ sl@0: AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]), sl@0: AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no, sl@0: AC_TRY_COMPILE([[#define ]$1[ 1 sl@0: ]$2], $3, sl@0: [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes, sl@0: [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no))) sl@0: if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then sl@0: AC_DEFINE($1) sl@0: tcl_flags="$tcl_flags $1" sl@0: fi sl@0: ]) sl@0: sl@0: AC_DEFUN([SC_TCL_EARLY_FLAGS],[ sl@0: AC_MSG_CHECKING([for required early compiler flags]) sl@0: tcl_flags="" sl@0: SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include ], sl@0: [char *p = (char *)strtoll; char *q = (char *)strtoull;]) sl@0: SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include ], sl@0: [struct stat64 buf; int i = stat64("/", &buf);]) sl@0: SC_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include ], sl@0: [char *p = (char *)open64;]) sl@0: if test "x${tcl_flags}" = "x" ; then sl@0: AC_MSG_RESULT([none]) sl@0: else sl@0: AC_MSG_RESULT([${tcl_flags}]) sl@0: fi sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_TCL_64BIT_FLAGS sl@0: # sl@0: # Check for what is defined in the way of 64-bit features. sl@0: # sl@0: # Arguments: sl@0: # None sl@0: # sl@0: # Results: sl@0: # sl@0: # Might define the following vars: sl@0: # TCL_WIDE_INT_IS_LONG sl@0: # TCL_WIDE_INT_TYPE sl@0: # HAVE_STRUCT_DIRENT64 sl@0: # HAVE_STRUCT_STAT64 sl@0: # HAVE_TYPE_OFF64_T sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_TCL_64BIT_FLAGS], [ sl@0: AC_MSG_CHECKING([for 64-bit integer type]) sl@0: AC_CACHE_VAL(tcl_cv_type_64bit,[ sl@0: tcl_cv_type_64bit=none sl@0: # See if the compiler knows natively about __int64 sl@0: AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], sl@0: tcl_type_64bit=__int64, tcl_type_64bit="long long") sl@0: # See if we should use long anyway Note that we substitute in the sl@0: # type that is our current guess for a 64-bit type inside this check sl@0: # program, so it should be modified only carefully... sl@0: AC_TRY_COMPILE(,[switch (0) { sl@0: case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; sl@0: }],tcl_cv_type_64bit=${tcl_type_64bit})]) sl@0: if test "${tcl_cv_type_64bit}" = none ; then sl@0: AC_DEFINE(TCL_WIDE_INT_IS_LONG) sl@0: AC_MSG_RESULT([using long]) sl@0: else sl@0: AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}) sl@0: AC_MSG_RESULT([${tcl_cv_type_64bit}]) sl@0: sl@0: # Now check for auxiliary declarations sl@0: AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[ sl@0: AC_TRY_COMPILE([#include sl@0: #include ],[struct dirent64 p;], sl@0: tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)]) sl@0: if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then sl@0: AC_DEFINE(HAVE_STRUCT_DIRENT64) sl@0: fi sl@0: sl@0: AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[ sl@0: AC_TRY_COMPILE([#include ],[struct stat64 p; sl@0: ], sl@0: tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)]) sl@0: if test "x${tcl_cv_struct_stat64}" = "xyes" ; then sl@0: AC_DEFINE(HAVE_STRUCT_STAT64) sl@0: fi sl@0: sl@0: AC_CHECK_FUNCS(open64 lseek64) sl@0: AC_MSG_CHECKING([for off64_t]) sl@0: AC_CACHE_VAL(tcl_cv_type_off64_t,[ sl@0: AC_TRY_COMPILE([#include ],[off64_t offset; sl@0: ], sl@0: tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)]) sl@0: dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the sl@0: dnl functions lseek64 and open64 are defined. sl@0: if test "x${tcl_cv_type_off64_t}" = "xyes" && \ sl@0: test "x${ac_cv_func_lseek64}" = "xyes" && \ sl@0: test "x${ac_cv_func_open64}" = "xyes" ; then sl@0: AC_DEFINE(HAVE_TYPE_OFF64_T) sl@0: AC_MSG_RESULT([yes]) sl@0: else sl@0: AC_MSG_RESULT([no]) sl@0: fi sl@0: fi sl@0: ]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_TCL_GETHOSTBYADDR_R sl@0: # sl@0: # Check if we have MT-safe variant of gethostbyaddr(). sl@0: # sl@0: # Arguments: sl@0: # None sl@0: # sl@0: # Results: sl@0: # sl@0: # Might define the following vars: sl@0: # HAVE_GETHOSTBYADDR_R sl@0: # HAVE_GETHOSTBYADDR_R_7 sl@0: # HAVE_GETHOSTBYADDR_R_8 sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [ sl@0: AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: ], [ sl@0: char *addr; sl@0: int length; sl@0: int type; sl@0: struct hostent *result; sl@0: char buffer[2048]; sl@0: int buflen = 2048; sl@0: int h_errnop; sl@0: sl@0: (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, sl@0: &h_errnop); sl@0: ], tcl_cv_api_gethostbyaddr_r_7=yes, tcl_cv_api_gethostbyaddr_r_7=no)]) sl@0: tcl_ok=$tcl_cv_api_gethostbyaddr_r_7 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETHOSTBYADDR_R_7) sl@0: else sl@0: AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: ], [ sl@0: char *addr; sl@0: int length; sl@0: int type; sl@0: struct hostent *result, *resultp; sl@0: char buffer[2048]; sl@0: int buflen = 2048; sl@0: int h_errnop; sl@0: sl@0: (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, sl@0: &resultp, &h_errnop); sl@0: ], tcl_cv_api_gethostbyaddr_r_8=yes, tcl_cv_api_gethostbyaddr_r_8=no)]) sl@0: tcl_ok=$tcl_cv_api_gethostbyaddr_r_8 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETHOSTBYADDR_R_8) sl@0: fi sl@0: fi sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETHOSTBYADDR_R) sl@0: fi sl@0: ])]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_TCL_GETHOSTBYNAME_R sl@0: # sl@0: # Check to see what variant of gethostbyname_r() we have. sl@0: # Based on David Arnold's example from the comp.programming.threads sl@0: # FAQ Q213 sl@0: # sl@0: # Arguments: sl@0: # None sl@0: # sl@0: # Results: sl@0: # sl@0: # Might define the following vars: sl@0: # HAVE_GETHOSTBYADDR_R sl@0: # HAVE_GETHOSTBYADDR_R_3 sl@0: # HAVE_GETHOSTBYADDR_R_5 sl@0: # HAVE_GETHOSTBYADDR_R_6 sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [ sl@0: AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: ], [ sl@0: char *name; sl@0: struct hostent *he, *res; sl@0: char buffer[2048]; sl@0: int buflen = 2048; sl@0: int h_errnop; sl@0: sl@0: (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop); sl@0: ], tcl_cv_api_gethostbyname_r_6=yes, tcl_cv_api_gethostbyname_r_6=no)]) sl@0: tcl_ok=$tcl_cv_api_gethostbyname_r_6 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETHOSTBYNAME_R_6) sl@0: else sl@0: AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: ], [ sl@0: char *name; sl@0: struct hostent *he; sl@0: char buffer[2048]; sl@0: int buflen = 2048; sl@0: int h_errnop; sl@0: sl@0: (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop); sl@0: ], tcl_cv_api_gethostbyname_r_5=yes, tcl_cv_api_gethostbyname_r_5=no)]) sl@0: tcl_ok=$tcl_cv_api_gethostbyname_r_5 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETHOSTBYNAME_R_5) sl@0: else sl@0: AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: ], [ sl@0: char *name; sl@0: struct hostent *he; sl@0: struct hostent_data data; sl@0: sl@0: (void) gethostbyname_r(name, he, &data); sl@0: ], tcl_cv_api_gethostbyname_r_3=yes, tcl_cv_api_gethostbyname_r_3=no)]) sl@0: tcl_ok=$tcl_cv_api_gethostbyname_r_3 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETHOSTBYNAME_R_3) sl@0: fi sl@0: fi sl@0: fi sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETHOSTBYNAME_R) sl@0: fi sl@0: ])]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_TCL_GETPWUID_R sl@0: # sl@0: # Check if we have MT-safe variant of getpwuid() and if yes, sl@0: # which one exactly. sl@0: # sl@0: # Arguments: sl@0: # None sl@0: # sl@0: # Results: sl@0: # sl@0: # Might define the following vars: sl@0: # HAVE_GETPWUID_R sl@0: # HAVE_GETPWUID_R_4 sl@0: # HAVE_GETPWUID_R_5 sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [ sl@0: AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: #include sl@0: ], [ sl@0: uid_t uid; sl@0: struct passwd pw, *pwp; sl@0: char buf[512]; sl@0: int buflen = 512; sl@0: sl@0: (void) getpwuid_r(uid, &pw, buf, buflen, &pwp); sl@0: ], tcl_cv_api_getpwuid_r_5=yes, tcl_cv_api_getpwuid_r_5=no)]) sl@0: tcl_ok=$tcl_cv_api_getpwuid_r_5 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETPWUID_R_5) sl@0: else sl@0: AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: #include sl@0: ], [ sl@0: uid_t uid; sl@0: struct passwd pw; sl@0: char buf[512]; sl@0: int buflen = 512; sl@0: sl@0: (void)getpwnam_r(uid, &pw, buf, buflen); sl@0: ], tcl_cv_api_getpwuid_r_4=yes, tcl_cv_api_getpwuid_r_4=no)]) sl@0: tcl_ok=$tcl_cv_api_getpwuid_r_4 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETPWUID_R_4) sl@0: fi sl@0: fi sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETPWUID_R) sl@0: fi sl@0: ])]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_TCL_GETPWNAM_R sl@0: # sl@0: # Check if we have MT-safe variant of getpwnam() and if yes, sl@0: # which one exactly. sl@0: # sl@0: # Arguments: sl@0: # None sl@0: # sl@0: # Results: sl@0: # sl@0: # Might define the following vars: sl@0: # HAVE_GETPWNAM_R sl@0: # HAVE_GETPWNAM_R_4 sl@0: # HAVE_GETPWNAM_R_5 sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [ sl@0: AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: #include sl@0: ], [ sl@0: char *name; sl@0: struct passwd pw, *pwp; sl@0: char buf[512]; sl@0: int buflen = 512; sl@0: sl@0: (void) getpwnam_r(name, &pw, buf, buflen, &pwp); sl@0: ], tcl_cv_api_getpwnam_r_5=yes, tcl_cv_api_getpwnam_r_5=no)]) sl@0: tcl_ok=$tcl_cv_api_getpwnam_r_5 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETPWNAM_R_5) sl@0: else sl@0: AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: #include sl@0: ], [ sl@0: char *name; sl@0: struct passwd pw; sl@0: char buf[512]; sl@0: int buflen = 512; sl@0: sl@0: (void)getpwnam_r(name, &pw, buf, buflen); sl@0: ], tcl_cv_api_getpwnam_r_4=yes, tcl_cv_api_getpwnam_r_4=no)]) sl@0: tcl_ok=$tcl_cv_api_getpwnam_r_4 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETPWNAM_R_4) sl@0: fi sl@0: fi sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETPWNAM_R) sl@0: fi sl@0: ])]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_TCL_GETGRGID_R sl@0: # sl@0: # Check if we have MT-safe variant of getgrgid() and if yes, sl@0: # which one exactly. sl@0: # sl@0: # Arguments: sl@0: # None sl@0: # sl@0: # Results: sl@0: # sl@0: # Might define the following vars: sl@0: # HAVE_GETGRGID_R sl@0: # HAVE_GETGRGID_R_4 sl@0: # HAVE_GETGRGID_R_5 sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [ sl@0: AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: #include sl@0: ], [ sl@0: gid_t gid; sl@0: struct group gr, *grp; sl@0: char buf[512]; sl@0: int buflen = 512; sl@0: sl@0: (void) getgrgid_r(gid, &gr, buf, buflen, &grp); sl@0: ], tcl_cv_api_getgrgid_r_5=yes, tcl_cv_api_getgrgid_r_5=no)]) sl@0: tcl_ok=$tcl_cv_api_getgrgid_r_5 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETGRGID_R_5) sl@0: else sl@0: AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: #include sl@0: ], [ sl@0: gid_t gid; sl@0: struct group gr; sl@0: char buf[512]; sl@0: int buflen = 512; sl@0: sl@0: (void)getgrgid_r(gid, &gr, buf, buflen); sl@0: ], tcl_cv_api_getgrgid_r_4=yes, tcl_cv_api_getgrgid_r_4=no)]) sl@0: tcl_ok=$tcl_cv_api_getgrgid_r_4 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETGRGID_R_4) sl@0: fi sl@0: fi sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETGRGID_R) sl@0: fi sl@0: ])]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_TCL_GETGRNAM_R sl@0: # sl@0: # Check if we have MT-safe variant of getgrnam() and if yes, sl@0: # which one exactly. sl@0: # sl@0: # Arguments: sl@0: # None sl@0: # sl@0: # Results: sl@0: # sl@0: # Might define the following vars: sl@0: # HAVE_GETGRNAM_R sl@0: # HAVE_GETGRNAM_R_4 sl@0: # HAVE_GETGRNAM_R_5 sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [ sl@0: AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: #include sl@0: ], [ sl@0: char *name; sl@0: struct group gr, *grp; sl@0: char buf[512]; sl@0: int buflen = 512; sl@0: sl@0: (void) getgrnam_r(name, &gr, buf, buflen, &grp); sl@0: ], tcl_cv_api_getgrnam_r_5=yes, tcl_cv_api_getgrnam_r_5=no)]) sl@0: tcl_ok=$tcl_cv_api_getgrnam_r_5 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETGRNAM_R_5) sl@0: else sl@0: AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [ sl@0: AC_TRY_COMPILE([ sl@0: #include sl@0: #include sl@0: ], [ sl@0: char *name; sl@0: struct group gr; sl@0: char buf[512]; sl@0: int buflen = 512; sl@0: sl@0: (void)getgrnam_r(name, &gr, buf, buflen); sl@0: ], tcl_cv_api_getgrnam_r_4=yes, tcl_cv_api_getgrnam_r_4=no)]) sl@0: tcl_ok=$tcl_cv_api_getgrnam_r_4 sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETGRNAM_R_4) sl@0: fi sl@0: fi sl@0: if test "$tcl_ok" = yes; then sl@0: AC_DEFINE(HAVE_GETGRNAM_R) sl@0: fi sl@0: ])]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # SC_CONFIG_COMMANDS_PRE(CMDS) sl@0: # sl@0: # Replacement for autoconf 2.5x AC_COMMANDS_PRE: sl@0: # Commands to run right before config.status is sl@0: # created. Accumulates. sl@0: # sl@0: # Requires presence of SC_OUTPUT_COMMANDS_PRE at the end sl@0: # of configure.in (right before AC_OUTPUT). sl@0: # sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_DEFUN([SC_CONFIG_COMMANDS_PRE], [ sl@0: define([SC_OUTPUT_COMMANDS_PRE], defn([SC_OUTPUT_COMMANDS_PRE])[$1 sl@0: ])]) sl@0: AC_DEFUN([SC_OUTPUT_COMMANDS_PRE]) sl@0: