* support/regression/generate-cases.py: corrected the file name
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 27 Jun 2007 16:17:14 +0000 (16:17 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 27 Jun 2007 16:17:14 +0000 (16:17 +0000)
  in warning
* configure.in, configure, sdccconf_in.h: find out the endianess of
  host machine

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

ChangeLog
configure
configure.in
sdccconf_in.h
support/regression/generate-cases.py

index ee00e52290b6a3fe4c53cb48a29426548019a32c..77e199a38ef46c6b81104c97561151aee13bb91f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-06-27 Borut Razem <borut.razem AT siol.net>
+
+       * support/regression/generate-cases.py: corrected the file name
+         in warning
+       * configure.in, configure, sdccconf_in.h: find out the endianess of
+         host machine
+
 2007-06-27 Gudjon I. Gudjonsson <gudjon AT gudjon.org>
 
        * device/include/mcs51/p89c66x.h: NXP header file, OK to change licence
@@ -12,7 +19,6 @@
        * support/librarian/sdcclib.c: fixed warning:
          format '%s' expects type 'char *', but argument 2 has type 'int'
 
-
 2007-06-25 Jesus Calvino-Fraga <jesusc at ece.ubc.ca>
 
        * support/librarian/sdcclib.c: Added feature Requests [1510635]
index df428ca207785ad46561619049144a99b9574c1d..149bd2d951f3fe8c08338f8d7f65252b7a9c36b7 100755 (executable)
--- a/configure
+++ b/configure
@@ -6037,9 +6037,14 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ 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
+
+# SDCC_BUILD_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
+# -------------------------------------------------------------------------
+# SDCC_BUILD_BIGENDIAN
+
+{ echo "$as_me:$LINENO: checking whether build machine byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether build machine byte ordering is bigendian... $ECHO_C" >&6; }
+if test "${sdcc_cv_build_bigendian+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   # See if sys/param.h defines the BYTE_ORDER macro.
@@ -6119,12 +6124,12 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_c_bigendian=yes
+  sdcc_cv_build_bigendian=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_c_bigendian=no
+       sdcc_cv_build_bigendian=no
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -6135,7 +6140,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
        # 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
+  sdcc_cv_build_bigendian=unknown
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -6174,14 +6179,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
-  ac_cv_c_bigendian=yes
+  sdcc_cv_build_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
+  if test "$sdcc_cv_build_bigendian" = unknown; then
+    sdcc_cv_build_bigendian=no
   else
     # finding both strings is unlikely to happen, but who knows?
-    ac_cv_c_bigendian=unknown
+    sdcc_cv_build_bigendian=unknown
   fi
 fi
 else
@@ -6237,14 +6242,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_c_bigendian=no
+  sdcc_cv_build_bigendian=no
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-ac_cv_c_bigendian=yes
+sdcc_cv_build_bigendian=yes
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
@@ -6254,22 +6259,22 @@ fi
 
 rm -f core conftest.err 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
+{ echo "$as_me:$LINENO: result: $sdcc_cv_build_bigendian" >&5
+echo "${ECHO_T}$sdcc_cv_build_bigendian" >&6; }
+case $sdcc_cv_build_bigendian in
   yes)
 
 cat >>confdefs.h <<\_ACEOF
-#define WORDS_BIGENDIAN 1
+#define BUILD_WORDS_BIGENDIAN 1
 _ACEOF
  ;;
   no)
      ;;
   *)
     { { echo "$as_me:$LINENO: error: unknown endianness
-presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+presetting sdcc_cv_build_bigendian=no (or yes) will help" >&5
 echo "$as_me: error: unknown endianness
-presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+presetting sdcc_cv_build_bigendian=no (or yes) will help" >&2;}
    { (exit 1); exit 1; }; } ;;
 esac
 
index 7b9632b9cc8a46e66196bfcb707df5ad460c10e6..2ceadb5e0a6d6070069ddafc94c2391bb74beb64 100644 (file)
@@ -376,7 +376,78 @@ AC_DEFINE_UNQUOTED(TYPE_UBYTE,  unsigned $TYPE_CHAR)
 AC_DEFINE_UNQUOTED(TYPE_UWORD,  unsigned $TYPE_WORD)
 AC_DEFINE_UNQUOTED(TYPE_UDWORD, unsigned $TYPE_DWORD)
 
-AC_C_BIGENDIAN
+
+# SDCC_BUILD_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
+# -------------------------------------------------------------------------
+AC_DEFUN([SDCC_BUILD_BIGENDIAN],
+[AC_CACHE_CHECK(whether build machine byte ordering is bigendian, sdcc_cv_build_bigendian,
+[# See if sys/param.h defines the BYTE_ORDER macro.
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
+#include <sys/param.h>
+],
+[#if  ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
+       && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
+ bogus endian macros
+#endif
+])],
+[# It does; now see whether it defined to BIG_ENDIAN or not.
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
+#include <sys/param.h>
+], [#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+])], [sdcc_cv_build_bigendian=yes], [sdcc_cv_build_bigendian=no])],
+[# It does not; compile a test program.
+AC_RUN_IFELSE(
+[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long int l;
+    char c[sizeof (long int)];
+  } u;
+  u.l = 1;
+  return u.c[sizeof (long int) - 1] == 1;
+]])],
+             [sdcc_cv_build_bigendian=no],
+             [sdcc_cv_build_bigendian=yes],
+[# try to guess the endianness by grepping values into an object file
+  sdcc_cv_build_bigendian=unknown
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }]],
+[[ _ascii (); _ebcdic (); ]])],
+[if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+  sdcc_cv_build_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+  if test "$sdcc_cv_build_bigendian" = unknown; then
+    sdcc_cv_build_bigendian=no
+  else
+    # finding both strings is unlikely to happen, but who knows?
+    sdcc_cv_build_bigendian=unknown
+  fi
+fi])])])])
+case $sdcc_cv_build_bigendian in
+  yes)
+    m4_default([$1],
+      [AC_DEFINE([BUILD_WORDS_BIGENDIAN], 1,
+       [Define to 1 if your processor stores words with the most significant
+        byte first (like Motorola and SPARC, unlike Intel and VAX).])]) ;;
+  no)
+    $2 ;;
+  *)
+    m4_default([$3],
+      [AC_MSG_ERROR([unknown endianness
+presetting sdcc_cv_build_bigendian=no (or yes) will help])]) ;;
+esac
+])# SDCC_BUILD_BIGENDIAN
+
+SDCC_BUILD_BIGENDIAN
 
 # Set standard installation paths
 # ===========================================================================
index 4c6511561bbdf7b49704bcc7e06cbcd900dfd6b5..dc3d30b4a0bc3df9b4059f1defb91b06584b7144 100644 (file)
 #undef TYPE_UWORD
 #undef TYPE_UDWORD
 
+/* find out the endianess of host machine */
+#if __BIG_ENDIAN__ || _BIG_ENDIAN
+/* 1) trust the compiler */
+#define WORDS_BIGENDIAN 1
+#elsif __LITTLE_ENDIAN__
+/* just in case ... */
 #undef WORDS_BIGENDIAN
+#elif (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
+/* 2) trust the header files */
+# if BYTE_ORDER == BIG_ENDIAN 
+#   define WORDS_BIGENDIAN 1
+# endif
+#else 
+/* 3) assume that host machine has the same endianess as the build machine */
+# undef BUILD_WORDS_BIGENDIAN
+# if (defined BUILD_WORDS_BIGENDIAN && BUILD_WORDS_BIGENDIAN)
+#   define WORDS_BIGENDIAN  1
+/* 4) assume that host is a little endian machine */
+#endif
 
 #undef OPT_DISABLE_MCS51
 #undef OPT_DISABLE_GBZ80
index e5053cddb586eb977f82d3cfbb53bc202ab7b012..e2c08cc7b98f031a270e4df8af77c94397f263c7 100644 (file)
@@ -165,7 +165,7 @@ class InstanceGenerator:
         self.readfile()
         self.parse()
         if self.writetemplate() == 0:
-            sys.stderr.write("Empty function list in " + outdir + "!\n")
+            sys.stderr.write("Empty function list in " + self.inname + "!\n")
 
         # Create the output directory if it doesn't exist
         createdir(outdir)