Skip to content

Commit 95b8c53

Browse files
committed
Fix [9fee4b5bb2] - cross-compilation
2 parents 72eda8a + 4667a9e commit 95b8c53

4 files changed

Lines changed: 190 additions & 1 deletion

File tree

‎Makefile.in‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ PKG_ENV = TCL_THREAD_LIBRARY=`@CYGPATH@ $(srcdir)/lib` \
153153

154154
TCLSH_PROG = @TCLSH_PROG@
155155
TCLSH = $(TCLSH_ENV) $(PKG_ENV) $(TCLSH_PROG)
156+
TCLSH_NATIVE = @TCLSH_NATIVE@
156157

157158
#WISH_ENV = TK_LIBRARY=`@CYGPATH@ $(TK_SRC_DIR)/library`
158159
#WISH_PROG = @WISH_PROG@
@@ -227,7 +228,7 @@ ${THREAD_ZIP_FILE}: ${ZIP_INSTALL_OBJS}
227228
@cp -a $(srcdir)/lib/* ${THREAD_VFS_PATH};
228229
@find ${THREAD_VFS_ROOT} -type d -empty -delete
229230
@echo "creating ${THREAD_ZIP_FILE} from ${THREAD_VFS_PATH}"
230-
@echo "zipfs mkzip ${THREAD_ZIP_FILE} ${THREAD_VFS_PATH} ${THREAD_VFS_PATH}" | $(TCLSH)
231+
@echo "zipfs mkzip ${THREAD_ZIP_FILE} ${THREAD_VFS_PATH} ${THREAD_VFS_PATH}" | $(TCLSH_NATIVE)
231232

232233

233234
#========================================================================

‎aclocal.m4‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,45 @@ AC_DEFUN(TCLTHREAD_WITH_LMDB, [
134134
fi
135135
])
136136

137+
# FIND_TCLSH9_NATIVE
138+
# Locates a Tcl 9 tclsh and set TCLSH_NATIVE to its path if found.
139+
# Unsets TCLSH_NATIVE if not found.
140+
AC_DEFUN([FIND_TCLSH9_NATIVE], [
141+
found="no"
142+
for f in tclsh9.0 tclsh90 tclsh; do
143+
AS_UNSET([TCLSH_NATIVE])
144+
AS_UNSET([ac_cv_path_TCLSH_NATIVE])
145+
AC_PATH_PROG([TCLSH_NATIVE], [$f], [no])
146+
if test "$TCLSH_NATIVE" != "no"; then
147+
AC_MSG_CHECKING([$TCLSH_NATIVE is Tcl 9])
148+
CHECK_TCLSH_VERSION([found], [$TCLSH_NATIVE], [9])
149+
AC_MSG_RESULT([$found])
150+
if test "$found" = "yes"; then
151+
found=yes
152+
break
153+
fi
154+
fi
155+
done
156+
if test "$found" != "yes"; then
157+
AS_UNSET(TCLSH_NATIVE)
158+
fi
159+
])
160+
161+
# CHECK_TCLSH_VERSION(RESULTVAR, EXECUTABLE, VERSIONREQUIREMENTS)
162+
# RESULTVAR - name of variable to in which to store result.
163+
# EXECUTABLE - tclsh program to check
164+
# VERSIONREQUIREMENTS - version requirements as passed to Tcl [package vsatisfies]
165+
#
166+
# The stored result is "yes" if the EXECUTABLE is a tclsh and meets the
167+
# version requirements and "no" in all other cases.
168+
169+
AC_DEFUN([CHECK_TCLSH_VERSION], [
170+
$1=`echo "puts [[package vsatisfies \\$tcl_version $3]]" | $2`
171+
if test "x[$][$1]" = "x1"; then
172+
$1=yes
173+
else
174+
$1=no
175+
fi
176+
])
177+
137178
# EOF

‎configure‎

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ INSTALL_MSGS
627627
INSTALL_LIBRARIES
628628
THREAD_ZIP_FILE
629629
ZIPFS_BUILD
630+
TCLSH_NATIVE
630631
TCLSH_PROG
631632
VC_MANIFEST_EMBED_EXE
632633
VC_MANIFEST_EMBED_DLL
@@ -2599,6 +2600,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
25992600

26002601

26012602

2603+
26022604
#--------------------------------------------------------------------
26032605
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
26042606
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
@@ -9729,6 +9731,123 @@ INSTALL_LIBRARIES=install-libraries
97299731
INSTALL_MSGS=install-msgs
97309732
fi
97319733

9734+
if test "${ZIPFS_BUILD}" != 0; then
9735+
# Only search if user has not specified
9736+
if test -z "$TCLSH_NATIVE"; then
9737+
9738+
found="no"
9739+
for f in tclsh9.0 tclsh90 tclsh; do
9740+
{ TCLSH_NATIVE=; unset TCLSH_NATIVE;}
9741+
{ ac_cv_path_TCLSH_NATIVE=; unset ac_cv_path_TCLSH_NATIVE;}
9742+
# Extract the first word of "$f", so it can be a program name with args.
9743+
set dummy $f; ac_word=$2
9744+
{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
9745+
printf %s "checking for $ac_word... " >&6; }
9746+
if test ${ac_cv_path_TCLSH_NATIVE+y}
9747+
then :
9748+
printf %s "(cached) " >&6
9749+
else case e in #(
9750+
e) case $TCLSH_NATIVE in
9751+
[\\/]* | ?:[\\/]*)
9752+
ac_cv_path_TCLSH_NATIVE="$TCLSH_NATIVE" # Let the user override the test with a path.
9753+
;;
9754+
*)
9755+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
9756+
for as_dir in $PATH
9757+
do
9758+
IFS=$as_save_IFS
9759+
case $as_dir in #(((
9760+
'') as_dir=./ ;;
9761+
*/) ;;
9762+
*) as_dir=$as_dir/ ;;
9763+
esac
9764+
for ac_exec_ext in '' $ac_executable_extensions; do
9765+
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
9766+
ac_cv_path_TCLSH_NATIVE="$as_dir$ac_word$ac_exec_ext"
9767+
printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
9768+
break 2
9769+
fi
9770+
done
9771+
done
9772+
IFS=$as_save_IFS
9773+
9774+
test -z "$ac_cv_path_TCLSH_NATIVE" && ac_cv_path_TCLSH_NATIVE="no"
9775+
;;
9776+
esac ;;
9777+
esac
9778+
fi
9779+
TCLSH_NATIVE=$ac_cv_path_TCLSH_NATIVE
9780+
if test -n "$TCLSH_NATIVE"; then
9781+
{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $TCLSH_NATIVE" >&5
9782+
printf '%s\n' "$TCLSH_NATIVE" >&6; }
9783+
else
9784+
{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5
9785+
printf '%s\n' "no" >&6; }
9786+
fi
9787+
9788+
9789+
if test "$TCLSH_NATIVE" != "no"; then
9790+
{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking $TCLSH_NATIVE is Tcl 9" >&5
9791+
printf %s "checking $TCLSH_NATIVE is Tcl 9... " >&6; }
9792+
9793+
found=`echo "puts [package vsatisfies \\$tcl_version 9]" | $TCLSH_NATIVE`
9794+
if test "x$found" = "x1"; then
9795+
found=yes
9796+
else
9797+
found=no
9798+
fi
9799+
9800+
{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $found" >&5
9801+
printf '%s\n' "$found" >&6; }
9802+
if test "$found" = "yes"; then
9803+
found=yes
9804+
break
9805+
fi
9806+
fi
9807+
done
9808+
if test "$found" != "yes"; then
9809+
{ TCLSH_NATIVE=; unset TCLSH_NATIVE;}
9810+
fi
9811+
9812+
# If not found, and not cross building set to TCLSH_PROG. One is
9813+
# not supposed to use that for native operations so check that not cross-
9814+
# compiling.
9815+
if test -z "$TCLSH_NATIVE" -a -n "$TCLSH_PROG" -a x"$ac_cv_cross" != x"yes"; then
9816+
{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking $TCLSH_PROG for Tcl 9" >&5
9817+
printf %s "checking $TCLSH_PROG for Tcl 9... " >&6; }
9818+
9819+
found=`echo "puts [package vsatisfies \\$tcl_version 9]" | $TCLSH_PROG`
9820+
if test "x$found" = "x1"; then
9821+
found=yes
9822+
else
9823+
found=no
9824+
fi
9825+
9826+
{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $found" >&5
9827+
printf '%s\n' "$found" >&6; }
9828+
if test x"$found" != x"yes"; then
9829+
as_fn_error $? "cannot find a usable native Tcl 9 tclsh. Either set TCLSH_NATIVE or use configure with --disable-zipfs" "$LINENO" 5
9830+
fi
9831+
TCLSH_NATIVE="$TCLSH_PROG"
9832+
fi
9833+
else
9834+
# User specified. Check version acceptable.
9835+
9836+
found=`echo "puts [package vsatisfies \\$tcl_version 9]" | $TCLSH_NATIVE`
9837+
if test "x$found" = "x1"; then
9838+
found=yes
9839+
else
9840+
found=no
9841+
fi
9842+
9843+
if test x"$found" != x"yes"; then
9844+
as_fn_error $? "$TCLSH_NATIVE is not a Tcl 9 tclsh." "$LINENO" 5
9845+
fi
9846+
fi
9847+
fi
9848+
9849+
9850+
97329851

97339852

97349853

‎configure.ac‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dnl to configure the system for the local environment.
1818
#-----------------------------------------------------------------------
1919

2020
AC_INIT([thread],[3.0.6])
21+
AC_PREREQ([2.73])
2122

2223
#--------------------------------------------------------------------
2324
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
@@ -235,6 +236,33 @@ AC_MSG_RESULT([no])
235236
INSTALL_LIBRARIES=install-libraries
236237
INSTALL_MSGS=install-msgs
237238
fi
239+
240+
if test "${ZIPFS_BUILD}" != 0; then
241+
# Only search if user has not specified
242+
if test -z "$TCLSH_NATIVE"; then
243+
FIND_TCLSH9_NATIVE
244+
# If not found, and not cross building set to TCLSH_PROG. One is
245+
# not supposed to use that for native operations so check that not cross-
246+
# compiling.
247+
if test -z "$TCLSH_NATIVE" -a -n "$TCLSH_PROG" -a x"$ac_cv_cross" != x"yes"; then
248+
AC_MSG_CHECKING([$TCLSH_PROG for Tcl 9])
249+
CHECK_TCLSH_VERSION([found], [$TCLSH_PROG], [9])
250+
AC_MSG_RESULT([$found])
251+
if test x"$found" != x"yes"; then
252+
AC_MSG_ERROR([cannot find a usable native Tcl 9 tclsh. Either set TCLSH_NATIVE or use configure with --disable-zipfs])
253+
fi
254+
TCLSH_NATIVE="$TCLSH_PROG"
255+
fi
256+
else
257+
# User specified. Check version acceptable.
258+
CHECK_TCLSH_VERSION([found], [$TCLSH_NATIVE], [9])
259+
if test x"$found" != x"yes"; then
260+
AC_MSG_ERROR([$TCLSH_NATIVE is not a Tcl 9 tclsh.])
261+
fi
262+
fi
263+
fi
264+
265+
AC_SUBST(TCLSH_NATIVE)
238266
AC_SUBST(ZIPFS_BUILD)
239267
AC_SUBST(THREAD_ZIP_FILE)
240268
AC_SUBST(INSTALL_LIBRARIES)

0 commit comments

Comments
 (0)