6 # Note
: modules which support options
*must
* be included before
'options'
7 use cc cc
-shared cc
-db cc
-lib
11 utf8
=> "include support for utf8-encoded strings"
12 lineedit
=1 => "disable line editing"
13 references
=1 => "disable support for references"
14 math
=> "include support for math functions"
15 ipv6
=> "include ipv6 support in the aio extension"
16 maintainer
=> {enable the
[debug
] command and JimPanic
}
17 full
=> "Enable some optional features: ipv6, math, utf8, binary, oo, tree"
18 with
-jim
-shared shared
=> "build a shared library instead of a static library"
19 jim
-regexp
=1 => "prefer POSIX regex if over the the built-in (Tcl-compatible) regex"
20 docs
=1 => "don't build or install the documentation"
21 random
-hash
=> "randomise hash tables. more secure but hash table results are not predicable"
22 with
-jim
-ext
: {with
-ext
:"ext1 ext2 ..."} => {
23 Specify additional jim extensions to include.
24 These are enabled by default
:
26 aio
- ANSI I
/O
, including open and socket
27 eventloop
- after
, vwait
, update
28 array
- Tcl
-compatible array command
29 clock
- Tcl
-compatible clock command
30 exec
- Tcl
-compatible exec command
31 file
- Tcl
-compatible file command
32 glob
- Tcl
-compatible glob command
33 history
- Tcl access to interactive history
34 readdir
- Required for glob
35 package
- Package management with the package command
36 load
- Load binary extensions at runtime with load or package
37 posix
- Posix APIs including os.fork
, os.wait
, pid
38 regexp
- Tcl
-compatible regexp
, regsub commands
39 signal
- Signal handling
40 stdlib
- Built
-in commands including lassign
, lambda
, alias
41 syslog
- System logging with syslog
42 tclcompat
- Tcl compatible read
, gets
, puts
, parray
, case
, ...
43 namespace
- Tcl compatible namespace support
45 These are disabled by default
:
48 tree
- OO tree structure
, similar to tcllib
::struct
::tree
49 binary
- Tcl
-compatible
'binary' command
50 readline
- Interface to libreadline
51 rlprompt
- Tcl wrapper around the readline extension
52 mk
- Interface to Metakit
53 tclprefix
- Support for the tcl
::prefix command
54 sqlite3
- Interface to sqlite3
55 win32
- Interface to win32
57 with
-out
-jim
-ext
: {without
-ext
:"default|ext1 ext2 ..."} => {
58 Specify jim extensions to exclude.
59 If
'default' is given
, the default extensions will not be added.
61 with
-jim
-extmod
: {with
-mod
:"ext1 ext2 ..."} => {
62 Specify jim extensions to build as separate
modules (either C or Tcl
).
63 Note that not all extensions can be built as loadable modules.
65 # To help out openocd with automake
69 cc
-check
-types
"long long"
73 if
{[cctest
-cflags
-fno
-unwind
-tables
]} {
74 define
-append CCOPTS
-fno
-unwind
-tables
76 if
{[cctest
-cflags
-fno
-asynchronous
-unwind
-tables
]} {
77 define
-append CCOPTS
-fno
-asynchronous
-unwind
-tables
80 cc
-check
-includes sys
/time.h sys
/socket.h netinet
/in.h arpa
/inet.h netdb.h
81 cc
-check
-includes sys
/un.h dlfcn.h unistd.h dirent.h crt_externs.h
85 # Haiku needs
-lnetwork
, Solaris needs
-lnsl
86 if
{[cc
-check
-function
-in
-lib inet_ntop
{nsl network
}]} {
87 # This does nothing if no libs are needed
88 cc
-with
[list
-libs
[get
-define lib_inet_ntop
]]
89 define
-append LDLIBS
[get
-define lib_inet_ntop
]
91 # Solaris needs
-lsocket
, Windows needs
-lwsock32
92 if
{[cc
-check
-function
-in
-lib socket socket
]} {
93 define
-append LDLIBS
[get
-define lib_socket
]
96 cc
-check
-functions ualarm lstat fork vfork system select execvpe
97 cc
-check
-functions backtrace geteuid mkstemp realpath strptime isatty
98 cc
-check
-functions regcomp waitpid sigaction sys_signame sys_siglist isascii
99 cc
-check
-functions syslog opendir readlink sleep usleep pipe getaddrinfo utimes
100 cc
-check
-functions shutdown socketpair isinf isnan
102 if
{[cc
-check
-functions sysinfo
]} {
103 cc
-with
{-includes sys
/sysinfo.h
} {
104 cc
-check
-members
"struct sysinfo.uptime"
109 cc
-check
-functions fseeko ftello
111 define TCL_LIBRARY
[get
-define prefix
]/lib
/jim
113 lassign
[split
[get
-define host
] -] host_cpu host_vendor host_os
114 # Scrub revision from the host_os
115 regsub
-all
{[0-9.
]} $host_os
{} host_os
117 switch
-glob
-- $host_os
{
119 # We provide our own implementation of dlopen for mingw32
120 define
-feature dlopen
-compat
121 define
-feature winconsole
122 define TCL_PLATFORM_OS $host_os
123 define TCL_PLATFORM_PLATFORM windows
124 define TCL_PLATFORM_PATH_SEPARATOR
{;}
127 # Note that cygwin is considered a unix platform
128 define TCL_PLATFORM_OS $host_os
129 define TCL_PLATFORM_PLATFORM unix
130 define TCL_PLATFORM_PATH_SEPARATOR
:
135 cc
-check
-tools ar ranlib strip
136 define tclsh
[info nameofexecutable
]
138 if
{![cc
-check
-functions _NSGetEnviron
]} {
139 msg
-checking
"Checking environ declared in unistd.h..."
140 if
{[cctest
-cflags
-D_GNU_SOURCE
-includes unistd.h
-code
{char
**ep
= environ
;}]} {
141 define NO_ENVIRON_EXTERN
148 # Windows has a mkdir with no permission arg
149 cc
-check
-includes sys
/types.h sys
/stat.h
150 msg
-checking
"Checking for mkdir with one arg..."
151 if
{[cctest
-includes
{sys
/types.h sys
/stat.h
} -code
{mkdir("/dummy");}]} {
152 define HAVE_MKDIR_ONE_ARG
161 if
{[opt
-bool utf8 full
]} {
162 msg
-result
"Enabling UTF-8"
168 if
{[opt
-bool maintainer
]} {
169 msg
-result
"Enabling maintainer settings"
170 define JIM_MAINTAINER
172 if
{[opt
-bool math full
]} {
173 msg
-result
"Enabling math functions"
174 define JIM_MATH_FUNCTIONS
175 cc
-check
-function
-in
-lib sin m
176 define
-append LDLIBS
[get
-define lib_sin
]
178 if
{[opt
-bool ipv6 full
]} {
179 msg
-result
"Enabling IPv6"
182 if
{[opt
-bool lineedit full
]} {
183 if
{([cc
-check
-includes termios.h
] && [have
-feature isatty
]) ||
[have
-feature winconsole
]} {
184 msg
-result
"Enabling line editing"
186 lappend extra_objs linenoise.o
189 if
{[opt
-bool references
]} {
190 msg
-result
"Enabling references"
191 define JIM_REFERENCES
193 if
{[opt
-bool shared with
-jim
-shared
]} {
194 msg
-result
"Building shared library"
196 msg
-result
"Building static library"
199 define LIBSOEXT
[format
[get
-define SH_SOEXTVER
] [format
%.2f
[expr
{[get
-define JIM_VERSION
] / 100.0}]]]
200 define JIM_INSTALL
[opt
-bool install
-jim
]
201 define JIM_DOCS
[opt
-bool docs
]
202 define JIM_RANDOMISE_HASH
[opt
-bool random
-hash
]
204 # Attributes of the extensions
205 # tcl
=Pure Tcl extension
206 # static
=Can
't be built as a module
207 # optional=Not selected by default
208 # cpp=Is a C++ extension
210 dict set extdb attrs {
223 nshelper { tcl optional }
229 readline { optional }
231 rlprompt { tcl optional }
235 stdlib { tcl static }
237 tclcompat { tcl static }
243 # Additional information about certain extensions
244 # dep=list of extensions which are required for this extension
245 # check=[expr] expression to evaluate to determine if the extension can be used
246 # libdep=list of 'define
' symbols for dependent libraries
247 dict set extdb info {
249 exec { check {([have-feature vfork] && [have-feature waitpid]) || [have-feature system]} }
251 load { check {[have-feature dlopen-compat] || [cc-check-function-in-lib dlopen dl]} libdep lib_dlopen }
252 mk { check {[check-metakit]} libdep lib_mk }
253 namespace { dep nshelper }
254 posix { check {[have-feature waitpid]} }
255 readdir { check {[have-feature opendir]} }
256 readline { check {[cc-check-function-in-lib readline readline]} libdep lib_readline}
257 rlprompt { dep readline }
259 sdl { check {[cc-check-function-in-lib SDL_SetVideoMode SDL] && [cc-check-function-in-lib rectangleRGBA SDL_gfx]}
260 libdep {lib_SDL_SetVideoMode lib_rectangleRGBA}
262 signal { check {[have-feature sigaction] && [have-feature vfork]} }
263 sqlite3 { check {[cc-check-function-in-lib sqlite3_prepare_v2 sqlite3]} libdep lib_sqlite3_prepare_v2 }
264 syslog { check {[have-feature syslog]} }
266 win32 { check {[have-feature windows]} }
269 # autosetup cc-check-function-in-library can't handle C
++ libraries
270 proc check
-metakit
{} {
272 msg
-checking
"Checking for Metakit..."
273 cc
-with
{-lang c
++} {
274 if
{[cctest
-includes mk4.h
-libs
-lmk4
-code
{c4_Storage
dummy();}]} {
279 msg
-result
"not found"
285 # Set up the withinfo array based on what the user selected
287 set
withinfo(without
) [join
[opt
-val
{without
-ext with
-out
-jim
-ext
}]]
288 set
withinfo(ext
) [join
[opt
-val
{with
-ext with
-jim
-ext
}]]
289 set
withinfo(mod
) [join
[opt
-val
{with
-mod with
-jim
-extmod
}]]
290 set
withinfo(nodefault
) 0
291 if
{$
withinfo(without
) eq
"default"} {
292 set
withinfo(without
) {}
293 set
withinfo(nodefault
) 1
296 # Now go check everything
- see autosetup
/local.tcl
297 array set extinfo
[check
-extensions
]
300 if
{[have
-feature windows
]} {
301 lappend extra_objs jim
-win32compat.o
303 if
{[llength $
extinfo(module
-c
)] && [get
-define JIM_STATICLIB
]} {
304 user
-error
"cygwin/mingw require --shared for dynamic modules"
308 if
{[ext
-get
-status regexp
] in
{y m
}} {
309 if
{![have
-feature regcomp
]} {
310 # No regcomp means we need to use the built
-in version
315 if
{$jimregexp ||
[opt
-bool jim
-regexp
]} {
316 msg
-result
"Using built-in regexp"
319 # If the built
-in regexp overrides the system regcomp
, etc.
320 # jim must be built shared so that the correct symbols are found
321 if
{[ext
-get
-status regexp
] eq
"m" && [get
-define JIM_STATICLIB
] && [have
-feature regcomp
]} {
322 user
-error
"Must use --shared with regexp module and built-in regexp"
326 if
{[ext
-get
-status load
] eq
"n"} {
327 # If we don
't have load, no need to support shared objects
328 define SH_LINKFLAGS ""
331 msg-result "Jim static extensions: [lsort [concat $extinfo(static-tcl) $extinfo(static-c)]]"
332 if {[llength $extinfo(module-tcl)]} {
333 msg-result "Jim Tcl extensions: [lsort $extinfo(module-tcl)]"
335 if {[llength $extinfo(module-c)]} {
336 msg-result "Jim dynamic extensions: [lsort $extinfo(module-c)]"
339 define STATIC_EXTS [concat $extinfo(static-c) $extinfo(static-tcl)]
340 define C_EXT_OBJS [prefix jim- [suffix .o $extinfo(static-c)]]
341 define TCL_EXT_OBJS [suffix .o $extinfo(static-tcl)]
342 define C_EXT_SHOBJS [suffix .so $extinfo(module-c)]
343 define TCL_EXTS [suffix .tcl $extinfo(module-tcl)]
344 define EXTRA_OBJS $extra_objs
346 make-config-header jim-config.h -auto {HAVE_LONG_LONG* JIM_UTF8} -bare JIM_VERSION -none *
347 make-config-header jimautoconf.h -auto {jim_ext_* TCL_PLATFORM_* TCL_LIBRARY USE_* JIM_* _FILE_OFFSET*}
348 make-template Makefile.in
349 make-template build-jim-ext.in
351 catch {exec chmod +x build-jim-ext}