Diff

Differences From Artifact [da08c3d389]:

To Artifact [5f3b54111a]:


     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  +AC_MSG_CHECKING([what target to build])
           14  +AC_ARG_ENABLE(kitdll, AC_HELP_STRING([--enable-kitdll], [Enable building KitDLL instead of Tclkit (default: no)]), [
           15  +	case "$enableval" in
           16  +		yes|kitdll)
           17  +			TARGET="kitdll"
           18  +			;;
           19  +		no)
           20  +			true
           21  +			;;
           22  +		*)
           23  +			AC_MSG_RESULT([unknown])
           24  +
           25  +			AC_MSG_ERROR([Invalid option: $enableval])
           26  +			;;
           27  +	esac
           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  +if test "x$TARGET" = "tclkit"; then
           36  +	dnl Figure out how to statically link to libgcc, if needed
           37  +	DC_STATIC_LIBGCC
           38  +else
           39  +	dnl We have KitDLL
           40  +
           41  +	dnl Determine system information
           42  +	DC_CHK_OS_INFO
           43  +
           44  +	dnl Determine how to create a shared object
           45  +	DC_GET_SHOBJFLAGS
           46  +
           47  +	dnl KitDLL always uses C-VFS
           48  +	AC_DEFINE([KIT_STORAGE_CVFS], [1], [Define if you are going to use C-VFS for kit storage])
           49  +
           50  +	dnl Define KitDLL usage
           51  +	AC_DEFINE([TCLKIT_DLL], [1], [Define if you are using a KitDLL rather than a Tclkit])
           52  +fi
    17     53   
    18     54   dnl Find the appropriate Tcl headers and libraries
    19     55   DC_DO_TCL
    20     56   
    21     57   dnl Find archives we need to link to
    22     58   DC_FIND_TCLKIT_LIBS
    23     59   
................................................................................
    34     70   		EXTRA_OBJS="$EXTRA_OBJS kit.res.o"
    35     71   	fi
    36     72   fi
    37     73   
    38     74   dnl Check for Tcl features
    39     75   SAVE_LIBS="${LIBS}"
    40     76   LIBS="${ARCHS} ${LIBS}"
           77  +
    41     78   dnl Determine if we have "Tcl_SetStartupScript" (8.6.x) or "TclSetStartupScriptPath" (8.4.x)
    42     79   AC_CHECK_FUNCS(Tcl_SetStartupScript TclSetStartupScriptPath)
           80  +
    43     81   dnl Check for the ability to get the current system encoding
    44     82   AC_CHECK_FUNCS(Tcl_GetEncodingNameFromEnvironment Tcl_SetSystemEncoding)
    45     83   LIBS="${SAVE_LIBS}"
    46     84   
    47     85   dnl Check for optional headers
    48     86   AC_HEADER_STDC
    49     87   AC_CHECK_HEADERS(unistd.h string.h strings.h)
................................................................................
    56     94   
    57     95   dnl Find zlib
    58     96   AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [directory containing zlib]), [
    59     97   	CPPFLAGS="${CPPFLAGS} -I${with_zlib}/include -I${with_zlib}"
    60     98   	CFLAGS="${CFLAGS} -I${with_zlib}/include -I${with_zlib}"
    61     99   	LDFLAGS="${LDFLAGS} -L${with_zlib}/lib -L${with_zlib}"
    62    100   ])
    63         -DC_DO_STATIC_LINK_LIB(zlib, -lz,, [
    64         -	DC_DO_STATIC_LINK_LIB(zlib, -lzlib,, [
    65         -		AC_SEARCH_LIBS(inflate, z zlib,, [
    66         -			AC_MSG_WARN([Couldn't find inflate (normally in zlib)!])
          101  +
          102  +dnl Only needed for Tclkit
          103  +if test "x$TARGET" = "tclkit"; then
          104  +	DC_DO_STATIC_LINK_LIB(zlib, -lz,, [
          105  +		DC_DO_STATIC_LINK_LIB(zlib, -lzlib,, [
          106  +			AC_SEARCH_LIBS(inflate, z zlib,, [
          107  +				AC_MSG_WARN([Couldn't find inflate (normally in zlib)!])
          108  +			])
    67    109   		])
    68    110   	])
    69         -])
          111  +fi
    70    112   
    71    113   dnl Determine which storage mechanism to use
    72    114   AC_MSG_CHECKING([which Tclkit Storage mechanism to use])
    73         -AC_ARG_ENABLE(kit-storage, AC_HELP_STRING([--enable-kit-storage={zip|mk4}], [Use mk4 for storage (default: auto)]), [
          115  +
          116  +storage_mech="auto"
          117  +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)]), [
    74    118   	case "$enableval" in
    75    119   		mk4)
    76         -			AC_MSG_RESULT([mk4])
          120  +			storage_mech="mk4"
          121  +
    77    122   			AC_DEFINE([KIT_STORAGE_MK4], [1], [Define if you are going to use Metakit4 for kit storage])
    78    123   			;;
    79    124   		zip)
    80         -			AC_MSG_RESULT([zip])
          125  +			storage_mech="zip"
          126  +
    81    127   			AC_DEFINE([KIT_STORAGE_ZIP], [1], [Define if you are going to use ZIP for kit storage])
    82    128   			;;
          129  +		cvfs)
          130  +			storage_mech="cvfs"
          131  +
          132  +			AC_DEFINE([KIT_STORAGE_CVFS], [1], [Define if you are going to use C-VFS for kit storage])
          133  +			;;
    83    134   		yes)
    84    135   			# If they just want to enable kit storage, but nothing specifically, do nothing
    85         -			AC_MSG_RESULT([auto])
          136  +			storage_mech="auto"
    86    137   			;;
    87    138   		auto)
    88    139   			# Auto is how it works by default
    89         -			AC_MSG_RESULT([auto])
          140  +			storage_mech="auto"
    90    141   			;;
    91    142   		no)
    92    143   			# You can't disable kit storage
    93    144   			AC_MSG_RESULT([fail])
    94    145   			AC_MSG_ERROR([Kit Storage cannot be disabled])
    95    146   			;;
    96    147   		*)
    97    148   			AC_MSG_RESULT([fail])
    98    149   			AC_MSG_ERROR([Unknown kit storage type: $enableval])
    99    150   			;;
   100    151   	esac
   101         -], [
   102         -	AC_MSG_RESULT([auto])
   103    152   ])
          153  +AC_MSG_RESULT([$storage_mech])
          154  +
          155  +dnl Verify sanity of storage mechanism
          156  +if ! test "x$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
          166  +
          167  +dnl Put correct Makefile template in place
          168  +rm -f Makefile.in
          169  +cp Makefile.${TARGET}.in Makefile.in
   104    170   
   105    171   dnl Produce output
   106    172   AC_OUTPUT(Makefile)