-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.c
47 lines (40 loc) · 979 Bytes
/
conftest.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
conftest.c
This file checks your system configuration to
adjust the Makefile for cingb
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char testarray[8]={0,0,0,1,0,0,0,0};
printf("OK cc: compilation & execution works ...\n");
printf("OK cc: checking type-sizes ... ");
if (sizeof(int)!=4) {
printf("int: not 4 bytes ! FAILED\n");
exit(0);
} else {
if (sizeof(char)!=1) {
printf("char: not 1 byte ! FAILED\n");
exit(0);
} else {
if (sizeof(testarray)!=8) {
printf("custom array is not 8 bytes !\n");
} else printf("ok\n");
}
}
printf("OK Checking endian structure ... ");
if (*((int *)testarray)==0x00000001) {
printf("OK big endian found.\n");
exit(1);
} else {
if (*((int *)testarray)==0x01000000) {
printf("OK little endian found.\n");
exit(2);
} else {
printf("check FAILED.\n");
printf("Unknown CPU architecture.\n");
exit(0);
}
}
}