Skip to content

Commit

Permalink
Add configuration option --with-tk8
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Nov 14, 2024
1 parent d632cbc commit 6be94c4
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 123 deletions.
51 changes: 8 additions & 43 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -5881,7 +5881,7 @@ printf %s "checking for Tcl private include files... " >&6; }
# If Tcl was built as a framework, attempt to use
# the framework's Headers and PrivateHeaders directories
case ${TCL_DEFS} in
*TCL_FRAMEWORK*)
*TCL_FRAMEWORK*)
if test -d "${TCL_BIN_DIR}/Headers" -a \
-d "${TCL_BIN_DIR}/PrivateHeaders"; then
TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
Expand Down Expand Up @@ -7017,7 +7017,7 @@ printf "%s\n" "$ac_cv_cross" >&6; }
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'

TCL_LIB_VERSIONS_OK=nodots
;;
;;
AIX-*)
if test "$GCC" != "yes"
then :
Expand All @@ -7029,7 +7029,7 @@ then :
;;
*)
# Make sure only first arg gets _r
CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'`
CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'`
;;
esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using $CC for compiling with threads" >&5
Expand Down Expand Up @@ -7799,46 +7799,6 @@ esac
fi
# TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if ld accepts -single_module flag" >&5
printf %s "checking if ld accepts -single_module flag... " >&6; }
if test ${tcl_cv_ld_single_module+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
int i;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
tcl_cv_ld_single_module=yes
else case e in #(
e) tcl_cv_ld_single_module=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_single_module" >&5
printf "%s\n" "$tcl_cv_ld_single_module" >&6; }
if test $tcl_cv_ld_single_module = yes
then :

SHLIB_LD="${SHLIB_LD} -Wl,-single_module"

fi
# TEA specific: link shlib with current and compatibility version flags
vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([0-9]\{1,5\}\)\(\(\.[0-9]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
Expand Down Expand Up @@ -9345,6 +9305,11 @@ rm -rf conftest*

printf "%s\n" "#define TCL_MAJOR_VERSION 8" >>confdefs.h

fi
if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tk8}" != x; then

printf "%s\n" "#define TK_MAJOR_VERSION 8" >>confdefs.h

fi
if test "${TEA_PLATFORM}" = "windows" ; then
if test "${SHARED_BUILD}" = "1" ; then
Expand Down
60 changes: 17 additions & 43 deletions itclWidget/configure
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ enable_option_checking
with_tcl
with_tcl8
with_tk
with_tk8
with_itcl
with_tclinclude
with_tkinclude
Expand Down Expand Up @@ -1437,6 +1438,7 @@ Optional Packages:
(tclConfig.sh)
--with-tcl8 Compile for Tcl8 in Tcl9 environment
--with-tk directory containing tk configuration (tkConfig.sh)
--with-tk8 Compile for Tk8 in Tk9 environment
--with-itcl directory containing itcl configuration (itclConfig.sh)
--with-tclinclude directory containing the public Tcl header files
--with-tkinclude directory containing the public Tk header files
Expand Down Expand Up @@ -4076,6 +4078,13 @@ then :
withval=$with_tk; with_tkconfig="${withval}"
fi


# Check whether --with-tk8 was given.
if test ${with_tk8+y}
then :
withval=$with_tk8; with_tk8="${withval}"
fi

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Tk configuration" >&5
printf %s "checking for Tk configuration... " >&6; }
if test ${ac_cv_c_tkconfig+y}
Expand Down Expand Up @@ -6273,7 +6282,7 @@ printf %s "checking for Tcl private include files... " >&6; }
# If Tcl was built as a framework, attempt to use
# the framework's Headers and PrivateHeaders directories
case ${TCL_DEFS} in
*TCL_FRAMEWORK*)
*TCL_FRAMEWORK*)
if test -d "${TCL_BIN_DIR}/Headers" -a \
-d "${TCL_BIN_DIR}/PrivateHeaders"; then
TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
Expand Down Expand Up @@ -7656,7 +7665,7 @@ printf "%s\n" "$ac_cv_cross" >&6; }
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'

TCL_LIB_VERSIONS_OK=nodots
;;
;;
AIX-*)
if test "$GCC" != "yes"
then :
Expand All @@ -7668,7 +7677,7 @@ then :
;;
*)
# Make sure only first arg gets _r
CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'`
CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'`
;;
esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using $CC for compiling with threads" >&5
Expand Down Expand Up @@ -8438,46 +8447,6 @@ esac
fi
# TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if ld accepts -single_module flag" >&5
printf %s "checking if ld accepts -single_module flag... " >&6; }
if test ${tcl_cv_ld_single_module+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
int i;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
tcl_cv_ld_single_module=yes
else case e in #(
e) tcl_cv_ld_single_module=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$hold_ldflags ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_single_module" >&5
printf "%s\n" "$tcl_cv_ld_single_module" >&6; }
if test $tcl_cv_ld_single_module = yes
then :

SHLIB_LD="${SHLIB_LD} -Wl,-single_module"

fi
# TEA specific: link shlib with current and compatibility version flags
vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([0-9]\{1,5\}\)\(\(\.[0-9]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
Expand Down Expand Up @@ -9938,6 +9907,11 @@ rm -rf conftest*

printf "%s\n" "#define TCL_MAJOR_VERSION 8" >>confdefs.h

fi
if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tk8}" != x; then

printf "%s\n" "#define TK_MAJOR_VERSION 8" >>confdefs.h

fi
if test "${TEA_PLATFORM}" = "windows" ; then
if test "${SHARED_BUILD}" = "1" ; then
Expand Down
22 changes: 10 additions & 12 deletions itclWidget/tclconfig/tcl.m4
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ AC_DEFUN([TEA_PATH_TKCONFIG], [
AS_HELP_STRING([--with-tk],
[directory containing tk configuration (tkConfig.sh)]),
[with_tkconfig="${withval}"])
AC_ARG_WITH(tk8,
AS_HELP_STRING([--with-tk8],
[Compile for Tk8 in Tk9 environment]),
[with_tk8="${withval}"])
AC_MSG_CHECKING([for Tk configuration])
AC_CACHE_VAL(ac_cv_c_tkconfig,[
Expand Down Expand Up @@ -1293,7 +1297,7 @@ AC_DEFUN([TEA_CONFIG_CFLAGS], [
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
TCL_LIB_VERSIONS_OK=nodots
;;
;;
AIX-*)
AS_IF([test "$GCC" != "yes"], [
# AIX requires the _r compiler when gcc isn't being used
Expand All @@ -1303,7 +1307,7 @@ AC_DEFUN([TEA_CONFIG_CFLAGS], [
;;
*)
# Make sure only first arg gets _r
CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
;;
esac
AC_MSG_RESULT([Using $CC for compiling with threads])
Expand Down Expand Up @@ -1661,15 +1665,6 @@ AC_DEFUN([TEA_CONFIG_CFLAGS], [
])
# TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
hold_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
[tcl_cv_ld_single_module=yes],[tcl_cv_ld_single_module=no])
LDFLAGS=$hold_ldflags])
AS_IF([test $tcl_cv_ld_single_module = yes], [
SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
])
# TEA specific: link shlib with current and compatibility version flags
vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
Expand Down Expand Up @@ -3217,6 +3212,9 @@ print("manifest needed")
PACKAGE_LIB_PREFIX="${PACKAGE_LIB_PREFIX8}"
AC_DEFINE(TCL_MAJOR_VERSION, 8, [Compile for Tcl8?])
fi
if test "${TCL_MAJOR_VERSION}" -gt 8 -a x"${with_tk8}" != x; then
AC_DEFINE(TK_MAJOR_VERSION, 8, [Compile for Tk8?])
fi
if test "${TEA_PLATFORM}" = "windows" ; then
if test "${SHARED_BUILD}" = "1" ; then
# We force the unresolved linking of symbols that are really in
Expand Down Expand Up @@ -3417,7 +3415,7 @@ AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
# If Tcl was built as a framework, attempt to use
# the framework's Headers and PrivateHeaders directories
case ${TCL_DEFS} in
*TCL_FRAMEWORK*)
*TCL_FRAMEWORK*)
if test -d "${TCL_BIN_DIR}/Headers" -a \
-d "${TCL_BIN_DIR}/PrivateHeaders"; then
TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
Expand Down
51 changes: 27 additions & 24 deletions win/nmakehlp.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ main(
case 'c':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -c <compiler option>\n"
"usage: %s -c <compiler option>\n"
"Tests for whether cl.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
Expand All @@ -101,7 +101,7 @@ main(
case 'l':
if (argc < 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -l <linker option> ?<mandatory option> ...?\n"
"usage: %s -l <linker option> ?<mandatory option> ...?\n"
"Tests for whether link.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
Expand Down Expand Up @@ -271,7 +271,7 @@ CheckForCompilerFeature(
if (!ok) {
DWORD err = GetLastError();
int chars = snprintf(msg, sizeof(msg) - 1,
"Tried to launch: \"%s\", but got error [%lu]: ", cmdline, err);
"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);

FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPSTR)&msg[chars],
Expand Down Expand Up @@ -318,11 +318,11 @@ CheckForCompilerFeature(
*/

return !(strstr(Out.buffer, "D4002") != NULL
|| strstr(Err.buffer, "D4002") != NULL
|| strstr(Out.buffer, "D9002") != NULL
|| strstr(Err.buffer, "D9002") != NULL
|| strstr(Out.buffer, "D2021") != NULL
|| strstr(Err.buffer, "D2021") != NULL);
|| strstr(Err.buffer, "D4002") != NULL
|| strstr(Out.buffer, "D9002") != NULL
|| strstr(Err.buffer, "D9002") != NULL
|| strstr(Out.buffer, "D2021") != NULL
|| strstr(Err.buffer, "D2021") != NULL);
}

static int
Expand Down Expand Up @@ -405,7 +405,7 @@ CheckForLinkerFeature(
if (!ok) {
DWORD err = GetLastError();
int chars = snprintf(msg, sizeof(msg) - 1,
"Tried to launch: \"%s\", but got error [%lu]: ", cmdline, err);
"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);

FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPSTR)&msg[chars],
Expand Down Expand Up @@ -493,9 +493,9 @@ IsIn(

/*
* GetVersionFromFile --
* Looks for a match string in a file and then returns the version
* following the match where a version is anything acceptable to
* package provide or package ifneeded.
* Looks for a match string in a file and then returns the version
* following the match where a version is anything acceptable to
* package provide or package ifneeded.
*/

static const char *
Expand Down Expand Up @@ -600,9 +600,9 @@ list_free(list_item_t **listPtrPtr)
*
* Usage is something like:
* nmakehlp -S << $** > $@
* @PACKAGE_NAME@ $(PACKAGE_NAME)
* @PACKAGE_VERSION@ $(PACKAGE_VERSION)
* <<
* @PACKAGE_NAME@ $(PACKAGE_NAME)
* @PACKAGE_VERSION@ $(PACKAGE_VERSION)
* <<
*/

static int
Expand Down Expand Up @@ -747,8 +747,9 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
#else
hSearch = FindFirstFile(path, &finfo);
#endif
if (hSearch == INVALID_HANDLE_VALUE)
if (hSearch == INVALID_HANDLE_VALUE) {
return 1; /* Not found */
}

/* Loop through all subdirs checking if the keypath is under there */
ret = 1; /* Assume not found */
Expand All @@ -758,11 +759,13 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
* We need to check it is a directory despite the
* FindExSearchLimitToDirectories in the above call. See SDK docs
*/
if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
continue;
}
sublen = strlen(finfo.cFileName);
if ((dirlen+1+sublen+1+keylen+1) > sizeof(path))
if ((dirlen+1+sublen+1+keylen+1) > sizeof(path)) {
continue; /* Path does not fit, assume not matched */
}
strncpy(path+dirlen+1, finfo.cFileName, sublen);
path[dirlen+1+sublen] = '\\';
strncpy(path+dirlen+1+sublen+1, keypath, keylen+1);
Expand All @@ -782,13 +785,13 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
* LocateDependency --
*
* Locates a dependency for a package.
* keypath - a relative path within the package directory
* that is used to confirm it is the correct directory.
* keypath - a relative path within the package directory
* that is used to confirm it is the correct directory.
* The search path for the package directory is currently only
* the parent and grandparent of the current working directory.
* If found, the command prints
* name_DIRPATH=<full path of located directory>
* and returns 0. If not found, does not print anything and returns 1.
* the parent and grandparent of the current working directory.
* If found, the command prints
* name_DIRPATH=<full path of located directory>
* and returns 0. If not found, does not print anything and returns 1.
*/
static int LocateDependency(const char *keypath)
{
Expand Down
Loading

0 comments on commit 6be94c4

Please sign in to comment.