Diff

Differences From Artifact [d545ae6633]:

To Artifact [20795b4d45]:


     3      3   
     4      4   dnl Checks for programs.
     5      5   AC_PROG_CC
     6      6   AC_PROG_MAKE_SET
     7      7   AC_PROG_INSTALL
     8      8   AC_AIX
     9      9   AC_GNU_SOURCE
           10  +
           11  +dnl Find out if we should build a DLL or an Executable
           12  +TARGET="tclkit"
           13  +EXTRA_KIT_DEPS=""
           14  +AC_MSG_CHECKING([what target to build])
           15  +AC_ARG_ENABLE(kitdll, AC_HELP_STRING([--enable-kitdll], [Enable building KitDLL instead of Tclkit (default: no)]), [
           16  +	AS_CASE([$enableval],
           17  +		[yes|kitdll], [
           18  +			TARGET="kitdll"
           19  +		],
           20  +		no, [
           21  +			true
           22  +		], [
           23  +			AC_MSG_RESULT([unknown])
           24  +
           25  +			AC_MSG_ERROR([Invalid option: $enableval])
           26  +		]
           27  +	)
           28  +])
           29  +AC_MSG_RESULT([$TARGET])
    10     30   
    11     31   dnl Find the appropriate libraries to link to
    12     32   AC_SEARCH_LIBS(acos, m,, [ AC_MSG_WARN([Couldn't find acos (normally in libm)!]) ])
    13     33   AC_SEARCH_LIBS(dlsym, dl,, [ AC_MSG_WARN([Couldn't find dlsym (normally in libdl)!]) ])
    14     34   
    15         -dnl Figure out how to statically link to libgcc, if needed
    16         -DC_STATIC_LIBGCC
           35  +AS_IF([test "$TARGET" = "tclkit"], [
           36  +	dnl We have Tclkit
           37  +
           38  +	dnl Figure out how to statically link to libgcc, if needed
           39  +	DC_STATIC_LIBGCC
           40  +
           41  +	dnl Specify local Appinit function
           42  +	AC_DEFINE(TK_LOCAL_APPINIT, [TclKit_AppInit], [Tclkit appinit function])
           43  +], [
           44  +	dnl We have KitDLL
           45  +
           46  +	dnl Determine system information
           47  +	DC_CHK_OS_INFO
           48  +
           49  +	dnl Determine how to create a shared object
           50  +	DC_GET_SHOBJFLAGS
           51  +
           52  +	dnl Determine if we have "objcopy" available to weaken non-Tcl/Tk symbols
           53  +	AC_CHECK_TOOL(OBJCOPY, objcopy, [:])
           54  +
           55  +	dnl Define KitDLL usage
           56  +	AC_DEFINE([TCLKIT_DLL], [1], [Define if you are using a KitDLL rather than a Tclkit])
           57  +])
           58  +
           59  +dnl Set linker rpath for tclsh/wish
           60  +DC_SETLDRUNPATH([.])
    17     61   
    18     62   dnl Find the appropriate Tcl headers and libraries
    19     63   DC_DO_TCL
    20     64   
    21     65   dnl Find archives we need to link to
    22     66   DC_FIND_TCLKIT_LIBS
    23     67   
    24     68   dnl Find extra objects we need to link as a part of "kit"
    25     69   AC_SUBST(EXTRA_OBJS)
           70  +AC_SUBST(EXTRA_VFS_OBJS)
    26     71   
    27     72   dnl Check for Windows Resource Compiler
    28     73   AC_CHECK_TOOL([RC], [windres], [false])
    29     74   
    30     75   dnl If we found the resource compiler, add "kit.res.o" to our list of objects to build
    31         -if ! test "$RC" = "false"; then
    32         -	EXTRA_OBJS="$EXTRA_OBJS kit.res.o"
    33         -fi
           76  +dnl (as long as the source for such an object exists)
           77  +AS_IF([test "$RC" != "false"], [
           78  +	AS_IF([test -f kit.rc], [
           79  +		EXTRA_OBJS="$EXTRA_OBJS kit.res.o"
           80  +	])
           81  +])
    34     82   
    35     83   dnl Check for Tcl features
    36     84   SAVE_LIBS="${LIBS}"
    37     85   LIBS="${ARCHS} ${LIBS}"
           86  +
    38     87   dnl Determine if we have "Tcl_SetStartupScript" (8.6.x) or "TclSetStartupScriptPath" (8.4.x)
    39     88   AC_CHECK_FUNCS(Tcl_SetStartupScript TclSetStartupScriptPath)
           89  +
    40     90   dnl Check for the ability to get the current system encoding
    41     91   AC_CHECK_FUNCS(Tcl_GetEncodingNameFromEnvironment Tcl_SetSystemEncoding)
    42     92   LIBS="${SAVE_LIBS}"
    43     93   
    44     94   dnl Check for optional headers
    45     95   AC_HEADER_STDC
    46     96   AC_CHECK_HEADERS(unistd.h string.h strings.h)
................................................................................
    53    103   
    54    104   dnl Find zlib
    55    105   AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [directory containing zlib]), [
    56    106   	CPPFLAGS="${CPPFLAGS} -I${with_zlib}/include -I${with_zlib}"
    57    107   	CFLAGS="${CFLAGS} -I${with_zlib}/include -I${with_zlib}"
    58    108   	LDFLAGS="${LDFLAGS} -L${with_zlib}/lib -L${with_zlib}"
    59    109   ])
          110  +
          111  +dnl Only needed for Tclkit
    60    112   DC_DO_STATIC_LINK_LIB(zlib, -lz,, [
    61    113   	DC_DO_STATIC_LINK_LIB(zlib, -lzlib,, [
    62    114   		AC_SEARCH_LIBS(inflate, z zlib,, [
    63    115   			AC_MSG_WARN([Couldn't find inflate (normally in zlib)!])
    64    116   		])
    65    117   	])
    66    118   ])
    67    119   
    68    120   dnl Determine which storage mechanism to use
    69    121   AC_MSG_CHECKING([which Tclkit Storage mechanism to use])
    70         -AC_ARG_ENABLE(kit-storage, AC_HELP_STRING([--enable-kit-storage={zip|mk4}], [Use mk4 for storage (default: auto)]), [
    71         -	case "$enableval" in
    72         -		mk4)
    73         -			AC_MSG_RESULT([mk4])
    74         -			AC_DEFINE([KIT_STORAGE_MK4], [1], [Define if you are going to use Metakit4 for kit storage])
    75         -			;;
    76         -		zip)
    77         -			AC_MSG_RESULT([zip])
    78         -			AC_DEFINE([KIT_STORAGE_ZIP], [1], [Define if you are going to use ZIP for kit storage])
    79         -			;;
    80         -		yes)
          122  +
          123  +storage_mech="auto"
          124  +AC_ARG_ENABLE(kit-storage, AC_HELP_STRING([--enable-kit-storage={zip|mk4|cvfs}], [Specify storage mechanism to use for built-in VFS (default: auto)]), [
          125  +	AS_CASE(["$enableval"],
          126  +		mk4, [
          127  +			storage_mech="mk4"
          128  +		],
          129  +		zip, [
          130  +			storage_mech="zip"
          131  +		],
          132  +		cvfs, [
          133  +			storage_mech="cvfs"
          134  +		],
          135  +		yes, [
    81    136   			# If they just want to enable kit storage, but nothing specifically, do nothing
    82         -			AC_MSG_RESULT([auto])
    83         -			;;
    84         -		auto)
          137  +			storage_mech="auto"
          138  +		],
          139  +		auto, [
    85    140   			# Auto is how it works by default
    86         -			AC_MSG_RESULT([auto])
    87         -			;;
    88         -		no)
          141  +			storage_mech="auto"
          142  +		],
          143  +		no, [
    89    144   			# You can't disable kit storage
    90    145   			AC_MSG_RESULT([fail])
    91    146   			AC_MSG_ERROR([Kit Storage cannot be disabled])
    92         -			;;
    93         -		*)
          147  +		],
          148  +		[
    94    149   			AC_MSG_RESULT([fail])
    95    150   			AC_MSG_ERROR([Unknown kit storage type: $enableval])
    96         -			;;
    97         -	esac
    98         -], [
    99         -	AC_MSG_RESULT([auto])
          151  +		]
          152  +	)
          153  +])
          154  +
          155  +dnl Explicitly define the storage mechanism
          156  +AS_IF([test "$storage_mech" = "auto"], [
          157  +	AS_IF([test "$TARGET" = 'tclkit'], [
          158  +		AS_IF([test "x$kc_cv_feature_kit_includes_mk4tcl" = 'x1'], [
          159  +			storage_mech="mk4"
          160  +		], [
          161  +			storage_mech="zip"
          162  +		])
          163  +	], [
          164  +		storage_mech="cvfs"
          165  +	])
   100    166   ])
   101    167   
          168  +dnl Note result
          169  +AC_MSG_RESULT([$storage_mech])
          170  +
          171  +dnl Define appropriate macros for the storage mechanism
          172  +AS_CASE([$storage_mech],
          173  +	mk4, [
          174  +		AC_DEFINE([KIT_STORAGE_MK4], [1], [Define if you are going to use Metakit4 for kit storage])
          175  +	],
          176  +	zip, [
          177  +		AC_DEFINE([KIT_STORAGE_ZIP], [1], [Define if you are going to use ZIP for kit storage])
          178  +
          179  +		dnl Add appropriate dependencies
          180  +		EXTRA_KIT_DEPS="zipvfs.tcl.h"
          181  +	],
          182  +	cvfs, [
          183  +		AC_DEFINE([KIT_STORAGE_CVFS], [1], [Define if you are going to use C-VFS for kit storage])
          184  +
          185  +		dnl Define that C-VFS should be make [load]-able
          186  +		AC_DEFINE([CVFS_MAKE_LOADABLE], [1], [Specify that the C-VFS should be able to be loaded])
          187  +
          188  +		dnl Add appropriate dependencies
          189  +		EXTRA_KIT_DEPS="cvfs.tcl.h"
          190  +		EXTRA_VFS_OBJS="${EXTRA_VFS_OBJS} cvfs_data_tcl.o"
          191  +	]
          192  +)
          193  +
          194  +AC_SUBST(EXTRA_KIT_DEPS)
          195  +
          196  +dnl Put correct Makefile template in place
          197  +rm -f Makefile.in
          198  +cp Makefile.${TARGET}.in Makefile.in
          199  +
   102    200   dnl Produce output
   103         -AC_OUTPUT(Makefile)
          201  +AC_OUTPUT(Makefile Makefile.common)