+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
* 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]
_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.
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
# 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
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
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
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
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
# ===========================================================================
#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
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)