aboutsummaryrefslogtreecommitdiff
path: root/auto.def
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-11-28 23:26:13 +1000
committerSteve Bennett <steveb@workware.net.au>2011-06-09 11:45:39 +1000
commitf25d6276ee487d583e35c48f3125ef388c9f7d3f (patch)
tree03775dc0c0f6112c58266b9bfa83bf4382f58a38 /auto.def
parentc8abfa88a3319425921064d045679614a1b4a550 (diff)
downloadjimtcl-f25d6276ee487d583e35c48f3125ef388c9f7d3f.zip
jimtcl-f25d6276ee487d583e35c48f3125ef388c9f7d3f.tar.gz
jimtcl-f25d6276ee487d583e35c48f3125ef388c9f7d3f.tar.bz2
Use autosetup instead of autoconf
Faster, simpler auto-configuration Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'auto.def')
-rw-r--r--auto.def325
1 files changed, 325 insertions, 0 deletions
diff --git a/auto.def b/auto.def
new file mode 100644
index 0000000..6904976
--- /dev/null
+++ b/auto.def
@@ -0,0 +1,325 @@
+# vim:se syn=tcl:
+#
+
+# Note: modules which support options *must* be included before 'options'
+use cc cc-shared
+
+options {
+ utf8 => "include support for utf8-encoded strings"
+ lineedit=1 => "disable line editing"
+ references=1 => "disable support for references"
+ math => "include support for math functions"
+ ipv6 => "include ipv6 support in the aio extension"
+ with-jim-shared shared => "build a shared library instead of a static library"
+ jim-regexp => "use the built-in (Tcl-compatible) regexp, even if POSIX regex is available"
+ with-jim-ext: {with-ext:"ext1 ext2 ..."} => {
+ Specify additional jim extensions to include.
+ These are enabled by default:
+
+ aio - ANSI I/O, including open and socket
+ eventloop - after, vwait, update
+ array - Tcl-compatible array command
+ clock - Tcl-compatible clock command
+ exec - Tcl-compatible exec command
+ file - Tcl-compatible file command
+ glob - Tcl-compatible glob command
+ readdir - Required for glob
+ package - Package management with the package command
+ load - Load binary extensions at runtime with load or package
+ posix - Posix APIs including os.fork, os.wait, pid
+ regexp - Tcl-compatible regexp, regsub commands
+ signal - Signal handling
+ stdlib - Built-in commands including lassign, lambda, alias
+ syslog - System logging with syslog
+ tclcompat - Tcl compatible read, gets, puts, parray, case, ...
+
+ These are disabled by default:
+
+ nvp - Name-value pairs C-only API
+ oo - Jim OO extension
+ tree - OO tree structure, similar to tcllib ::struct::tree
+ readline - Interface to libreadline
+ rlprompt - Tcl wrapper around the readline extension
+ sqlite - Interface to sqlite
+ sqlite3 - Interface to sqlite3
+ win32 - Interface to win32
+ }
+ with-out-jim-ext: {without-ext:"default|ext1 ext2 ..."} => {
+ Specify jim extensions to exclude.
+ If 'default' is given, the default extensions will not be added.
+ }
+ with-jim-extmod: {with-mod:"ext1 ext2 ..."} => {
+ Specify jim extensions to build as separate modules (either C or Tcl).
+ Note that not all extensions can be built as loadable modules.
+ }
+}
+
+cc-check-types "long long"
+
+cc-check-includes sys/un.h dlfcn.h unistd.h
+
+cc-check-functions ualarm sysinfo lstat fork vfork
+cc-check-functions backtrace geteuid mkstemp realpath strptime
+cc-check-functions regcomp waitpid sigaction sys_signame sys_siglist
+cc-check-functions syslog opendir readlink sleep usleep pipe inet_ntop getaddrinfo
+
+switch -glob -- [get-define host] {
+ *-*-ming* {
+ # We provide our own implementation of dlopen for mingw32
+ define-feature dlopen-compat
+ }
+}
+
+# Find some tools
+cc-check-tools ar ranlib strip
+define tclsh [info nameofexecutable]
+
+msg-checking "Checking environ declared in unistd.h..."
+if {[cctest -cflags -D_GNU_SOURCE -includes unistd.h -code {char **ep = environ;}]} {
+ define NO_ENVIRON_EXTERN
+ msg-result "yes"
+} else {
+ msg-result "no"
+}
+
+set extra_objs {}
+set jimregexp 0
+
+if {[opt-bool utf8]} {
+ msg-result "Enabling UTF-8"
+ define JIM_UTF8
+ incr jimregexp
+}
+if {[opt-bool math]} {
+ msg-result "Enabling math functions"
+ define JIM_MATH_FUNCTIONS
+}
+if {[opt-bool ipv6]} {
+ msg-result "Enabling IPv6"
+ define JIM_IPV6
+}
+if {[opt-bool lineedit] && [cc-check-includes termios.h]} {
+ msg-result "Enabling line editing"
+ define USE_LINENOISE
+ lappend extra_objs linenoise.o
+}
+if {[opt-bool references]} {
+ msg-result "Enabling references"
+ define JIM_REFERENCES
+}
+if {[opt-bool shared with-jim-shared]} {
+ msg-result "Building shared library"
+ define JIM_LIBTYPE shared
+} else {
+ msg-result "Building static library"
+ define JIM_LIBTYPE static
+}
+
+# Note: Extension handling is mapped directly from the configure.ac
+# implementation
+
+set without [join [opt-val {without-ext with-out-jim-ext}]]
+set withext [join [opt-val {with-ext with-jim-ext}]]
+set withmod [join [opt-val {with-mod with-jim-extmod}]]
+
+# Tcl extensions
+set ext_tcl "stdlib glob tclcompat tree rlprompt oo"
+# C extensions
+set ext_c "load package readdir array clock exec file posix regexp signal aio eventloop syslog nvp readline sqlite sqlite3 win32"
+
+# Tcl extensions which can be modules
+set ext_tcl_mod "glob tree rlprompt oo"
+# C extensions which can be modules
+set ext_c_mod "readdir array clock file posix regexp syslog readline sqlite sqlite3 win32"
+
+# All extensions
+set ext_all [concat $ext_c $ext_tcl]
+
+# Default static extensions
+set ext_default "stdlib load package readdir glob array clock exec file posix regexp signal tclcompat aio eventloop syslog"
+
+if {$without eq "default"} {
+ set ext_default stdlib
+ set without {}
+}
+
+# Check valid extension names
+foreach i [concat $withext $without $withmod] {
+ if {$i ni $ext_all} {
+ user-error "Unknown extension: $i"
+ }
+}
+
+# needs_xxx="expression" means that the expr must eval to 1 to select the extension
+# dep_xxx="yyy zzz" means that if xxx is selected, so is yyy and zzz
+set dep(glob) readdir
+set dep(rlprompt) readline
+set dep(tree) oo
+
+set needs(aio) {expr {[cc-check-function-in-lib socket socket] || 1}}
+set needs(exec) {expr {[have-feature vfork] && [have-feature waitpid]}}
+set needs(load) {expr {[have-feature dlopen-compat] || [cc-check-function-in-lib dlopen dl]}}
+set needs(posix) {have-feature waitpid}
+set needs(readdir) {have-feature opendir}
+set needs(readline) {cc-check-function-in-lib readline readline}
+set needs(signal) {expr {[have-feature sigaction] && [have-feature vfork]}}
+set needs(sqlite) {cc-check-function-in-lib sqlite_open sqlite}
+set needs(sqlite3) {cc-check-function-in-lib sqlite3_open sqlite3}
+set needs(syslog) {have-feature syslog}
+set needs(win32) {have-feature windows}
+
+# First handle dependencies. If an extension is enabled, also enable its dependency
+foreach i [concat $ext_default $withext] {
+ if {$i in $without} {
+ continue
+ }
+ if {[info exists dep($i)]} {
+ lappend withext {*}$dep($i)
+ }
+}
+
+foreach i $withmod {
+ if {[info exists dep($i)]} {
+ # Theoretically, a mod could depend upon something which must be static
+ # If already configured static, don't make it a module
+ foreach d $dep($i) {
+ if {$d ni $withext} {
+ lappend withmod $d
+ }
+ }
+ }
+}
+
+# Now that we know what the platform supports:
+
+# For all known extensions:
+# - If it is disabled, remove it
+# - Otherwise, check to see if it's pre-requisites are met
+# - If yes, add it if it is enabled or is a default
+# - If no, error if it is enabled, or do nothing otherwise
+# - Modules may be either C or Tcl
+
+set extmodtcl {}
+set extmod {}
+set ext {}
+
+foreach i [lsort $ext_all] {
+ # First discard the extension if disabled or not enabled
+ if {$i in $without} {
+ msg-result "Extension $i...disabled"
+ continue
+ }
+ if {$i ni [concat $withext $withmod $ext_default]} {
+ msg-result "Extension $i...not enabled"
+ continue
+ }
+
+ # Check dependencies
+ set met 1
+ if {[info exists needs($i)]} {
+ set met [eval $needs($i)]
+ }
+
+ msg-checking "Extension $i..."
+
+ # Selected as a module?
+ if {$i in $withmod} {
+ if {$i in $ext_tcl_mod} {
+ # Easy, a Tcl module
+ msg-result "tcl"
+ lappend extmodtcl $i
+ continue
+ }
+ if {$i ni $ext_c_mod} {
+ user-error "not a module"
+ }
+ if {!$met} {
+ user-error "dependencies not met"
+ }
+ msg-result "module"
+ lappend extmod $i
+ continue
+ }
+
+ # Selected as a static extension?
+ if {$i in $withext} {
+ if {!$met} {
+ user-error "dependencies not met"
+ }
+ msg-result "enabled"
+ lappend ext $i
+ continue
+ }
+
+ # Enabled by default?
+ if {$i in $ext_default} {
+ if {!$met} {
+ msg-result "disabled (dependencies)"
+ continue
+ }
+ msg-result "enabled (default)"
+ lappend ext $i
+ continue
+ }
+}
+
+if {[have-feature windows]} {
+ if {"aio" in "$ext $extmod"} {
+ define-append LIBS -lwsock32
+ }
+ lappend extra_objs jim-win32compat.o
+
+ if {$extmod ne "" && [get-define JIM_LIBTYPE] eq "static"} {
+ user-error "cygwin/mingw require --shared for dynamic modules"
+ }
+}
+
+if {"regexp" in "$ext $extmod"} {
+ # No regcomp means we need to use the built-in version
+ if {![have-feature regcomp]} {
+ incr jimregexp
+ }
+}
+
+if {$jimregexp || [opt-bool jim-regexp]} {
+ msg-result "Using built-in regexp"
+ define JIM_REGEXP
+
+ # If the built-in regexp overrides the system regcomp, etc.
+ # jim must be built shared so that the correct symbols are found
+ if {"regexp" in $extmod && [get-define JIM_LIBTYPE] eq "static" && [have-feature regcomp]} {
+ user-error "Must use --shared with regexp module and built-in regexp"
+ }
+}
+if {"load" ni $ext} {
+ # If we don't have load, no need to support shared objects
+ define SH_LINKFLAGS ""
+}
+
+msg-result "Jim static extensions: [lsort $ext]"
+if {$extmodtcl ne ""} {
+ msg-result "Jim Tcl extensions: [lsort $extmodtcl]"
+}
+if {$extmod ne ""} {
+ msg-result "Jim dynamic extensions: [lsort $extmod]"
+}
+
+define JIM_EXTENSIONS $ext
+define JIM_TCL_EXTENSIONS $extmodtcl
+define JIM_MOD_EXTENSIONS $extmod
+define EXTRA_OBJS $extra_objs
+
+foreach e $ext {
+ define jim_ext_$e
+ if {$e in $ext_tcl} {
+ define-append GENERATED_SRCS jim-$e.c
+ }
+}
+
+define TCL_LIBRARY [get-define prefix]/lib/jim
+define TCL_PLATFORM_OS [exec uname -s]
+define TCL_PLATFORM_PLATFORM unix
+
+make-autoconf-h jim-config.h {HAVE_LONG_LONG* JIM_UTF8}
+make-autoconf-h jimautoconf.h {HAVE_* jim_ext_* TCL_PLATFORM_* TCL_LIBRARY USE_* JIM_*}
+make-template Makefile.in