* src/configure.in: check for endianess (even while cross-compiling)
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 8 Mar 2003 14:56:42 +0000 (14:56 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 8 Mar 2003 14:56:42 +0000 (14:56 +0000)
* src/configure:      check for endianess (even while cross-compiling)
* src/configure_in.h: check for endianess (even while cross-compiling)
* src/avr/gen.c:        remove old endianess stuff
* src/mcs51/gen.c:      remove old endianess stuff
* src/ds390/gen.c:      remove old endianess stuff
* src/pic/gen.c:        remove old endianess stuff
* src/pic/genarith.c:   remove old endianess stuff
* src/pic/glue.c:       fix endianess check
* src/pic16/gen.c:      remove old endianess stuff
* src/pic16/genarith.c: remove old endianess stuff
* src/pic16/glue.c:     fix endianess check
* src/xa51/gen.c:       remove old endianess stuff
* src/z80/gen.c:        fix endianess check
* src/SDCCglue.c:       fix endianess check

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2346 4a8a32a2-be11-0410-ad9d-d568d2c75423

16 files changed:
ChangeLog
configure
configure.in
sdccconf_in.h
src/SDCCglue.c
src/avr/gen.c
src/ds390/gen.c
src/mcs51/gen.c
src/pic/gen.c
src/pic/genarith.c
src/pic/glue.c
src/pic16/gen.c
src/pic16/genarith.c
src/pic16/glue.c
src/xa51/gen.c
src/z80/gen.c

index c178840c8e81756d4c68643ffe1772b2808bdc1d..b3a342a5b0fdc051809fe267011e255cab70e585 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,28 @@
+2003-03-08  Bernhard Held <bernhard@bernhardheld.de>
+
+       * src/configure.in:   check for endianess (even while cross-compiling)
+       * src/configure:      check for endianess (even while cross-compiling)
+       * src/configure_in.h: check for endianess (even while cross-compiling)
+       * src/avr/gen.c:        remove old endianess stuff
+       * src/mcs51/gen.c:      remove old endianess stuff
+       * src/ds390/gen.c:      remove old endianess stuff
+       * src/pic/gen.c:        remove old endianess stuff
+       * src/pic/genarith.c:   remove old endianess stuff
+       * src/pic/glue.c:       fix endianess check
+       * src/pic16/gen.c:      remove old endianess stuff
+       * src/pic16/genarith.c: remove old endianess stuff
+       * src/pic16/glue.c:     fix endianess check
+       * src/xa51/gen.c:       remove old endianess stuff
+       * src/z80/gen.c:        fix endianess check
+       * src/SDCCglue.c:       fix endianess check
+
 2003-03-08  Bernhard Held <bernhard@bernhardheld.de>
 
        * src/SDCCsymt.h: use appropriate data-types on host for SDCC's int and long
-       * configure: find appropriate data-types on host for SDCC's int and long
-       * configure.in: find appropriate data-types on host for SDCC's int and long
-       * sdccconf_in.h: find appropriate data-types on host for SDCC's int and long
+       * src/configure: find appropriate data-types on host for SDCC's int and long
+       * src/configure.in: find appropriate data-types on host for SDCC's int and long
+       * src/sdccconf_in.h: find appropriate data-types on host for SDCC's int and long
        * src/xa51/gen.c: use %d, not %ld for 4 byte variables
-       * sdcc_vc_in.h: use appropriate data-types on host for SDCC's int and long
 
 2003-03-07    <johan@balder>
 
index 4cdd8c4598b98de92ee2fe03518a47a7e042c83a..7b72ebd2d0278925fe10678c64ef9c786c20c8d3 100755 (executable)
--- a/configure
+++ b/configure
@@ -3727,234 +3727,6 @@ fi
 done
 
 
-for ac_header in endian.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_header_compiler=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
-  no:yes )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in machine/endian.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_header_compiler=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
-  no:yes )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
 for ac_header in malloc.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -6647,140 +6419,85 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-echo "$as_me:$LINENO: checking for long long" >&5
-echo $ECHO_N "checking for long long... $ECHO_C" >&6
-if test "${ac_cv_type_long_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-$ac_includes_default
-int
-main ()
+    if $CXX -v 2>&1|grep "mingw" >/dev/null 2>&1; then
+       ac_cv_sizeof_char=1
+       ac_cv_sizeof_short=2
+       ac_cv_sizeof_int=4
+       ac_cv_sizeof_long=4
+    else
+       : # FIXME
+    fi
+#echo
+fi
+
+type_name()
 {
-if ((long long *) 0)
-  return 0;
-if (sizeof (long long))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_long_long=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_type_long_long=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
-echo "${ECHO_T}$ac_cv_type_long_long" >&6
+    if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
+       echo "char"
+       exit
+    fi
+    if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
+       echo "short"
+       exit
+    fi
+    if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
+       echo "int"
+       exit
+    fi
+    if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
+       echo "long"
+       exit
+    fi
+    echo "long"
+}
 
-echo "$as_me:$LINENO: checking size of long long" >&5
-echo $ECHO_N "checking size of long long... $ECHO_C" >&6
-if test "${ac_cv_sizeof_long_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$ac_cv_type_long_long" = yes; then
-  # The cast to unsigned long works around a bug in the HP C Compiler
-  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-  # This bug is HP SR number 8606223364.
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)];
-test_array [0] = 0
+echo "$as_me:$LINENO: checking type name for byte" >&5
+echo $ECHO_N "checking type name for byte... $ECHO_C" >&6
+TYPE_BYTE=`type_name 1`
+echo "$as_me:$LINENO: result: $TYPE_BYTE" >&5
+echo "${ECHO_T}$TYPE_BYTE" >&6
+echo "$as_me:$LINENO: checking type name for word" >&5
+echo $ECHO_N "checking type name for word... $ECHO_C" >&6
+TYPE_WORD=`type_name 2`
+echo "$as_me:$LINENO: result: $TYPE_WORD" >&5
+echo "${ECHO_T}$TYPE_WORD" >&6
+echo "$as_me:$LINENO: checking type name for dword" >&5
+echo $ECHO_N "checking type name for dword... $ECHO_C" >&6
+TYPE_DWORD=`type_name 4`
+echo "$as_me:$LINENO: result: $TYPE_DWORD" >&5
+echo "${ECHO_T}$TYPE_DWORD" >&6
+cat >>confdefs.h <<_ACEOF
+#define TYPE_BYTE $TYPE_BYTE
+_ACEOF
 
-  ;
-  return 0;
-}
+cat >>confdefs.h <<_ACEOF
+#define TYPE_WORD $TYPE_WORD
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
+cat >>confdefs.h <<_ACEOF
+#define TYPE_DWORD $TYPE_DWORD
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_hi=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_lo=`expr $ac_mid + 1`
-                    if test $ac_lo -le $ac_mid; then
-                      ac_lo= ac_hi=
-                      break
-                    fi
-                    ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-  done
+
+
+echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
+if test "${ac_cv_c_bigendian+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+  # See if sys/param.h defines the BYTE_ORDER macro.
 cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 #include "confdefs.h"
-$ac_includes_default
+#include <sys/types.h>
+#include <sys/param.h>
+
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)];
-test_array [0] = 0
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
 
   ;
   return 0;
@@ -6798,17 +6515,19 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 #include "confdefs.h"
-$ac_includes_default
+#include <sys/types.h>
+#include <sys/param.h>
+
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)];
-test_array [0] = 0
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
 
   ;
   return 0;
@@ -6826,40 +6545,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_lo=$ac_mid; break
+  ac_cv_c_bigendian=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_hi=`expr '(' $ac_mid ')' - 1`
-                       if test $ac_mid -le $ac_hi; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid`
+ac_cv_c_bigendian=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-  done
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_lo= ac_hi=
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+# It does not; compile a test program.
+if test "$cross_compiling" = yes; then
+  # try to guess the endianness by grepping values into an object file
+  ac_cv_c_bigendian=unknown
   cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 #include "confdefs.h"
-$ac_includes_default
+short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 0
-
+ _ascii (); _ebcdic ();
   ;
   return 0;
 }
@@ -6876,59 +6588,37 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_hi=$ac_mid
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+  ac_cv_c_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+  if test "$ac_cv_c_bigendian" = unknown; then
+    ac_cv_c_bigendian=no
+  else
+    # finding both strings is unlikely to happen, but who knows?
+    ac_cv_c_bigendian=unknown
+  fi
+fi
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_lo=`expr '(' $ac_mid ')' + 1`
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long_long=$ac_lo;;
-'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77" >&5
-echo "$as_me: error: cannot compute sizeof (long long), 77" >&2;}
-   { (exit 1); exit 1; }; } ;;
-esac
-else
-  if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
-echo "$as_me: error: cannot run test program while cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 #include "confdefs.h"
-$ac_includes_default
-long longval () { return (long) (sizeof (long long)); }
-unsigned long ulongval () { return (long) (sizeof (long long)); }
-#include <stdio.h>
-#include <stdlib.h>
 int
 main ()
 {
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    exit (1);
-  if (((long) (sizeof (long long))) < 0)
-    {
-      long i = longval ();
-      if (i != ((long) (sizeof (long long))))
-       exit (1);
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long i = ulongval ();
-      if (i != ((long) (sizeof (long long))))
-       exit (1);
-      fprintf (f, "%lu\n", i);
-    }
-  exit (ferror (f) || fclose (f) != 0);
-
-  ;
-  return 0;
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long l;
+    char c[sizeof (long)];
+  } u;
+  u.l = 1;
+  exit (u.c[sizeof (long) - 1] == 1);
 }
 _ACEOF
 rm -f conftest$ac_exeext
@@ -6942,114 +6632,37 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_sizeof_long_long=`cat conftest.val`
+  ac_cv_c_bigendian=no
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
 ( exit $ac_status )
-{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77" >&5
-echo "$as_me: error: cannot compute sizeof (long long), 77" >&2;}
-   { (exit 1); exit 1; }; }
+ac_cv_c_bigendian=yes
 fi
 rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
-rm -f conftest.val
-else
-  ac_cv_sizeof_long_long=0
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
-echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-_ACEOF
-
-
-else
-    if $CXX -v 2>&1|grep "mingw" >/dev/null 2>&1; then
-       ac_cv_sizeof_char=1
-       ac_cv_sizeof_short=2
-       ac_cv_sizeof_int=4
-       ac_cv_sizeof_long=4
-       ac_cv_sizeof_long_long=4
-    else
-       : # FIXME
-    fi
-#echo
-fi
-
-type_name()
-{
-    if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
-       echo "char"
-       exit
-    fi
-    if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
-       echo "short"
-       exit
-    fi
-    if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
-       echo "int"
-       exit
-    fi
-    if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
-       echo "long"
-       exit
-    fi
-    echo "long"
-}
-
-echo "$as_me:$LINENO: checking type name for byte" >&5
-echo $ECHO_N "checking type name for byte... $ECHO_C" >&6
-TYPE_BYTE=`type_name 1`
-echo "$as_me:$LINENO: result: $TYPE_BYTE" >&5
-echo "${ECHO_T}$TYPE_BYTE" >&6
-echo "$as_me:$LINENO: checking type name for word" >&5
-echo $ECHO_N "checking type name for word... $ECHO_C" >&6
-TYPE_WORD=`type_name 2`
-echo "$as_me:$LINENO: result: $TYPE_WORD" >&5
-echo "${ECHO_T}$TYPE_WORD" >&6
-echo "$as_me:$LINENO: checking type name for dword" >&5
-echo $ECHO_N "checking type name for dword... $ECHO_C" >&6
-TYPE_DWORD=`type_name 4`
-echo "$as_me:$LINENO: result: $TYPE_DWORD" >&5
-echo "${ECHO_T}$TYPE_DWORD" >&6
-cat >>confdefs.h <<_ACEOF
-#define TYPE_BYTE $TYPE_BYTE
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define TYPE_WORD $TYPE_WORD
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define TYPE_DWORD $TYPE_DWORD
-_ACEOF
-
-
-if echo $TYPE_DWORD|grep short >/dev/null; then
-    A="h"
-elif echo $TYPE_DWORD|grep long >/dev/null; then
-    A="l"
-else
-    A=""
-fi
-
-if echo $TYPE_WORD|grep short >/dev/null; then M="h"
-elif echo $TYPE_WORD|grep long >/dev/null; then M="l"
-else M=""
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
+echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6
+case $ac_cv_c_bigendian in
+  yes)
 
-cat >>confdefs.h <<_ACEOF
-#define _A_ "${A}"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define _M_ "${M}"
+cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
 _ACEOF
-
+ ;;
+  no)
+     ;;
+  *)
+    { { echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
 
 
 #
index e59d955c5acbd123aa291771a0e9a1c51cad649b..e46aae401e5223cbd3e3ae6a5291c3278248aa49 100755 (executable)
@@ -64,8 +64,6 @@ AC_LANG_C
 AC_HEADER_STDC
 AC_CHECK_HEADERS(getopt.h)
 AC_CHECK_HEADERS(unistd.h)
-AC_CHECK_HEADERS(endian.h)
-AC_CHECK_HEADERS(machine/endian.h)
 AC_CHECK_HEADERS(malloc.h)
 AC_CHECK_HEADERS(sys/isa_defs.h)
 AC_CHECK_HEADERS(sys/socket.h)
@@ -233,6 +231,7 @@ AC_DEFINE_UNQUOTED(TYPE_BYTE, $TYPE_BYTE)
 AC_DEFINE_UNQUOTED(TYPE_WORD, $TYPE_WORD)
 AC_DEFINE_UNQUOTED(TYPE_DWORD, $TYPE_DWORD)
 
+AC_C_BIGENDIAN
 
 #
 #
index 0facfd7f1492dcb8e5f08072253a1f25be37dcac..2cbf330524d6830bf6bcece8b0b3c3a13c906458 100644 (file)
@@ -24,9 +24,6 @@
 #undef STD_DS390_LIB
 #undef STD_XA51_LIB
 #undef HAVE_SYS_SOCKET_H
-#undef HAVE_SYS_ISA_DEFS_H
-#undef HAVE_ENDIAN_H
-#undef HAVE_MACHINE_ENDIAN_H
 
 #undef HAVE_STRERROR
 #undef HAVE_VSNPRINTF
@@ -41,6 +38,8 @@
 #define TYPE_UWORD unsigned TYPE_WORD
 #define TYPE_UDWORD unsigned TYPE_DWORD
 
+#undef WORDS_BIGENDIAN
+
 #undef OPT_DISABLE_MCS51
 #undef OPT_DISABLE_GBZ80
 #undef OPT_DISABLE_Z80
index c4ef6f2f5e4ef2f02c53992e1dcbb2b561904220..906c8382bb392c267426797d161db52d8d6e8ace 100644 (file)
@@ -145,7 +145,7 @@ aopLiteralLong (value * val, int offset, int size)
 
        /* it is type float */
        fl.f = (float) floatFromVal (val);
-#ifdef _BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
        tsprintf (buffer, sizeof(buffer), 
                  "!immedbyte", fl.c[3 - offset]);
 #else
index 06c7476a5c142b29bdc24215c922da173701b10b..62329c5086a1f303d9cc3375205f852cfd50d8d6 100644 (file)
 #include "SDCCglobl.h"
 #include "newalloc.h"
 
-#ifdef HAVE_SYS_ISA_DEFS_H
-#include <sys/isa_defs.h>
-#else
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#else
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#else
-#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__)
-#warning "Cannot determine ENDIANESS of this machine assuming LITTLE_ENDIAN"
-#warning "If you running sdcc on an INTEL 80x86 Platform you are okay"
-#endif
-#endif
-#endif
-#endif
-
 #include "common.h"
 #include "SDCCpeeph.h"
 #include "ralloc.h"
index 132fe8ee6182474bba0f1197cbd57cd3819e664c..c35fc6f4a71d40e77bb323803c7dab0f1a38fd4e 100644 (file)
 #include "SDCCglobl.h"
 #include "newalloc.h"
 
-#ifdef HAVE_SYS_ISA_DEFS_H
-#include <sys/isa_defs.h>
-#else
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#else
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#else
-#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__)
-#warning "Cannot determine ENDIANESS of this machine assuming LITTLE_ENDIAN"
-#warning "If you running sdcc on an INTEL 80x86 Platform you are okay"
-#endif
-#endif
-#endif
-#endif
-
 #define BETTER_LITERAL_SHIFT
 
 char *aopLiteral (value * val, int offset);
index 770dc876d77f37ac1b510435055881a554c79f59..9ef6d91e3260afe23fd61e5ade03c3d792593367 100644 (file)
 #include "SDCCglobl.h"
 #include "newalloc.h"
 
-#ifdef HAVE_SYS_ISA_DEFS_H
-#include <sys/isa_defs.h>
-#else
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#else
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#else
-#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__)
-#warning "Cannot determine ENDIANESS of this machine assuming LITTLE_ENDIAN"
-#warning "If you running sdcc on an INTEL 80x86 Platform you are okay"
-#endif
-#endif
-#endif
-#endif
-
 #include "common.h"
 #include "SDCCpeeph.h"
 #include "ralloc.h"
index 665d8b2724af83e456c843ab0480ed98b5a27dc6..44f440f804fefd3343d2a1309caec93660e22577 100644 (file)
 #include "SDCCglobl.h"
 #include "newalloc.h"
 
-#ifdef HAVE_SYS_ISA_DEFS_H
-#include <sys/isa_defs.h>
-#else
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#else
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#else
-#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__)
-#warning "Cannot determine ENDIANESS of this machine assuming LITTLE_ENDIAN"
-#warning "If you running sdcc on an INTEL 80x86 Platform you are okay"
-#endif
-#endif
-#endif
-#endif
-
 #include "common.h"
 #include "SDCCpeeph.h"
 #include "ralloc.h"
index 241ca2f3171b244374aec5ded7dd7d65ec5b15e4..f998a7c4af8a20e65ca715572b1c03cc4a88b13c 100644 (file)
 #define __FUNCTION__           __FILE__
 #endif
 
-#ifdef HAVE_SYS_ISA_DEFS_H
-#include <sys/isa_defs.h>
-#else
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#else
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#else
-#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__)
-#warning "Cannot determine ENDIANESS of this machine assuming LITTLE_ENDIAN"
-#warning "If you running sdcc on an INTEL 80x86 Platform you are okay"
-#endif
-#endif
-#endif
-#endif
-
 #include "common.h"
 #include "SDCCpeeph.h"
 #include "ralloc.h"
index e50b255c202ec591b8ddf0ef1df9c1561bb67329..76cf38149683fcdf955b3a8b395438498ab06856 100644 (file)
@@ -29,7 +29,7 @@
 #include "newalloc.h"
 
 
-#ifdef _BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
   #define _ENDIAN(x)  (3-x)
 #else
   #define _ENDIAN(x)  (x)
@@ -86,7 +86,7 @@ int pic14aopLiteral (value *val, int offset)
 
   /* it is type float */
   fl.f = (float) floatFromVal(val);
-#ifdef _BIG_ENDIAN    
+#ifdef WORDS_BIGENDIAN
   return fl.c[3-offset];
 #else
   return fl.c[offset];
index d9265bce7b40c28e0466fd59313141dfef2b271f..422ad251daef9775753ca2be4c0682284931996b 100644 (file)
 #include "SDCCglobl.h"
 #include "newalloc.h"
 
-#ifdef HAVE_SYS_ISA_DEFS_H
-#include <sys/isa_defs.h>
-#else
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#else
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#else
-#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__)
-#warning "Cannot determine ENDIANESS of this machine assuming LITTLE_ENDIAN"
-#warning "If you running sdcc on an INTEL 80x86 Platform you are okay"
-#endif
-#endif
-#endif
-#endif
-
 #include "common.h"
 #include "SDCCpeeph.h"
 #include "ralloc.h"
index 0c8f6ff3fd7bbb48c7c21693392f3b29be5cf069..218c263ad35e7a378dc0a50e406baca289a0b3dd 100644 (file)
 #define __FUNCTION__           __FILE__
 #endif
 
-#ifdef HAVE_SYS_ISA_DEFS_H
-#include <sys/isa_defs.h>
-#else
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#else
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#else
-#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__)
-#warning "Cannot determine ENDIANESS of this machine assuming LITTLE_ENDIAN"
-#warning "If you running sdcc on an INTEL 80x86 Platform you are okay"
-#endif
-#endif
-#endif
-#endif
-
 #include "common.h"
 #include "SDCCpeeph.h"
 #include "ralloc.h"
index c49b51734777a53719153db2813d98df44d75308..7e7d1c7e5dbe96bd4e8a100d5fd93bf63fcf965d 100644 (file)
@@ -29,7 +29,7 @@
 #include "newalloc.h"
 
 
-#ifdef _BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
   #define _ENDIAN(x)  (3-x)
 #else
   #define _ENDIAN(x)  (x)
@@ -86,7 +86,7 @@ int pic16aopLiteral (value *val, int offset)
 
   /* it is type float */
   fl.f = (float) floatFromVal(val);
-#ifdef _BIG_ENDIAN    
+#ifdef WORDS_BIGENDIAN
   return fl.c[3-offset];
 #else
   return fl.c[offset];
index fdd1a3c249f958324b2c6fdc22d3361dca1802d6..3313b880c03e75822f70ebb091911ecd00ae46ec 100755 (executable)
 #include "SDCCglobl.h"
 #include "newalloc.h"
 
-#ifdef HAVE_SYS_ISA_DEFS_H
-#include <sys/isa_defs.h>
-#else
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#else
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#else
-#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__)
-#warning "Cannot determine ENDIANESS of this machine assuming LITTLE_ENDIAN"
-#warning "If you running sdcc on an INTEL 80x86 Platform you are okay"
-#endif
-#endif
-#endif
-#endif
-
 #include "common.h"
 #include "SDCCpeeph.h"
 #include "ralloc.h"
index 7e2f401bc0d6bb88be453ac841322a716071786c..b5f0afc975a66fb4c0b35702e14f32b4d27bac53 100644 (file)
 #define STRCASECMP strcasecmp
 #endif
 
-#ifdef HAVE_SYS_ISA_DEFS_H
-#include <sys/isa_defs.h>
-#endif
-
 #include "z80.h"
 #include "SDCCglobl.h"
 #include "SDCCpeeph.h"
@@ -1144,7 +1140,7 @@ aopGetLitWordLong (asmop * aop, int offset, bool with_hash)
             /* it is type float */
             fl.f = (float) floatFromVal (val);
 
-#ifdef _BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
             i = fl.c[3-offset] | (fl.c[3-offset-1]<<8);
 #else
             i = fl.c[offset] | (fl.c[offset+1]<<8);