revamped alignment test; don't delete config.log after configure run (after all it might be important to debug configure)

svn-id: r8275
This commit is contained in:
Max Horn 2003-06-02 21:22:54 +00:00
parent 6dbd36d668
commit 4729b52c3b

24
configure vendored
View file

@ -113,7 +113,7 @@ echo $datatype
# #
echo "Running ScummVM configure..." echo "Running ScummVM configure..."
echo "Configure run on" `date` > $TMPLOG
# #
# Check any parameters we received # Check any parameters we received
@ -310,25 +310,23 @@ rm -f tmp_endianess_check tmp_endianess_check.cpp
# #
# Check whether memory alignment is required # Check whether memory alignment is required
# #
echo -n "Alignment required (don't worry if this shows a 'Bus error')... " echo -n "Alignment required... "
cat > $TMPC << EOF cat > $TMPC << EOF
#include <stdlib.h>
#include <signal.h>
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int i; unsigned char test[8] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 };
unsigned char buf[20]; signal(SIGBUS, exit);
for (i = 0; i < 20; i++) signal(SIGABRT, exit);
buf[i] = 0xE7; signal(SIGSEGV, exit);
for (i = 0; i < 16; i++) { if (*((unsigned int *)(test + 1)) != 0x55443322 && *((unsigned int *)(test + 1)) != 0x22334455) {
if (*(int *)(&buf[i]) != 0xE7E7E7E7) return 1;
return 1;
*(int *)(&buf[i]) = 0xE7E7E7E7;
} }
return 0; return 0;
} }
EOF EOF
_need_memalign=yes _need_memalign=yes
# TODO: Hide the "Bus error" message, if possible...
trap true BUS
cc_check && ./$TMPO && _need_memalign=no cc_check && ./$TMPO && _need_memalign=no
if test "$_need_memalign" = yes ; then if test "$_need_memalign" = yes ; then
_def_align='#define SCUMM_NEED_ALIGNMENT' _def_align='#define SCUMM_NEED_ALIGNMENT'
@ -405,7 +403,7 @@ else
fi fi
echo "$_alsa" echo "$_alsa"
rm -f $TMPC $TMPO $TMPLOG rm -f $TMPC $TMPO
echo echo