summaryrefslogtreecommitdiffstats
path: root/unix/tcl.m4
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tcl.m4')
-rw-r--r--unix/tcl.m4112
1 files changed, 67 insertions, 45 deletions
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 3a7305d..c840017 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -31,7 +31,7 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [
AC_MSG_CHECKING([for Tcl configuration])
AC_CACHE_VAL(ac_cv_c_tclconfig,[
- # First check to see if --with-tclconfig was specified.
+ # First check to see if --with-tcl was specified.
if test x"${with_tclconfig}" != x ; then
if test -f "${with_tclconfig}/tclConfig.sh" ; then
ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
@@ -59,7 +59,10 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [
# check in a few common install locations
if test x"${ac_cv_c_tclconfig}" = x ; then
for i in `ls -d ${prefix}/lib 2>/dev/null` \
- `ls -d /usr/local/lib 2>/dev/null` ; do
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
if test -f "$i/tclConfig.sh" ; then
ac_cv_c_tclconfig=`(cd $i; pwd)`
break
@@ -68,7 +71,7 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [
fi
# check in a few other private locations
- if test x"${ac_cv_c_tcliconfig}" = x ; then
+ if test x"${ac_cv_c_tclconfig}" = x ; then
for i in \
${srcdir}/../tcl \
`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
@@ -151,7 +154,10 @@ AC_DEFUN(SC_PATH_TKCONFIG, [
# check in a few common install locations
if test x"${ac_cv_c_tkconfig}" = x ; then
for i in `ls -d ${prefix}/lib 2>/dev/null` \
- `ls -d /usr/local/lib 2>/dev/null` ; do
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
if test -f "$i/tkConfig.sh" ; then
ac_cv_c_tkconfig=`(cd $i; pwd)`
break
@@ -242,10 +248,10 @@ AC_DEFUN(SC_LOAD_TCLCONFIG, [
#------------------------------------------------------------------------
AC_DEFUN(SC_LOAD_TKCONFIG, [
- AC_MSG_CHECKING([for existence of $TCLCONFIG])
+ AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh])
if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
- AC_MSG_CHECKING([loading $TK_BIN_DIR/tkConfig.sh])
+ AC_MSG_RESULT([loading])
. $TK_BIN_DIR/tkConfig.sh
else
AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
@@ -397,6 +403,7 @@ AC_DEFUN(SC_ENABLE_THREADS, [
TCL_THREADS=0
AC_MSG_RESULT([no (default)])
fi
+ AC_SUBST(TCL_THREADS)
])
#------------------------------------------------------------------------
@@ -407,7 +414,7 @@ AC_DEFUN(SC_ENABLE_THREADS, [
# Arguments:
# none
#
-# Requires the following vars to be set:
+# Requires the following vars to be set in the Makefile:
# CFLAGS_DEBUG
# CFLAGS_OPTIMIZE
# LDFLAGS_DEBUG
@@ -419,10 +426,10 @@ AC_DEFUN(SC_ENABLE_THREADS, [
# --enable-symbols
#
# Defines the following vars:
-# CFLAGS_DEFAULT Sets to CFLAGS_DEBUG if true
-# Sets to CFLAGS_OPTIMIZE if false
-# LDFLAGS_DEFAULT Sets to LDFLAGS_DEBUG if true
-# Sets to LDFLAGS_OPTIMIZE if false
+# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
+# Sets to $(CFLAGS_OPTIMIZE) if false
+# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
+# Sets to $(LDFLAGS_OPTIMIZE) if false
# DBGX Debug library extension
#
#------------------------------------------------------------------------
@@ -430,14 +437,15 @@ AC_DEFUN(SC_ENABLE_THREADS, [
AC_DEFUN(SC_ENABLE_SYMBOLS, [
AC_MSG_CHECKING([for build with symbols])
AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
+# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
if test "$tcl_ok" = "yes"; then
- CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
- LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
+ CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
+ LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
DBGX=g
AC_MSG_RESULT([yes])
else
- CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
- LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
+ CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
+ LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
DBGX=""
AC_MSG_RESULT([no])
fi
@@ -470,6 +478,8 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [
# MAKE_LIB - Command to execute to build the Tcl library;
# differs depending on whether or not Tcl is being
# compiled as a shared library.
+# STLIB_LD - Base command to use for combining object files
+# into a static library.
# SHLIB_CFLAGS - Flags to pass to cc when compiling the components
# of a shared library (may request position-independent
# code, among other things).
@@ -578,15 +588,6 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
fi
fi
- AC_MSG_CHECKING([if gcc is being used])
- if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_gcc="yes"
- else
- using_gcc="no"
- fi
-
- AC_MSG_RESULT([$using_gcc ($CC)])
-
# Step 2: check for existence of -ldl library. This is needed because
# Linux can use either -ldl or -ldld for dynamic loading.
@@ -604,7 +605,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
TCL_LIB_VERSIONS_OK=ok
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE=-O
- if test "$using_gcc" = "yes" ; then
+ if test "$GCC" = "yes" ; then
CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
else
CFLAGS_WARNING=""
@@ -612,10 +613,13 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
TCL_NEEDS_EXP_FILE=0
TCL_BUILD_EXP_FILE=""
TCL_EXP_FILE=""
- STLIB_LD="ar cr"
+dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
+dnl AC_CHECK_TOOL(AR, ar, :)
+ AC_CHECK_PROG(AR, ar, ar)
+ STLIB_LD='${AR} cr'
case $system in
AIX-5.*)
- if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then
+ if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
# AIX requires the _r compiler when gcc isn't being used
if test "${CC}" != "cc_r" ; then
CC=${CC}_r
@@ -635,24 +639,24 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
# AIX-5 has dl* in libc.so
DL_LIBS=""
LDFLAGS=""
- if test "$using_gcc" = "yes" ; then
+ if test "$GCC" = "yes" ; then
LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
else
LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
fi
if test "$do64bit" = "yes" ; then
- if test "$using_gcc" = "no" ; then
+ if test "$GCC" = "yes" ; then
+ AC_MSG_WARN("64bit mode not supported with GCC on $system")
+ else
do64bit_ok=yes
EXTRA_CFLAGS="-q64"
LDFLAGS="-q64"
- else
- AC_MSG_WARN("64bit mode not supported with GCC on $system")
fi
fi
;;
AIX-*)
- if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then
+ if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
# AIX requires the _r compiler when gcc isn't being used
if test "${CC}" != "cc_r" ; then
CC=${CC}_r
@@ -789,7 +793,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- if test "$using_gcc" = "yes" ; then
+ if test "$GCC" = "yes" ; then
EXTRA_CFLAGS="-mabi=n32"
LDFLAGS="-mabi=n32"
else
@@ -949,6 +953,10 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
DL_LIBS=""
LDFLAGS="-export-dynamic"
LD_SEARCH_FLAGS=""
+ # FreeBSD doesn't handle version numbers with dots.
+ UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
+ SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
+ TCL_LIB_VERSIONS_OK=nodots
;;
Rhapsody-*|Darwin-*)
SHLIB_CFLAGS="-fno-common"
@@ -1008,18 +1016,18 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
DL_LIBS=""
LDFLAGS=""
LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- if test "$using_gcc" = "no" ; then
+ if test "$GCC" != "yes" ; then
EXTRA_CFLAGS="-DHAVE_TZSET -std1"
fi
# see pthread_intro(3) for pthread support on osf1, k.furukawa
if test "${TCL_THREADS}" = "1" ; then
EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
- if test "$using_gcc" = "no" ; then
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread"
- LDFLAGS="-pthread"
- else
+ if test "$GCC" = "yes" ; then
LIBS=`echo $LIBS | sed s/-lpthreads//`
LIBS="$LIBS -lpthread -lmach -lexc"
+ else
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread"
+ LDFLAGS="-pthread"
fi
fi
@@ -1051,7 +1059,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
# Note, dlopen is available only on SCO 3.2.5 and greater. However,
# this test works, since "uname -s" was non-standard in 3.2.4 and
# below.
- if test "$using_gcc" = "yes" ; then
+ if test "$GCC" = "yes" ; then
SHLIB_CFLAGS="-fPIC -melf"
LDFLAGS="-melf -Wl,-Bexport"
else
@@ -1095,6 +1103,12 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
TCL_LIB_VERSIONS_OK=nodots
;;
SunOS-5.[[0-6]]*)
+
+ # Note: If _REENTRANT isn't defined, then Solaris
+ # won't define thread-safe library routines.
+
+ AC_DEFINE(_REENTRANT)
+
SHLIB_CFLAGS="-KPIC"
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
@@ -1109,6 +1123,12 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
;;
SunOS-5*)
+
+ # Note: If _REENTRANT isn't defined, then Solaris
+ # won't define thread-safe library routines.
+
+ AC_DEFINE(_REENTRANT)
+
SHLIB_CFLAGS="-KPIC"
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
LDFLAGS=""
@@ -1116,7 +1136,9 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
if test "$do64bit" = "yes" ; then
arch=`isainfo`
if test "$arch" = "sparcv9 sparc" ; then
- if test "$using_gcc" = "no" ; then
+ if test "$GCC" = "yes" ; then
+ AC_MSG_WARN("64bit mode not supported with GCC on $system")
+ else
do64bit_ok=yes
if test "$do64bitVIS" = "yes" ; then
EXTRA_CFLAGS="-xarch=v9a"
@@ -1125,8 +1147,6 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
EXTRA_CFLAGS="-xarch=v9"
LDFLAGS="-xarch=v9"
fi
- else
- AC_MSG_WARN("64bit mode not supported with GCC on $system")
fi
else
AC_MSG_WARN("64bit mode only supported sparcv9 system")
@@ -1140,7 +1160,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- if test "$using_gcc" = "yes" ; then
+ if test "$GCC" = "yes" ; then
LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
else
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
@@ -1155,7 +1175,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
DL_LIBS=""
LDFLAGS="-Wl,-D,08000000"
LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- if test "$using_gcc" = "no" ; then
+ if test "$GCC" != "yes" ; then
EXTRA_CFLAGS="-DHAVE_TZSET -std1"
fi
;;
@@ -1292,7 +1312,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
# standard manufacturer compiler.
if test "$DL_OBJS" != "tclLoadNone.o" ; then
- if test "$using_gcc" = "yes" ; then
+ if test "$GCC" = "yes" ; then
case $system in
AIX-*)
;;
@@ -1734,6 +1754,8 @@ AC_DEFUN(SC_TIME_HANDLER, [
AC_HEADER_TIME
AC_STRUCT_TIMEZONE
+ AC_CHECK_FUNCS(gmtime_r localtime_r)
+
AC_MSG_CHECKING([tm_tzadj in struct tm])
AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
[AC_DEFINE(HAVE_TM_TZADJ)