aboutsummaryrefslogtreecommitdiff
path: root/autosetup/cc-lib.tcl
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 /autosetup/cc-lib.tcl
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 'autosetup/cc-lib.tcl')
-rw-r--r--autosetup/cc-lib.tcl36
1 files changed, 36 insertions, 0 deletions
diff --git a/autosetup/cc-lib.tcl b/autosetup/cc-lib.tcl
new file mode 100644
index 0000000..e769db9
--- /dev/null
+++ b/autosetup/cc-lib.tcl
@@ -0,0 +1,36 @@
+# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
+# All rights reserved
+
+# @synopsis:
+#
+# Provides a library of common tests on top of the 'cc' module.
+
+use cc
+
+module-options {}
+
+# @cc-check-lfs
+#
+# The equivalent of the AC_SYS_LARGEFILE macro
+#
+# defines 'HAVE_LFS' if LFS is available,
+# and defines '_FILE_OFFSET_BITS=64' if necessary
+#
+# Returns 1 if 'LFS' is available or 0 otherwise
+#
+proc cc-check-lfs {} {
+ cc-check-includes sys/types.h
+ msg-checking "Checking if -D_FILE_OFFSET_BITS=64 is needed..."
+ set lfs 1
+ if {[msg-quiet cc-with {-includes sys/types.h} {cc-check-sizeof off_t}] == 8} {
+ msg-result no
+ } elseif {[msg-quiet cc-with {-includes sys/types.h -cflags -D_FILE_OFFSET_BITS=64} {cc-check-sizeof off_t}] == 8} {
+ define _FILE_OFFSET_BITS 64
+ msg-result yes
+ } else {
+ set lfs 0
+ msg-result none
+ }
+ define-feature lfs $lfs
+ return $lfs
+}