Diff

Differences From Artifact [c9dbeb54a1]:

To Artifact [a84d1ae23f]:


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