aboutsummaryrefslogtreecommitdiff
path: root/autosetup
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2011-08-18 13:43:47 +1000
committerSteve Bennett <steveb@workware.net.au>2011-08-18 20:13:37 +1000
commit6f288aab0c5797f844ee458dd98f30b1f3db62c6 (patch)
tree630afcf247b6c60d9f04d31589d9a7a9d64aabb2 /autosetup
parent645ed6fd4b6f9038c7e1d85d74c3872b3cb9a507 (diff)
downloadjimtcl-6f288aab0c5797f844ee458dd98f30b1f3db62c6.zip
jimtcl-6f288aab0c5797f844ee458dd98f30b1f3db62c6.tar.gz
jimtcl-6f288aab0c5797f844ee458dd98f30b1f3db62c6.tar.bz2
Fix build on Solaris (gcc)
inet_ntop needs -lnsl on Solaris Solaris has sysinfo, but no uptime Link flags need to be a bit different Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'autosetup')
-rwxr-xr-xautosetup/autosetup38
-rw-r--r--autosetup/cc-shared.tcl19
-rw-r--r--autosetup/system.tcl52
3 files changed, 102 insertions, 7 deletions
diff --git a/autosetup/autosetup b/autosetup/autosetup
index fae164e..9cd9622 100755
--- a/autosetup/autosetup
+++ b/autosetup/autosetup
@@ -184,7 +184,7 @@ proc main {argv} {
#
# Check each of the named, boolean options and return 1 if any of them have
# been set by the user.
-#
+#
proc opt-bool {args} {
option-check-names {*}$args
opt_bool ::useropts {*}$args
@@ -200,7 +200,7 @@ proc opt-bool {args} {
## lindex [opt-val $names] end
#
# If no options were set, $default is returned (exactly, not as a list).
-#
+#
proc opt-val {names {default ""}} {
option-check-names {*}$names
join [opt_val ::useropts $names $default]
@@ -398,7 +398,7 @@ proc options-show {} {
# For example, --disable-lfs is an alias for --disable=largefile:
#
## lfs=1 largefile=1 => "Disable large file support"
-#
+#
proc options {optlist} {
# Allow options as a list or args
options-add $optlist "Local Options:"
@@ -436,7 +436,7 @@ proc config_sub {alias} {
}
# @define name ?value=1?
-#
+#
# Defines the named variable to the given value.
# These (name, value) pairs represent the results of the configuration check
# and are available to be checked, modified and substituted.
@@ -567,6 +567,36 @@ proc quote-argv {argv} {
join $args
}
+# @suffix suf list
+#
+# Takes a list and returns a new list with $suf appended
+# to each element
+#
+## suffix .c {a b c} => {a.c b.c c.c}
+#
+proc suffix {suf list} {
+ set result {}
+ foreach p $list {
+ lappend result $p$suf
+ }
+ return $result
+}
+
+# @prefix pre list
+#
+# Takes a list and returns a new list with $pre prepended
+# to each element
+#
+## prefix jim- {a.c b.c} => {jim-a.c jim-b.c}
+#
+proc prefix {pre list} {
+ set result {}
+ foreach p $list {
+ lappend result $pre$p
+ }
+ return $result
+}
+
# @find-executable name
#
# Searches the path for an executable with the given name.
diff --git a/autosetup/cc-shared.tcl b/autosetup/cc-shared.tcl
index 6de498d..b59816c 100644
--- a/autosetup/cc-shared.tcl
+++ b/autosetup/cc-shared.tcl
@@ -37,12 +37,27 @@ switch -glob -- [get-define host] {
define SH_LDFLAGS -shared
define SHOBJ_LDFLAGS -shared
}
+ *-*-solaris* {
+ # XXX: These haven't been fully tested.
+ #define SH_LINKFLAGS -Wl,-export-dynamic
+ define SH_CFLAGS -Kpic
+ define SHOBJ_CFLAGS -Kpic
+ define SHOBJ_LDFLAGS "-G"
+ }
+ *-*-hpux {
+ # XXX: These haven't been tested
+ define SH_LINKFLAGS -Wl,+s
+ define SH_CFLAGS +z
+ define SHOBJ_CFLAGS "+O3 +z"
+ define SHOBJ_LDFLAGS -b
+ define LD_LIBRARY_PATH SHLIB_PATH
+ }
* {
# Generic Unix settings
define SH_LINKFLAGS -rdynamic
- define SH_CFLAGS -fPIC
+ define SH_CFLAGS -fpic
define SH_LDFLAGS -shared
- define SHOBJ_CFLAGS -fPIC
+ define SHOBJ_CFLAGS -fpic
define SHOBJ_LDFLAGS "-shared -nostartfiles"
}
}
diff --git a/autosetup/system.tcl b/autosetup/system.tcl
index 8915273..b72dfbc 100644
--- a/autosetup/system.tcl
+++ b/autosetup/system.tcl
@@ -113,6 +113,24 @@ proc write-if-changed {file buf {script {}}} {
# path to the source directory from the directory where the output
# file is created. Use @top_srcdir@ for the absolute path.
#
+# Conditional sections may be specified as follows:
+## @if name == value
+## lines
+## @else
+## lines
+## @endif
+#
+# Where 'name' is a defined variable name and @else is optional.
+# If the expression does not match, all lines through '@endif' are ignored.
+#
+# The alternative forms may also be used:
+## @if name
+## @if name != value
+#
+# Where the first form is true if the variable is defined, but not empty or 0
+#
+# Currently these expressions can't be nested.
+#
proc make-template {template {out {}}} {
set infile [file join $::autosetup(srcdir) $template]
@@ -142,7 +160,39 @@ proc make-template {template {out {}}} {
foreach {n v} [array get ::define] {
lappend mapping @$n@ $v
}
- writefile $out [string map $mapping [readfile $infile]]\n
+ set result {}
+ foreach line [split [readfile $infile] \n] {
+ if {[info exists cond]} {
+ set l [string trimright $line]
+ if {$l eq "@endif"} {
+ unset cond
+ continue
+ }
+ if {$l eq "@else"} {
+ set cond [expr {!$cond}]
+ continue
+ }
+ if {$cond} {
+ lappend result $line
+ }
+ continue
+ }
+ if {[regexp {^@if\s+(\w+)(.*)} $line -> name expression]} {
+ lassign $expression equal value
+ set varval [get-define $name ""]
+ if {$equal eq ""} {
+ set cond [expr {$varval ni {"" 0}}]
+ } else {
+ set cond [expr {$varval eq $value}]
+ if {$equal ne "=="} {
+ set cond [expr {!$cond}]
+ }
+ }
+ continue
+ }
+ lappend result $line
+ }
+ writefile $out [string map $mapping [join $result \n]]\n
msg-result "Created [relative-path $out] from [relative-path $template]"
}