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 with
-jim
-shared shared
=> "build a shared library instead of a static library"
15 jim
-regexp
=> "use the built-in (Tcl-compatible) regexp, even if POSIX regex is available"
16 with
-jim
-ext
: {with
-ext
:"ext1 ext2 ..."} => {
17 Specify additional jim extensions to include.
18 These are enabled by default
:
20 aio
- ANSI I
/O
, including open and socket
21 eventloop
- after
, vwait
, update
22 array
- Tcl
-compatible array command
23 clock
- Tcl
-compatible clock command
24 exec
- Tcl
-compatible exec command
25 file
- Tcl
-compatible file command
26 glob
- Tcl
-compatible glob command
27 readdir
- Required for glob
28 package
- Package management with the package command
29 load
- Load binary extensions at runtime with load or package
30 posix
- Posix APIs including os.fork
, os.wait
, pid
31 regexp
- Tcl
-compatible regexp
, regsub commands
32 signal
- Signal handling
33 stdlib
- Built
-in commands including lassign
, lambda
, alias
34 syslog
- System logging with syslog
35 tclcompat
- Tcl compatible read
, gets
, puts
, parray
, case
, ...
37 These are disabled by default
:
39 nvp
- Name
-value pairs C
-only API
41 tree
- OO tree structure
, similar to tcllib
::struct
::tree
42 binary
- Tcl
-compatible
'binary' command
43 readline
- Interface to libreadline
44 rlprompt
- Tcl wrapper around the readline extension
45 sqlite
- Interface to sqlite
46 sqlite3
- Interface to sqlite3
47 win32
- Interface to win32
49 with
-out
-jim
-ext
: {without
-ext
:"default|ext1 ext2 ..."} => {
50 Specify jim extensions to exclude.
51 If
'default' is given
, the default extensions will not be added.
53 with
-jim
-extmod
: {with
-mod
:"ext1 ext2 ..."} => {
54 Specify jim extensions to build as separate
modules (either C or Tcl
).
55 Note that not all extensions can be built as loadable modules.
59 cc
-check
-types
"long long"
61 cc
-check
-includes sys
/socket.h netinet
/in.h arpa
/inet.h netdb.h
62 cc
-check
-includes sys
/un.h dlfcn.h unistd.h crt_externs.h
64 cc
-check
-functions ualarm sysinfo lstat fork vfork system select
65 cc
-check
-functions backtrace geteuid mkstemp realpath strptime gettimeofday
66 cc
-check
-functions regcomp waitpid sigaction sys_signame sys_siglist
67 cc
-check
-functions syslog opendir readlink sleep usleep pipe inet_ntop getaddrinfo
69 switch
-glob
-- [get
-define host
] {
71 # We provide our own implementation of dlopen for mingw32
72 define
-feature dlopen
-compat
77 cc
-check
-tools ar ranlib strip
78 define tclsh
[info nameofexecutable
]
80 if
{![cc
-check
-functions _NSGetEnviron
]} {
81 msg
-checking
"Checking environ declared in unistd.h..."
82 if
{[cctest
-cflags
-D_GNU_SOURCE
-includes unistd.h
-code
{char
**ep
= environ
;}]} {
83 define NO_ENVIRON_EXTERN
90 # Windows has a mkdir with no permission arg
91 cc
-check
-includes sys
/types.h sys
/stat.h
92 msg
-checking
"Checking for mkdir with one arg..."
93 if
{[cctest
-includes
{sys
/types.h sys
/stat.h
} -code
{mkdir("/dummy");}]} {
94 define HAVE_MKDIR_ONE_ARG
103 if
{[opt
-bool utf8
]} {
104 msg
-result
"Enabling UTF-8"
108 if
{[opt
-bool maintainer
]} {
109 msg
-result
"Enabling maintainer settings"
110 define JIM_MAINTAINER
112 if
{[opt
-bool math
]} {
113 msg
-result
"Enabling math functions"
114 define JIM_MATH_FUNCTIONS
115 define
-append LIBS
-lm
117 if
{[opt
-bool ipv6
]} {
118 msg
-result
"Enabling IPv6"
121 if
{[opt
-bool lineedit
] && [cc
-check
-includes termios.h
]} {
122 msg
-result
"Enabling line editing"
124 lappend extra_objs linenoise.o
126 if
{[opt
-bool references
]} {
127 msg
-result
"Enabling references"
128 define JIM_REFERENCES
130 if
{[opt
-bool shared with
-jim
-shared
]} {
131 msg
-result
"Building shared library"
132 define JIM_LIBTYPE shared
134 msg
-result
"Building static library"
135 define JIM_LIBTYPE static
138 # Note
: Extension handling is mapped directly from the configure.ac
141 set without
[join
[opt
-val
{without
-ext with
-out
-jim
-ext
}]]
142 set withext
[join
[opt
-val
{with
-ext with
-jim
-ext
}]]
143 set withmod
[join
[opt
-val
{with
-mod with
-jim
-extmod
}]]
146 set ext_tcl
"stdlib glob tclcompat tree rlprompt oo binary"
148 set ext_c
"load package readdir array clock exec file posix regexp signal aio eventloop pack syslog nvp readline sqlite sqlite3 win32"
150 # Tcl extensions which can be modules
151 set ext_tcl_mod
"glob tree rlprompt oo binary"
152 # C extensions which can be modules
153 set ext_c_mod
"readdir array clock file posix regexp syslog readline pack sqlite sqlite3 win32"
156 set ext_all
[concat $ext_c $ext_tcl
]
158 # Default static extensions
159 set ext_default
"stdlib load package readdir glob array clock exec file posix regexp signal tclcompat aio eventloop syslog"
161 if
{$without eq
"default"} {
162 set ext_default stdlib
166 # Check valid extension names
167 foreach i
[concat $withext $without $withmod
] {
168 if
{$i ni $ext_all
} {
169 user
-error
"Unknown extension: $i"
173 # needs_xxx
="expression" means that the expr must eval to
1 to select the extension
174 # dep_xxx
="yyy zzz" means that if xxx is selected
, so is yyy and zzz
175 set
dep(glob
) readdir
176 set
dep(rlprompt
) readline
180 set
needs(aio
) {expr
{[cc
-check
-function
-in
-lib socket socket
] ||
1}}
181 set
needs(exec
) {expr
{([have
-feature vfork
] && [have
-feature waitpid
]) ||
[have
-feature system
]}}
182 set
needs(load
) {expr
{[cc
-check
-function
-in
-lib dlopen dl
] ||
[have
-feature dlopen
-compat
]}}
183 set
needs(posix
) {have
-feature waitpid
}
184 set
needs(readdir
) {have
-feature opendir
}
185 set
needs(readline
) {cc
-check
-function
-in
-lib readline readline
}
186 set
needs(signal
) {expr
{[have
-feature sigaction
] && [have
-feature vfork
]}}
187 set
needs(sqlite
) {cc
-check
-function
-in
-lib sqlite_open sqlite
}
188 set
needs(sqlite3
) {cc
-check
-function
-in
-lib sqlite3_open sqlite3
}
189 set
needs(syslog
) {have
-feature syslog
}
190 set
needs(eventloop
) {expr
{[have
-feature select
] ||
[have
-feature usleep
]}}
191 set
needs(win32
) {have
-feature windows
}
193 # First handle dependencies. If an extension is enabled
, also enable its dependency
194 foreach i
[concat $ext_default $withext
] {
195 if
{$i in $without
} {
198 if
{[info exists
dep($i
)]} {
199 lappend withext
{*}$
dep($i
)
204 if
{[info exists
dep($i
)]} {
205 # Theoretically
, a mod could depend upon something which must be static
206 # If already configured static
, don
't make it a module
208 if {$d ni $withext} {
215 # Now that we know what the platform supports:
217 # For all known extensions:
218 # - If it is disabled, remove it
219 # - Otherwise, check to see if it's pre
-requisites are met
220 #
- If yes
, add it if it is enabled or is a default
221 #
- If no
, error if it is enabled
, or do nothing otherwise
222 #
- Modules may be either C or Tcl
228 foreach i
[lsort $ext_all
] {
229 # First discard the extension if disabled or not enabled
230 if
{$i in $without
} {
231 msg
-result
"Extension $i...disabled"
234 if
{$i ni
[concat $withext $withmod $ext_default
]} {
235 msg
-result
"Extension $i...not enabled"
241 if
{[info exists
needs($i
)]} {
242 set met
[eval $
needs($i
)]
245 msg
-checking
"Extension $i..."
247 # Selected as a module?
248 if
{$i in $withmod
} {
249 if
{$i in $ext_tcl_mod
} {
255 if
{$i ni $ext_c_mod
} {
256 user
-error
"not a module"
259 user
-error
"dependencies not met"
266 # Selected as a static extension?
267 if
{$i in $withext
} {
269 user
-error
"dependencies not met"
276 # Enabled by default?
277 if
{$i in $ext_default
} {
279 msg
-result
"disabled (dependencies)"
282 msg
-result
"enabled (default)"
288 if
{[have
-feature windows
]} {
289 lappend extra_objs jim
-win32compat.o
291 if
{$extmod ne
"" && [get
-define JIM_LIBTYPE
] eq
"static"} {
292 user
-error
"cygwin/mingw require --shared for dynamic modules"
296 if
{"regexp" in
"$ext $extmod"} {
297 # No regcomp means we need to use the built
-in version
298 if
{![have
-feature regcomp
]} {
303 if
{$jimregexp ||
[opt
-bool jim
-regexp
]} {
304 msg
-result
"Using built-in regexp"
307 # If the built
-in regexp overrides the system regcomp
, etc.
308 # jim must be built shared so that the correct symbols are found
309 if
{"regexp" in $extmod
&& [get
-define JIM_LIBTYPE
] eq
"static" && [have
-feature regcomp
]} {
310 user
-error
"Must use --shared with regexp module and built-in regexp"
313 if
{"load" ni $ext
} {
314 # If we don
't have load, no need to support shared objects
315 define SH_LINKFLAGS ""
318 msg-result "Jim static extensions: [lsort $ext]"
319 if {$extmodtcl ne ""} {
320 msg-result "Jim Tcl extensions: [lsort $extmodtcl]"
323 msg-result "Jim dynamic extensions: [lsort $extmod]"
326 define JIM_EXTENSIONS $ext
327 define JIM_TCL_EXTENSIONS $extmodtcl
328 define JIM_MOD_EXTENSIONS $extmod
329 define EXTRA_OBJS $extra_objs
333 if {$e in $ext_tcl} {
334 define-append GENERATED_SRCS jim-$e.c
338 define TCL_LIBRARY [get-define prefix]/lib/jim
339 define TCL_PLATFORM_OS [exec uname -s]
340 define TCL_PLATFORM_PLATFORM unix
342 make-autoconf-h jim-config.h {HAVE_LONG_LONG* JIM_UTF8}
343 make-autoconf-h jimautoconf.h {HAVE_* jim_ext_* TCL_PLATFORM_* TCL_LIBRARY USE_* JIM_*}
344 make-template Makefile.in