summaryrefslogtreecommitdiffstats
path: root/Modules/TestEndianess.c.in
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-08-10 17:14:00 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-08-10 17:14:00 (GMT)
commit578841cce53d476afdb646ed7db29f3752ac9786 (patch)
tree3697ad9bf2b8c52bb0e8cd15a9f95f41f6379fbb /Modules/TestEndianess.c.in
parentc6092b7e5e9a421d317969eb3230ccdb7acc0065 (diff)
downloadCMake-578841cce53d476afdb646ed7db29f3752ac9786.zip
CMake-578841cce53d476afdb646ed7db29f3752ac9786.tar.gz
CMake-578841cce53d476afdb646ed7db29f3752ac9786.tar.bz2
STYLE: remove unused CheckTypeSize.c.in
ENH: change test for endianess from TRY_RUN() to TRY_COMPILE() by testing the binary image of a 16bit integer array, tested on Linux x86, Intel Mac and Sun (big endian) Alex
Diffstat (limited to 'Modules/TestEndianess.c.in')
-rw-r--r--Modules/TestEndianess.c.in20
1 files changed, 20 insertions, 0 deletions
diff --git a/Modules/TestEndianess.c.in b/Modules/TestEndianess.c.in
new file mode 100644
index 0000000..68094d4
--- /dev/null
+++ b/Modules/TestEndianess.c.in
@@ -0,0 +1,20 @@
+/* A 16 bit integer is required. */
+typedef @CMAKE_16BIT_TYPE@ cmakeint16;
+
+/* On a little endian machine, these 16bit ints will give "THIS IS LITTLE ENDIAN."
+ On a big endian machine the characters will be exchanged pairwise. */
+const cmakeint16 info_little[] = {0x4854, 0x5349, 0x4920, 0x2053, 0x494c, 0x5454, 0x454c, 0x4520, 0x444e, 0x4149, 0x2e4e, 0x0000};
+
+/* on a big endian machine, these 16bit ints will give "THIS IS BIG ENDIAN."
+ On a little endian machine the characters will be exchanged pairwise. */
+const cmakeint16 info_big[] = {0x5448, 0x4953, 0x2049, 0x5320, 0x4249, 0x4720, 0x454e, 0x4449, 0x414e, 0x2e2e, 0x0000};
+
+#ifdef __CLASSIC_C__
+int main(){
+ int ac;
+ char*av[];
+#else
+int main(int ac, char*av[]){
+#endif
+ return (&info_little[0] != &info_big[0]);
+}