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