configure-check for endianess and fallback in rdesktop.h
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@691 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
581acea28a
commit
d94956c179
29
configure
vendored
29
configure
vendored
@ -296,6 +296,33 @@ fi
|
||||
|
||||
|
||||
# Platform-specific options
|
||||
|
||||
#Endianess
|
||||
cat >conftest.$$.c << EOF
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int test = 1;
|
||||
|
||||
return(*(unsigned char*) (&test));
|
||||
}
|
||||
EOF
|
||||
$cc -o conftest.$$ conftest.$$.c
|
||||
./conftest.$$
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Architecture is big-endian"
|
||||
echo
|
||||
cflags="$cflags -DB_ENDIAN"
|
||||
else
|
||||
echo "Architecture is little-endian"
|
||||
echo
|
||||
cflags="$cflags -DL_ENDIAN"
|
||||
fi
|
||||
rm conftest.$$ conftest.$$.c
|
||||
|
||||
#Alignment
|
||||
cat >conftest.$$.c << EOF
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
@ -317,7 +344,7 @@ need_alignment=yes
|
||||
if [ "$need_alignment" = "yes" ]; then
|
||||
echo "Architecture needs alignment"
|
||||
echo
|
||||
cflags="$cflags -DNEED_ALIGNMENT"
|
||||
cflags="$cflags -DNEED_ALIGN"
|
||||
fi
|
||||
rm conftest.$$ conftest.$$.c
|
||||
|
||||
|
12
rdesktop.h
12
rdesktop.h
@ -59,6 +59,18 @@
|
||||
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
/* If configure does not define the endianess, try
|
||||
to find it out */
|
||||
#if !defined(L_ENDIAN) && !defined(B_ENDIAN)
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define L_ENDIAN
|
||||
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define B_ENDIAN
|
||||
#else
|
||||
#error Unknown endianness. Edit rdesktop.h.
|
||||
#endif
|
||||
#endif /* B_ENDIAN, L_ENDIAN from configure */
|
||||
|
||||
#include "parse.h"
|
||||
#include "constants.h"
|
||||
#include "types.h"
|
||||
|
Loading…
Reference in New Issue
Block a user