📄 tcl.m4
字号:
# SHLIB_LD_LIBS# LIBS# AR# RC# RES## MAKE_LIB# MAKE_EXE# MAKE_DLL## LIBSUFFIX# LIBPREFIX# LIBRARIES# EXESUFFIX# DLLSUFFIX##--------------------------------------------------------------------AC_DEFUN(SC_CONFIG_CFLAGS, [ # Step 0: Enable 64 bit support? AC_MSG_CHECKING([if 64bit support is requested]) AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no]) AC_MSG_RESULT($do64bit) # Set some defaults (may get changed below) EXTRA_CFLAGS="" AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo) # Check for a bug in gcc's windres that causes the # compile to fail when a Windows native path is # passed into windres. The mingw toolchain requires # Windows native paths while Cygwin should work # with both. Avoid the bug by passing a POSIX # path when using the Cygwin toolchain. if test "$GCC" = "yes" && test "$CYGPATH" != "echo" ; then conftest=/tmp/conftest.rc echo "STRINGTABLE BEGIN" > $conftest echo "101 \"name\"" >> $conftest echo "END" >> $conftest AC_MSG_CHECKING([for Windows native path bug in windres]) cyg_conftest=`$CYGPATH $conftest` if AC_TRY_COMMAND($RC -o conftest.res.o $cyg_conftest) ; then AC_MSG_RESULT([no]) else AC_MSG_RESULT([yes]) CYGPATH=echo fi conftest= cyg_conftest= fi if test "$CYGPATH" = "echo" || test "$ac_cv_cygwin" = "yes"; then DEPARG='"$<"' else DEPARG='"$(shell $(CYGPATH) $<)"' fi # set various compiler flags depending on whether we are using gcc or cl AC_MSG_CHECKING([compiler flags]) if test "${GCC}" = "yes" ; then if test "$do64bit" = "yes" ; then AC_MSG_WARN("64bit mode not supported with GCC on Windows") fi SHLIB_LD="" SHLIB_LD_LIBS="" LIBS="" LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32" STLIB_LD='${AR} cr' RC_OUT=-o RC_TYPE= RC_INCLUDE=--include RC_DEFINE=--define RES=res.o MAKE_LIB="\${STLIB_LD} \[$]@" POST_MAKE_LIB="\${RANLIB} \[$]@" MAKE_EXE="\${CC} -o \[$]@" LIBPREFIX="lib" #if test "$ac_cv_cygwin" = "yes"; then # extra_cflags="-mno-cygwin" # extra_ldflags="-mno-cygwin" #else # extra_cflags="" # extra_ldflags="" #fi if test "$ac_cv_cygwin" = "yes"; then touch ac$$.c if ${CC} -c -mwin32 ac$$.c >/dev/null 2>&1; then case "$extra_cflags" in *-mwin32*) ;; *) extra_cflags="-mwin32 $extra_cflags" ;; esac case "$extra_ldflags" in *-mwin32*) ;; *) extra_ldflags="-mwin32 $extra_ldflags" ;; esac fi rm -f ac$$.o ac$$.c else extra_cflags='' extra_ldflags='' fi if test "${SHARED_BUILD}" = "0" ; then # static AC_MSG_RESULT([using static flags]) runtime= MAKE_DLL="echo " LIBSUFFIX="s\${DBGX}.a" LIBRARIES="\${STATIC_LIBRARIES}" EXESUFFIX="s\${DBGX}.exe" else # dynamic AC_MSG_RESULT([using shared flags]) # ad-hoc check to see if CC supports -shared. if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then AC_MSG_ERROR([${CC} does not support the -shared option. You will need to upgrade to a newer version of the toolchain.]) fi runtime= # Link with gcc since ld does not link to default libs like # -luser32 and -lmsvcrt by default. Make sure CFLAGS is # included so -mno-cygwin passed the correct libs to the linker. SHLIB_LD='${CC} -shared ${CFLAGS}' # Add SHLIB_LD_LIBS to the Make rule, not here. MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags} \ -Wl,--out-implib,\$(patsubst %.dll,lib%.a,\[$]@)" LIBSUFFIX="\${DBGX}.a" EXESUFFIX="\${DBGX}.exe" LIBRARIES="\${SHARED_LIBRARIES}" fi # DLLSUFFIX is separate because it is the building block for # users of tclConfig.sh that may build shared or static. DLLSUFFIX="\${DBGX}.dll" EXTRA_CFLAGS="${extra_cflags}" CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE= CFLAGS_WARNING="-Wall -Wconversion" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= # Specify the CC output file names based on the target name CC_OBJNAME="-o \[$]@" CC_EXENAME="-o \[$]@" # Specify linker flags depending on the type of app being # built -- Console vs. Window. # # ORIGINAL COMMENT: # We need to pass -e _WinMain@16 so that ld will use # WinMain() instead of main() as the entry point. We can't # use autoconf to check for this case since it would need # to run an executable and that does not work when # cross compiling. Remove this -e workaround once we # require a gcc that does not have this bug. # # MK NOTE: Tk should use a different mechanism. This causes # interesting problems, such as wish dying at startup. #LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}" LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" else if test "${SHARED_BUILD}" = "0" ; then # static AC_MSG_RESULT([using static flags]) runtime=-MT MAKE_DLL="echo " LIBSUFFIX="s\${DBGX}.lib" LIBRARIES="\${STATIC_LIBRARIES}" EXESUFFIX="s\${DBGX}.exe" else # dynamic AC_MSG_RESULT([using shared flags]) runtime=-MD # Add SHLIB_LD_LIBS to the Make rule, not here. MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\[$]@" LIBSUFFIX="\${DBGX}.lib" EXESUFFIX="\${DBGX}.exe" LIBRARIES="\${SHARED_LIBRARIES}" fi # DLLSUFFIX is separate because it is the building block for # users of tclConfig.sh that may build shared or static. DLLSUFFIX="\${DBGX}.dll" # This is a 2-stage check to make sure we have the 64-bit SDK # We have to know where the SDK is installed. if test "$do64bit" = "yes" ; then if test "x${MSSDK}x" = "xx" ; then MSSDK="C:/Progra~1/Microsoft SDK" fi # In order to work in the tortured autoconf environment, # we need to ensure that this path has no spaces MSSDK=$(cygpath -w -s "$MSSDK" | sed -e 's!\\!/!g') if test ! -d "${MSSDK}/bin/win64" ; then AC_MSG_WARN("could not find 64-bit SDK to enable 64bit mode") do64bit="no" fi fi if test "$do64bit" = "yes" ; then # All this magic is necessary for the Win64 SDK RC1 - hobbs CC="${MSSDK}/Bin/Win64/cl.exe \ -I${MSSDK}/Include/prerelease \ -I${MSSDK}/Include/Win64/crt \ -I${MSSDK}/Include/Win64/crt/sys \ -I${MSSDK}/Include" RC="${MSSDK}/bin/rc.exe" CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -Gs ${runtime}" lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \ -LIBPATH:${MSSDK}/Lib/Prerelease/IA64" STLIB_LD="${MSSDK}/bin/win64/lib.exe -nologo ${lflags}" LINKBIN="${MSSDK}/bin/win64/link.exe ${lflags}" else RC="rc" CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d" CFLAGS_OPTIMIZE="-nologo -Oti -Gs -GD ${runtime}" STLIB_LD="lib -nologo" LINKBIN="link -link50compat" fi SHLIB_LD="${LINKBIN} -dll -nologo -incremental:no" SHLIB_LD_LIBS="user32.lib advapi32.lib" LIBS="user32.lib advapi32.lib" LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib" RC_OUT=-fo RC_TYPE=-r RC_INCLUDE=-i RC_DEFINE=-d RES=res MAKE_LIB="\${STLIB_LD} -out:\[$]@" POST_MAKE_LIB= MAKE_EXE="\${CC} -Fe\[$]@" LIBPREFIX="" EXTRA_CFLAGS="-YX" CFLAGS_WARNING="-W3" LDFLAGS_DEBUG="-debug:full -debugtype:both" LDFLAGS_OPTIMIZE="-release" # Specify the CC output file names based on the target name CC_OBJNAME="-Fo\[$]@" CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\[$]@')\"" # Specify linker flags depending on the type of app being # built -- Console vs. Window. LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi # DL_LIBS is empty, but then we match the Unix version AC_SUBST(DL_LIBS) AC_SUBST(CFLAGS_DEBUG) AC_SUBST(CFLAGS_OPTIMIZE) AC_SUBST(CFLAGS_WARNING)])#------------------------------------------------------------------------# SC_WITH_TCL --## Location of the Tcl build directory.## Arguments:# none## Results:## Adds the following arguments to configure:# --with-tcl=...## Defines the following vars:# TCL_BIN_DIR Full path to the tcl build dir.#------------------------------------------------------------------------AC_DEFUN(SC_WITH_TCL, [ if test -d ../../tcl8.4$1/win; then TCL_BIN_DEFAULT=../../tcl8.4$1/win else TCL_BIN_DEFAULT=../../tcl8.4/win fi AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.4 binaries from DIR], TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DEFAULT; pwd`) if test ! -d $TCL_BIN_DIR; then AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist) fi if test ! -f $TCL_BIN_DIR/Makefile; then AC_MSG_ERROR(There is no Makefile in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?) else echo "building against Tcl binaries in: $TCL_BIN_DIR" fi AC_SUBST(TCL_BIN_DIR)])# FIXME : SC_PROG_TCLSH should really look for the installed tclsh and# not the build version. If we want to use the build version in the# tk script, it is better to hardcode that!#------------------------------------------------------------------------# SC_PROG_TCLSH# Locate a tclsh shell in the following directories:# ${exec_prefix}/bin# ${prefix}/bin# ${TCL_BIN_DIR}# ${TCL_BIN_DIR}/../bin# ${PATH}## Arguments# none## Results# Subst's the following values:# TCLSH_PROG#------------------------------------------------------------------------AC_DEFUN(SC_PROG_TCLSH, [ AC_MSG_CHECKING([for tclsh]) AC_CACHE_VAL(ac_cv_path_tclsh, [ search_path=`echo ${exec_prefix}/bin:${prefix}/bin:${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/tclsh[[8-9]]*.exe 2> /dev/null` \ `ls -r $dir/tclsh* 2> /dev/null` ; do if test x"$ac_cv_path_tclsh" = x ; then if test -f "$j" ; then ac_cv_path_tclsh=$j break fi fi done done ]) if test -f "$ac_cv_path_tclsh" ; then TCLSH_PROG="$ac_cv_path_tclsh" AC_MSG_RESULT($TCLSH_PROG) elif test -f "$TCL_BIN_DIR/tclConfig.sh" ; then # One-tree build. ac_cv_path_tclsh="$TCL_BIN_DIR/tclsh" TCLSH_PROG="$ac_cv_path_tclsh" AC_MSG_RESULT($TCLSH_PROG) else AC_MSG_ERROR(No tclsh found in PATH: $search_path) fi AC_SUBST(TCLSH_PROG)])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -