Remove some c++ style comments
[jimtcl.git] / auto.def
blob7eb00ca3808013e875ba34b0ffa3fe67597f7619
1 # vim:se syn=tcl:
4 # Note: modules which support options *must* be included before 'options'
5 use cc cc-shared cc-db
6 use local
8 options {
9 utf8 => "include support for utf8-encoded strings"
10 lineedit=1 => "disable line editing"
11 references=1 => "disable support for references"
12 math => "include support for math functions"
13 ipv6 => "include ipv6 support in the aio extension"
14 maintainer => {enable the [debug] command and JimPanic}
15 full => "Enable some optional features: ipv6, math, utf8, binary, oo, tree"
16 with-jim-shared shared => "build a shared library instead of a static library"
17 jim-regexp => "use the built-in (Tcl-compatible) regexp, even if POSIX regex is available"
18 with-jim-ext: {with-ext:"ext1 ext2 ..."} => {
19 Specify additional jim extensions to include.
20 These are enabled by default:
22 aio - ANSI I/O, including open and socket
23 eventloop - after, vwait, update
24 array - Tcl-compatible array command
25 clock - Tcl-compatible clock command
26 exec - Tcl-compatible exec command
27 file - Tcl-compatible file command
28 glob - Tcl-compatible glob command
29 history - Tcl access to interactive history
30 readdir - Required for glob
31 package - Package management with the package command
32 load - Load binary extensions at runtime with load or package
33 posix - Posix APIs including os.fork, os.wait, pid
34 regexp - Tcl-compatible regexp, regsub commands
35 signal - Signal handling
36 stdlib - Built-in commands including lassign, lambda, alias
37 syslog - System logging with syslog
38 tclcompat - Tcl compatible read, gets, puts, parray, case, ...
40 These are disabled by default:
42 oo - Jim OO extension
43 tree - OO tree structure, similar to tcllib ::struct::tree
44 binary - Tcl-compatible 'binary' command
45 readline - Interface to libreadline
46 rlprompt - Tcl wrapper around the readline extension
47 mk - Interface to Metakit
48 tclprefix - Support for the tcl::prefix command
49 sqlite - Interface to sqlite
50 sqlite3 - Interface to sqlite3
51 win32 - Interface to win32
53 with-out-jim-ext: {without-ext:"default|ext1 ext2 ..."} => {
54 Specify jim extensions to exclude.
55 If 'default' is given, the default extensions will not be added.
57 with-jim-extmod: {with-mod:"ext1 ext2 ..."} => {
58 Specify jim extensions to build as separate modules (either C or Tcl).
59 Note that not all extensions can be built as loadable modules.
61 # To help out openocd with automake
62 install-jim=1
65 cc-check-types "long long"
67 cc-check-includes sys/time.h sys/socket.h netinet/in.h arpa/inet.h netdb.h
68 cc-check-includes sys/un.h dlfcn.h unistd.h dirent.h crt_externs.h
70 define LDLIBS ""
72 # Haiku needs -lnetwork, Solaris needs -lnsl
73 if {[cc-check-function-in-lib inet_ntop {nsl network}]} {
74 # This does nothing if no libs are needed
75 cc-with [list -libs [get-define lib_inet_ntop]]
76 define-append LDLIBS [get-define lib_inet_ntop]
78 # Solaris needs -lsocket, Windows needs -lwsock32
79 if {[cc-check-function-in-lib socket socket]} {
80 define-append LDLIBS [get-define lib_socket]
83 cc-check-functions ualarm lstat fork vfork system select
84 cc-check-functions backtrace geteuid mkstemp realpath strptime
85 cc-check-functions regcomp waitpid sigaction sys_signame sys_siglist
86 cc-check-functions syslog opendir readlink sleep usleep pipe getaddrinfo utimes
87 if {[cc-check-functions sysinfo]} {
88 cc-with {-includes sys/sysinfo.h} {
89 cc-check-members "struct sysinfo.uptime"
93 define TCL_LIBRARY [get-define prefix]/lib/jim
95 lassign [split [get-define host] -] host_cpu host_vendor host_os
96 # Scrub revision from the host_os
97 regsub -all {[0-9.]} $host_os {} host_os
99 switch -glob -- $host_os {
100 mingw* {
101 # We provide our own implementation of dlopen for mingw32
102 define-feature dlopen-compat
103 define-feature winconsole
104 define TCL_PLATFORM_OS $host_os
105 define TCL_PLATFORM_PLATFORM windows
106 define TCL_PLATFORM_PATH_SEPARATOR {;}
108 default {
109 # Note that cygwin is considered a unix platform
110 define TCL_PLATFORM_OS $host_os
111 define TCL_PLATFORM_PLATFORM unix
112 define TCL_PLATFORM_PATH_SEPARATOR :
116 # Find some tools
117 cc-check-tools ar ranlib strip
118 define tclsh [info nameofexecutable]
120 if {![cc-check-functions _NSGetEnviron]} {
121 msg-checking "Checking environ declared in unistd.h..."
122 if {[cctest -cflags -D_GNU_SOURCE -includes unistd.h -code {char **ep = environ;}]} {
123 define NO_ENVIRON_EXTERN
124 msg-result "yes"
125 } else {
126 msg-result "no"
130 # Windows has a mkdir with no permission arg
131 cc-check-includes sys/types.h sys/stat.h
132 msg-checking "Checking for mkdir with one arg..."
133 if {[cctest -includes {sys/types.h sys/stat.h} -code {mkdir("/dummy");}]} {
134 define HAVE_MKDIR_ONE_ARG
135 msg-result yes
136 } else {
137 msg-result no
140 set extra_objs {}
141 set jimregexp 0
143 if {[opt-bool utf8 full]} {
144 msg-result "Enabling UTF-8"
145 define JIM_UTF8
146 incr jimregexp
147 } else {
148 define JIM_UTF8 0
150 if {[opt-bool maintainer]} {
151 msg-result "Enabling maintainer settings"
152 define JIM_MAINTAINER
154 if {[opt-bool math full]} {
155 msg-result "Enabling math functions"
156 define JIM_MATH_FUNCTIONS
157 cc-check-function-in-lib sin m
158 define-append LDLIBS [get-define lib_sin]
160 if {[opt-bool ipv6 full]} {
161 msg-result "Enabling IPv6"
162 define JIM_IPV6
164 if {[opt-bool lineedit full]} {
165 if {([cc-check-includes termios.h] && [cc-check-functions isatty]) || [have-feature winconsole]} {
166 msg-result "Enabling line editing"
167 define USE_LINENOISE
168 lappend extra_objs linenoise.o
171 if {[opt-bool references]} {
172 msg-result "Enabling references"
173 define JIM_REFERENCES
175 if {[opt-bool shared with-jim-shared]} {
176 msg-result "Building shared library"
177 } else {
178 msg-result "Building static library"
179 define JIM_STATICLIB
181 define JIM_INSTALL [opt-bool install-jim]
183 # Attributes of the extensions
184 # tcl=Pure Tcl extension
185 # static=Can't be built as a module
186 # optional=Not selected by default
187 # full=Select if the --full option is set
188 # cpp=Is a C++ extension
189 global extdb
190 dict set extdb attrs {
191 aio { static }
192 array {}
193 binary { tcl optional full }
194 clock {}
195 eventloop { static }
196 exec { static }
197 file {}
198 glob { tcl }
199 history {}
200 load { static }
201 mk { cpp optional }
202 oo { tcl optional full }
203 pack { optional full }
204 package { static }
205 posix {}
206 readdir {}
207 readline { optional }
208 regexp {}
209 rlprompt { tcl optional }
210 sdl { optional }
211 signal { static }
212 sqlite3 { optional }
213 stdlib { tcl static }
214 syslog { optional }
215 tclcompat { tcl static }
216 tclprefix { optional full }
217 tree { tcl optional full }
218 win32 { optional }
221 # Additional information about certain extensions
222 # dep=list of extensions which are required for this extension
223 # check=[expr] expression to evaluate to determine if the extension can be used
224 # libdep=list of 'define' symbols for dependent libraries
225 dict set extdb info {
226 binary { dep pack }
227 exec { check {([have-feature vfork] && [have-feature waitpid]) || [have-feature system]} }
228 glob { dep readdir }
229 load { check {[have-feature dlopen-compat] || [cc-check-function-in-lib dlopen dl]} libdep lib_dlopen }
230 mk { check {[check-metakit]} libdep lib_mk }
231 posix { check {[have-feature waitpid]} }
232 readdir { check {[have-feature opendir]} }
233 readline { check {[cc-check-function-in-lib readline readline]} }
234 rlprompt { dep readline }
235 sdl { check {[cc-check-function-in-lib SDL_SetVideoMode SDL] && [cc-check-function-in-lib rectangleRGBA SDL_gfx]}
236 libdep {lib_SDL_SetVideoMode lib_rectangleRGBA}
238 signal { check {[have-feature sigaction] && [have-feature vfork]} }
239 sqlite3 { check {[cc-check-function-in-lib sqlite3_open sqlite3]} libdep lib_sqlite3_open }
240 syslog { check {[have-feature syslog]} }
241 tree { dep oo }
242 win32 { check {[have-feature windows]} }
245 # autosetup cc-check-function-in-library can't handle C++ libraries
246 proc check-metakit {} {
247 set found 0
248 msg-checking "Checking for Metakit..."
249 if {[cctest -lang c++ -includes mk4.h -libs -lmk4 -code {c4_Storage dummy();}]} {
250 msg-result ok
251 define lib_mk -lmk4
252 incr found
253 } else {
254 msg-result "not found"
256 return $found
259 # Set up the withinfo array based on what the user selected
260 global withinfo
261 set withinfo(without) [join [opt-val {without-ext with-out-jim-ext}]]
262 set withinfo(ext) [join [opt-val {with-ext with-jim-ext}]]
263 set withinfo(mod) [join [opt-val {with-mod with-jim-extmod}]]
264 set withinfo(full) [opt-bool full]
265 set withinfo(nodefault) 0
266 if {$withinfo(without) eq "default"} {
267 set withinfo(without) {}
268 set withinfo(nodefault) 1
271 # Now go check everything - see autosetup/local.tcl
272 array set extinfo [check-extensions]
274 # Now special checks
275 if {[have-feature windows]} {
276 lappend extra_objs jim-win32compat.o
278 if {[llength $extinfo(module-c)] && [get-define JIM_STATICLIB]} {
279 user-error "cygwin/mingw require --shared for dynamic modules"
283 if {[ext-get-status regexp] in {y m}} {
284 if {![have-feature regcomp]} {
285 # No regcomp means we need to use the built-in version
286 incr jimregexp
290 if {$jimregexp || [opt-bool jim-regexp]} {
291 msg-result "Using built-in regexp"
292 define JIM_REGEXP
294 # If the built-in regexp overrides the system regcomp, etc.
295 # jim must be built shared so that the correct symbols are found
296 if {[ext-get-status regexp] eq "m" && [get-define JIM_STATICLIB] && [have-feature regcomp]} {
297 user-error "Must use --shared with regexp module and built-in regexp"
301 if {[ext-get-status load] eq "n"} {
302 # If we don't have load, no need to support shared objects
303 define SH_LINKFLAGS ""
306 msg-result "Jim static extensions: [lsort [concat $extinfo(static-tcl) $extinfo(static-c)]]"
307 if {[llength $extinfo(module-tcl)]} {
308 msg-result "Jim Tcl extensions: [lsort $extinfo(module-tcl)]"
310 if {[llength $extinfo(module-c)]} {
311 msg-result "Jim dynamic extensions: [lsort $extinfo(module-c)]"
314 define STATIC_EXTS [concat $extinfo(static-c) $extinfo(static-tcl)]
315 define C_EXT_OBJS [prefix jim- [suffix .o $extinfo(static-c)]]
316 define TCL_EXT_OBJS [suffix .o $extinfo(static-tcl)]
317 define C_EXT_SHOBJS [suffix .so $extinfo(module-c)]
318 define TCL_EXTS [suffix .tcl $extinfo(module-tcl)]
319 define EXTRA_OBJS $extra_objs
321 make-config-header jim-config.h -auto {HAVE_LONG_LONG* JIM_UTF8} -none *
322 make-config-header jimautoconf.h -auto {jim_ext_* TCL_PLATFORM_* TCL_LIBRARY USE_* JIM_*}
323 make-template Makefile.in
324 make-template build-jim-ext.in
326 catch {exec chmod +x build-jim-ext}