Diff

Differences From Artifact [c33a095bf7]:

To Artifact [274d569e46]:


     2      2   	AC_MSG_CHECKING([path to tcl])
     3      3   	AC_ARG_WITH(tcl, AC_HELP_STRING([--with-tcl], [directory containing tcl configuration (tclConfig.sh)]), [], [
     4      4   		with_tcl="auto"
     5      5   	])
     6      6   
     7      7   	if test "${with_tcl}" = "auto"; then
     8      8   		for dir in `echo "${PATH}" | sed 's@:@ @g'`; do
            9  +			if test -f "${dir}/tclConfig.sh"; then
           10  +				tclconfigshdir="${dir}"
           11  +				tclconfigsh="${tclconfigshdir}/tclConfig.sh"
           12  +				break
           13  +			fi
     9     14   			if test -f "${dir}/../lib/tclConfig.sh"; then
    10         -				tclconfigsh="${dir}/../lib/tclConfig.sh"
           15  +				tclconfigshdir="${dir}/../lib"
           16  +				tclconfigsh="${tclconfigshdir}/tclConfig.sh"
    11     17   				break
    12     18   			fi
    13     19   			if test -f "${dir}/../lib64/tclConfig.sh"; then
    14         -				tclconfigsh="${dir}/../lib64/tclConfig.sh"
           20  +				tclconfigshdir="${dir}/../lib64"
           21  +				tclconfigsh="${tclconfigshdir}/tclConfig.sh"
    15     22   				break
    16     23   			fi
    17     24   		done
    18     25   
    19     26   		if test -z "${tclconfigsh}"; then
    20     27   			AC_MSG_ERROR([Unable to find tclConfig.sh])
    21     28   		fi
    22     29   	else
    23         -		tclconfigsh="${with_tcl}/tclConfig.sh"
           30  +		tclconfigshdir="${with_tcl}"
           31  +		tclconfigsh="${tclconfigshdir}/tclConfig.sh"
    24     32   	fi
    25     33   
    26     34   	if test -f "${tclconfigsh}"; then
    27     35   		source "${tclconfigsh}"
    28     36   
    29         -		CFLAGS="${CFLAGS} ${TCL_INCLUDE_SPEC} -I${TCL_SRC_DIR}/generic -I${TCL_SRC_DIR}/unix"
    30         -		CPPFLAGS="${CPPFLAGS} ${TCL_INCLUDE_SPEC} -I${TCL_SRC_DIR}/generic -I${TCL_SRC_DIR}/unix"
           37  +		CFLAGS="${CFLAGS} ${TCL_INCLUDE_SPEC} -I${TCL_SRC_DIR}/generic -I${tclconfigshdir}"
           38  +		CPPFLAGS="${CPPFLAGS} ${TCL_INCLUDE_SPEC} -I${TCL_SRC_DIR}/generic -I${tclconfigshdir}"
    31     39   		LDFLAGS="${LDFLAGS}"
    32     40   		LIBS="${LIBS} ${TCL_LIBS}"
    33     41   	fi
    34     42   
    35     43   	AC_SUBST(CFLAGS)
    36     44   	AC_SUBST(CPPFLAGS)
    37     45   	AC_SUBST(LDFLAGS)
    38     46   	AC_SUBST(LIBS)
    39     47   
    40     48   	AC_MSG_RESULT([$tclconfigsh])
    41     49   ])
           50  +
           51  +AC_DEFUN(DC_DO_TK, [
           52  +	AC_MSG_CHECKING([path to tk])
           53  +	AC_ARG_WITH(tk, AC_HELP_STRING([--with-tk], [directory containing tk configuration (tkConfig.sh)]), [], [
           54  +		with_tk="auto"
           55  +	])
           56  +
           57  +	if test "${with_tk}" = "auto"; then
           58  +		for dir in ../../../tk/build/tk*/*/ `echo "${PATH}" | sed 's@:@ @g'`; do
           59  +			if test -f "${dir}/tkConfig.sh"; then
           60  +				tkconfigshdir="${dir}"
           61  +				tkconfigsh="${tkconfigshdir}/tkConfig.sh"
           62  +				break
           63  +			fi
           64  +			if test -f "${dir}/../lib/tkConfig.sh"; then
           65  +				tkconfigshdir="${dir}/../lib"
           66  +				tkconfigsh="${tkconfigshdir}/tkConfig.sh"
           67  +				break
           68  +			fi
           69  +			if test -f "${dir}/../lib64/tkConfig.sh"; then
           70  +				tkconfigshdir="${dir}/../lib64"
           71  +				tkconfigsh="${tkconfigshdir}/tkConfig.sh"
           72  +				break
           73  +			fi
           74  +		done
           75  +
           76  +		if test -z "${tkconfigsh}"; then
           77  +			AC_MSG_ERROR([Unable to find tkConfig.sh])
           78  +		fi
           79  +	else
           80  +		tkconfigshdir="${with_tk}"
           81  +		tkconfigsh="${tkconfigshdir}/tkConfig.sh"
           82  +	fi
           83  +
           84  +	if test -f "${tkconfigsh}"; then
           85  +		source "${tkconfigsh}"
           86  +
           87  +		CFLAGS="${CFLAGS} ${TK_INCLUDE_SPEC} -I${TK_SRC_DIR}/generic -I${tkconfigshdir}"
           88  +		CPPFLAGS="${CPPFLAGS} ${TK_INCLUDE_SPEC} -I${TK_SRC_DIR}/generic -I${tkconfigshdir}"
           89  +		LDFLAGS="${LDFLAGS}"
           90  +		LIBS="${LIBS} ${TK_LIBS}"
           91  +	fi
           92  +
           93  +	AC_SUBST(CFLAGS)
           94  +	AC_SUBST(CPPFLAGS)
           95  +	AC_SUBST(LDFLAGS)
           96  +	AC_SUBST(LIBS)
           97  +
           98  +	AC_MSG_RESULT([$tkconfigsh])
           99  +])
    42    100   
    43    101   AC_DEFUN(DC_DO_STATIC_LINK_LIBCXX, [
    44    102   	AC_MSG_CHECKING([for how to statically link to libstdc++])
    45    103   
    46    104   	SAVELIBS="${LIBS}"
    47    105   	staticlibcxx=""
    48    106   	for trylink in "-Wl,-Bstatic -lCstd -lCrun -Wl,-Bdynamic" "-Wl,-Bstatic -lstdc++ -Wl,-Bdynamic" "-lCstd -lCrun" "-lstdc++"; do
................................................................................
    58    116   
    59    117   	AC_MSG_RESULT([${staticlibcxx}])
    60    118   
    61    119   	AC_SUBST(LIBS)
    62    120   ])
    63    121   
    64    122   AC_DEFUN(DC_FIND_TCLKIT_LIBS, [
          123  +	DC_SETUP_TCL_PLAT_DEFS
    65    124   
    66         -	for proj in mk4tcl tcl tclvfs; do
          125  +	for proj in mk4tcl tcl tclvfs tk; do
    67    126   		AC_MSG_CHECKING([for libraries required for ${proj}])
    68    127   
    69    128   		libdir="../../../${proj}/inst"
    70         -		libfiles="`find "${libdir}" -name '*.a' | tr "\n" ' '`"
          129  +		libfiles="`find "${libdir}" -name '*.a' | grep -v 'stub' | tr "\n" ' '`"
    71    130   
    72    131   		ARCHS="${ARCHS} ${libfiles}"
    73    132   
    74    133   		AC_MSG_RESULT([${libfiles}])
    75    134   
    76    135   		if test "${libfiles}" != ""; then
    77    136   			if test "${proj}" = "mk4tcl"; then
    78    137   				AC_DEFINE(KIT_INCLUDES_MK4TCL, [1], [Specify this if you link against mkt4tcl])
    79    138   				DC_DO_STATIC_LINK_LIBCXX
          139  +			fi
          140  +			if test "${proj}" = "tk"; then
          141  +				DC_DO_TK
          142  +				AC_DEFINE(KIT_INCLUDES_TK, [1], [Specify this if we link statically to Tk])
          143  +
          144  +				if test "$host_os" = "mingw32msvc"; then
          145  +					AC_DEFINE(KITSH_NEED_WINMAIN, [1], [Define if you need WinMain (Windows)])
          146  +					CFLAGS="${CFLAGS} -mwindows"
          147  +				fi
    80    148   			fi
    81    149   		fi
    82    150   	done
    83    151   
    84    152   	AC_SUBST(ARCHS)
    85    153   ])
    86    154   
................................................................................
    94    162   		mingw32msvc*)
    95    163   			CFLAGS="${CFLAGS} -mno-cygwin -mms-bitfields"
    96    164   
    97    165   			dnl If we are building for Win32, we need to define "BUILD_tcl" so that
    98    166   			dnl TCL_STORAGE_CLASS gets defined as DLLEXPORT, to make static linking
    99    167   			dnl work
   100    168   			AC_DEFINE(BUILD_tcl, [1], [Define if you need to pretend to be building Tcl (Windows)])
          169  +			AC_DEFINE(BUILD_tk, [1], [Define if you need to pretend to be building Tk (Windows)])
   101    170   			;;
   102    171   		cygwin*)
   103    172   			CFLAGS="${CFLAGS} -mms-bitfields"
   104    173   			;;
   105    174   	esac
   106         -])          
          175  +])