2017-04-25 14:41:48 +02:00
|
|
|
dnl Process this file with autoconf to produce a configure script.
|
|
|
|
|
dnl Use autoconf 2.52 or newer.
|
|
|
|
|
|
|
|
|
|
AC_INIT(magic,, magic-hackers@csl.cornell.edu)
|
|
|
|
|
AC_PREREQ(2.52)
|
|
|
|
|
AC_CONFIG_SRCDIR(rules.mak)
|
build: make configure relocatable (out-of-tree)
Enable `mkdir build; cd build; ../configure` to run entirely in the build
directory, with generated config landing there instead of in the source
tree. This is the autoconf-layer groundwork for a full VPATH build; the
make layer (defs.mak/rules.mak VPATH support, per-dir orchestration) is
still to come, so an out-of-tree `make` is not yet expected to work.
Changes:
* configure (wrapper): run the generated config.status in the *current*
directory with --srcdir pointing back at the source tree (instead of
`cd scripts`), so outputs land in the build dir. Uses an absolute
basedir so any build-dir location works, not just a subdir of srcdir.
* scripts/configure.in:
- AC_CONFIG_AUX_DIR(.) -> AC_CONFIG_AUX_DIR(scripts). Once srcdir
resolves to the true top (scripts' parent, where rules.mak lives),
autoconf searches for install-sh/config.sub/... relative to srcdir;
"." pointed at the wrong place and out-of-tree configure died with
"cannot find install-sh".
- Name the .in templates explicitly
(defs.mak:scripts/defs.mak.in, scripts/makedbh:scripts/makedbh.in)
so config.status finds them from a separate build dir. defs.mak is
written to the build top; makedbh under build/scripts/ to match
${SCRIPTS}/makedbh.
- Drop the trailing `cp defs.mak ..`; defs.mak is now generated in the
build top directly, and from a build dir the copy would clobber the
source tree's defs.mak.
* scripts/configure: regenerated with autoconf 2.69.
Verified: out-of-tree `../configure` completes rc=0, writes defs.mak /
scripts/makedbh / config.status into the build dir, records
srcdir=<source top>, and leaves the source tree's tracked files and
generated defs.mak/makedbh untouched.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:20:59 +02:00
|
|
|
dnl configure.in lives in scripts/, but the source root is its parent (that is
|
|
|
|
|
dnl where rules.mak is, so srcdir resolves there). The aux scripts (install-sh,
|
|
|
|
|
dnl config.sub, config.guess, missing, mkinstalldirs) live in scripts/, which is
|
|
|
|
|
dnl "scripts" relative to that srcdir -- not ".". Using "." breaks out-of-tree
|
|
|
|
|
dnl configure with "cannot find install-sh".
|
|
|
|
|
AC_CONFIG_AUX_DIR(scripts)
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
AC_CANONICAL_SYSTEM
|
|
|
|
|
|
|
|
|
|
dnl pass the version string on the the makefiles
|
|
|
|
|
PACKAGE=magic
|
|
|
|
|
|
|
|
|
|
dnl Override default target when compiling under TCL
|
|
|
|
|
ALL_TARGET="standard"
|
|
|
|
|
INSTALL_TARGET="install-magic"
|
|
|
|
|
|
|
|
|
|
dnl Checks for programs.
|
|
|
|
|
AC_PROG_CC
|
|
|
|
|
AC_PROG_CPP
|
|
|
|
|
AC_PROG_CXX
|
|
|
|
|
AC_ISC_POSIX
|
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
|
AC_PROG_RANLIB
|
2024-10-17 22:15:30 +02:00
|
|
|
AC_PROG_SED
|
2017-04-25 14:41:48 +02:00
|
|
|
|
2026-07-23 16:21:47 +02:00
|
|
|
dnl Prefix the compilers with ccache when it is installed (autodetected; opt out
|
|
|
|
|
dnl with --disable-ccache). Done after the AC_PROG_C* checks above so those
|
|
|
|
|
dnl feature tests run with the plain compiler; only the substituted @CC@/@CXX@
|
|
|
|
|
dnl used by the build pick up the prefix, and rules.mak's `${CC} ... -c` recipe
|
|
|
|
|
dnl then goes through ccache with no Makefile change. This pairs with the
|
|
|
|
|
dnl build-info isolation (utils/buildinfo.c): the volatile MAGIC_BUILDDATE lives
|
|
|
|
|
dnl only on that one unit's command line, so a rebuild hits the cache for every
|
|
|
|
|
dnl other unit instead of missing all of them.
|
|
|
|
|
AC_ARG_ENABLE(ccache,
|
|
|
|
|
[ --disable-ccache do not use ccache even if it is installed],
|
|
|
|
|
[], [enable_ccache=yes])
|
|
|
|
|
if test "x$enable_ccache" = "xyes"; then
|
|
|
|
|
AC_CHECK_PROG(CCACHE, ccache, ccache)
|
|
|
|
|
if test "x$CCACHE" != "x"; then
|
|
|
|
|
CC="$CCACHE $CC"
|
|
|
|
|
test "x$CXX" != "x" && CXX="$CCACHE $CXX"
|
|
|
|
|
AC_MSG_NOTICE([using ccache: CC="$CC"])
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2026-07-23 16:27:18 +02:00
|
|
|
dnl Optional: normalize the absolute source-root prefix embedded in compiled
|
|
|
|
|
dnl output (__FILE__, debug info) so a cached object is valid regardless of which
|
|
|
|
|
dnl checkout / build dir produced it -- needed for *correct* cross-tree ccache
|
|
|
|
|
dnl sharing (which also wants CCACHE_BASEDIR=<build top> in the environment at
|
|
|
|
|
dnl build time; see the README). Off by default: it relativizes debug paths, so
|
|
|
|
|
dnl gdb then needs `set substitute-path . <srcdir>`. Requires GCC 8+/clang, so
|
|
|
|
|
dnl the flag is probed before use. Same-tree cache hits do NOT need this (the
|
|
|
|
|
dnl command-line paths already match); it is purely for cross-tree correctness.
|
|
|
|
|
CCACHE_PREFIX_MAP_FLAG=""
|
|
|
|
|
AC_ARG_ENABLE(ccache-prefix-map,
|
|
|
|
|
[ --enable-ccache-prefix-map relativize embedded source paths for cross-tree ccache (needs ccache; makes debug paths relative)],
|
|
|
|
|
[
|
|
|
|
|
if test "x$CCACHE" = "x"; then
|
|
|
|
|
AC_MSG_WARN([--enable-ccache-prefix-map ignored: ccache is not in use])
|
|
|
|
|
else
|
|
|
|
|
AC_MSG_CHECKING([whether $CC accepts -ffile-prefix-map])
|
|
|
|
|
magic_save_cflags="$CFLAGS"
|
|
|
|
|
CFLAGS="$CFLAGS -ffile-prefix-map=/nonexistent=."
|
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
|
|
|
|
|
[AC_MSG_RESULT([yes]); CCACHE_PREFIX_MAP_FLAG="-ffile-prefix-map"],
|
|
|
|
|
[AC_MSG_RESULT([no]); AC_MSG_WARN([compiler lacks -ffile-prefix-map; not relativizing paths])])
|
|
|
|
|
CFLAGS="$magic_save_cflags"
|
|
|
|
|
fi
|
|
|
|
|
])
|
|
|
|
|
AC_SUBST(CCACHE_PREFIX_MAP_FLAG)
|
|
|
|
|
|
2025-03-21 12:39:21 +01:00
|
|
|
AC_PATH_PROG(PERL, perl, no)
|
|
|
|
|
AC_SUBST(PERL)
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
dnl check if the linker is a GNU linker
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------
|
|
|
|
|
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
|
|
|
|
# (This stuff ripped from libtool)
|
|
|
|
|
#------------------------------------------------------------
|
|
|
|
|
AC_DEFUN([AC_PROG_LD],
|
|
|
|
|
[AC_ARG_WITH(gnu-ld,
|
|
|
|
|
[ --with-gnu-ld assume the C compiler uses GNU ld [[default=no]]],
|
|
|
|
|
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
|
|
|
|
AC_REQUIRE([AC_PROG_CC])dnl
|
|
|
|
|
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
|
|
|
|
dnl ###not for PostgreSQL### AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
|
|
|
|
ac_prog=ld
|
|
|
|
|
if test "$GCC" = yes; then
|
|
|
|
|
# Check if gcc -print-prog-name=ld gives a path.
|
|
|
|
|
AC_MSG_CHECKING([for ld used by GCC])
|
|
|
|
|
case $host in
|
|
|
|
|
*-*-mingw*)
|
|
|
|
|
# gcc leaves a trailing carriage return which upsets mingw
|
|
|
|
|
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
|
|
|
|
|
*)
|
|
|
|
|
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
|
|
|
|
|
esac
|
|
|
|
|
case "$ac_prog" in
|
|
|
|
|
# Accept absolute paths.
|
|
|
|
|
changequote(,)dnl
|
|
|
|
|
[\\/]* | [A-Za-z]:[\\/]*)
|
|
|
|
|
re_direlt='/[^/][^/]*/\.\./'
|
|
|
|
|
changequote([,])dnl
|
|
|
|
|
# Canonicalize the path of ld
|
|
|
|
|
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
|
|
|
|
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
|
|
|
|
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
|
|
|
|
done
|
|
|
|
|
test -z "$LD" && LD="$ac_prog"
|
|
|
|
|
;;
|
|
|
|
|
"")
|
|
|
|
|
# If it fails, then pretend we aren't using GCC.
|
|
|
|
|
ac_prog=ld
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
# If it is relative, then search for the first ld in PATH.
|
|
|
|
|
with_gnu_ld=unknown
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
elif test "$with_gnu_ld" = yes; then
|
|
|
|
|
AC_MSG_CHECKING([for GNU ld])
|
|
|
|
|
else
|
|
|
|
|
AC_MSG_CHECKING([for non-GNU ld])
|
|
|
|
|
fi
|
|
|
|
|
AC_CACHE_VAL(ac_cv_path_LD,
|
|
|
|
|
[if test -z "$LD"; then
|
|
|
|
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
|
|
|
|
for ac_dir in $PATH; do
|
|
|
|
|
test -z "$ac_dir" && ac_dir=.
|
|
|
|
|
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
|
|
|
|
ac_cv_path_LD="$ac_dir/$ac_prog"
|
|
|
|
|
# Check to see if the program is GNU ld. I'd rather use --version,
|
|
|
|
|
# but apparently some GNU ld's only accept -v.
|
|
|
|
|
# Break only if it was the GNU/non-GNU ld that we prefer.
|
|
|
|
|
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
|
|
|
|
test "$with_gnu_ld" != no && break
|
|
|
|
|
else
|
|
|
|
|
test "$with_gnu_ld" != yes && break
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
IFS="$ac_save_ifs"
|
|
|
|
|
else
|
|
|
|
|
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
|
|
|
|
fi])
|
|
|
|
|
LD="$ac_cv_path_LD"
|
|
|
|
|
if test -n "$LD"; then
|
|
|
|
|
AC_MSG_RESULT($LD)
|
|
|
|
|
else
|
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
|
fi
|
|
|
|
|
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
|
|
|
|
AC_PROG_LD_GNU
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
AC_DEFUN([AC_PROG_LD_GNU],
|
|
|
|
|
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
|
|
|
|
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
|
|
|
|
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
|
|
|
|
ac_cv_prog_gnu_ld=yes
|
|
|
|
|
else
|
|
|
|
|
ac_cv_prog_gnu_ld=no
|
|
|
|
|
fi])
|
|
|
|
|
with_gnu_ld=$ac_cv_prog_gnu_ld
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
AC_PROG_LD
|
|
|
|
|
|
|
|
|
|
AC_CHECK_SIZEOF([void *], 4)
|
|
|
|
|
AC_CHECK_SIZEOF([unsigned int], 4)
|
|
|
|
|
AC_CHECK_SIZEOF([unsigned long], 4)
|
|
|
|
|
AC_CHECK_SIZEOF([unsigned long long], 8)
|
|
|
|
|
|
|
|
|
|
dnl Check byte arrangement for doubleint routines
|
|
|
|
|
AC_C_BIGENDIAN
|
2024-10-21 15:31:50 +02:00
|
|
|
AC_C_INLINE
|
|
|
|
|
AC_C_RESTRICT
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
dnl Check for required header files
|
|
|
|
|
AC_HEADER_STDC
|
|
|
|
|
|
2025-06-18 15:29:37 +02:00
|
|
|
dnl Check for compiler bool support
|
|
|
|
|
AC_HEADER_STDBOOL
|
|
|
|
|
|
2024-10-14 23:07:03 +02:00
|
|
|
AC_FUNC_ALLOCA
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
dnl Need either setenv or putenv
|
|
|
|
|
AC_CHECK_FUNCS(setenv putenv)
|
|
|
|
|
|
2025-02-24 09:35:12 +01:00
|
|
|
dnl Check for getrlimit
|
|
|
|
|
AC_CHECK_FUNCS(getrlimit)
|
|
|
|
|
|
|
|
|
|
dnl Check for setrlimit
|
|
|
|
|
AC_CHECK_FUNCS(setrlimit)
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
dnl Check for vfork
|
|
|
|
|
AC_CHECK_FUNC(vfork)
|
|
|
|
|
|
|
|
|
|
dnl Check for <sys/mman.h>
|
|
|
|
|
AC_CHECK_HEADERS(sys/mman.h)
|
|
|
|
|
|
|
|
|
|
dnl Check for <dirent.h>
|
|
|
|
|
AC_CHECK_HEADERS(dirent.h)
|
|
|
|
|
|
|
|
|
|
dnl Check for <limits.h>
|
|
|
|
|
AC_CHECK_HEADERS(limits.h)
|
|
|
|
|
|
|
|
|
|
dnl Check for <param.h>
|
|
|
|
|
AC_CHECK_HEADERS(param.h)
|
|
|
|
|
|
|
|
|
|
dnl Check for <paths.h>
|
|
|
|
|
AC_CHECK_HEADERS(paths.h)
|
|
|
|
|
|
2025-02-24 09:35:12 +01:00
|
|
|
dnl Check for <sys/resource.h>
|
|
|
|
|
AC_CHECK_HEADERS(sys/resource.h)
|
|
|
|
|
|
2024-10-04 12:30:50 +02:00
|
|
|
dnl Check for <sys/time.h>
|
|
|
|
|
AC_CHECK_HEADERS(sys/time.h)
|
2024-10-12 14:57:08 +02:00
|
|
|
AC_HEADER_TIME
|
2024-10-04 12:30:50 +02:00
|
|
|
|
2024-10-16 10:38:24 +02:00
|
|
|
dnl Check for <termio.h>
|
|
|
|
|
AC_CHECK_HEADERS(termio.h)
|
|
|
|
|
|
|
|
|
|
dnl Check for <termios.h>
|
|
|
|
|
AC_CHECK_HEADERS(termios.h)
|
|
|
|
|
|
|
|
|
|
dnl Check for <sys/ioctl.h>
|
|
|
|
|
AC_CHECK_HEADERS(sys/ioctl.h)
|
|
|
|
|
|
2025-07-17 21:55:50 +02:00
|
|
|
dnl Check for <sys/ioctl_compat.h>
|
|
|
|
|
AC_CHECK_HEADERS(sys/ioctl_compat.h)
|
|
|
|
|
|
|
|
|
|
dnl Check for <sgtty.h>
|
|
|
|
|
AC_CHECK_HEADERS(sgtty.h)
|
|
|
|
|
|
2024-10-17 22:15:30 +02:00
|
|
|
AC_STRUCT_DIRENT_D_TYPE
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
dnl Check for va_copy
|
|
|
|
|
AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy,
|
|
|
|
|
AC_TRY_LINK(
|
|
|
|
|
[#include <stdarg.h>],
|
|
|
|
|
[va_list ap1, ap2;
|
|
|
|
|
va_copy(ap1,ap2);
|
|
|
|
|
],
|
|
|
|
|
[ac_cv_c_va_copy="yes"],
|
|
|
|
|
[ac_cv_c_va_copy="no"])
|
|
|
|
|
)
|
|
|
|
|
if test "$ac_cv_c_va_copy" = "yes"
|
|
|
|
|
then
|
|
|
|
|
AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
|
|
|
|
|
fi
|
|
|
|
|
AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy,
|
|
|
|
|
AC_TRY_LINK(
|
|
|
|
|
[#include <stdarg.h>],
|
|
|
|
|
[va_list ap1, ap2;
|
|
|
|
|
__va_copy(ap1,ap2);
|
|
|
|
|
],
|
|
|
|
|
[ac_cv_c___va_copy="yes"],
|
|
|
|
|
[ac_cv_c___va_copy="no"])
|
|
|
|
|
)
|
|
|
|
|
if test "$ac_cv_c___va_copy" = "yes"
|
|
|
|
|
then
|
|
|
|
|
AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
|
|
|
|
|
fi
|
|
|
|
|
|
2024-10-17 11:56:15 +02:00
|
|
|
dnl Control assertions in codebase from configure
|
|
|
|
|
AC_ARG_ENABLE(assertions,
|
|
|
|
|
[ --enable-assertions build with fatal assertions enabled],
|
|
|
|
|
[],
|
|
|
|
|
[enable_assertions=no])
|
|
|
|
|
|
|
|
|
|
NDEBUG_defs="-DNDEBUG"
|
|
|
|
|
if test "x$enable_assertions" = "xyes" ; then
|
|
|
|
|
NDEBUG_defs=""
|
|
|
|
|
fi
|
|
|
|
|
|
2024-10-17 12:00:28 +02:00
|
|
|
dnl Control assertions in codebase from configure
|
|
|
|
|
AC_ARG_ENABLE(debug,
|
|
|
|
|
[ --enable-debug build with fatal debug enabled],
|
|
|
|
|
[],
|
|
|
|
|
[enable_debug=no])
|
|
|
|
|
|
|
|
|
|
DEBUG_defs=""
|
|
|
|
|
if test "x$enable_debug" = "xyes" ; then
|
|
|
|
|
DEBUG_defs="-DDEBUG"
|
|
|
|
|
fi
|
|
|
|
|
|
2022-05-12 15:27:32 +02:00
|
|
|
dnl Allow file compression (zlib) to be disabled
|
|
|
|
|
AC_ARG_ENABLE(compression,
|
|
|
|
|
[ --disable-compression disable file compression],
|
|
|
|
|
[],
|
|
|
|
|
[enable_compression=yes])
|
|
|
|
|
|
2022-05-10 15:19:39 +02:00
|
|
|
dnl Check for zlib
|
2022-05-28 23:51:20 +02:00
|
|
|
ZLIB_FLAG=""
|
2022-05-12 15:27:32 +02:00
|
|
|
if test "x$enable_compression" = "xyes" ; then
|
2022-05-28 23:51:20 +02:00
|
|
|
AC_CHECK_LIB([z],[gzopen],[
|
|
|
|
|
AC_DEFINE([HAVE_ZLIB],[1],["zlib compression"])
|
|
|
|
|
ZLIB_FLAG=" -lz"
|
2026-07-23 16:00:13 +02:00
|
|
|
])
|
2022-05-12 15:27:32 +02:00
|
|
|
fi
|
2022-05-10 15:19:39 +02:00
|
|
|
|
2026-07-23 16:00:13 +02:00
|
|
|
dnl Allow the build date to be omitted from the binary (reproducible builds).
|
|
|
|
|
dnl Substituted (not AC_DEFINE'd) so it reaches only buildinfo.o, not @DEFS@ /
|
|
|
|
|
dnl every compile command line. When disabled, defs.mak also skips computing the
|
|
|
|
|
dnl date entirely (see MAGIC_BUILDDATE_DEFS in scripts/defs.mak.in).
|
|
|
|
|
AC_ARG_ENABLE(magic-builddate,
|
|
|
|
|
[ --disable-magic-builddate omit the build date from the binary (reproducible builds)],
|
|
|
|
|
[],
|
|
|
|
|
[enable_magic_builddate=yes])
|
|
|
|
|
if test "x$enable_magic_builddate" = "xno" ; then
|
|
|
|
|
MAGIC_BUILDDATE_DEFS="-DMAGIC_NO_BUILDDATE"
|
|
|
|
|
else
|
|
|
|
|
MAGIC_BUILDDATE_DEFS=""
|
|
|
|
|
fi
|
|
|
|
|
AC_SUBST(MAGIC_BUILDDATE_DEFS)
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
dnl Check for some C99 functions
|
|
|
|
|
|
|
|
|
|
dnl Built-in round/roundf require CFLAGS -std=c99, but this also
|
|
|
|
|
dnl requires that all functions be declared explicitly! For now,
|
|
|
|
|
dnl built-in functions are disabled, with macros used instead.
|
|
|
|
|
|
|
|
|
|
dnl NOTE---Bug in the x86_64 math library; round() and roundf() are incorrect.
|
|
|
|
|
|
|
|
|
|
case $target in
|
|
|
|
|
*x86_64*) ;;
|
|
|
|
|
*)
|
|
|
|
|
AC_CACHE_CHECK([for built-in roundf], ac_cv_c_roundf,
|
|
|
|
|
AC_TRY_LINK(
|
|
|
|
|
[#include <math.h>],
|
|
|
|
|
[float f;
|
|
|
|
|
f = roundf(1.5);
|
|
|
|
|
],
|
|
|
|
|
[ac_cv_c_roundf="yes"],
|
|
|
|
|
[ac_cv_c_roundf="no"])
|
|
|
|
|
)
|
|
|
|
|
if test "$ac_cv_c_roundf" = "no"
|
|
|
|
|
then
|
|
|
|
|
# Check fo C99 function from libm
|
|
|
|
|
AC_CHECK_LIB([m],[roundf],[AC_DEFINE([HAVE_ROUNDF],[1],["c99 function"])])
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_CACHE_CHECK([for built-in round], ac_cv_c_round,
|
|
|
|
|
AC_TRY_LINK(
|
|
|
|
|
[#include <math.h>],
|
|
|
|
|
[double d;
|
|
|
|
|
d = round(1.5);
|
|
|
|
|
],
|
|
|
|
|
[ac_cv_c_round="yes"],
|
|
|
|
|
[ac_cv_c_round="no"])
|
|
|
|
|
)
|
|
|
|
|
if test "$ac_cv_c_round" = "no"
|
|
|
|
|
then
|
|
|
|
|
# Check fo C99 function from libm
|
|
|
|
|
AC_CHECK_LIB([m],[round],[AC_DEFINE([HAVE_ROUND],[1],["c99 function"])])
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
2017-10-13 16:28:07 +02:00
|
|
|
stub_defs=""
|
2017-04-25 14:41:48 +02:00
|
|
|
extra_defs="$extra_defs -DCAD_DIR=\\\"\${LIBDIR}\\\" -DBIN_DIR=\\\"\${BINDIR}\\\""
|
|
|
|
|
X_LIBS=
|
|
|
|
|
X_CFLAGS=
|
|
|
|
|
INC_SPECS=
|
build: per-file automatic dependencies (.deps), retire the Depend/sed machinery
Replace the monolithic per-directory `Depend` file -- generated by a separate,
serial `make depend` pass (one `gcc -MM` over all sources) and post-processed by
sed -- with automake-style per-file dependency fragments produced as a side
effect of each compile.
rules.mak's %.o rule now adds, when the compiler supports it,
-MMD -MP -MF .deps/<stem>.d
so every object records the (non-system) headers it used. Those fragments are
`-include`d best-effort: absent on a first build, present and correct after.
Benefits:
* self-maintaining -- no explicit depend step; deps refresh on every compile;
* parallel -- generated during the (already parallel) compile, no barrier;
* -MMD already drops system headers (what the sed did) and -MP tolerates a
removed/renamed header, so the sed post-processing is gone;
* fixes out-of-tree incremental header tracking: with an absolute srcdir the
old sed stripped the now-absolute *local* header paths too, silently losing
them; the .d files keep them.
configure probes `-MMD -MP` (AUTODEP_FLAGS; empty and best-effort-skipped if the
compiler cannot). clean/distclean remove .deps (rm -r); .gitignore replaces the
obsolete */Depend with .deps/. `make depend` is kept as a no-op for callers that
still invoke it (e.g. the WASM build script).
Verified out-of-tree (--disable-ccache): 324 .d files, 0 Depend files, a header
touch recompiles its dependents, no-op rebuild is idle, clean clears .deps. (The
top-level depend phase still runs here as a no-op; removed next.)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 16:47:29 +02:00
|
|
|
AUTODEP_FLAGS=
|
2017-04-25 14:41:48 +02:00
|
|
|
SHLIB_CFLAGS=""
|
|
|
|
|
LD_RUN_PATH=""
|
|
|
|
|
WISH_EXE=""
|
|
|
|
|
TCLSH_EXE=""
|
|
|
|
|
|
|
|
|
|
modules=""
|
|
|
|
|
unused=""
|
|
|
|
|
cadinstall=""
|
|
|
|
|
extra_libs=""
|
|
|
|
|
top_extra_libs=""
|
|
|
|
|
sub_extra_libs=""
|
2026-07-20 13:03:14 +02:00
|
|
|
ld_first_libs=""
|
2017-04-25 14:41:48 +02:00
|
|
|
ld_extra_libs=""
|
|
|
|
|
ld_extra_objs=""
|
|
|
|
|
programs=""
|
|
|
|
|
rl_defs=
|
|
|
|
|
rl_libs=
|
|
|
|
|
gr_cflags=
|
|
|
|
|
gr_dflags=
|
|
|
|
|
gr_libs=
|
|
|
|
|
gr_srcs=
|
|
|
|
|
gr_hsrcs=
|
|
|
|
|
gr_hprog=
|
|
|
|
|
|
|
|
|
|
magic_with_tcl="yes"
|
|
|
|
|
magic_with_tk="yes"
|
|
|
|
|
magic_with_tcl_includes=""
|
|
|
|
|
magic_with_tk_includes=""
|
|
|
|
|
magic_with_tcl_libraries=""
|
|
|
|
|
magic_with_tk_libraries=""
|
|
|
|
|
|
|
|
|
|
dnl We will attempt to configure with Tcl/Tk and OpenGL. However,
|
|
|
|
|
dnl if checks for the appropriate header and library files fail,
|
|
|
|
|
dnl we will revert to non-Tcl and/or non-OpenGL compilation.
|
|
|
|
|
dnl Compilation for Tcl/Tk may be explicitly prohibited by using
|
|
|
|
|
dnl --with-tcl=no or --with-interpreter=no, and OpenGL may be
|
|
|
|
|
dnl disabled with --with-opengl=no
|
|
|
|
|
|
|
|
|
|
usingOGL=1
|
|
|
|
|
usingTcl=1
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
usingTk=1
|
2017-04-25 14:41:48 +02:00
|
|
|
usingOA=0
|
2017-08-02 04:14:42 +02:00
|
|
|
usingCairo=1
|
2020-02-19 20:25:58 +01:00
|
|
|
usingPython3=1
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
dnl Check for gcore, used by niceabort.c
|
|
|
|
|
|
|
|
|
|
AC_PATH_PROG(GCORE, gcore, [no])
|
|
|
|
|
|
2026-07-22 17:02:51 +02:00
|
|
|
dnl LaTeX + dvips are optional. When both are present the default "make"
|
|
|
|
|
dnl regenerates the PostScript documentation (doc/latexfiles) from the .tex
|
|
|
|
|
dnl sources into the build tree. When either is missing, the pre-built
|
|
|
|
|
dnl PostScript shipped in the source tree is installed as-is instead.
|
|
|
|
|
AC_PATH_PROG(LATEX, latex, no)
|
|
|
|
|
AC_PATH_PROG(DVIPS, dvips, no)
|
|
|
|
|
if test "x${LATEX}" != "xno" -a "x${DVIPS}" != "xno" ; then
|
|
|
|
|
DOCS_TARGET="docs"
|
|
|
|
|
else
|
|
|
|
|
DOCS_TARGET=""
|
|
|
|
|
fi
|
|
|
|
|
AC_SUBST(LATEX)
|
|
|
|
|
AC_SUBST(DVIPS)
|
|
|
|
|
AC_SUBST(DOCS_TARGET)
|
|
|
|
|
|
2020-02-19 20:25:58 +01:00
|
|
|
dnl Python3 is preferred for running the preprocessor script
|
|
|
|
|
dnl but CPP can be used instead.
|
|
|
|
|
AC_PATH_PROG([PYTHON3], [python3], [no])
|
2022-03-29 22:52:01 +02:00
|
|
|
if test "x${PYTHON3}" == "xno"; then
|
2020-02-19 20:25:58 +01:00
|
|
|
|
|
|
|
|
dnl check size of pointer for correct behavior on 64-bit systems
|
|
|
|
|
dnl If the C preprocessor is GCC, we need to force the flag to
|
|
|
|
|
dnl assert that input files are of type C, or else the preprocessing
|
|
|
|
|
dnl stage will not execute correctly on the ".in" files in the scmos
|
|
|
|
|
dnl directory.
|
|
|
|
|
|
|
|
|
|
usingPython3=
|
|
|
|
|
if test "$CPP" = "$CC -E" ; then
|
|
|
|
|
MCPP="$CPP -x c"
|
2022-04-11 10:00:09 +02:00
|
|
|
MSED="sed -e 's/\\\\/\\\\\\\\/'"
|
2020-02-19 20:25:58 +01:00
|
|
|
else
|
|
|
|
|
MCPP="$CPP"
|
2022-04-11 10:00:09 +02:00
|
|
|
MSED="sed -e 's/\\\\/\\\\\\\\/'"
|
2020-02-19 20:25:58 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
else
|
build: out-of-tree outlier Makefiles — full make + install
Fix the remaining non-standard Makefiles so a full out-of-tree
`../configure && make && make install` builds and installs a complete
magic TCL tree, sources read from the source tree, all outputs in the
build tree.
Shared linker/preprocessor paths (scripts/configure.in, regenerated
scripts/configure):
* --version-script=${MAGICDIR}/magic/symbol.map -> ${MAGICSRC}/... so
every shared-library link (tclmagic.so, ...) finds the source map.
* MCPP preproc.py path ${MAGICDIR}/scripts -> ${MAGICSRC}/scripts.
Programs (built via tcllibrary, PROGRAMS = magic tcltk):
* magic/Makefile: proto.magicrc, magicWasm.o and the bitmaps/.initrc/
magicps.pro install copies use $< / $(srcdir) instead of bare names.
* tcltk/Makefile: magicexec/magicdnull compile $<; the sed'd launcher
scripts (magic.tcl/.sh, ext2spice.sh, ext2sim.sh) read $<; VERSION dep
-> ${MAGICSRC}; install-tcl copies each TCL file from the build dir if
present else $(srcdir) (magic.tcl is generated, the rest are source).
Techs (scmos):
* scmos/Makefile: SC_PP template include -> $(srcdir)/extract_template;
tech-file inputs (scmos.tech.in, *.tech.in) via $(srcdir)/$< ; recurse
into cif_template with mkdir + -f ${MAGICSRC}/scmos/cif_template/Makefile;
install copies from build-or-$(srcdir).
* scmos/cif_template/Makefile: MKDIR -> ${MAGICSRC}/scripts/mkdirs;
SC_CPP gains -I$(srcdir); cpp reads $(srcdir)/cif{in,out}.c so the .gen
includes resolve; objs/ generated in the build tree.
Data-file installs (source files copied from $(srcdir)):
* graphics/Makefile: glyphs, outline fonts, and the X11 helper build.
* windows/Makefile: glyphs and vector fonts.
* doc/Makefile: recurse into man/tutcells/html/latexfiles build-aware;
doc/man, doc/tutcells install with $< ; doc/html tars $(srcdir);
doc/latexfiles reads pre-built PostScript from ${MAGICSRC}/doc/psfiles.
Verified out-of-tree (mkdir _build; cd _build; ../configure): `make`
returns rc=0 (33 module libs, tclmagic.so, magicexec/magicdnull, scmos
tech files + cif_template objs, proto.magicrc), and
`make install DESTDIR=...` returns rc=0 installing 376 files
(bin/magic, tcl/tclmagic.so, sys/ glyphs+fonts+techs+dstyles), with the
source tree left completely clean.
Not exercised by the default TCL build/install and therefore not
converted here: the standalone .so/program variants of
lef/plot/router/ext2spice/ext2sim (their module libs do build), the
disabled oa module (-I. -> -I$(srcdir) still needed if enabled), the
WASM path, and doc/latexfiles PostScript *regeneration* (which still
writes into the source psfiles dir).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:59:44 +02:00
|
|
|
MCPP="${PYTHON3} \${MAGICSRC}/scripts/preproc.py -ccomm"
|
2020-02-19 20:25:58 +01:00
|
|
|
MSED="cat"
|
|
|
|
|
usingPython3=1
|
|
|
|
|
fi
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
dnl Check for X enabled/disabled
|
|
|
|
|
|
|
|
|
|
AC_PATH_XTRA
|
|
|
|
|
|
2022-03-17 08:23:56 +01:00
|
|
|
if test "x$no_x" = "x"; then
|
2017-04-25 14:41:48 +02:00
|
|
|
usingX11=1
|
|
|
|
|
else
|
2022-03-30 16:55:08 +02:00
|
|
|
echo Unable to find X11 or X11 disabled---compiling without graphics.
|
2017-04-25 14:41:48 +02:00
|
|
|
echo Graphics options will be NULL only!
|
|
|
|
|
if test $usingOGL ; then
|
|
|
|
|
echo "Cannot use OpenGL/GLX without X11, disabling."
|
|
|
|
|
usingOGL=
|
|
|
|
|
fi
|
2017-08-02 04:14:42 +02:00
|
|
|
if test $usingCairo ; then
|
|
|
|
|
echo "Cannot use Cairo without X11, disabling."
|
|
|
|
|
usingCairo=
|
|
|
|
|
fi
|
2022-03-30 16:55:08 +02:00
|
|
|
# if test $usingTcl ; then
|
|
|
|
|
# echo "Cannot compile TCL version without X11, disabling."
|
|
|
|
|
# usingTcl=
|
|
|
|
|
# fi
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
|
2020-01-28 16:40:01 +01:00
|
|
|
# For distributed installs, where the run-time files are installed in a
|
|
|
|
|
# place that is a temporary staging area, like DESTDIR, but unlike DESTDIR,
|
|
|
|
|
# the prefix is replaced by the destination directory, rather than appended
|
|
|
|
|
# to it.
|
2020-01-28 18:29:44 +01:00
|
|
|
DIST_DIR="\${exec_prefix}"
|
2020-01-28 16:40:01 +01:00
|
|
|
AC_ARG_WITH(distdir,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --with-distdir=DIR install into location DIR for distribution], [
|
2020-01-28 16:40:01 +01:00
|
|
|
if test "$withval" = "no" -o "$withval" = "NO" ; then
|
2020-01-28 18:29:44 +01:00
|
|
|
DIST_DIR="\${exec_prefix}"
|
2020-01-28 16:40:01 +01:00
|
|
|
else
|
2020-01-28 18:29:44 +01:00
|
|
|
DIST_DIR=${withval}
|
2020-01-28 16:40:01 +01:00
|
|
|
fi
|
|
|
|
|
], )
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
# Check for libXi, which is required on some systems but not available on
|
|
|
|
|
# others.
|
|
|
|
|
use_libxi=""
|
|
|
|
|
use_libxmu=""
|
|
|
|
|
use_libxext=""
|
|
|
|
|
AC_CHECK_LIB([Xi], [XOpenDevice], use_libxi="-lXi")
|
|
|
|
|
AC_CHECK_LIB([Xmu], [XmuInternAtom], use_libxmu="-lXmu")
|
|
|
|
|
AC_CHECK_LIB([Xext], [XextFindDisplay], use_libxext="-lXext")
|
|
|
|
|
|
|
|
|
|
AC_ARG_WITH(interpreter,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --with-interpreter=[arg] enable interpreter (tcl, scheme, or no)], [
|
2017-04-25 14:41:48 +02:00
|
|
|
if test "$withval" = "no" -o "$withval" = "NO"; then
|
|
|
|
|
usingTcl=
|
|
|
|
|
elif test "$withval" = "scheme" -o "$withval" = "SCHEME"; then
|
|
|
|
|
usingScheme=1
|
|
|
|
|
usingTcl=
|
|
|
|
|
elif test "$withval" != "tcl" -a "$withval" != "TCL"; then
|
|
|
|
|
echo "Unknown option to --with-interpreter: Must be scheme, tcl, or no."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
], )
|
|
|
|
|
|
|
|
|
|
AC_ARG_WITH(tcl,
|
|
|
|
|
[ --with-tcl=DIR Find tclConfig.sh in DIR], [
|
|
|
|
|
magic_with_tcl=$withval
|
|
|
|
|
if test "$withval" = "no" -o "$withval" = "NO"; then
|
|
|
|
|
usingTcl=
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
usingTk=
|
2017-04-25 14:41:48 +02:00
|
|
|
elif test $usingScheme ; then
|
|
|
|
|
echo Attempt to enable both Tcl and Scheme interpreters.
|
|
|
|
|
echo Disabling Tcl, and using Scheme instead.
|
|
|
|
|
usingTcl=
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
usingTk=
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
], )
|
|
|
|
|
|
|
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
dnl Do our best to find Tcl/Tk. If we can't, then flag a warning
|
|
|
|
|
dnl and don't set the usingTcl variable.
|
|
|
|
|
dnl
|
|
|
|
|
dnl This has been broken up into a number of sections, each of which
|
|
|
|
|
dnl depends independently on the setting of usingTcl.
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
dnl
|
|
|
|
|
dnl `usingTk` is independent of `usingTcl`: --without-tk enables
|
|
|
|
|
dnl Tcl-only embedding (used by the WASM build, which has no display
|
|
|
|
|
dnl server and cannot run Tk).
|
2017-04-25 14:41:48 +02:00
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
AC_ARG_WITH(tk, [ --with-tk=DIR Find tkConfig.sh in DIR],
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
magic_with_tk=$withval
|
|
|
|
|
if test "$withval" = "no" -o "$withval" = "NO"; then
|
|
|
|
|
usingTk=
|
|
|
|
|
fi)
|
2017-04-25 14:41:48 +02:00
|
|
|
AC_ARG_WITH(tclincls, [ --with-tclincls=DIR Find tcl.h in DIR],
|
|
|
|
|
magic_with_tcl_includes=$withval)
|
|
|
|
|
AC_ARG_WITH(tkincls, [ --with-tkincls=DIR Find tk.h in DIR],
|
|
|
|
|
magic_with_tk_includes=$withval)
|
|
|
|
|
AC_ARG_WITH(tcllibs, [ --with-tcllibs=DIR Find Tcl library in DIR],
|
|
|
|
|
magic_with_tcl_libraries=$withval)
|
|
|
|
|
AC_ARG_WITH(tklibs, [ --with-tklibs=DIR Find Tk library in DIR],
|
|
|
|
|
magic_with_tk_libraries=$withval)
|
2020-10-05 08:47:31 +02:00
|
|
|
AC_ARG_WITH(wish, [ --with-wish=EXE Use wish binary at EXE],
|
|
|
|
|
magic_with_wish_binary=$withval)
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
# Find the Tcl build configuration file "tclConfig.sh"
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
if test $usingTcl ; then
|
|
|
|
|
TCL_INC_DIR="."
|
|
|
|
|
TK_INC_DIR="."
|
|
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for tclConfig.sh])
|
|
|
|
|
tcl_config_sh=""
|
|
|
|
|
|
|
|
|
|
if test "$magic_with_tcl" = "no" ; then
|
|
|
|
|
magic_with_tcl=""
|
|
|
|
|
elif test "$magic_with_tcl" != "yes" ; then
|
|
|
|
|
#
|
|
|
|
|
# Verify that a tclConfig.sh file exists in the directory specified
|
|
|
|
|
# by --with-tcl.
|
|
|
|
|
#
|
|
|
|
|
for dir in \
|
|
|
|
|
$magic_with_tcl
|
|
|
|
|
do
|
|
|
|
|
if test -r "$dir/tclConfig.sh" ; then
|
|
|
|
|
tcl_config_sh="$dir/tclConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
elif test -r "$dir/lib/tclConfig.sh" ; then
|
|
|
|
|
tcl_config_sh="$dir/lib/tclConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
elif test -r "$dir/unix/tclConfig.sh" ; then
|
|
|
|
|
tcl_config_sh="$dir/unix/tclConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
else
|
|
|
|
|
#
|
|
|
|
|
# Otherwise, search for Tcl configuration file.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# 1. Search previously named locations.
|
|
|
|
|
|
|
|
|
|
for dir in \
|
|
|
|
|
$prefix \
|
|
|
|
|
$exec_prefix
|
|
|
|
|
do
|
|
|
|
|
if test -r "$dir/tclConfig.sh" ; then
|
|
|
|
|
tcl_config_sh="$dir/tclConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
elif test -r "$dir/lib/tclConfig.sh" ; then
|
|
|
|
|
tcl_config_sh="$dir/lib/tclConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
elif test -r "$dir/unix/tclConfig.sh" ; then
|
|
|
|
|
tcl_config_sh="$dir/unix/tclConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# 2. Search standard locations.
|
|
|
|
|
# (1/25/05---/usr/lib added for Ubuntu Linux)
|
|
|
|
|
# (6/19/06---/usr/lib64 added for 64-bit architectures
|
|
|
|
|
|
|
|
|
|
if test "x$tcl_config_sh" = "x" ; then
|
|
|
|
|
for dir in \
|
|
|
|
|
`ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
|
|
|
|
|
/usr/local/tcl \
|
|
|
|
|
/usr/local/lib \
|
|
|
|
|
/usr/lib64 \
|
|
|
|
|
/usr/local \
|
|
|
|
|
`ls -dr /usr/lib/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
|
|
|
|
|
/sw/lib \
|
|
|
|
|
/usr
|
|
|
|
|
do
|
|
|
|
|
if test -r "$dir/tclConfig.sh" ; then
|
|
|
|
|
tcl_config_sh="$dir/tclConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
elif test -r "$dir/lib/tclConfig.sh" ; then
|
|
|
|
|
tcl_config_sh="$dir/lib/tclConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_MSG_RESULT([${tcl_config_sh}])
|
|
|
|
|
|
|
|
|
|
if test "x$tcl_config_sh" = "x" ; then
|
|
|
|
|
echo "Can't find Tcl configuration script \"tclConfig.sh\""
|
|
|
|
|
echo "Reverting to non-Tcl compilation"
|
|
|
|
|
usingTcl=
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
# Find the Tk build configuration file "tkConfig.sh"
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
if test $usingTk ; then
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for tkConfig.sh])
|
|
|
|
|
tk_config_sh=""
|
|
|
|
|
if test "$magic_with_tk" != "yes"; then
|
|
|
|
|
#
|
|
|
|
|
# Verify that a tkConfig.sh file exists in the directory specified
|
|
|
|
|
# by --with-tcl or --with-tk.
|
|
|
|
|
#
|
|
|
|
|
for dir in \
|
|
|
|
|
$magic_with_tk \
|
|
|
|
|
$magic_with_tcl
|
|
|
|
|
do
|
|
|
|
|
if test -r "$dir/tkConfig.sh" ; then
|
|
|
|
|
tk_config_sh="$dir/tkConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
elif test -r "$dir/lib/tkConfig.sh" ; then
|
|
|
|
|
tk_config_sh="$dir/lib/tkConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
elif test -r "$dir/unix/tkConfig.sh" ; then
|
|
|
|
|
tk_config_sh="$dir/unix/tkConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
else
|
|
|
|
|
#
|
|
|
|
|
# Search for Tk configuration file.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# 1. Search previously named locations.
|
|
|
|
|
#
|
|
|
|
|
for dir in \
|
|
|
|
|
$prefix \
|
|
|
|
|
$exec_prefix
|
|
|
|
|
do
|
|
|
|
|
if test -r "$dir/tkConfig.sh" ; then
|
|
|
|
|
tk_config_sh="$dir/tkConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
elif test -r "$dir/lib/tkConfig.sh" ; then
|
|
|
|
|
tk_config_sh="$dir/lib/tkConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
elif test -r "$dir/unix/tkConfig.sh" ; then
|
|
|
|
|
tk_config_sh="$dir/unix/tkConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
#
|
|
|
|
|
# 2. Search standard locations.
|
|
|
|
|
#
|
|
|
|
|
if test "x$tk_config_sh" = "x" ; then
|
|
|
|
|
for dir in \
|
|
|
|
|
`ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
|
|
|
|
|
`ls -dr /usr/local/tk/tk[[7-9]].[[0-9]]* 2>/dev/null` \
|
|
|
|
|
/usr/local/tcl \
|
|
|
|
|
/usr/local/lib \
|
|
|
|
|
/usr/lib64 \
|
|
|
|
|
/usr/local \
|
|
|
|
|
`ls -dr /usr/lib/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
|
|
|
|
|
`ls -dr /usr/lib/tk[[7-9]].[[0-9]]* 2>/dev/null` \
|
|
|
|
|
/sw/lib \
|
|
|
|
|
${x_libraries} \
|
|
|
|
|
/usr
|
|
|
|
|
do
|
|
|
|
|
if test -r "$dir/tkConfig.sh" ; then
|
|
|
|
|
tk_config_sh="$dir/tkConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
elif test -r "$dir/lib/tkConfig.sh" ; then
|
|
|
|
|
tk_config_sh="$dir/lib/tkConfig.sh"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
AC_MSG_RESULT([${tk_config_sh}])
|
|
|
|
|
|
|
|
|
|
if test "x$tk_config_sh" = "x" ; then
|
|
|
|
|
echo "can't find Tk configuration script \"tkConfig.sh\""
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
echo "Reverting to non-Tk compilation"
|
|
|
|
|
usingTk=
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
# Source in the Tcl/Tk configuration scripts.
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
if test $usingTcl ; then
|
|
|
|
|
. $tcl_config_sh
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
if test $usingTk ; then
|
|
|
|
|
. $tk_config_sh
|
|
|
|
|
fi
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
# Should probably trust the config file contents, but this configure
|
|
|
|
|
# file checks the Tcl and Tk include and lib directories. Since
|
|
|
|
|
# the config file doesn't separate out the libraries from the strings
|
|
|
|
|
# passed to the compiler/linker, do it manually here.
|
|
|
|
|
#
|
|
|
|
|
# Extract TCL_LIB_DIR from TCL_LIB_SPEC
|
|
|
|
|
# Extract TK_LIB_DIR from TK_LIB_SPEC
|
|
|
|
|
# Extract TCL_INC_DIR from TCL_INCLUDE_SPEC
|
|
|
|
|
# Extract TK_INC_DIR from TK_INCLUDE_SPEC
|
|
|
|
|
#
|
|
|
|
|
# These will be the defaults unless overridden by configure command line
|
|
|
|
|
|
|
|
|
|
tmpstr=${TCL_LIB_SPEC#*-L}
|
|
|
|
|
TCL_LIB_DIR=${tmpstr% -l*}
|
|
|
|
|
TCL_INC_DIR=${TCL_INCLUDE_SPEC#*-I}
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
if test $usingTk ; then
|
|
|
|
|
tmpstr=${TK_LIB_SPEC#*-L}
|
|
|
|
|
TK_LIB_DIR=${tmpstr% -l*}
|
|
|
|
|
TK_INC_DIR=${TK_INCLUDE_SPEC#*-I}
|
|
|
|
|
|
|
|
|
|
if test "$TCL_VERSION" = "7.6" -a "$TK_VERSION" = "4.2" ; then
|
|
|
|
|
:
|
|
|
|
|
elif test "$TCL_VERSION" = "7.5" -a "$TK_VERSION" = "4.1" ; then
|
|
|
|
|
:
|
|
|
|
|
elif test "$TCL_VERSION" = "$TK_VERSION" ; then
|
|
|
|
|
:
|
|
|
|
|
else
|
|
|
|
|
echo "Mismatched Tcl/Tk versions ($TCL_VERSION != $TK_VERSION)"
|
|
|
|
|
echo "Reverting to non-Tcl compile"
|
|
|
|
|
usingTcl=
|
|
|
|
|
usingTk=
|
|
|
|
|
fi
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test $usingTcl ; then
|
|
|
|
|
if test "x${magic_with_tcl_includes}" != "x" ; then
|
|
|
|
|
if test -r "${magic_with_tcl_includes}/tcl.h" ; then
|
|
|
|
|
TCL_INC_DIR=${magic_with_tcl_includes}
|
|
|
|
|
else
|
|
|
|
|
echo "Can't find tcl.h in \"${magic_with_tcl_includes}\""
|
|
|
|
|
echo "Reverting to non-Tcl compile"
|
|
|
|
|
usingTcl=
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
for dir in \
|
|
|
|
|
${TCL_PREFIX}/include/tcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION} \
|
|
|
|
|
${TCL_PREFIX}/include \
|
|
|
|
|
${TCL_SRC_DIR}/generic \
|
|
|
|
|
${TCL_INC_DIR}
|
|
|
|
|
do
|
|
|
|
|
if test -r "$dir/tcl.h" ; then
|
|
|
|
|
TCL_INC_DIR=$dir
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
if test "x${TCL_INC_DIR}" = "x" ; then
|
|
|
|
|
echo "Can't find tcl.h header file"
|
|
|
|
|
echo "Reverting to non-Tcl compile"
|
|
|
|
|
usingTcl=
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
if test $usingTk ; then
|
2017-04-25 14:41:48 +02:00
|
|
|
if test "x${magic_with_tk_includes}" != "x" ; then
|
|
|
|
|
if test -r "${magic_with_tk_includes}/tk.h" ; then
|
|
|
|
|
TK_INC_DIR=${magic_with_tk_includes}
|
|
|
|
|
else
|
|
|
|
|
echo "Can't find tk.h in \"${magic_with_tk_includes}\""
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
echo "Reverting to non-Tk compile"
|
|
|
|
|
usingTk=
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
for dir in \
|
|
|
|
|
${TK_PREFIX}/include/tk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION} \
|
|
|
|
|
${TK_PREFIX}/include \
|
|
|
|
|
${TK_SRC_DIR}/generic \
|
|
|
|
|
${TK_INC_DIR} \
|
|
|
|
|
${TCL_INC_DIR}
|
|
|
|
|
do
|
|
|
|
|
if test -r "$dir/tk.h" ; then
|
|
|
|
|
TK_INC_DIR=$dir
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
if test "x${TK_INC_DIR}" = "x" ; then
|
|
|
|
|
echo "Can't find tk.h header file"
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
echo "Reverting to non-Tk compile"
|
|
|
|
|
usingTk=
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# FIXME -- why are we not using TCL_LIB_FILE FROM tclConfig.sh?
|
|
|
|
|
if test $usingTcl ; then
|
|
|
|
|
case $target in
|
|
|
|
|
*-sunos4*|*-*-netbsd*|NetBSD-*|FreeBSD-*|OpenBSD-*)
|
|
|
|
|
TCL_LIB_NAME="tcl${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}"
|
|
|
|
|
TK_LIB_NAME="tk${TK_MAJOR_VERSION}${TK_MINOR_VERSION}"
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
TCL_LIB_NAME="tcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}"
|
|
|
|
|
TK_LIB_NAME="tk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
loclib=`echo ${TCL_LIB_SPEC} | sed -e 's/.*-L//' -e 's/ .*//'`
|
|
|
|
|
|
|
|
|
|
if test "x${TCL_LIB_SPEC}" = "x" ; then
|
|
|
|
|
TCL_LIB_SPEC="-l${TCL_LIB_NAME}"
|
|
|
|
|
fi
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
if test $usingTk -a "x${TK_LIB_SPEC}" = "x" ; then
|
2017-04-25 14:41:48 +02:00
|
|
|
TK_LIB_SPEC="-l${TK_LIB_NAME}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Find the version of "wish" that corresponds to TCL_EXEC_PREFIX
|
|
|
|
|
# We really ought to run "ldd" to confirm that the linked libraries match.
|
|
|
|
|
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
if test $usingTk -a "x${magic_with_wish_binary}" = "x" ; then
|
2020-10-05 08:47:31 +02:00
|
|
|
AC_MSG_CHECKING([for wish executable])
|
|
|
|
|
for dir in \
|
|
|
|
|
${TK_EXEC_PREFIX}/bin \
|
|
|
|
|
${TK_EXEC_PREFIX}
|
2017-04-25 14:41:48 +02:00
|
|
|
do
|
2020-10-05 08:47:31 +02:00
|
|
|
for wishexe in \
|
|
|
|
|
wish-X11 \
|
|
|
|
|
wish \
|
|
|
|
|
wish${TK_VERSION} \
|
|
|
|
|
wish.exe \
|
|
|
|
|
wish${TK_VERSION}.exe
|
|
|
|
|
do
|
|
|
|
|
if test -r "$dir/$wishexe" ; then
|
|
|
|
|
WISH_EXE=$dir/$wishexe
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
if test "x${WISH_EXE}" != "x" ; then
|
2017-04-25 14:41:48 +02:00
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
2020-10-05 08:47:31 +02:00
|
|
|
if test "x${WISH_EXE}" = "x" ; then
|
|
|
|
|
echo "Warning: Can't find executable for \"wish\". You may have to"
|
|
|
|
|
echo "manually set the value for WISH_EXE in the magic startup script."
|
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
|
else
|
|
|
|
|
AC_MSG_RESULT([${WISH_EXE}])
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
elif test $usingTk ; then
|
2020-10-05 08:47:31 +02:00
|
|
|
WISH_EXE=${magic_with_wish_binary}
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Find the version of "tclsh" that corresponds to TCL_EXEC_PREFIX
|
|
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for tclsh executable])
|
|
|
|
|
for dir in \
|
|
|
|
|
${TK_EXEC_PREFIX}/bin \
|
|
|
|
|
${TK_EXEC_PREFIX}
|
|
|
|
|
do
|
|
|
|
|
for tclshexe in \
|
|
|
|
|
tclsh \
|
|
|
|
|
tclsh${TK_VERSION} \
|
|
|
|
|
tclsh.exe \
|
|
|
|
|
tclsh${TK_VERSION}.exe
|
|
|
|
|
do
|
|
|
|
|
if test -r "$dir/$tclshexe" ; then
|
|
|
|
|
TCLSH_EXE=$dir/$tclshexe
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
if test "x${TCLSH_EXE}" != "x" ; then
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
if test "x${TCLSH_EXE}" = "x" ; then
|
|
|
|
|
echo "Warning: Can't find executable for \"tclsh\"."
|
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
|
else
|
|
|
|
|
AC_MSG_RESULT([${TCLSH_EXE}])
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Have to define SHDLIB_EXT here even though we have to do it below, too.
|
|
|
|
|
case $target in
|
|
|
|
|
*-hpux*)
|
|
|
|
|
SHDLIB_EXT=".sl"
|
|
|
|
|
SHDLIB_EXT_ALT=".sl"
|
|
|
|
|
;;
|
|
|
|
|
*cygwin*)
|
|
|
|
|
SHDLIB_EXT=".dll"
|
|
|
|
|
SHDLIB_EXT_ALT=".dll.a"
|
|
|
|
|
;;
|
|
|
|
|
*darwin*)
|
|
|
|
|
SHDLIB_EXT=".dylib"
|
|
|
|
|
SHDLIB_EXT_ALT=".dylib"
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
SHDLIB_EXT=".so"
|
|
|
|
|
SHDLIB_EXT_ALT=".so"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
if test "x${magic_with_tcl_libraries}" != "x" ; then
|
|
|
|
|
for libname in \
|
|
|
|
|
"${magic_with_tcl_libraries}/${TCL_LIB_FILE}" \
|
2017-10-13 16:28:07 +02:00
|
|
|
"${magic_with_tcl_libraries}/lib${TCL_LIB_FILE}" \
|
2017-04-25 14:41:48 +02:00
|
|
|
"${magic_with_tcl_libraries}/lib${TCL_LIB_NAME}${SHDLIB_EXT}" \
|
|
|
|
|
"${magic_with_tcl_libraries}/lib${TCL_LIB_NAME}${SHDLIB_EXT_ALT}"
|
|
|
|
|
do
|
|
|
|
|
if test -r "$libname" ; then
|
|
|
|
|
TCL_LIB_DIR="${magic_with_tcl_libraries}"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if test "x${TCL_LIB_DIR}" = "x" ; then
|
|
|
|
|
echo "Can't find tcl library in \"${magic_with_tcl_libraries}\""
|
|
|
|
|
echo "Reverting to non-Tcl compile"
|
|
|
|
|
usingTcl=
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
for libname in \
|
|
|
|
|
"${loclib:=${TCL_EXEC_PREFIX}/lib}/lib${TCL_LIB_NAME}${SHDLIB_EXT}" \
|
2017-10-13 16:28:07 +02:00
|
|
|
"${loclib:=${TCL_EXEC_PREFIX}/lib}/lib${TCL_LIB_NAME}${SHDLIB_EXT_ALT}" \
|
|
|
|
|
"${loclib:=${TCL_EXEC_PREFIX}/lib64}/lib${TCL_LIB_NAME}${SHDLIB_EXT}"
|
2017-04-25 14:41:48 +02:00
|
|
|
do
|
|
|
|
|
if test -r "$libname" ; then
|
|
|
|
|
TCL_LIB_DIR="${TCL_EXEC_PREFIX}/lib"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
if test "x${TCL_LIB_DIR}" = "x" ; then
|
|
|
|
|
echo "Can't find tcl library"
|
|
|
|
|
echo "Reverting to non-Tcl compile"
|
|
|
|
|
usingTcl=
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
if test $usingTk ; then
|
2017-04-25 14:41:48 +02:00
|
|
|
if test "x${magic_with_tk_libraries}" != "x" ; then
|
|
|
|
|
for libname in \
|
|
|
|
|
"${magic_with_tk_libraries}/${TCL_LIB_FILE}" \
|
2017-10-13 16:28:07 +02:00
|
|
|
"${magic_with_tk_libraries}/lib${TCL_LIB_FILE}" \
|
2017-04-25 14:41:48 +02:00
|
|
|
"${magic_with_tk_libraries}/lib${TK_LIB_NAME}${SHDLIB_EXT}" \
|
|
|
|
|
"${magic_with_tk_libraries}/lib${TK_LIB_NAME}${SHDLIB_EXT_ALT}"
|
|
|
|
|
do
|
|
|
|
|
if test -r "$libname" ; then
|
|
|
|
|
TK_LIB_DIR="${magic_with_tk_libraries}"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
if test "x${TK_LIB_DIR}" = "x" ; then
|
|
|
|
|
echo "Can't find tk library in \"${magic_with_tk_libraries}\""
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
echo "Reverting to non-Tk compile"
|
|
|
|
|
usingTk=
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
for libname in \
|
|
|
|
|
"${loclib:=${TK_EXEC_PREFIX}/lib}/lib${TK_LIB_NAME}${SHDLIB_EXT}" \
|
2017-10-13 16:28:07 +02:00
|
|
|
"${loclib:=${TK_EXEC_PREFIX}/lib}/lib${TK_LIB_NAME}${SHDLIB_EXT_ALT}" \
|
|
|
|
|
"${loclib:=${TK_EXEC_PREFIX}/lib64}/lib${TK_LIB_NAME}${SHDLIB_EXT}"
|
2017-04-25 14:41:48 +02:00
|
|
|
do
|
|
|
|
|
if test -r "$libname" ; then
|
|
|
|
|
TK_LIB_DIR="${TK_EXEC_PREFIX}/lib"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
if test "x${TK_LIB_DIR}" = "x" ; then
|
|
|
|
|
echo "Can't find tk library"
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
echo "Reverting to non-Tk compile"
|
|
|
|
|
usingTk=
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
dnl ----------------------------------------------------
|
|
|
|
|
dnl End of Tcl/Tk search
|
|
|
|
|
dnl ----------------------------------------------------
|
|
|
|
|
|
|
|
|
|
dnl OpenAccess database support.
|
|
|
|
|
dnl There should be some checks here to confirm that the libraries
|
|
|
|
|
dnl are there, and usable.
|
|
|
|
|
|
|
|
|
|
dnl There is no default search path here. Is there a default
|
|
|
|
|
dnl installation location for the OpenAccess libraries and include
|
|
|
|
|
dnl files?
|
|
|
|
|
|
|
|
|
|
AC_ARG_WITH(openaccess,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --with-openaccess=DIR use OpenAccess libraries in DIR], [
|
2017-04-25 14:41:48 +02:00
|
|
|
if test "$withval" = "no" -o "$withval" = "NO" ; then
|
|
|
|
|
OA=
|
|
|
|
|
OA_LIBS=
|
|
|
|
|
unused="$unused oa"
|
|
|
|
|
elif test "$withval" = "yes"; then
|
|
|
|
|
AC_MSG_ERROR([path to OpenAccess libraries is required])
|
|
|
|
|
OA=
|
|
|
|
|
OA_LIBS=
|
|
|
|
|
unused="$unused oa"
|
|
|
|
|
else
|
|
|
|
|
usingOA=1
|
|
|
|
|
OA=${withval}
|
|
|
|
|
OA_LIBS="-L\${OA}/lib -loaDB -loaDD -loaTC -loaBase"
|
|
|
|
|
OA_LIBS="${OA_LIBS} -lclalite_sh -lcls_sh -lcdsCommon_sh"
|
|
|
|
|
AC_DEFINE(OPENACCESS)
|
|
|
|
|
LD_RUN_PATH="-Wl,-rpath=\${OA}/lib"
|
|
|
|
|
modules="$modules oa"
|
|
|
|
|
extra_libs="$extra_libs \${MAGICDIR}/oa/liboa.o"
|
|
|
|
|
fi
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(memdebug,
|
|
|
|
|
[ --enable-memdebug enable memory debugging],
|
|
|
|
|
[],
|
|
|
|
|
[enable_memdebug=no])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_memdebug" = "xyes" ; then
|
|
|
|
|
if test "x$magic_with_tcl" = "x" ; then
|
|
|
|
|
LIBS="${LIBS} -lefence"
|
|
|
|
|
else
|
|
|
|
|
AC_DEFINE(TCL_MEM_DEBUG)
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(modular,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --enable-modular embed ext2sim and ext2spice packages],
|
2017-04-25 14:41:48 +02:00
|
|
|
[],
|
|
|
|
|
[enable_modular=no])
|
|
|
|
|
|
2022-02-08 22:12:07 +01:00
|
|
|
if test "x$enable_modular" = "xyes" ; then
|
2017-04-25 14:41:48 +02:00
|
|
|
AC_DEFINE(EXT2SPICE_AUTO)
|
|
|
|
|
AC_DEFINE(EXT2SIM_AUTO)
|
2022-02-08 22:12:07 +01:00
|
|
|
else
|
|
|
|
|
modules="$modules ext2sim ext2spice"
|
|
|
|
|
extra_libs="$extra_libs \${MAGICDIR}/ext2sim/libext2sim.o"
|
|
|
|
|
extra_libs="$extra_libs \${MAGICDIR}/ext2spice/libext2spice.o"
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(locking,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --disable-locking disable file locking],
|
2017-04-25 14:41:48 +02:00
|
|
|
[],
|
|
|
|
|
[enable_locking=yes])
|
|
|
|
|
|
Played around with the file locking and discovered to my chagrin that
whenever a process writes a cell to disk, it immediately releases the
file lock it had on that cell, which is clearly not the intent of file
locking. Fixed this issue. On a related topic, revised the "cellname
writeable" command so that it can make a cell editable even if the cell
has an advisory lock and cannot be made writeable. Perhaps there should
be a clearer distinction here between "writeable" and "editable". Also:
Reconsidered the previous commit, which removed the "--disable-locking"
from the configuration options. Because some operating systems may not
implement fnctl()-based file locking (Cygwin, for one, apparently doesn't),
it is still useful to be able to completely remove the function, in case
the operating system will fail to recognize the fnctl() values in the
code. Now, file locking behavior can be permanently removed through the
configuration option, or temporarily disabled from the command line.
2022-01-01 22:53:46 +01:00
|
|
|
if test "x$enable_locking" = "xyes" ; then
|
|
|
|
|
case $target in
|
|
|
|
|
*cygwin*)
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
AC_DEFINE(FILE_LOCKS)
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(calma,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --disable-calma disable calma package],
|
2017-04-25 14:41:48 +02:00
|
|
|
[],
|
|
|
|
|
[enable_calma=yes])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_calma" = "xyes" ; then
|
|
|
|
|
AC_DEFINE(CALMA_MODULE)
|
|
|
|
|
modules="$modules calma"
|
|
|
|
|
extra_libs="$extra_libs \${MAGICDIR}/calma/libcalma.o"
|
|
|
|
|
else
|
|
|
|
|
unused="$unused calma"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(cif,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --disable-cif disable cif package],
|
2017-04-25 14:41:48 +02:00
|
|
|
[],
|
|
|
|
|
[enable_cif=yes])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_cif" = "xyes" ; then
|
|
|
|
|
AC_DEFINE(CIF_MODULE)
|
|
|
|
|
modules="$modules cif"
|
|
|
|
|
extra_libs="$extra_libs \${MAGICDIR}/cif/libcif.o"
|
|
|
|
|
else
|
|
|
|
|
unused="$unused cif"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(client-render,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --disable-client-render disable OpenGL client-side rendering],
|
2017-04-25 14:41:48 +02:00
|
|
|
[],
|
|
|
|
|
[enable_client_render=yes])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_client_render" = "xno" ; then
|
|
|
|
|
AC_DEFINE(OGL_SERVER_SIDE_ONLY)
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(invert-y,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --enable-invert-y invert screen top to bottom in OpenGL],
|
2017-04-25 14:41:48 +02:00
|
|
|
[],
|
|
|
|
|
[enable_invert_y=no])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_invert_y" = "xyes" ; then
|
|
|
|
|
AC_DEFINE(OGL_INVERT_Y)
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(framebuffer-backing-store,
|
2017-10-04 20:53:01 +02:00
|
|
|
[ --disable-framebuffer-backing-store disable OpenGL framebuffer backing store],
|
2017-04-25 14:41:48 +02:00
|
|
|
[],
|
2017-10-04 20:53:01 +02:00
|
|
|
[enable_framebuffer_backing_store=yes])
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
if test "x$enable_framebuffer_backing_store" != "xyes" ; then
|
|
|
|
|
AC_DEFINE(X11_BACKING_STORE)
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(plot,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --disable-plot disable plot package],
|
2017-04-25 14:41:48 +02:00
|
|
|
[],
|
|
|
|
|
[enable_plot=yes])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_plot" = "xyes" ; then
|
|
|
|
|
AC_DEFINE(PLOT_MODULE)
|
|
|
|
|
modules="$modules plot"
|
|
|
|
|
extra_libs="$extra_libs \${MAGICDIR}/plot/libplot.o"
|
|
|
|
|
else
|
|
|
|
|
unused="$unused plot"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(lef,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --disable-lef disable LEF package],
|
2017-04-25 14:41:48 +02:00
|
|
|
[],
|
|
|
|
|
[enable_lef=yes])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_lef" = "xyes" ; then
|
|
|
|
|
AC_DEFINE(LEF_MODULE)
|
|
|
|
|
modules="$modules lef"
|
|
|
|
|
extra_libs="$extra_libs \${MAGICDIR}/lef/liblef.o \${MAGICDIR}/extflat/libextflat.o"
|
|
|
|
|
else
|
|
|
|
|
unused="$unused lef"
|
|
|
|
|
fi
|
|
|
|
|
|
2025-01-10 15:58:57 +01:00
|
|
|
dnl The readline code is incompatible with Tcl/Tk, which has its own
|
|
|
|
|
dnl readline-like interface, so regardless of the setting of this
|
|
|
|
|
dnl option, if Tcl/Tk support is enabled, it will always be disabled.
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
AC_ARG_ENABLE(readline,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --disable-readline disable readline package],
|
2017-04-25 14:41:48 +02:00
|
|
|
[ if test $usingTcl ; then
|
|
|
|
|
enable_readline=no
|
|
|
|
|
fi
|
|
|
|
|
],
|
|
|
|
|
[ if test $usingTcl ; then
|
|
|
|
|
enable_readline=no
|
|
|
|
|
else
|
|
|
|
|
enable_readline=yes
|
|
|
|
|
fi
|
|
|
|
|
])
|
|
|
|
|
|
2025-10-04 00:32:54 +02:00
|
|
|
use_system_readline=yes
|
|
|
|
|
use_bundled_readline=auto
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(readline-bundled,
|
|
|
|
|
[ --enable-readline-bundled enable readline bundled package],
|
|
|
|
|
[ use_bundled_readline=yes
|
|
|
|
|
], [
|
|
|
|
|
use_bundled_readline=no
|
|
|
|
|
])
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
if test "x$enable_readline" = "xyes" ; then
|
|
|
|
|
AC_DEFINE(USE_READLINE)
|
2025-10-04 00:32:54 +02:00
|
|
|
if test $use_bundled_readline != yes ; then
|
|
|
|
|
AC_CHECK_LIB(readline, rl_pre_input_hook,[
|
|
|
|
|
dnl noop, prevent default action LIBS+=-lreadline
|
|
|
|
|
],
|
2017-04-25 14:41:48 +02:00
|
|
|
use_system_readline=no)
|
2025-10-04 00:32:54 +02:00
|
|
|
AC_CHECK_LIB(readline, rl_username_completion_function,[
|
|
|
|
|
dnl noop, prevent default action LIBS+=-lreadline
|
|
|
|
|
],
|
2017-04-25 14:41:48 +02:00
|
|
|
use_system_readline=no)
|
2025-10-04 00:32:54 +02:00
|
|
|
AC_CHECK_LIB(readline, rl_filename_completion_function,[
|
|
|
|
|
dnl noop, prevent default action LIBS+=-lreadline
|
|
|
|
|
],
|
2017-04-25 14:41:48 +02:00
|
|
|
use_system_readline=no)
|
2025-10-04 00:32:54 +02:00
|
|
|
AC_CHECK_LIB(readline, rl_attempted_completion_over,[
|
|
|
|
|
dnl noop, prevent default action LIBS+=-lreadline
|
|
|
|
|
],
|
2017-04-25 14:41:48 +02:00
|
|
|
use_system_readline=no)
|
2025-10-04 00:32:54 +02:00
|
|
|
fi
|
|
|
|
|
if test $use_system_readline = yes && test $use_bundled_readline != yes; then
|
2017-04-25 14:41:48 +02:00
|
|
|
AC_DEFINE(HAVE_READLINE)
|
|
|
|
|
rl_libs="-lreadline"
|
2025-10-04 00:32:54 +02:00
|
|
|
use_bundled_readline=
|
2017-04-25 14:41:48 +02:00
|
|
|
else
|
2025-10-04 00:32:54 +02:00
|
|
|
echo "Using bundled readline"
|
|
|
|
|
AC_DEFINE(NEED_READLINE)
|
|
|
|
|
# not readline/libhistory.a (seems subset of libreadline.a)
|
|
|
|
|
rl_libs="\${MAGICDIR}/readline/libreadline.a"
|
2017-04-25 14:41:48 +02:00
|
|
|
CPPFLAGS="$CPPFLAGS -I\${MAGICDIR}/readline"
|
2024-10-08 09:08:25 +02:00
|
|
|
use_bundled_readline=1
|
2025-10-04 00:32:54 +02:00
|
|
|
|
|
|
|
|
AC_CHECK_LIB(termcap, tgetent, [
|
2017-04-25 14:41:48 +02:00
|
|
|
rl_libs="$rl_libs -ltermcap"
|
|
|
|
|
], [
|
|
|
|
|
AC_CHECK_LIB(ncurses, tgetent, [
|
|
|
|
|
rl_libs="$rl_libs -lncurses"
|
|
|
|
|
], )
|
|
|
|
|
], )
|
2025-10-04 00:32:54 +02:00
|
|
|
modules="$modules readline"
|
|
|
|
|
fi
|
2017-04-25 14:41:48 +02:00
|
|
|
else
|
|
|
|
|
unused="$unused readline"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(threads,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --disable-threads disable threaded graphics],
|
2017-04-25 14:41:48 +02:00
|
|
|
[ if test $usingTcl ; then
|
|
|
|
|
enable_threads=no
|
|
|
|
|
fi
|
|
|
|
|
],
|
|
|
|
|
[ if test $usingTcl ; then
|
|
|
|
|
enable_threads=no
|
|
|
|
|
else
|
|
|
|
|
enable_threads=yes
|
|
|
|
|
fi
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_threads" = "xyes" ; then
|
2022-03-30 16:55:08 +02:00
|
|
|
if test $usingX11 ; then
|
|
|
|
|
usingThreads=1
|
|
|
|
|
AC_DEFINE(HAVE_PTHREADS)
|
|
|
|
|
gr_libs="$gr_libs -lpthread"
|
|
|
|
|
gr_srcs="$gr_srcs \${X11THREAD_SRCS}"
|
|
|
|
|
gr_hsrcs=""
|
|
|
|
|
gr_hprog=""
|
|
|
|
|
fi
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(route,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --disable-route disable routing package],
|
2017-04-25 14:41:48 +02:00
|
|
|
[],
|
|
|
|
|
[enable_route=yes])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_route" = "xyes" ; then
|
|
|
|
|
AC_DEFINE(ROUTE_MODULE)
|
|
|
|
|
modules="$modules garouter grouter irouter mzrouter router gcr"
|
|
|
|
|
programs="$programs net2ir"
|
|
|
|
|
extra_libs="$extra_libs \${MAGICDIR}/garouter/libgarouter.o \
|
|
|
|
|
\${MAGICDIR}/mzrouter/libmzrouter.o \${MAGICDIR}/router/librouter.o \
|
|
|
|
|
\${MAGICDIR}/irouter/libirouter.o \${MAGICDIR}/grouter/libgrouter.o \
|
|
|
|
|
\${MAGICDIR}/gcr/libgcr.o"
|
|
|
|
|
else
|
|
|
|
|
unused="$unused garouter grouter irouter mzrouter router gcr"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(rsim,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --disable-rsim disable IRSIM tool],
|
2017-04-25 14:41:48 +02:00
|
|
|
[ if test $usingTcl ; then
|
|
|
|
|
enable_rsim=no
|
|
|
|
|
fi
|
|
|
|
|
],
|
|
|
|
|
[ if test $usingTcl ; then
|
|
|
|
|
enable_rsim=no
|
|
|
|
|
else
|
|
|
|
|
enable_rsim=yes
|
|
|
|
|
fi
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_rsim" = "xyes" ; then
|
|
|
|
|
AC_DEFINE(RSIM_MODULE)
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(new-macros,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --disable-new-macros disable new macro set],
|
2017-04-25 14:41:48 +02:00
|
|
|
[],
|
|
|
|
|
[enable_new_macros=yes])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_new_macros" = "xyes" ; then
|
|
|
|
|
AC_DEFINE(USE_NEW_MACROS)
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_ARG_WITH(opengl,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --with-opengl=DIR use OpenGL include files in DIR], [
|
2017-04-25 14:41:48 +02:00
|
|
|
if test "$withval" = "no" -o "$withval" = "NO" ; then
|
|
|
|
|
usingOGL=
|
|
|
|
|
elif test "$withval" != "no" -a "$withval" != "yes"; then
|
|
|
|
|
OGL_INCLUDE_DIR=${withval}
|
|
|
|
|
fi
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
dnl Check for OpenGL headers and libraries, if OpenGL was specified.
|
|
|
|
|
dnl If they cannot be found, then disable OpenGL and flag a warning.
|
|
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
if test $usingOGL ; then
|
|
|
|
|
ac_save_CPPFLAGS="$CPPFLAGS"
|
|
|
|
|
if test $OGL_INCLUDE_DIR ; then
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -I$OGL_INCLUDE_DIR"
|
|
|
|
|
fi
|
|
|
|
|
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
|
|
|
|
|
AC_CHECK_HEADER(GL/gl.h, , [
|
|
|
|
|
echo "GL header files not found, disabling OpenGL"
|
|
|
|
|
usingOGL=
|
|
|
|
|
],)
|
|
|
|
|
CPPFLAGS="$ac_save_CPPFLAGS"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test $usingOGL ; then
|
|
|
|
|
ac_save_CPPFLAGS="$CPPFLAGS"
|
|
|
|
|
ac_save_LDFLAGS="$LDFLAGS"
|
|
|
|
|
LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS -lm"
|
|
|
|
|
AC_CHECK_LIB(GL, glXCreateContext, , [
|
|
|
|
|
echo "GL library files not found, disabling OpenGL"
|
|
|
|
|
usingOGL=
|
|
|
|
|
],)
|
2024-10-08 09:08:25 +02:00
|
|
|
AC_CHECK_LIB(GLU, gluNewTess, [
|
|
|
|
|
usingGLU=1
|
|
|
|
|
use_libglu="-lGLU"
|
|
|
|
|
], [
|
2017-04-25 14:41:48 +02:00
|
|
|
echo "GLU library files not found; disabling font rendering"
|
|
|
|
|
use_libglu=""
|
|
|
|
|
],)
|
|
|
|
|
CPPFLAGS="$ac_save_CPPFLAGS"
|
|
|
|
|
LDFLAGS="$ac_save_LDFLAGS"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test "x$use_libglu" != "x" ; then
|
|
|
|
|
AC_DEFINE(VECTOR_FONTS)
|
2024-10-08 09:08:25 +02:00
|
|
|
usingGLU=1
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test $usingOGL ; then
|
|
|
|
|
if test $OGL_INCLUDE_DIR ; then
|
|
|
|
|
gr_cflags="${gr_cflags} -I${OGL_INCLUDE_DIR}"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2017-08-02 04:14:42 +02:00
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
dnl Check for cairo graphics headers and libraries
|
|
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
AC_ARG_WITH(cairo,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --with-cairo=DIR use Cairo include files in DIR], [
|
2017-08-02 04:14:42 +02:00
|
|
|
if test "$withval" = "no" -o "$withval" = "NO" ; then
|
|
|
|
|
usingCairo=
|
|
|
|
|
elif test "$withval" != "no" -a "$withval" != "yes"; then
|
|
|
|
|
CAIRO_INCLUDE_DIR=${withval}
|
|
|
|
|
fi
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
if test $usingCairo ; then
|
|
|
|
|
ac_save_CPPFLAGS="$CPPFLAGS"
|
|
|
|
|
if test $CAIRO_INCLUDE_DIR ; then
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -I$CAIRO_INCLUDE_DIR"
|
|
|
|
|
fi
|
|
|
|
|
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
|
|
|
|
|
AC_CHECK_HEADER(cairo/cairo.h, , [
|
|
|
|
|
echo "Cairo header files not found, disabling Cairo"
|
|
|
|
|
usingCairo=
|
|
|
|
|
],)
|
|
|
|
|
CPPFLAGS="$ac_save_CPPFLAGS"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test $usingCairo ; then
|
|
|
|
|
ac_save_CPPFLAGS="$CPPFLAGS"
|
|
|
|
|
ac_save_LDFLAGS="$LDFLAGS"
|
|
|
|
|
LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS -lm"
|
|
|
|
|
AC_CHECK_LIB(cairo, cairo_user_to_device, , [
|
|
|
|
|
echo "Cairo library files not found, disabling Cairo"
|
|
|
|
|
usingCairo=
|
|
|
|
|
],)
|
|
|
|
|
CPPFLAGS="$ac_save_CPPFLAGS"
|
|
|
|
|
LDFLAGS="$ac_save_LDFLAGS"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test $usingCairo ; then
|
|
|
|
|
if test $CAIRO_INCLUDE_DIR ; then
|
|
|
|
|
gr_cflags="${gr_cflags} -I${CAIRO_INCLUDE_DIR}"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2017-09-17 18:31:31 +02:00
|
|
|
dnl
|
|
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(cairo-offscreen,
|
2024-10-17 12:02:28 +02:00
|
|
|
[ --enable-cairo-offscreen Use Cairo for off-screen rendering],
|
2017-09-17 18:31:31 +02:00
|
|
|
[enable_cairo_offscreen=yes],
|
|
|
|
|
[])
|
|
|
|
|
|
|
|
|
|
if test "x$enable_cairo_offscreen" = "xyes" ; then
|
|
|
|
|
if test $usingCairo ; then
|
|
|
|
|
AC_DEFINE(CAIRO_OFFSCREEN_RENDER)
|
|
|
|
|
else
|
|
|
|
|
echo "Cairo not being compiled in, can't use for offscreen rendering."
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2017-08-02 04:14:42 +02:00
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
dnl Once we're sure what, if any, interpreter is being compiled,
|
|
|
|
|
dnl set all the appropriate definitions. For Tcl/Tk, override
|
|
|
|
|
dnl the default install targets: allows compiling tcl version with
|
|
|
|
|
dnl "make" instead of requiring "make tcl"
|
|
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
if test $usingTcl ; then
|
|
|
|
|
cadinstall="$cadinstall graphics tcltk"
|
|
|
|
|
modules="$modules tcltk"
|
|
|
|
|
unused="$unused lisp"
|
|
|
|
|
programs="$programs tcltk"
|
|
|
|
|
ALL_TARGET="tcl"
|
|
|
|
|
INSTALL_TARGET="install-tcl"
|
|
|
|
|
AC_DEFINE(MAGIC_WRAPPER)
|
|
|
|
|
extra_libs="$extra_libs \${MAGICDIR}/tcltk/libtcltk.o"
|
|
|
|
|
extra_defs="$extra_defs -DTCL_DIR=\\\"\${TCLDIR}\\\""
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
if test $usingTk ; then
|
|
|
|
|
stub_defs="$stub_defs -DUSE_TCL_STUBS -DUSE_TK_STUBS"
|
|
|
|
|
else
|
|
|
|
|
stub_defs="$stub_defs -DUSE_TCL_STUBS -DMAGIC_NO_TK"
|
|
|
|
|
extra_defs="$extra_defs -DMAGIC_NO_TK"
|
|
|
|
|
fi
|
2017-04-25 14:41:48 +02:00
|
|
|
elif test $usingScheme ; then
|
|
|
|
|
modules="$modules lisp"
|
|
|
|
|
unused="$unused tcltk"
|
|
|
|
|
cadinstall="$cadinstall lisp"
|
|
|
|
|
extra_libs="$extra_libs \${MAGICDIR}/lisp/liblisp.o"
|
2022-02-08 22:12:07 +01:00
|
|
|
programs="$programs graphics"
|
2017-04-25 14:41:48 +02:00
|
|
|
AC_DEFINE(SCHEME_INTERPRETER)
|
|
|
|
|
else
|
|
|
|
|
unused="$unused lisp tcltk"
|
2022-02-08 22:12:07 +01:00
|
|
|
programs="$programs graphics"
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
dnl Handle graphics based on the setting of "usingTcl", "usingX11",
|
|
|
|
|
dnl and "usingOGL"
|
|
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
if test $usingTcl ; then
|
|
|
|
|
if test $usingX11 ; then
|
|
|
|
|
gr_dflags="$gr_dflags -DX11 -DXLIB"
|
|
|
|
|
gr_libs="$gr_libs -lX11"
|
|
|
|
|
gr_srcs="$gr_srcs \${TK_SRCS}"
|
|
|
|
|
fi
|
|
|
|
|
if test $usingOGL ; then
|
|
|
|
|
AC_DEFINE(THREE_D)
|
|
|
|
|
gr_dflags="$gr_dflags -DOGL"
|
|
|
|
|
gr_libs="$gr_libs -lGL ${use_libglu} ${use_libxi} ${use_libxmu} ${use_libxext} -lm"
|
2025-10-04 00:34:52 +02:00
|
|
|
gr_srcs="$gr_srcs \${TOGL_GL_SRCS} \${TOGL_GLU_SRCS} \${THREE_D_GL_SRCS}"
|
2017-04-25 14:41:48 +02:00
|
|
|
if ! test $usingX11 ; then
|
|
|
|
|
usingX11=1
|
|
|
|
|
gr_dflags="$gr_dflags -DXLIB"
|
|
|
|
|
gr_libs="$gr_libs -lX11"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2017-08-02 04:14:42 +02:00
|
|
|
if test $usingCairo ; then
|
|
|
|
|
gr_dflags="$gr_dflags -DCAIRO"
|
|
|
|
|
gr_libs="$gr_libs -lcairo -lfontconfig -lfreetype"
|
2017-08-30 22:34:42 +02:00
|
|
|
gr_srcs="$gr_srcs \${TCAIRO_SRCS}"
|
2017-08-02 04:14:42 +02:00
|
|
|
if ! test $usingX11 ; then
|
|
|
|
|
usingX11=1
|
|
|
|
|
gr_dflags="$gr_dflags -DXLIB"
|
|
|
|
|
gr_libs="$gr_libs -lX11"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
if test $usingTk ; then
|
|
|
|
|
gr_srcs="$gr_srcs \${TKCOMMON_SRCS}"
|
|
|
|
|
fi
|
2017-04-25 14:41:48 +02:00
|
|
|
else
|
|
|
|
|
if test $usingX11 ; then
|
|
|
|
|
gr_dflags="$gr_dflags -DX11 -DXLIB"
|
|
|
|
|
gr_libs="$gr_libs -lX11"
|
|
|
|
|
gr_srcs="$gr_srcs \${X11_SRCS}"
|
|
|
|
|
fi
|
|
|
|
|
if test $usingOGL ; then
|
|
|
|
|
gr_dflags="$gr_dflags -DOGL"
|
|
|
|
|
gr_libs="$gr_libs -lGL ${use_libglu} ${use_libxi} ${use_libxmu} ${use_libxext} -lm"
|
2025-10-04 00:34:52 +02:00
|
|
|
gr_srcs="$gr_srcs \${OGL_GL_SRCS} \${OGL_GLU_SRCS}"
|
2017-04-25 14:41:48 +02:00
|
|
|
if ! test $usingX11 ; then
|
|
|
|
|
usingX11=1
|
|
|
|
|
gr_libs="$gr_libs -lX11"
|
|
|
|
|
gr_dflags="$gr_dflags -DXLIB"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
if test $usingX11 ; then
|
|
|
|
|
if ! test $usingThreads; then
|
|
|
|
|
gr_dflags="$gr_dflags -DX11HELP_PROG=\\\"\${X11HELP_PROG}\\\""
|
|
|
|
|
gr_hsrcs="$gr_hsrcs \${X11HELPER_SRCS}"
|
|
|
|
|
gr_hprog="$gr_hprog \${X11HELP_PROG}"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2022-03-30 16:55:08 +02:00
|
|
|
if test $usingX11 ; then
|
|
|
|
|
gr_libs="$gr_libs \${X11_LDFLAGS}"
|
|
|
|
|
fi
|
|
|
|
|
|
2024-10-17 22:15:30 +02:00
|
|
|
dnl We use GR_LIBS for graphics but some autoconf helpers might edit LIBS
|
|
|
|
|
dnl remove "-lcairo" from LIBS if present in GR_LIBS
|
|
|
|
|
for find in \
|
|
|
|
|
cairo X11 GL GLU fontconfig freetype
|
|
|
|
|
do
|
|
|
|
|
if echo "$gr_libs" | grep -q -- "\-l${find}" ; then
|
|
|
|
|
dnl Not all sed support wildcard '\?'
|
|
|
|
|
LIBS=`echo "$LIBS" | sed -e "s/\-l${find} \?//" | tr -d '\n'`
|
|
|
|
|
LIBS=`echo "$LIBS" | sed -e "s/\-l${find} //" | tr -d '\n'`
|
|
|
|
|
LIBS=`echo "$LIBS" | sed -e "s/\-l${find}//" | tr -d '\n'`
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
dnl Define system-specific settings
|
|
|
|
|
dnl ----------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
case $target in
|
|
|
|
|
*-linux*)
|
|
|
|
|
AC_DEFINE(linux)
|
2023-07-11 18:34:55 +02:00
|
|
|
AC_DEFINE(SYSV)
|
2017-04-25 14:41:48 +02:00
|
|
|
dnl Defining "ISC" prevents compiler failure on redefinition of "wchar_t"
|
|
|
|
|
AC_DEFINE(ISC)
|
|
|
|
|
dnl 64-bit support for AMD Opteron
|
|
|
|
|
case $target in
|
|
|
|
|
*x86_64*)
|
2023-07-11 22:02:35 +02:00
|
|
|
CFLAGS="${CFLAGS} -m64 -fPIC -Werror=implicit-function-declaration"
|
2017-04-25 14:41:48 +02:00
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
if test $usingOGL ; then
|
|
|
|
|
gr_libs="$gr_libs -lstdc++"
|
|
|
|
|
fi
|
|
|
|
|
if test -f /usr/lib/libbsd-compat.a ; then
|
|
|
|
|
gr_libs="$gr_libs -lbsd-compat"
|
|
|
|
|
elif test -f /usr/lib/libbsd.a ; then
|
|
|
|
|
gr_libs="$gr_libs -lbsd"
|
|
|
|
|
fi
|
|
|
|
|
;;
|
2023-07-11 18:34:55 +02:00
|
|
|
*-emscripten*)
|
|
|
|
|
AC_DEFINE(linux)
|
|
|
|
|
CFLAGS="${CFLAGS} -fPIC -Werror=implicit-function-declaration -Wno-int-conversion -Wno-implicit-int"
|
|
|
|
|
;;
|
2017-04-25 14:41:48 +02:00
|
|
|
*solaris*)
|
|
|
|
|
AC_DEFINE(SYSV)
|
|
|
|
|
;;
|
|
|
|
|
*irix*)
|
|
|
|
|
AC_DEFINE(SYSV)
|
|
|
|
|
AC_DEFINE(IRIX)
|
|
|
|
|
AC_DEFINE(_BSD_SIGNALS)
|
|
|
|
|
;;
|
|
|
|
|
*sysv*)
|
|
|
|
|
AC_DEFINE(SYSV)
|
|
|
|
|
;;
|
|
|
|
|
*cygwin*)
|
|
|
|
|
AC_DEFINE(CYGWIN)
|
|
|
|
|
AC_DEFINE(i386)
|
|
|
|
|
;;
|
|
|
|
|
*darwin*)
|
|
|
|
|
if test "$CPP" = "cc -E" ; then
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
|
|
|
|
|
fi
|
2018-07-19 16:23:30 +02:00
|
|
|
AC_DEFINE(_FORTIFY_SOURCE, 0, [Avoid checks on string overruns])
|
2017-04-25 14:41:48 +02:00
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
# Tcl/Tk configuration
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
if test $usingTcl ; then
|
2017-10-13 16:28:07 +02:00
|
|
|
LIB_SPECS_NOSTUB="${LIB_SPECS}"
|
2022-03-30 16:55:08 +02:00
|
|
|
LIB_SPECS_GRNULL="${LIB_SPECS}"
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
#
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
# Tk libraries and header files (skipped under --without-tk)
|
2017-04-25 14:41:48 +02:00
|
|
|
#
|
|
|
|
|
# -----------------------------------------------------------------------
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
if test $usingTk ; then
|
|
|
|
|
if test "${TK_INC_DIR}" != "/usr/include" ; then
|
|
|
|
|
INC_SPECS="${INC_SPECS} -I${TK_INC_DIR}"
|
|
|
|
|
fi
|
|
|
|
|
if test "${TK_LIB_DIR}" = "/usr/lib" -o \
|
|
|
|
|
"${TK_LIB_DIR}" = "/usr/lib64" ; then
|
|
|
|
|
LIB_SPECS_NOSTUB="${LIB_SPECS_NOSTUB} ${TK_LIB_SPEC}"
|
|
|
|
|
LIB_SPECS="${LIB_SPECS} ${TK_STUB_LIB_SPEC}"
|
2017-04-25 14:41:48 +02:00
|
|
|
else
|
Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.
magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.
Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
+ scripts/configure, so --with-tcl --without-tk is finally a valid
combination. Native Linux Tcl+Tk builds keep their previous behaviour
(both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.
WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
+ tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
and -ltclstub. After rules.mak include, magic: is a phony alias for
magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
(Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
!MAGIC_WRAPPER so they don't collide with the copies in
tcltk/tclmagic.c when both objects land in the same wasm binary.
npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.
CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
variants via npm/build.sh --variant=both, runs the existing notcl
test suite and the new TCL smoke test, and publishes only on a
v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
npm version.
2026-05-17 21:41:03 +02:00
|
|
|
LIB_SPECS_NOSTUB="${LIB_SPECS_NOSTUB} -L${TK_LIB_DIR} ${TK_LIB_SPEC}"
|
|
|
|
|
LIB_SPECS="${LIB_SPECS} -L${TK_LIB_DIR} ${TK_STUB_LIB_SPEC}"
|
|
|
|
|
if test "x${loader_run_path}" = "x" ; then
|
|
|
|
|
loader_run_path="${TK_LIB_DIR}"
|
|
|
|
|
else
|
|
|
|
|
loader_run_path="${TK_LIB_DIR}:${loader_run_path}"
|
|
|
|
|
fi
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# Tcl libraries and header files
|
|
|
|
|
#
|
|
|
|
|
# Add a header file directory specification only if the Tcl headers reside
|
|
|
|
|
# in a different directory from Tk's.
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
if test "${TCL_INC_DIR}" != "/usr/include" -a \
|
|
|
|
|
"${TCL_INC_DIR}" != "${TK_INC_DIR}" ; then
|
|
|
|
|
INC_SPECS="${INC_SPECS} -I${TCL_INC_DIR}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test "${TCL_LIB_DIR}" = "/usr/lib" -o \
|
|
|
|
|
"${TCL_LIB_DIR}" = "/usr/lib64" -o \
|
|
|
|
|
"${TCL_LIB_DIR}" = "${TK_LIB_DIR}" ; then
|
2017-10-13 16:28:07 +02:00
|
|
|
LIB_SPECS_NOSTUB="${LIB_SPECS_NOSTUB} ${TCL_LIB_SPEC}"
|
2022-03-30 16:55:08 +02:00
|
|
|
LIB_SPECS_GRNULL="${LIB_SPECS_GRNULL} ${TCL_LIB_SPEC}"
|
2017-10-13 16:28:07 +02:00
|
|
|
LIB_SPECS="${LIB_SPECS} ${TCL_STUB_LIB_SPEC}"
|
2017-04-25 14:41:48 +02:00
|
|
|
else
|
2017-10-13 16:28:07 +02:00
|
|
|
LIB_SPECS_NOSTUB="${LIB_SPECS_NOSTUB} -L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
|
2022-03-30 16:55:08 +02:00
|
|
|
LIB_SPECS_GRNULL="${LIB_SPECS_GRNULL} -L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
|
2017-10-13 16:28:07 +02:00
|
|
|
LIB_SPECS="${LIB_SPECS} -L${TCL_LIB_DIR} ${TCL_STUB_LIB_SPEC}"
|
2017-04-25 14:41:48 +02:00
|
|
|
if test "x${loader_run_path}" = "x" ; then
|
|
|
|
|
loader_run_path="${TCL_LIB_DIR}"
|
|
|
|
|
else
|
|
|
|
|
loader_run_path="${TCL_LIB_DIR}:${loader_run_path}"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# Check if we can generate shared libraries on this system. Set flags
|
|
|
|
|
# to generate shared libraries for systems that we know about. Start
|
|
|
|
|
# with the values found in tclConfig.sh, make changes as we know about
|
|
|
|
|
# the different systems.
|
|
|
|
|
#
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Initialize shared library build variables
|
|
|
|
|
|
|
|
|
|
SHLIB_LD=""
|
|
|
|
|
LDDL_FLAGS="-shared"
|
|
|
|
|
SHDLIB_EXT=".so"
|
|
|
|
|
EXTRA_LIB_SPECS=""
|
|
|
|
|
|
|
|
|
|
build_shared="yes"
|
|
|
|
|
|
|
|
|
|
case $target in
|
|
|
|
|
*-aix4.[[2-9]]*)
|
|
|
|
|
# No Position-Independent flags needed
|
|
|
|
|
|
|
|
|
|
# Use the installed export file or the one found in the source directory.
|
|
|
|
|
|
|
|
|
|
if test -r "${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp" ; then
|
|
|
|
|
tcl_exp="${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp"
|
|
|
|
|
else
|
|
|
|
|
tcl_exp="${TCL_SRC_DIR}/unix/lib.exp"
|
|
|
|
|
fi
|
|
|
|
|
if test -r "${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp" ; then
|
|
|
|
|
tk_exp="${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp"
|
|
|
|
|
else
|
|
|
|
|
tk_exp="${TK_SRC_DIR}/unix/lib.exp"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
full_src_path=`cd ${srcdir}; pwd`
|
|
|
|
|
|
|
|
|
|
# Use shell-script to link shared library
|
|
|
|
|
LD="${full_src_path}/cf/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry -bI:${tk_exp} -bI:${tcl_exp}"
|
|
|
|
|
|
|
|
|
|
SHLIB_LIB_SPECS="${aix_lib_specs} -lc"
|
|
|
|
|
|
|
|
|
|
LDFLAGS="-L${loader_run_path}"
|
|
|
|
|
EXTRA_LIB_SPECS="-ldl"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-aix*)
|
|
|
|
|
# No Position-Independent flags needed
|
|
|
|
|
|
|
|
|
|
# Use the installed export file or the one found in the source directory.
|
|
|
|
|
|
|
|
|
|
if test -r "${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp" ; then
|
|
|
|
|
tcl_exp="${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp"
|
|
|
|
|
else
|
|
|
|
|
tcl_exp="${TCL_SRC_DIR}/unix/lib.exp"
|
|
|
|
|
fi
|
|
|
|
|
if test -r "${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp" ; then
|
|
|
|
|
tk_exp="${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp"
|
|
|
|
|
else
|
|
|
|
|
tk_exp="${TK_SRC_DIR}/unix/lib.exp"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
full_src_path=`cd ${srcdir}/cf; pwd`
|
|
|
|
|
|
|
|
|
|
# Use shell-script to link shared library
|
|
|
|
|
|
|
|
|
|
LD="${full_src_path}/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry -bI:${tk_exp} -bI:${tcl_exp}"
|
|
|
|
|
SHLIB_LIB_SPECS="${aix_lib_specs} -lc"
|
|
|
|
|
LDFLAGS="-L${loader_run_path}"
|
|
|
|
|
EXTRA_LIB_SPECS="-lld"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-bsdi2*|*-bsdi3*)
|
|
|
|
|
LD="shlicc"
|
|
|
|
|
LDDL_FLAGS="-r"
|
|
|
|
|
EXTRA_LIB_SPECS="-ldl"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*darwin*)
|
|
|
|
|
SHDLIB_EXT=".dylib"
|
2017-10-17 01:56:04 +02:00
|
|
|
LDDL_FLAGS="-dynamiclib -undefined dynamic_lookup"
|
2017-04-25 14:41:48 +02:00
|
|
|
LDFLAGS="${LDFLAGS} ${LIB_SPECS}"
|
2017-10-17 01:56:04 +02:00
|
|
|
CFLAGS="${CFLAGS} ${X_CFLAGS} ${INC_SPECS}"
|
2017-04-25 14:41:48 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*cygwin*)
|
|
|
|
|
SHDLIB_EXT=".dll"
|
|
|
|
|
AC_DEFINE(USE_DL_IMPORT)
|
|
|
|
|
LDDL_FLAGS='-shared -Wl,--enable-auto-image-base'
|
|
|
|
|
if test "x${loader_run_path}" != "x" ; then
|
|
|
|
|
LD_RUN_PATH="${LD_RUN_PATH} -Wl,-rpath,${loader_run_path}"
|
|
|
|
|
fi
|
|
|
|
|
ld_extra_libs=${LIB_SPECS}
|
|
|
|
|
sub_extra_libs='-L${MAGICDIR}/magic -ltclmagic'
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-bsdi4*)
|
|
|
|
|
SHLIB_CFLAGS="-export-dynamic -fPIC"
|
|
|
|
|
LDDL_FLAGS='-shared -Wl,-E -Wl,-soname,$@'
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-dgux*)
|
|
|
|
|
SHLIB_CFLAGS="-K PIC"
|
|
|
|
|
LDDL_FLAGS="-G"
|
|
|
|
|
EXTRA_LIB_SPECS="-ldl"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-hpux*)
|
|
|
|
|
if test "$GCC" = "no" ; then
|
|
|
|
|
AC_DEFINE(_HPUX_SOURCE)
|
|
|
|
|
fi
|
|
|
|
|
AC_CHECK_LIB(dld, shl_load, [found=yes], [found=no])
|
|
|
|
|
if test "${found}" = "yes" ; then
|
|
|
|
|
SHLIB_CFLAGS="+z"
|
|
|
|
|
LDDL_FLAGS="-b -E -n +s +b,${loader_run_path}:."
|
|
|
|
|
SHDLIB_EXT=".sl"
|
|
|
|
|
|
|
|
|
|
# The run path is included in both LDFLAGS and LDDL_FLAGS
|
|
|
|
|
# because SHLIB_LD is ld and LD is cc/gcc.
|
|
|
|
|
|
|
|
|
|
LDFLAGS="-Wl,-E -Wl,+s,+b,${loader_run_path}:."
|
|
|
|
|
EXTRA_LIB_SPECS="-ldld"
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-irix64-6.5*)
|
|
|
|
|
LDDL_FLAGS="-32 -shared -rdata_shared"
|
|
|
|
|
if test "x${loader_run_path}" != "x" ; then
|
|
|
|
|
LD_RUN_PATH="${LD_RUN_PATH} -Wl,-rpath,${loader_run_path}"
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-irix-[56].*|*-irix64-*)
|
|
|
|
|
LDDL_FLAGS="-shared -rdata_shared"
|
|
|
|
|
if test "x${loader_run_path}" != "x" ; then
|
|
|
|
|
LD_RUN_PATH="${LD_RUN_PATH} -Wl,-rpath,${loader_run_path}"
|
|
|
|
|
fi
|
|
|
|
|
LDFLAGS=""
|
|
|
|
|
if test "$GCC" = "yes" ; then
|
|
|
|
|
SHLIB_CFLAGS="-mabi=n32 $SHLIB_CFLAGS"
|
|
|
|
|
LDDL_FLAGS="-mabi=n32 $LDDL_FLAGS"
|
|
|
|
|
LDFLAGS="-mabi=n32 $LDFLAGS"
|
|
|
|
|
else
|
|
|
|
|
CFLAGS="-n32 $CFLAGS"
|
|
|
|
|
LDFLAGS="-n32 $LDFLAGS"
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-linux*)
|
|
|
|
|
LDDL_FLAGS='-shared -Wl,-soname,$@'
|
|
|
|
|
if test "x${loader_run_path}" != "x" ; then
|
|
|
|
|
LD_RUN_PATH="${LD_RUN_PATH} -Wl,-rpath,${loader_run_path}"
|
|
|
|
|
fi
|
|
|
|
|
LDFLAGS=""
|
|
|
|
|
EXTRA_LIB_SPECS="-ldl"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-mp-ras-02*)
|
|
|
|
|
SHLIB_CFLAGS="-G -K PIC"
|
|
|
|
|
LDDL_FLAGS=""
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-mp-ras-*)
|
|
|
|
|
SHLIB_CFLAGS="-G -K PIC"
|
|
|
|
|
LDDL_FLAGS="-Wl,-Bexport"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-ncr-sysv4-*2*)
|
|
|
|
|
SHLIB_CFLAGS="-K PIC"
|
|
|
|
|
LDDL_FLAGS="-G"
|
|
|
|
|
|
|
|
|
|
EXTRA_LIB_SPECS="-ldl"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-ncr-sysv4*)
|
|
|
|
|
SHLIB_CFLAGS="-K PIC"
|
|
|
|
|
LDDL_FLAGS="-G -Wl,-Bexport"
|
|
|
|
|
|
|
|
|
|
LDFLAGS="-Wl,-Bexport"
|
|
|
|
|
EXTRA_LIB_SPECS="-ldl"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-freebsd*)
|
|
|
|
|
# Not available on all versions: check for include file.
|
|
|
|
|
SHLIB_CFLAGS="-fpic"
|
|
|
|
|
LDDL_FLAGS="-shared ${LIB_SPECS}"
|
|
|
|
|
;;
|
|
|
|
|
|
2022-08-06 05:03:35 +02:00
|
|
|
*-netbsd*)
|
2017-04-25 14:41:48 +02:00
|
|
|
# Not available on all versions: check for include file.
|
|
|
|
|
AC_CHECK_HEADER(dlfcn.h, test_ok=yes, test_ok=no)
|
|
|
|
|
if test "$test_ok" = yes; then
|
|
|
|
|
SHLIB_CFLAGS="-fPIC"
|
|
|
|
|
LDDL_FLAGS="-shared ${LIB_SPEC}"
|
|
|
|
|
fi
|
|
|
|
|
;;
|
2022-08-06 05:03:35 +02:00
|
|
|
|
|
|
|
|
*-openbsd*)
|
|
|
|
|
SHLIB_CFLAGS="-fPIC"
|
|
|
|
|
LDDL_FLAGS="-shared ${LIB_SPEC}"
|
|
|
|
|
;;
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
*-nextstep*)
|
|
|
|
|
LDDL_FLAGS="-nostdlib -r"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-osf1-1.[012]*)
|
|
|
|
|
# OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
|
|
|
|
|
|
|
|
|
|
# Warning: Ugly Makefile Hack
|
|
|
|
|
# Make package name same as library name
|
|
|
|
|
|
|
|
|
|
SHLIB_LD='ld -R -export $@:'
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-osf1-1.*)
|
|
|
|
|
# OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
|
|
|
|
|
|
|
|
|
|
SHLIB_CFLAGS="-fpic"
|
|
|
|
|
SHLIB_LD="ld -shared"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-osf1V*)
|
|
|
|
|
# Digital OSF/1
|
|
|
|
|
|
|
|
|
|
LDDL_FLAGS='-shared -expect_unresolved "*"'
|
|
|
|
|
if test "x${loader_run_path}" != "x" ; then
|
|
|
|
|
LD_RUN_PATH="${LD_RUN_PATH} -Wl,-rpath,${loader_run_path}"
|
|
|
|
|
fi
|
|
|
|
|
LDFLAGS=""
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-sco*)
|
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
|
|
SHLIB_CFLAGS="-Kpic -belf"
|
|
|
|
|
LDDL_FLAGS="-G"
|
|
|
|
|
LDFLAGS="-belf -Wl,-Bexport"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-sni-sysv*)
|
|
|
|
|
|
|
|
|
|
SHLIB_CFLAGS="-K PIC"
|
|
|
|
|
LDDL_FLAGS="-G"
|
|
|
|
|
|
|
|
|
|
EXTRA_LIB_SPECS="-ldl"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-sunos4*)
|
|
|
|
|
|
|
|
|
|
SHLIB_CFLAGS="-PIC"
|
|
|
|
|
LDDL_FLAGS="-assert pure-text"
|
|
|
|
|
|
|
|
|
|
EXTRA_LIB_SPECS="-ldl"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-solaris2*)
|
|
|
|
|
|
|
|
|
|
if test "$with_gnu_ld" = "yes" ; then
|
|
|
|
|
LDDL_FLAGS='-shared -Wl,-E -Wl,-soname,$@ ${LIB_SPEC}'
|
|
|
|
|
if test "x${loader_run_path}" != "x" ; then
|
|
|
|
|
LD_RUN_PATH="${LD_RUN_PATH} -Wl,-rpath,${loader_run_path}"
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
LDDL_FLAGS="-shared -mimpure-text"
|
|
|
|
|
if test "x${loader_run_path}" != "x" ; then
|
|
|
|
|
LD_RUN_PATH="${LD_RUN_PATH} -R ${loader_run_path}"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
EXTRA_LIB_SPECS="-ldl"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-mips-dde-sysv*)
|
|
|
|
|
|
|
|
|
|
SHLIB_CFLAGS="-KPIC"
|
|
|
|
|
LDDL_FLAGS="-G"
|
|
|
|
|
|
|
|
|
|
EXTRA_LIB_SPECS="-ldl"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*-pc-sysv4* | *-unixware-5*)
|
|
|
|
|
SHLIB_CFLAGS="-G -KPIC"
|
|
|
|
|
LDDL_FLAGS=" -Wl,-Bexport"
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
# If we're running gcc, then set SHLIB_CFLAGS flags for compiling
|
|
|
|
|
# shared libraries for gcc, instead of those of the vendor's compiler.
|
|
|
|
|
|
|
|
|
|
if test "$GCC" = "yes" ; then
|
|
|
|
|
case $target in
|
|
|
|
|
*cygwin*)
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
SHLIB_CFLAGS="-Wimplicit-int -fPIC"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
fi
|
|
|
|
|
if test "$with_gnu_ld" = "yes" ; then
|
build: out-of-tree outlier Makefiles — full make + install
Fix the remaining non-standard Makefiles so a full out-of-tree
`../configure && make && make install` builds and installs a complete
magic TCL tree, sources read from the source tree, all outputs in the
build tree.
Shared linker/preprocessor paths (scripts/configure.in, regenerated
scripts/configure):
* --version-script=${MAGICDIR}/magic/symbol.map -> ${MAGICSRC}/... so
every shared-library link (tclmagic.so, ...) finds the source map.
* MCPP preproc.py path ${MAGICDIR}/scripts -> ${MAGICSRC}/scripts.
Programs (built via tcllibrary, PROGRAMS = magic tcltk):
* magic/Makefile: proto.magicrc, magicWasm.o and the bitmaps/.initrc/
magicps.pro install copies use $< / $(srcdir) instead of bare names.
* tcltk/Makefile: magicexec/magicdnull compile $<; the sed'd launcher
scripts (magic.tcl/.sh, ext2spice.sh, ext2sim.sh) read $<; VERSION dep
-> ${MAGICSRC}; install-tcl copies each TCL file from the build dir if
present else $(srcdir) (magic.tcl is generated, the rest are source).
Techs (scmos):
* scmos/Makefile: SC_PP template include -> $(srcdir)/extract_template;
tech-file inputs (scmos.tech.in, *.tech.in) via $(srcdir)/$< ; recurse
into cif_template with mkdir + -f ${MAGICSRC}/scmos/cif_template/Makefile;
install copies from build-or-$(srcdir).
* scmos/cif_template/Makefile: MKDIR -> ${MAGICSRC}/scripts/mkdirs;
SC_CPP gains -I$(srcdir); cpp reads $(srcdir)/cif{in,out}.c so the .gen
includes resolve; objs/ generated in the build tree.
Data-file installs (source files copied from $(srcdir)):
* graphics/Makefile: glyphs, outline fonts, and the X11 helper build.
* windows/Makefile: glyphs and vector fonts.
* doc/Makefile: recurse into man/tutcells/html/latexfiles build-aware;
doc/man, doc/tutcells install with $< ; doc/html tars $(srcdir);
doc/latexfiles reads pre-built PostScript from ${MAGICSRC}/doc/psfiles.
Verified out-of-tree (mkdir _build; cd _build; ../configure): `make`
returns rc=0 (33 module libs, tclmagic.so, magicexec/magicdnull, scmos
tech files + cif_template objs, proto.magicrc), and
`make install DESTDIR=...` returns rc=0 installing 376 files
(bin/magic, tcl/tclmagic.so, sys/ glyphs+fonts+techs+dstyles), with the
source tree left completely clean.
Not exercised by the default TCL build/install and therefore not
converted here: the standalone .so/program variants of
lef/plot/router/ext2spice/ext2sim (their module libs do build), the
disabled oa module (-I. -> -I$(srcdir) still needed if enabled), the
WASM path, and doc/latexfiles PostScript *regeneration* (which still
writes into the source psfiles dir).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:59:44 +02:00
|
|
|
LDDL_FLAGS="${LDDL_FLAGS} -Wl,--version-script=\${MAGICSRC}/magic/symbol.map"
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
AC_SUBST(SHDLIB_EXT)
|
|
|
|
|
AC_SUBST(SHLIB_LD)
|
|
|
|
|
AC_SUBST(LD)
|
|
|
|
|
AC_SUBST(LDDL_FLAGS)
|
|
|
|
|
AC_SUBST(SHLIB_LIB_SPECS)
|
|
|
|
|
|
|
|
|
|
AC_SUBST(EXTRA_LIB_SPECS)
|
|
|
|
|
AC_SUBST(LDFLAGS)
|
2022-05-28 23:51:20 +02:00
|
|
|
AC_SUBST(ZLIB_FLAG)
|
2017-04-25 14:41:48 +02:00
|
|
|
AC_SUBST(INC_SPECS)
|
|
|
|
|
AC_SUBST(LIB_SPECS)
|
2017-10-13 16:28:07 +02:00
|
|
|
AC_SUBST(LIB_SPECS_NOSTUB)
|
2022-03-30 16:55:08 +02:00
|
|
|
AC_SUBST(LIB_SPECS_GRNULL)
|
2017-04-25 14:41:48 +02:00
|
|
|
AC_SUBST(WISH_EXE)
|
|
|
|
|
AC_SUBST(TCLSH_EXE)
|
|
|
|
|
AC_SUBST(TCL_LIB_DIR)
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
build: per-file automatic dependencies (.deps), retire the Depend/sed machinery
Replace the monolithic per-directory `Depend` file -- generated by a separate,
serial `make depend` pass (one `gcc -MM` over all sources) and post-processed by
sed -- with automake-style per-file dependency fragments produced as a side
effect of each compile.
rules.mak's %.o rule now adds, when the compiler supports it,
-MMD -MP -MF .deps/<stem>.d
so every object records the (non-system) headers it used. Those fragments are
`-include`d best-effort: absent on a first build, present and correct after.
Benefits:
* self-maintaining -- no explicit depend step; deps refresh on every compile;
* parallel -- generated during the (already parallel) compile, no barrier;
* -MMD already drops system headers (what the sed did) and -MP tolerates a
removed/renamed header, so the sed post-processing is gone;
* fixes out-of-tree incremental header tracking: with an absolute srcdir the
old sed stripped the now-absolute *local* header paths too, silently losing
them; the .d files keep them.
configure probes `-MMD -MP` (AUTODEP_FLAGS; empty and best-effort-skipped if the
compiler cannot). clean/distclean remove .deps (rm -r); .gitignore replaces the
obsolete */Depend with .deps/. `make depend` is kept as a no-op for callers that
still invoke it (e.g. the WASM build script).
Verified out-of-tree (--disable-ccache): 324 .d files, 0 Depend files, a header
touch recompiles its dependents, no-op rebuild is idle, clean clears .deps. (The
top-level depend phase still runs here as a no-op; removed next.)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 16:47:29 +02:00
|
|
|
dnl Automatic per-file dependency generation. Compilers that support -MMD -MP
|
|
|
|
|
dnl write a .deps/<stem>.d listing the (non-system) headers a source used, as a
|
|
|
|
|
dnl side effect of compiling it -- replacing the old serial "make depend" pass
|
|
|
|
|
dnl and its sed post-processing, and parallelising with the compile. Best
|
|
|
|
|
dnl effort: empty if unsupported, and the build proceeds without incremental
|
|
|
|
|
dnl header tracking. Probed (not assumed from $GCC) so clang and others are
|
|
|
|
|
dnl covered only when they actually produce the file.
|
|
|
|
|
AC_MSG_CHECKING([whether $CC generates dependencies with -MMD -MP])
|
|
|
|
|
magic_save_cflags="$CFLAGS"
|
|
|
|
|
CFLAGS="$CFLAGS -MMD -MP -MF conftest.autodep.d"
|
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
|
|
|
|
|
[if test -f conftest.autodep.d ; then
|
|
|
|
|
AC_MSG_RESULT([yes]); AUTODEP_FLAGS="-MMD -MP"
|
|
|
|
|
else
|
|
|
|
|
AC_MSG_RESULT([no (produced no .d)])
|
|
|
|
|
fi],
|
|
|
|
|
[AC_MSG_RESULT([no])])
|
|
|
|
|
rm -f conftest.autodep.d
|
|
|
|
|
CFLAGS="$magic_save_cflags"
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
dnl Substitute all variables
|
|
|
|
|
|
|
|
|
|
AC_SUBST(gr_libs)
|
|
|
|
|
AC_SUBST(PACKAGE)
|
|
|
|
|
AC_SUBST(SCRIPTS)
|
|
|
|
|
AC_SUBST(extra_libs)
|
|
|
|
|
AC_SUBST(extra_defs)
|
2017-10-13 16:28:07 +02:00
|
|
|
AC_SUBST(stub_defs)
|
2024-10-17 12:00:28 +02:00
|
|
|
AC_SUBST(DEBUG_defs)
|
2024-10-17 11:56:15 +02:00
|
|
|
AC_SUBST(NDEBUG_defs)
|
2026-07-20 13:03:14 +02:00
|
|
|
AC_SUBST(ld_first_libs)
|
2017-04-25 14:41:48 +02:00
|
|
|
AC_SUBST(ld_extra_libs)
|
|
|
|
|
AC_SUBST(ld_extra_objs)
|
|
|
|
|
AC_SUBST(top_extra_libs)
|
|
|
|
|
AC_SUBST(sub_extra_libs)
|
|
|
|
|
AC_SUBST(modules)
|
|
|
|
|
AC_SUBST(unused)
|
|
|
|
|
AC_SUBST(programs)
|
|
|
|
|
AC_SUBST(cadinstall)
|
2020-01-28 18:29:44 +01:00
|
|
|
AC_SUBST(DIST_DIR)
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
AC_SUBST(rl_defs)
|
|
|
|
|
AC_SUBST(rl_libs)
|
|
|
|
|
|
|
|
|
|
AC_SUBST(gr_cflags)
|
|
|
|
|
AC_SUBST(gr_dflags)
|
|
|
|
|
AC_SUBST(gr_libs)
|
|
|
|
|
AC_SUBST(gr_srcs)
|
|
|
|
|
AC_SUBST(gr_hsrcs)
|
|
|
|
|
AC_SUBST(gr_hprog)
|
|
|
|
|
|
|
|
|
|
AC_SUBST(X_CFLAGS)
|
2024-10-16 11:23:21 +02:00
|
|
|
AC_SUBST(X_EXTRA_LIBS)
|
|
|
|
|
AC_SUBST(X_LIBS)
|
|
|
|
|
AC_SUBST(X_PRE_LIBS)
|
2026-07-20 16:21:56 +02:00
|
|
|
AC_SUBST(CC)
|
2017-04-25 14:41:48 +02:00
|
|
|
AC_SUBST(CFLAGS)
|
2026-07-20 16:21:56 +02:00
|
|
|
AC_SUBST(CPPFLAGS)
|
|
|
|
|
AC_SUBST(CXX)
|
|
|
|
|
AC_SUBST(CXXFLAGS)
|
build: per-file automatic dependencies (.deps), retire the Depend/sed machinery
Replace the monolithic per-directory `Depend` file -- generated by a separate,
serial `make depend` pass (one `gcc -MM` over all sources) and post-processed by
sed -- with automake-style per-file dependency fragments produced as a side
effect of each compile.
rules.mak's %.o rule now adds, when the compiler supports it,
-MMD -MP -MF .deps/<stem>.d
so every object records the (non-system) headers it used. Those fragments are
`-include`d best-effort: absent on a first build, present and correct after.
Benefits:
* self-maintaining -- no explicit depend step; deps refresh on every compile;
* parallel -- generated during the (already parallel) compile, no barrier;
* -MMD already drops system headers (what the sed did) and -MP tolerates a
removed/renamed header, so the sed post-processing is gone;
* fixes out-of-tree incremental header tracking: with an absolute srcdir the
old sed stripped the now-absolute *local* header paths too, silently losing
them; the .d files keep them.
configure probes `-MMD -MP` (AUTODEP_FLAGS; empty and best-effort-skipped if the
compiler cannot). clean/distclean remove .deps (rm -r); .gitignore replaces the
obsolete */Depend with .deps/. `make depend` is kept as a no-op for callers that
still invoke it (e.g. the WASM build script).
Verified out-of-tree (--disable-ccache): 324 .d files, 0 Depend files, a header
touch recompiles its dependents, no-op rebuild is idle, clean clears .deps. (The
top-level depend phase still runs here as a no-op; removed next.)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 16:47:29 +02:00
|
|
|
AC_SUBST(AUTODEP_FLAGS)
|
2017-04-25 14:41:48 +02:00
|
|
|
AC_SUBST(SHLIB_CFLAGS)
|
2026-07-20 16:21:56 +02:00
|
|
|
AC_SUBST(LDFLAGS)
|
2017-04-25 14:41:48 +02:00
|
|
|
AC_SUBST(LD_RUN_PATH)
|
2017-08-25 20:13:30 +02:00
|
|
|
AC_SUBST(MCPP)
|
2020-02-19 20:25:58 +01:00
|
|
|
AC_SUBST(MSED)
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
AC_SUBST(OA)
|
|
|
|
|
AC_SUBST(OA_LIBS)
|
|
|
|
|
|
|
|
|
|
AC_SUBST(ALL_TARGET)
|
|
|
|
|
AC_SUBST(INSTALL_TARGET)
|
|
|
|
|
|
2024-10-08 09:08:25 +02:00
|
|
|
AC_SUBST(MAKE_TCL, [$usingTcl])
|
|
|
|
|
AC_SUBST(MAKE_X11, [$usingX11])
|
|
|
|
|
AC_SUBST(MAKE_GL, [$usingOGL])
|
|
|
|
|
AC_SUBST(MAKE_GLU, [$usingGLU])
|
|
|
|
|
AC_SUBST(MAKE_CAIRO, [$usingCairo])
|
|
|
|
|
AC_SUBST(MAKE_READLINE, [$use_bundled_readline])
|
|
|
|
|
|
build: make configure relocatable (out-of-tree)
Enable `mkdir build; cd build; ../configure` to run entirely in the build
directory, with generated config landing there instead of in the source
tree. This is the autoconf-layer groundwork for a full VPATH build; the
make layer (defs.mak/rules.mak VPATH support, per-dir orchestration) is
still to come, so an out-of-tree `make` is not yet expected to work.
Changes:
* configure (wrapper): run the generated config.status in the *current*
directory with --srcdir pointing back at the source tree (instead of
`cd scripts`), so outputs land in the build dir. Uses an absolute
basedir so any build-dir location works, not just a subdir of srcdir.
* scripts/configure.in:
- AC_CONFIG_AUX_DIR(.) -> AC_CONFIG_AUX_DIR(scripts). Once srcdir
resolves to the true top (scripts' parent, where rules.mak lives),
autoconf searches for install-sh/config.sub/... relative to srcdir;
"." pointed at the wrong place and out-of-tree configure died with
"cannot find install-sh".
- Name the .in templates explicitly
(defs.mak:scripts/defs.mak.in, scripts/makedbh:scripts/makedbh.in)
so config.status finds them from a separate build dir. defs.mak is
written to the build top; makedbh under build/scripts/ to match
${SCRIPTS}/makedbh.
- Drop the trailing `cp defs.mak ..`; defs.mak is now generated in the
build top directly, and from a build dir the copy would clobber the
source tree's defs.mak.
* scripts/configure: regenerated with autoconf 2.69.
Verified: out-of-tree `../configure` completes rc=0, writes defs.mak /
scripts/makedbh / config.status into the build dir, records
srcdir=<source top>, and leaves the source tree's tracked files and
generated defs.mak/makedbh untouched.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:20:59 +02:00
|
|
|
dnl Name the .in templates explicitly (relative to srcdir) so config.status can
|
|
|
|
|
dnl find them when run from a separate build directory. Outputs land in the
|
|
|
|
|
dnl build directory (config.status' CWD): defs.mak at the build top, makedbh
|
|
|
|
|
dnl under build/scripts/ (matching ${SCRIPTS}/makedbh = ${MAGICDIR}/scripts).
|
build: top Makefile.in + build-dir orchestration (out-of-tree)
Make a plain `make` in a build directory build every module into the
build tree. The top Makefile becomes a configure-generated Makefile.in,
and each recursion drives a build subdirectory (created on demand) using
the module Makefile from the source tree.
Makefile -> Makefile.in (config.status generates Makefile in the build
top via AC_CONFIG_FILES([Makefile:Makefile.in])):
* Add MAGICSRC = @abs_top_srcdir@; read VERSION and re-run configure from
${MAGICSRC}.
* Every descent `(cd $$dir && ${MAKE} <goal>)` and `${MAKE} -C $(dir $@)
<goal>` becomes:
mkdir -p <builddir> && ${MAKE} -C <builddir> \
-f ${MAGICSRC}/<dir>/Makefile <goal>
so the build subdir need not pre-exist and the source Makefile is used.
Applied to modules/libs/depend pattern rules and the
tcllibrary/mains/techs/install/clean loops.
* database/database.h: generate from ${MAGICSRC}/.../database.h.in into
the build tree (mkdir -p database), via the generated build-tree
${MAGICDIR}/scripts/makedbh.
* install-dirs/install-tcl-dirs use ${SCRIPTS}/mkdirs (now source-tree);
clean skips absent build subdirs; distclean/dist/tags updated for the
split source/build layout.
scripts/defs.mak.in:
* SCRIPTS now points at the source tree (${MAGICSRC}/scripts) for the
static helpers (mkdirs, printmans, ...); the one generated helper,
makedbh, is referenced directly at ${MAGICDIR}/scripts (build tree).
* Guard VPATH so it is set only inside module subdirectories, never at
the build top -- a top-level VPATH into the source tree could let a
stale source database/database.h shadow the build-tree copy.
scripts/configure.in: AC_CONFIG_FILES([Makefile:Makefile.in]); regenerated
scripts/configure.
Verified out-of-tree: `../configure && make modules && make libs` builds
all 33 module libraries (lib*.o and lib*.a) plus the generated
database/database.h into the build tree, with no errors and the source
tree left clean. A full `make` (link the magic program, build techs)
still needs the later outlier fixes (magic/, scmos/, ...).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:42:35 +02:00
|
|
|
AC_CONFIG_FILES([Makefile:Makefile.in])
|
build: make configure relocatable (out-of-tree)
Enable `mkdir build; cd build; ../configure` to run entirely in the build
directory, with generated config landing there instead of in the source
tree. This is the autoconf-layer groundwork for a full VPATH build; the
make layer (defs.mak/rules.mak VPATH support, per-dir orchestration) is
still to come, so an out-of-tree `make` is not yet expected to work.
Changes:
* configure (wrapper): run the generated config.status in the *current*
directory with --srcdir pointing back at the source tree (instead of
`cd scripts`), so outputs land in the build dir. Uses an absolute
basedir so any build-dir location works, not just a subdir of srcdir.
* scripts/configure.in:
- AC_CONFIG_AUX_DIR(.) -> AC_CONFIG_AUX_DIR(scripts). Once srcdir
resolves to the true top (scripts' parent, where rules.mak lives),
autoconf searches for install-sh/config.sub/... relative to srcdir;
"." pointed at the wrong place and out-of-tree configure died with
"cannot find install-sh".
- Name the .in templates explicitly
(defs.mak:scripts/defs.mak.in, scripts/makedbh:scripts/makedbh.in)
so config.status finds them from a separate build dir. defs.mak is
written to the build top; makedbh under build/scripts/ to match
${SCRIPTS}/makedbh.
- Drop the trailing `cp defs.mak ..`; defs.mak is now generated in the
build top directly, and from a build dir the copy would clobber the
source tree's defs.mak.
* scripts/configure: regenerated with autoconf 2.69.
Verified: out-of-tree `../configure` completes rc=0, writes defs.mak /
scripts/makedbh / config.status into the build dir, records
srcdir=<source top>, and leaves the source tree's tracked files and
generated defs.mak/makedbh untouched.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:20:59 +02:00
|
|
|
AC_CONFIG_FILES([defs.mak:scripts/defs.mak.in])
|
|
|
|
|
AC_CONFIG_FILES([scripts/makedbh:scripts/makedbh.in], [chmod +x scripts/makedbh])
|
2026-07-22 21:11:10 +02:00
|
|
|
dnl rules.mak is included straight from the source tree (${MAGICSRC}/rules.mak),
|
|
|
|
|
dnl so it is NOT copied into the build top. Only defs.mak (which has @...@
|
|
|
|
|
dnl substitutions) is generated there.
|
build: generate <magic/autoconf/config.h> from configure
Emit an autoconf config header carrying every autoconf define -- at least
all the -D options that appear on the compiler command lines, plus
anything else configure knows -- available to the tree as
#include <magic/autoconf/config.h>
It is built directly from confdefs.h just before AC_OUTPUT (which removes
that file), NOT via AC_CONFIG_HEADERS. This is deliberate:
* AC_CONFIG_HEADERS would rewrite @DEFS@ to -DHAVE_CONFIG_H and move the
defines into the header, changing every compiler command line and
breaking the build until sources #include it. Building from confdefs.h
leaves @DEFS@ (and the whole build) exactly as-is, so the header is a
pure additional artifact with no consumers yet.
* confdefs.h already holds every AC_DEFINE, including the many that have
no autoheader template (CALMA_MODULE, HAVE_READLINE, ...), which
AC_CONFIG_HEADERS/autoheader would have dropped.
Location mirrors the generated database.h (defs.mak GENINC): magic/autoconf/
config.h at the build top when in-tree (build dir == source dir), else
include/magic/autoconf/config.h so the clean -I include/ rule finds it and
the raw build dir stays off the search path. The directory is created on
demand and the header is rewritten on every ./configure. No defs.mak.in
change is needed -- the existing -I${GENINC} already resolves it.
.gitignore: ignore the in-tree magic/autoconf/config.h (out-of-tree it is
under the build dir and already ignored).
Verified: out-of-tree writes include/magic/autoconf/config.h, in-tree
writes magic/autoconf/config.h; both contain the command-line defines
(SIZEOF_VOID_P, CALMA_MODULE, HAVE_*, ...); #include <magic/autoconf/
config.h> resolves via -I${GENINC} from a subdir; @DEFS@ is unchanged
(-DHAVE_CONFIG_H absent) and modules still build.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 18:14:06 +02:00
|
|
|
|
2026-07-22 18:59:46 +02:00
|
|
|
dnl Per-module Makefiles (Makefile.in migration). Each converted module lists
|
|
|
|
|
dnl its Makefile here; config.status creates the build subdir and the Makefile.
|
|
|
|
|
AC_CONFIG_FILES([tiles/Makefile:tiles/Makefile.in])
|
2026-07-22 19:02:58 +02:00
|
|
|
AC_CONFIG_FILES([bplane/Makefile:bplane/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([calma/Makefile:calma/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([cif/Makefile:cif/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([cmwind/Makefile:cmwind/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([dbwind/Makefile:dbwind/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([debug/Makefile:debug/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([drc/Makefile:drc/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([extflat/Makefile:extflat/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([extract/Makefile:extract/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([garouter/Makefile:garouter/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([gcr/Makefile:gcr/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([grouter/Makefile:grouter/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([irouter/Makefile:irouter/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([mzrouter/Makefile:mzrouter/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([netmenu/Makefile:netmenu/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([plow/Makefile:plow/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([resis/Makefile:resis/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([select/Makefile:select/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([sim/Makefile:sim/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([textio/Makefile:textio/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([wiring/Makefile:wiring/Makefile.in])
|
2026-07-22 19:29:06 +02:00
|
|
|
AC_CONFIG_FILES([utils/Makefile:utils/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([windows/Makefile:windows/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([commands/Makefile:commands/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([database/Makefile:database/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([lef/Makefile:lef/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([plot/Makefile:plot/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([router/Makefile:router/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([ext2spice/Makefile:ext2spice/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([ext2sim/Makefile:ext2sim/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([extcheck/Makefile:extcheck/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([net2ir/Makefile:net2ir/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([graphics/Makefile:graphics/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([oa/Makefile:oa/Makefile.in])
|
2026-07-22 20:30:10 +02:00
|
|
|
AC_CONFIG_FILES([magic/Makefile:magic/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([tcltk/Makefile:tcltk/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([scmos/Makefile:scmos/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([doc/Makefile:doc/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([lisp/Makefile:lisp/Makefile.in])
|
2026-07-22 20:38:15 +02:00
|
|
|
AC_CONFIG_FILES([scmos/cif_template/Makefile:scmos/cif_template/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([doc/man/Makefile:doc/man/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([doc/tutcells/Makefile:doc/tutcells/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([doc/html/Makefile:doc/html/Makefile.in])
|
|
|
|
|
AC_CONFIG_FILES([doc/latexfiles/Makefile:doc/latexfiles/Makefile.in])
|
2026-07-22 18:59:46 +02:00
|
|
|
|
build: generate <magic/autoconf/config.h> from configure
Emit an autoconf config header carrying every autoconf define -- at least
all the -D options that appear on the compiler command lines, plus
anything else configure knows -- available to the tree as
#include <magic/autoconf/config.h>
It is built directly from confdefs.h just before AC_OUTPUT (which removes
that file), NOT via AC_CONFIG_HEADERS. This is deliberate:
* AC_CONFIG_HEADERS would rewrite @DEFS@ to -DHAVE_CONFIG_H and move the
defines into the header, changing every compiler command line and
breaking the build until sources #include it. Building from confdefs.h
leaves @DEFS@ (and the whole build) exactly as-is, so the header is a
pure additional artifact with no consumers yet.
* confdefs.h already holds every AC_DEFINE, including the many that have
no autoheader template (CALMA_MODULE, HAVE_READLINE, ...), which
AC_CONFIG_HEADERS/autoheader would have dropped.
Location mirrors the generated database.h (defs.mak GENINC): magic/autoconf/
config.h at the build top when in-tree (build dir == source dir), else
include/magic/autoconf/config.h so the clean -I include/ rule finds it and
the raw build dir stays off the search path. The directory is created on
demand and the header is rewritten on every ./configure. No defs.mak.in
change is needed -- the existing -I${GENINC} already resolves it.
.gitignore: ignore the in-tree magic/autoconf/config.h (out-of-tree it is
under the build dir and already ignored).
Verified: out-of-tree writes include/magic/autoconf/config.h, in-tree
writes magic/autoconf/config.h; both contain the command-line defines
(SIZEOF_VOID_P, CALMA_MODULE, HAVE_*, ...); #include <magic/autoconf/
config.h> resolves via -I${GENINC} from a subdir; @DEFS@ is unchanged
(-DHAVE_CONFIG_H absent) and modules still build.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 18:14:06 +02:00
|
|
|
dnl Emit an autoconf config header, available to the tree as
|
|
|
|
|
dnl #include <magic/autoconf/config.h>
|
|
|
|
|
dnl It carries every autoconf define (i.e. at least all the -D options that
|
|
|
|
|
dnl appear on the compiler command lines, plus anything else configure knows).
|
|
|
|
|
dnl We build it here, from confdefs.h, rather than via AC_CONFIG_HEADERS on
|
|
|
|
|
dnl purpose: that keeps @DEFS@ (hence the command lines and the whole build)
|
|
|
|
|
dnl exactly as-is, so the header is a pure additional artifact with no consumers
|
|
|
|
|
dnl yet. confdefs.h holds every AC_DEFINE and is still present at this point
|
|
|
|
|
dnl (AC_OUTPUT removes it), so it must run before AC_OUTPUT.
|
|
|
|
|
dnl
|
|
|
|
|
dnl Location mirrors the generated database.h (see defs.mak GENINC): at the
|
|
|
|
|
dnl build top when in-tree (build dir == source dir), else under a clean
|
|
|
|
|
dnl include/ subdir so the -I include/ rule finds <magic/autoconf/config.h> and
|
|
|
|
|
dnl the raw build dir is never on the search path. Regenerated on every
|
|
|
|
|
dnl ./configure; the directory is created on demand.
|
|
|
|
|
if test "`cd $srcdir && pwd`" = "`pwd`" ; then
|
|
|
|
|
magic_config_header=magic/autoconf/config.h
|
|
|
|
|
else
|
|
|
|
|
magic_config_header=include/magic/autoconf/config.h
|
|
|
|
|
fi
|
|
|
|
|
mkdir -p "`dirname $magic_config_header`"
|
|
|
|
|
{
|
|
|
|
|
echo "/* $magic_config_header -- generated by configure; DO NOT EDIT. */"
|
|
|
|
|
echo "/* Every autoconf define (>= all -D options on the compiler lines). */"
|
|
|
|
|
echo "#ifndef _MAGIC_AUTOCONF_CONFIG_H"
|
|
|
|
|
echo "#define _MAGIC_AUTOCONF_CONFIG_H 1"
|
|
|
|
|
grep '^#define ' confdefs.h | sort -u
|
|
|
|
|
echo "#endif /* _MAGIC_AUTOCONF_CONFIG_H */"
|
|
|
|
|
} > "$magic_config_header"
|
|
|
|
|
AC_MSG_NOTICE([created config header $magic_config_header])
|
|
|
|
|
|
2023-08-29 21:43:11 +02:00
|
|
|
AC_OUTPUT
|
2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
dnl
|
|
|
|
|
dnl Print configuration and report problems
|
|
|
|
|
|
|
|
|
|
ECHO_N=printf
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
echo "-----------------------------------------------------------"
|
|
|
|
|
echo "Configuration Summary (principle requirements):"
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
|
|
${ECHO_N} "X11: "
|
|
|
|
|
if test $usingX11 ; then
|
|
|
|
|
echo "yes"
|
|
|
|
|
else
|
|
|
|
|
echo "no"
|
|
|
|
|
echo
|
|
|
|
|
echo " Magic requires X11 for all graphics operations. Without it,"
|
|
|
|
|
echo " magic can only be run in batch mode using option '-dnull'."
|
|
|
|
|
echo " Generally, not finding X11 means that paths to header files"
|
|
|
|
|
echo " and/or libraries are missing or in an unexpected place. Try"
|
|
|
|
|
echo " using configure options --x-includes=<DIR> and --x-libraries=<DIR>."
|
|
|
|
|
echo
|
|
|
|
|
fi
|
|
|
|
|
|
2020-02-19 20:25:58 +01:00
|
|
|
${ECHO_N} "Python3: "
|
|
|
|
|
if test $usingPython3 ; then
|
|
|
|
|
echo "yes"
|
|
|
|
|
else
|
|
|
|
|
echo "no"
|
|
|
|
|
echo
|
|
|
|
|
echo " Magic installation will use the gcc preprocessor for forming"
|
|
|
|
|
echo " the default SCMOS technology files and the macro definitions."
|
|
|
|
|
echo " This usually works, but in case of preprocessor failure, you"
|
|
|
|
|
echo " may need python3 installed."
|
|
|
|
|
echo
|
|
|
|
|
fi
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
${ECHO_N} "OpenGL: "
|
|
|
|
|
if test $usingOGL ; then
|
|
|
|
|
echo "yes"
|
|
|
|
|
${ECHO_N} "Vector fonts: "
|
|
|
|
|
if test "x$use_libglu" != "x" ; then
|
|
|
|
|
echo "yes"
|
|
|
|
|
else
|
|
|
|
|
echo "no"
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
echo "no"
|
|
|
|
|
echo
|
2020-02-19 20:25:58 +01:00
|
|
|
if test $usingCairo ; then
|
|
|
|
|
echo " Cairo graphics are available so OpenGL is purely optional."
|
|
|
|
|
else
|
|
|
|
|
echo " OpenGL graphics are considerably better than the standard 8-bit"
|
|
|
|
|
echo " and 24-bit X11 graphics, provided that you have a video card and"
|
|
|
|
|
echo " driver supporting accelerated OpenGL graphics. If you get this"
|
|
|
|
|
echo " message, you may need to download OpenGL libraries and header"
|
|
|
|
|
echo " files, which are usually available from the video card manufacturer."
|
|
|
|
|
echo " Magic with un-accelerated OpenGL, such as using Mesa GL without"
|
|
|
|
|
echo " a supported graphics card, is usually a very bad combination."
|
|
|
|
|
echo
|
|
|
|
|
fi
|
2017-04-25 14:41:48 +02:00
|
|
|
fi
|
|
|
|
|
|
2017-08-02 04:14:42 +02:00
|
|
|
${ECHO_N} "Cairo: "
|
|
|
|
|
if test $usingCairo ; then
|
|
|
|
|
echo "yes"
|
|
|
|
|
else
|
|
|
|
|
echo "no"
|
|
|
|
|
echo
|
2020-02-19 20:25:58 +01:00
|
|
|
if test $usingOGL ; then
|
|
|
|
|
echo " OpenGL graphics are available so Cairo is purely optional"
|
|
|
|
|
echo " unless there are issues with the video card driver's"
|
|
|
|
|
echo " implementation of OpenGL."
|
|
|
|
|
else
|
|
|
|
|
echo " Cairo graphics are considerably better than the standard 8-bit"
|
|
|
|
|
echo " and 24-bit X11 graphics, provided that you have a video card and"
|
|
|
|
|
echo " driver supporting hardware-accelerated graphics. If you get this"
|
|
|
|
|
echo " message, you may need to download Cairo and fontconfig libraries"
|
|
|
|
|
echo " and header files, which are usually found in package cairo-devel."
|
|
|
|
|
echo
|
|
|
|
|
fi
|
2017-08-02 04:14:42 +02:00
|
|
|
fi
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
if test $usingTcl ; then
|
|
|
|
|
${ECHO_N} "Tcl/Tk: "
|
|
|
|
|
echo "yes"
|
|
|
|
|
else
|
|
|
|
|
if test $usingScheme ; then
|
|
|
|
|
${ECHO_N} "Scheme: "
|
|
|
|
|
echo "yes"
|
|
|
|
|
else
|
|
|
|
|
${ECHO_N} "Tcl/Tk: "
|
|
|
|
|
echo "no"
|
|
|
|
|
echo
|
|
|
|
|
echo " Without Tcl/Tk, you cannot run the enhanced version of magic"
|
|
|
|
|
echo " with the toolbar and menus, and a number of other functions"
|
|
|
|
|
echo " are disabled. If you did not specifically disable Tcl/Tk on"
|
|
|
|
|
echo " the configure command line, then getting this message means"
|
|
|
|
|
echo " that you do not have Tcl/Tk headers and or libraries installed,"
|
|
|
|
|
echo " or they are not in a standard path. Try using configure options"
|
|
|
|
|
echo " --with-tcl=<DIR> and --with-tk=<DIR>."
|
|
|
|
|
echo
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2026-07-22 17:02:51 +02:00
|
|
|
${ECHO_N} "LaTeX docs: "
|
|
|
|
|
if test "x${DOCS_TARGET}" != "x" ; then
|
|
|
|
|
echo "yes"
|
|
|
|
|
else
|
|
|
|
|
echo "no (install 'latex' and 'dvips' to regenerate documentation)"
|
|
|
|
|
fi
|
|
|
|
|
|
2017-04-25 14:41:48 +02:00
|
|
|
echo "-----------------------------------------------------------"
|
|
|
|
|
echo
|
|
|
|
|
echo "Use 'make' to compile and 'make install' to install."
|
|
|
|
|
echo
|
|
|
|
|
echo "-----------------------------------------------------------"
|
|
|
|
|
echo
|
|
|
|
|
|
build: make configure relocatable (out-of-tree)
Enable `mkdir build; cd build; ../configure` to run entirely in the build
directory, with generated config landing there instead of in the source
tree. This is the autoconf-layer groundwork for a full VPATH build; the
make layer (defs.mak/rules.mak VPATH support, per-dir orchestration) is
still to come, so an out-of-tree `make` is not yet expected to work.
Changes:
* configure (wrapper): run the generated config.status in the *current*
directory with --srcdir pointing back at the source tree (instead of
`cd scripts`), so outputs land in the build dir. Uses an absolute
basedir so any build-dir location works, not just a subdir of srcdir.
* scripts/configure.in:
- AC_CONFIG_AUX_DIR(.) -> AC_CONFIG_AUX_DIR(scripts). Once srcdir
resolves to the true top (scripts' parent, where rules.mak lives),
autoconf searches for install-sh/config.sub/... relative to srcdir;
"." pointed at the wrong place and out-of-tree configure died with
"cannot find install-sh".
- Name the .in templates explicitly
(defs.mak:scripts/defs.mak.in, scripts/makedbh:scripts/makedbh.in)
so config.status finds them from a separate build dir. defs.mak is
written to the build top; makedbh under build/scripts/ to match
${SCRIPTS}/makedbh.
- Drop the trailing `cp defs.mak ..`; defs.mak is now generated in the
build top directly, and from a build dir the copy would clobber the
source tree's defs.mak.
* scripts/configure: regenerated with autoconf 2.69.
Verified: out-of-tree `../configure` completes rc=0, writes defs.mak /
scripts/makedbh / config.status into the build dir, records
srcdir=<source top>, and leaves the source tree's tracked files and
generated defs.mak/makedbh untouched.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 14:20:59 +02:00
|
|
|
dnl "defs.mak" is now generated directly into the build top (config.status'
|
|
|
|
|
dnl CWD), so the old `cp defs.mak ..` is gone -- from a separate build directory
|
|
|
|
|
dnl it would clobber the source tree's copy.
|