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 TCL_PLATFORM_OS $host_os
102 define TCL_PLATFORM_PLATFORM windows
103 define TCL_PLATFORM_PATH_SEPARATOR
{;}
106 # Note that cygwin is considered a unix platform
107 define TCL_PLATFORM_OS $host_os
108 define TCL_PLATFORM_PLATFORM unix
109 define TCL_PLATFORM_PATH_SEPARATOR
:
114 cc
-check
-tools ar ranlib strip
115 define tclsh
[info nameofexecutable
]
117 if
{![cc
-check
-functions _NSGetEnviron
]} {
118 msg
-checking
"Checking environ declared in unistd.h..."
119 if
{[cctest
-cflags
-D_GNU_SOURCE
-includes unistd.h
-code
{char
**ep
= environ
;}]} {
120 define NO_ENVIRON_EXTERN
127 # Windows has a mkdir with no permission arg
128 cc
-check
-includes sys
/types.h sys
/stat.h
129 msg
-checking
"Checking for mkdir with one arg..."
130 if
{[cctest
-includes
{sys
/types.h sys
/stat.h
} -code
{mkdir("/dummy");}]} {
131 define HAVE_MKDIR_ONE_ARG
137 # autosetup can
't handle C++ libraries
138 proc check-metakit {} {
140 cc-with {-lang c++} {
141 msg-checking "Checking for Metakit..."
142 if {[cctest -includes mk4.h -libs -lmk4 -code {c4_Storage dummy();}]} {
147 msg-result "not found"
156 if {[opt-bool utf8 full]} {
157 msg-result "Enabling UTF-8"
163 if {[opt-bool maintainer]} {
164 msg-result "Enabling maintainer settings"
165 define JIM_MAINTAINER
167 if {[opt-bool math full]} {
168 msg-result "Enabling math functions"
169 define JIM_MATH_FUNCTIONS
170 cc-check-function-in-lib sin m
171 define-append LDLIBS [get-define lib_sin]
173 if {[opt-bool ipv6 full]} {
174 msg-result "Enabling IPv6"
177 if {[opt-bool lineedit full] && [cc-check-includes termios.h] && [cc-check-functions isatty]} {
178 msg-result "Enabling line editing"
180 lappend extra_objs linenoise.o
181 cc-check-functions isatty
183 if {[opt-bool references]} {
184 msg-result "Enabling references"
185 define JIM_REFERENCES
187 if {[opt-bool shared with-jim-shared]} {
188 msg-result "Building shared library"
190 msg-result "Building static library"
193 define JIM_INSTALL [opt-bool install-jim]
195 # Note: Extension handling is mapped directly from the configure.ac
198 set without [join [opt-val {without-ext with-out-jim-ext}]]
199 set withext [join [opt-val {with-ext with-jim-ext}]]
200 set withmod [join [opt-val {with-mod with-jim-extmod}]]
203 set ext_tcl "stdlib glob tclcompat tree rlprompt oo binary"
205 set ext_c "load package readdir array clock exec file posix regexp signal aio eventloop pack syslog nvp readline mk sqlite sqlite3 win32"
210 # Tcl extensions which can be modules
211 set ext_tcl_mod "glob tree rlprompt oo binary"
212 # Native extensions which can be modules
213 set ext_c_mod "readdir array clock file posix regexp syslog readline pack mk sqlite sqlite3 win32"
216 set ext_all [concat $ext_c $ext_tcl]
218 # Default static extensions
219 set ext_default "stdlib load package readdir glob array clock exec file posix regexp signal tclcompat aio eventloop syslog"
221 if {[opt-bool full]} {
222 lappend ext_default tree binary
225 if {$without eq "default"} {
226 set ext_default stdlib
230 # Check valid extension names
231 foreach i [concat $withext $without $withmod] {
232 if {$i ni $ext_all} {
233 user-error "Unknown extension: $i"
237 # needs_xxx="expression" means that the expr must eval to 1 to select the extension
238 # dep_xxx="yyy zzz" means that if xxx is selected, so is yyy and zzz
239 set dep(glob) readdir
240 set dep(rlprompt) readline
244 set needs(exec) {expr {([have-feature vfork] && [have-feature waitpid]) || [have-feature system]}}
245 set needs(load) {expr {[cc-check-function-in-lib dlopen dl] || [have-feature dlopen-compat]}}
246 set libdep(load) lib_dlopen
247 set needs(posix) {have-feature waitpid}
248 set needs(readdir) {have-feature opendir}
249 set needs(readline) {cc-check-function-in-lib readline readline}
250 set libdep(readline) lib_readline
251 set needs(signal) {expr {[have-feature sigaction] && [have-feature vfork]}}
252 set needs(mk) {check-metakit}
253 set libdep(mk) lib_mk
254 set needs(sqlite) {cc-check-function-in-lib sqlite_open sqlite}
255 set libdep(sqlite) lib_sqlite_open
256 set needs(sqlite3) {cc-check-function-in-lib sqlite3_open sqlite3}
257 set libdep(sqlite3) lib_sqlite3_open
258 set needs(syslog) {have-feature syslog}
259 set needs(win32) {have-feature windows}
261 # First handle dependencies. If an extension is enabled, also enable its dependency
262 foreach i [concat $ext_default $withext] {
263 if {$i in $without} {
266 if {[info exists dep($i)]} {
267 lappend withext {*}$dep($i)
272 if {[info exists dep($i)]} {
273 # Theoretically, a mod could depend upon something which must be static
274 # If already configured static, don't make it a module
276 if
{$d ni $withext
} {
283 # Now that we know what the platform supports
:
285 # For all known extensions
:
286 #
- If it is disabled
, remove it
287 #
- Otherwise
, check to see if it
's pre-requisites are met
288 # - If yes, add it if it is enabled or is a default
289 # - If no, error if it is enabled, or do nothing otherwise
290 # - Modules may be either C or Tcl
296 foreach i [lsort $ext_all] {
297 # First discard the extension if disabled or not enabled
298 if {$i in $without} {
299 msg-result "Extension $i...disabled"
302 if {$i ni [concat $withext $withmod $ext_default]} {
303 msg-result "Extension $i...not enabled"
309 if {[info exists needs($i)]} {
310 set met [eval $needs($i)]
315 msg-checking "Extension $i..."
317 # Selected as a module?
318 if {$i in $withmod} {
319 if {$i in $ext_tcl_mod} {
325 if {$i ni $ext_c_mod} {
326 user-error "not a module"
329 user-error "dependencies not met"
333 if {[info exists libdep($i)]} {
334 define-append LDLIBS_$i [get-define $libdep($i) ""]
339 # Selected as a static extension?
340 if {$i in $withext} {
342 user-error "dependencies not met"
345 } elseif {$i in $ext_default} {
347 msg-result "disabled (dependencies)"
350 msg-result "enabled (default)"
356 if {[info exists libdep($i)]} {
357 define-append LDLIBS [get-define $libdep($i) ""]
361 if {[have-feature windows]} {
362 lappend extra_objs jim-win32compat.o
364 if {$extmod ne "" && [get-define JIM_LIBTYPE] eq "static"} {
365 user-error "cygwin/mingw require --shared for dynamic modules"
369 if {"regexp" in "$ext $extmod"} {
370 # No regcomp means we need to use the built-in version
371 if {![have-feature regcomp]} {
376 if {$jimregexp || [opt-bool jim-regexp]} {
377 msg-result "Using built-in regexp"
380 # If the built-in regexp overrides the system regcomp, etc.
381 # jim must be built shared so that the correct symbols are found
382 if {"regexp" in $extmod && [get-define JIM_LIBTYPE] eq "static" && [have-feature regcomp]} {
383 user-error "Must use --shared with regexp module and built-in regexp"
386 if {"load" ni $ext} {
387 # If we don't have load
, no need to support shared objects
388 define SH_LINKFLAGS
""
391 msg
-result
"Jim static extensions: [lsort $ext]"
392 if
{$extmodtcl ne
""} {
393 msg
-result
"Jim Tcl extensions: [lsort $extmodtcl]"
396 msg
-result
"Jim dynamic extensions: [lsort $extmod]"
399 # Separate out the static extensions into C and Tcl
401 set ext_static_tcl
{}
404 if
{$e in $ext_tcl
} {
405 lappend ext_static_tcl $e
407 lappend ext_static_c $e
411 # If there are any static C
++ extensions
, jimsh must be linked using
413 foreach e $ext_static_c
{
414 if
{$e in $ext_cxx
} {
415 define HAVE_CXX_EXTENSIONS
419 define STATIC_EXTS
[concat $ext_static_c $ext_static_tcl
]
420 define C_EXT_OBJS
[prefix jim
- [suffix .o $ext_static_c
]]
421 define TCL_EXT_OBJS
[suffix .o $ext_static_tcl
]
422 define C_EXT_SHOBJS
[suffix .so $extmod
]
423 define TCL_EXTS
[suffix .tcl $extmodtcl
]
424 define EXTRA_OBJS $extra_objs
426 make
-config
-header jim
-config.h
-auto
{HAVE_LONG_LONG
* JIM_UTF8
} -none
*
427 make
-config
-header jimautoconf.h
-auto
{jim_ext_
* TCL_PLATFORM_
* TCL_LIBRARY USE_
* JIM_
*}
428 make
-template Makefile.in