4 # Note
: modules which support options
*must
* be included before
'options'
8 utf8
=> "include support for utf8-encoded strings"
9 lineedit
=1 => "disable line editing"
10 references
=1 => "disable support for references"
11 math
=> "include support for math functions"
12 ipv6
=> "include ipv6 support in the aio extension"
13 maintainer
=> {enable the
[debug
] command and JimPanic
}
14 full
=> "Enable some optional features: ipv6, math, utf8, binary, oo, tree"
15 with
-jim
-shared shared
=> "build a shared library instead of a static library"
16 jim
-regexp
=> "use the built-in (Tcl-compatible) regexp, even if POSIX regex is available"
17 with
-jim
-ext
: {with
-ext
:"ext1 ext2 ..."} => {
18 Specify additional jim extensions to include.
19 These are enabled by default
:
21 aio
- ANSI I
/O
, including open and socket
22 eventloop
- after
, vwait
, update
23 array
- Tcl
-compatible array command
24 clock
- Tcl
-compatible clock command
25 exec
- Tcl
-compatible exec command
26 file
- Tcl
-compatible file command
27 glob
- Tcl
-compatible glob command
28 readdir
- Required for glob
29 package
- Package management with the package command
30 load
- Load binary extensions at runtime with load or package
31 posix
- Posix APIs including os.fork
, os.wait
, pid
32 regexp
- Tcl
-compatible regexp
, regsub commands
33 signal
- Signal handling
34 stdlib
- Built
-in commands including lassign
, lambda
, alias
35 syslog
- System logging with syslog
36 tclcompat
- Tcl compatible read
, gets
, puts
, parray
, case
, ...
38 These are disabled by default
:
40 nvp
- Name
-value pairs C
-only API
42 tree
- OO tree structure
, similar to tcllib
::struct
::tree
43 binary
- Tcl
-compatible
'binary' command
44 readline
- Interface to libreadline
45 rlprompt
- Tcl wrapper around the readline extension
46 mk
- Interface to Metakit
47 sqlite
- Interface to sqlite
48 sqlite3
- Interface to sqlite3
49 win32
- Interface to win32
51 with
-out
-jim
-ext
: {without
-ext
:"default|ext1 ext2 ..."} => {
52 Specify jim extensions to exclude.
53 If
'default' is given
, the default extensions will not be added.
55 with
-jim
-extmod
: {with
-mod
:"ext1 ext2 ..."} => {
56 Specify jim extensions to build as separate
modules (either C or Tcl
).
57 Note that not all extensions can be built as loadable modules.
59 # To help out openocd with automake
63 cc
-check
-types
"long long"
65 cc
-check
-includes sys
/socket.h netinet
/in.h arpa
/inet.h netdb.h
66 cc
-check
-includes sys
/un.h dlfcn.h unistd.h crt_externs.h
70 # Haiku needs
-lnetwork
, Solaris needs
-lnsl
71 if
{[cc
-check
-function
-in
-lib inet_ntop
{nsl network
}]} {
72 # This does nothing if no libs are needed
73 cc
-with
[list
-libs
[get
-define lib_inet_ntop
]]
74 define
-append LDLIBS
[get
-define lib_inet_ntop
]
76 # Solaris needs
-lsocket
, Windows needs
-lwsock32
77 if
{[cc
-check
-function
-in
-lib socket socket
]} {
78 define
-append LDLIBS
[get
-define lib_socket
]
81 cc
-check
-functions ualarm lstat fork vfork system select
82 cc
-check
-functions backtrace geteuid mkstemp realpath strptime gettimeofday
83 cc
-check
-functions regcomp waitpid sigaction sys_signame sys_siglist
84 cc
-check
-functions syslog opendir readlink sleep usleep pipe getaddrinfo utimes
85 if
{[cc
-check
-functions sysinfo
]} {
86 cc
-with
{-includes sys
/sysinfo.h
} {
87 cc
-check
-members
"struct sysinfo.uptime"
91 define TCL_LIBRARY
[get
-define prefix
]/lib
/jim
93 lassign
[split
[get
-define host
] -] host_cpu host_vendor host_os
94 # Scrub revision from the host_os
95 regsub
-all
{[0-9.
]} $host_os
{} host_os
97 switch
-glob
-- $host_os
{
99 # We provide our own implementation of dlopen for mingw32
100 define
-feature dlopen
-compat
101 define
-feature winconsole
102 define TCL_PLATFORM_OS $host_os
103 define TCL_PLATFORM_PLATFORM windows
104 define TCL_PLATFORM_PATH_SEPARATOR
{;}
107 # Note that cygwin is considered a unix platform
108 define TCL_PLATFORM_OS $host_os
109 define TCL_PLATFORM_PLATFORM unix
110 define TCL_PLATFORM_PATH_SEPARATOR
:
115 cc
-check
-tools ar ranlib strip
116 define tclsh
[info nameofexecutable
]
118 if
{![cc
-check
-functions _NSGetEnviron
]} {
119 msg
-checking
"Checking environ declared in unistd.h..."
120 if
{[cctest
-cflags
-D_GNU_SOURCE
-includes unistd.h
-code
{char
**ep
= environ
;}]} {
121 define NO_ENVIRON_EXTERN
128 # Windows has a mkdir with no permission arg
129 cc
-check
-includes sys
/types.h sys
/stat.h
130 msg
-checking
"Checking for mkdir with one arg..."
131 if
{[cctest
-includes
{sys
/types.h sys
/stat.h
} -code
{mkdir("/dummy");}]} {
132 define HAVE_MKDIR_ONE_ARG
138 # autosetup can
't handle C++ libraries
139 proc check-metakit {} {
141 cc-with {-lang c++} {
142 msg-checking "Checking for Metakit..."
143 if {[cctest -includes mk4.h -libs -lmk4 -code {c4_Storage dummy();}]} {
148 msg-result "not found"
157 if {[opt-bool utf8 full]} {
158 msg-result "Enabling UTF-8"
164 if {[opt-bool maintainer]} {
165 msg-result "Enabling maintainer settings"
166 define JIM_MAINTAINER
168 if {[opt-bool math full]} {
169 msg-result "Enabling math functions"
170 define JIM_MATH_FUNCTIONS
171 cc-check-function-in-lib sin m
172 define-append LDLIBS [get-define lib_sin]
174 if {[opt-bool ipv6 full]} {
175 msg-result "Enabling IPv6"
178 if {[opt-bool lineedit full]} {
179 if {([cc-check-includes termios.h] && [cc-check-functions isatty]) || [have-feature winconsole]} {
180 msg-result "Enabling line editing"
182 lappend extra_objs linenoise.o
185 if {[opt-bool references]} {
186 msg-result "Enabling references"
187 define JIM_REFERENCES
189 if {[opt-bool shared with-jim-shared]} {
190 msg-result "Building shared library"
192 msg-result "Building static library"
195 define JIM_INSTALL [opt-bool install-jim]
197 # Note: Extension handling is mapped directly from the configure.ac
200 set without [join [opt-val {without-ext with-out-jim-ext}]]
201 set withext [join [opt-val {with-ext with-jim-ext}]]
202 set withmod [join [opt-val {with-mod with-jim-extmod}]]
205 set ext_tcl "stdlib glob tclcompat tree rlprompt oo binary"
207 set ext_c "load package readdir array clock exec file posix regexp signal aio eventloop pack syslog nvp readline mk sqlite sqlite3 win32 sdl"
212 # Tcl extensions which can be modules
213 set ext_tcl_mod "glob tree rlprompt oo binary"
214 # Native extensions which can be modules
215 set ext_c_mod "readdir array clock file posix regexp syslog readline pack mk sqlite sqlite3 win32 sdl"
218 set ext_all [concat $ext_c $ext_tcl]
220 # Default static extensions
221 set ext_default "stdlib load package readdir glob array clock exec file posix regexp signal tclcompat aio eventloop syslog"
223 if {[opt-bool full]} {
224 lappend ext_default tree binary
227 if {$without eq "default"} {
228 set ext_default stdlib
232 # Check valid extension names
233 foreach i [concat $withext $without $withmod] {
234 if {$i ni $ext_all} {
235 user-error "Unknown extension: $i"
239 # needs_xxx="expression" means that the expr must eval to 1 to select the extension
240 # dep_xxx="yyy zzz" means that if xxx is selected, so is yyy and zzz
241 set dep(glob) readdir
242 set dep(rlprompt) readline
246 set needs(exec) {expr {([have-feature vfork] && [have-feature waitpid]) || [have-feature system]}}
247 set needs(load) {expr {[cc-check-function-in-lib dlopen dl] || [have-feature dlopen-compat]}}
248 set libdep(load) lib_dlopen
249 set needs(posix) {have-feature waitpid}
250 set needs(readdir) {have-feature opendir}
251 set needs(readline) {cc-check-function-in-lib readline readline}
252 set libdep(readline) lib_readline
253 set needs(signal) {expr {[have-feature sigaction] && [have-feature vfork]}}
254 set needs(mk) {check-metakit}
255 set libdep(mk) lib_mk
256 set needs(sqlite) {cc-check-function-in-lib sqlite_open sqlite}
257 set libdep(sqlite) lib_sqlite_open
258 set needs(sqlite3) {cc-check-function-in-lib sqlite3_open sqlite3}
259 set libdep(sqlite3) lib_sqlite3_open
260 set needs(syslog) {have-feature syslog}
261 set needs(win32) {have-feature windows}
262 set needs(sdl) {expr {[cc-check-function-in-lib SDL_SetVideoMode SDL] && [cc-check-function-in-lib rectangleRGBA SDL_gfx]}}
263 set libdep(sdl) {lib_SDL_SetVideoMode lib_rectangleRGBA}
265 # First handle dependencies. If an extension is enabled, also enable its dependency
266 foreach i [concat $ext_default $withext] {
267 if {$i in $without} {
270 if {[info exists dep($i)]} {
271 lappend withext {*}$dep($i)
276 if {[info exists dep($i)]} {
277 # Theoretically, a mod could depend upon something which must be static
278 # If already configured static, don't make it a module
280 if
{$d ni $withext
} {
287 # Now that we know what the platform supports
:
289 # For all known extensions
:
290 #
- If it is disabled
, remove it
291 #
- Otherwise
, check to see if it
's pre-requisites are met
292 # - If yes, add it if it is enabled or is a default
293 # - If no, error if it is enabled, or do nothing otherwise
294 # - Modules may be either C or Tcl
300 foreach i [lsort $ext_all] {
301 # First discard the extension if disabled or not enabled
302 if {$i in $without} {
303 msg-result "Extension $i...disabled"
306 if {$i ni [concat $withext $withmod $ext_default]} {
307 msg-result "Extension $i...not enabled"
313 if {[info exists needs($i)]} {
314 set met [eval $needs($i)]
319 msg-checking "Extension $i..."
321 # Selected as a module?
322 if {$i in $withmod} {
323 if {$i in $ext_tcl_mod} {
329 if {$i ni $ext_c_mod} {
330 user-error "not a module"
333 user-error "dependencies not met"
337 if {[info exists libdep($i)]} {
338 foreach j $libdep($i) {
339 define-append LDLIBS_$i [get-define $j ""]
345 # Selected as a static extension?
346 if {$i in $withext} {
348 user-error "dependencies not met"
351 } elseif {$i in $ext_default} {
353 msg-result "disabled (dependencies)"
356 msg-result "enabled (default)"
362 if {[info exists libdep($i)]} {
363 foreach j $libdep($i) {
364 define-append LDLIBS [get-define $j ""]
369 if {[have-feature windows]} {
370 lappend extra_objs jim-win32compat.o
372 if {$extmod ne "" && [get-define JIM_LIBTYPE] eq "static"} {
373 user-error "cygwin/mingw require --shared for dynamic modules"
377 if {"regexp" in "$ext $extmod"} {
378 # No regcomp means we need to use the built-in version
379 if {![have-feature regcomp]} {
384 if {$jimregexp || [opt-bool jim-regexp]} {
385 msg-result "Using built-in regexp"
388 # If the built-in regexp overrides the system regcomp, etc.
389 # jim must be built shared so that the correct symbols are found
390 if {"regexp" in $extmod && [get-define JIM_LIBTYPE] eq "static" && [have-feature regcomp]} {
391 user-error "Must use --shared with regexp module and built-in regexp"
394 if {"load" ni $ext} {
395 # If we don't have load
, no need to support shared objects
396 define SH_LINKFLAGS
""
399 msg
-result
"Jim static extensions: [lsort $ext]"
400 if
{$extmodtcl ne
""} {
401 msg
-result
"Jim Tcl extensions: [lsort $extmodtcl]"
404 msg
-result
"Jim dynamic extensions: [lsort $extmod]"
407 # Separate out the static extensions into C and Tcl
409 set ext_static_tcl
{}
412 if
{$e in $ext_tcl
} {
413 lappend ext_static_tcl $e
415 lappend ext_static_c $e
419 # If there are any static C
++ extensions
, jimsh must be linked using
421 foreach e $ext_static_c
{
422 if
{$e in $ext_cxx
} {
423 define HAVE_CXX_EXTENSIONS
427 define STATIC_EXTS
[concat $ext_static_c $ext_static_tcl
]
428 define C_EXT_OBJS
[prefix jim
- [suffix .o $ext_static_c
]]
429 define TCL_EXT_OBJS
[suffix .o $ext_static_tcl
]
430 define C_EXT_SHOBJS
[suffix .so $extmod
]
431 define TCL_EXTS
[suffix .tcl $extmodtcl
]
432 define EXTRA_OBJS $extra_objs
434 make
-config
-header jim
-config.h
-auto
{HAVE_LONG_LONG
* JIM_UTF8
} -none
*
435 make
-config
-header jimautoconf.h
-auto
{jim_ext_
* TCL_PLATFORM_
* TCL_LIBRARY USE_
* JIM_
*}
436 make
-template Makefile.in