1 # Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
6 # Provides a library of common tests on top of the 'cc' module.
14 # The equivalent of the AC_SYS_LARGEFILE macro
16 # defines 'HAVE_LFS' if LFS is available,
17 # and defines '_FILE_OFFSET_BITS=64' if necessary
19 # Returns 1 if 'LFS' is available or 0 otherwise
21 proc cc-check-lfs
{} {
22 cc-check-includes sys
/types.h
23 msg-checking
"Checking if -D_FILE_OFFSET_BITS=64 is needed..."
25 if {[msg-quiet cc-with
{-includes sys
/types.h
} {cc-check-sizeof off_t
}] == 8} {
27 } elseif
{[msg-quiet cc-with
{-includes sys
/types.h
-cflags -D_FILE_OFFSET_BITS=64} {cc-check-sizeof off_t
}] == 8} {
28 define _FILE_OFFSET_BITS
64
34 define-feature lfs
$lfs
40 # The equivalent of the AC_C_BIGENDIAN macro
42 # defines 'HAVE_BIG_ENDIAN' if endian is known to be big,
43 # or 'HAVE_LITTLE_ENDIAN' if endian is known to be little.
45 # Returns 1 if determined, or 0 if not.
47 proc cc-check-endian
{} {
48 cc-check-includes sys
/types.h sys
/param.h
50 msg-checking
"Checking endian..."
51 cc-with
{-includes {sys
/types.h sys
/param.h
}} {
53 #if !defined(BIG_ENDIAN) || !defined(BYTE_ORDER)
55 #elif BYTE_ORDER != BIG_ENDIAN
59 define-feature big-endian
62 } elseif
{[cctest
-code {
63 #if !defined(LITTLE_ENDIAN) || !defined(BYTE_ORDER)
65 #elif BYTE_ORDER != LITTLE_ENDIAN
69 define-feature little-endian