summaryrefslogtreecommitdiffstats
path: root/src/util/db2/include
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2004-05-06 01:33:56 +0000
committerKen Raeburn <raeburn@mit.edu>2004-05-06 01:33:56 +0000
commit03feec0e60a84cbe1c1f77137eb23b2945fd2c44 (patch)
tree3dd22dccb7b4c43189f41ab1d5b8df064c8d611a /src/util/db2/include
parent2523b96a81748d0f7c2ad01cf524bbccb00252c3 (diff)
downloadkrb5-03feec0e60a84cbe1c1f77137eb23b2945fd2c44.tar.gz
krb5-03feec0e60a84cbe1c1f77137eb23b2945fd2c44.tar.xz
krb5-03feec0e60a84cbe1c1f77137eb23b2945fd2c44.zip
Since the AES code builds, and doesn't do any configure-time byte order checks
that I noticed, something similar ought to work for the DB code. This is the first cut; nightly testing builds should tell us if it's sufficient on most of the platforms we work on. * include/db-int.h: Include stdlib.h, and endian.h if available. (LITTLE_ENDIAN, BIG_ENDIAN, BYTE_ORDER): If not defined, and if versions with one or two leading underscores are defined, define the no-underscore form in terms of the with-underscore one. (DB_BYTE_ORDER): Define by checking LITTLE_ENDIAN, BIG_ENDIAN, and BYTE_ORDER; report an error if that doesn't work. Don't check WORDS_BIGENDIAN. * Makefile.in (all-prerecurse): Make sure headers generated by config.status are up to date. (include/config.h, $(srcdir)/include/config.h.in, include/db-config.h): New rules. * configure.in: Don't check byte order here. Check for endian.h. ticket: 2551 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16317 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/db2/include')
-rw-r--r--src/util/db2/include/ChangeLog10
-rw-r--r--src/util/db2/include/db-int.h49
2 files changed, 59 insertions, 0 deletions
diff --git a/src/util/db2/include/ChangeLog b/src/util/db2/include/ChangeLog
index eacdbc8b7..3ca9befe5 100644
--- a/src/util/db2/include/ChangeLog
+++ b/src/util/db2/include/ChangeLog
@@ -1,3 +1,13 @@
+2004-05-05 Ken Raeburn <raeburn@mit.edu>
+
+ * db-int.h: Include stdlib.h, and endian.h if available.
+ (LITTLE_ENDIAN, BIG_ENDIAN, BYTE_ORDER): If not defined, and if
+ versions with one or two leading underscores are defined, define
+ the no-underscore form in terms of the with-underscore one.
+ (DB_BYTE_ORDER): Define by checking LITTLE_ENDIAN, BIG_ENDIAN, and
+ BYTE_ORDER; report an error if that doesn't work. Don't check
+ WORDS_BIGENDIAN.
+
2002-09-05 Ken Raeburn <raeburn@mit.edu>
* db-int.h: If stdint.h or inttypes.h are found, include them.
diff --git a/src/util/db2/include/db-int.h b/src/util/db2/include/db-int.h
index 2c21fb207..ddc2d4764 100644
--- a/src/util/db2/include/db-int.h
+++ b/src/util/db2/include/db-int.h
@@ -44,11 +44,60 @@
#define DB_LITTLE_ENDIAN 1234
#define DB_BIG_ENDIAN 4321
+#include <stdlib.h>
+#ifdef HAVE_ENDIAN_H
+# include <endian.h>
+#endif
+/* Handle both BIG and LITTLE defined and BYTE_ORDER matches one, or
+ just one defined; both with and without leading underscores.
+
+ Ignore "PDP endian" machines, this code doesn't support them
+ anyways. */
+#if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN) && !defined(BYTE_ORDER)
+# ifdef _LITTLE_ENDIAN
+# define LITTLE_ENDIAN _LITTLE_ENDIAN
+# endif
+# ifdef _BIG_ENDIAN
+# define BIG_ENDIAN _BIG_ENDIAN
+# endif
+# ifdef _BYTE_ORDER
+# define BYTE_ORDER _BYTE_ORDER
+# endif
+#endif
+#if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN) && !defined(BYTE_ORDER)
+# ifdef __LITTLE_ENDIAN
+# define LITTLE_ENDIAN __LITTLE_ENDIAN
+# endif
+# ifdef __BIG_ENDIAN
+# define BIG_ENDIAN __BIG_ENDIAN
+# endif
+# ifdef __BYTE_ORDER
+# define BYTE_ORDER __BYTE_ORDER
+# endif
+#endif
+#if defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) && defined(BYTE_ORDER)
+# if LITTLE_ENDIAN == BYTE_ORDER
+# define DB_BYTE_ORDER DB_LITTLE_ENDIAN
+# elif BIG_ENDIAN == BYTE_ORDER
+# define DB_BYTE_ORDER DB_BIG_ENDIAN
+# else
+# error "LITTLE_ENDIAN and BIG_ENDIAN defined, but can't determine byte order"
+# endif
+#elif defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
+# define DB_BYTE_ORDER DB_LITTLE_ENDIAN
+#elif defined(BIG_ENDIAN) && !defined(LITTLE_ENDIAN)
+# define DB_BYTE_ORDER DB_BIG_ENDIAN
+#else
+# error "can't determine byte order from included system headers"
+#endif
+
+#if 0
#ifdef WORDS_BIGENDIAN
#define DB_BYTE_ORDER DB_BIG_ENDIAN
#else
#define DB_BYTE_ORDER DB_LITTLE_ENDIAN
#endif
+#endif
/* end autoconf-based stuff */