Since the AES code builds, and doesn't do any configure-time byte order checks
authorKen Raeburn <raeburn@mit.edu>
Thu, 6 May 2004 01:33:56 +0000 (01:33 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 6 May 2004 01:33:56 +0000 (01:33 +0000)
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

src/util/db2/ChangeLog
src/util/db2/Makefile.in
src/util/db2/configure.in
src/util/db2/include/ChangeLog
src/util/db2/include/db-int.h

index df2504914e7ebb2c590bf43f5a679d3f6cd17429..0591d6cd6151a6e6869b8b0787280081a2474cf9 100644 (file)
@@ -1,3 +1,11 @@
+2004-05-05  Ken Raeburn  <raeburn@mit.edu>
+
+       * 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.
+
 2004-04-22  Ken Raeburn  <raeburn@mit.edu>
 
        * libdb.exports: New file.
index 6ca75509720b27aeb364a1eabfce2901292ca0fd..39dc7c21678b0db76aaef08614eac5176bd993cd 100644 (file)
@@ -16,6 +16,7 @@ HDRDIR=$(BUILDTOP)/include
 HDRS = $(HDRDIR)/db.h $(HDRDIR)/db-config.h $(HDRDIR)/db-ndbm.h
 
 all-unix:: all-liblinks includes
+all-prerecurse: include/config.h include/db-config.h
 clean-unix:: clean-liblinks clean-libs clean-includes
 
 includes:: $(HDRS)
@@ -27,6 +28,13 @@ $(HDRDIR)/db-config.h: include/db-config.h
 $(HDRDIR)/db-ndbm.h: $(srcdir)/include/db-ndbm.h
        $(CP) $(srcdir)/include/db-ndbm.h $@
 
+include/config.h: $(srcdir)/include/config.h.in
+       cd $(thisconfigdir) && $(SHELL) config.status
+$(srcdir)/include/config.h.in: @MAINT@ $(srcdir)/configure.in $(SRCTOP)/aclocal.m4
+       cd $(srcdir) && ($(AUTOHEADER) --include=$(CONFIG_RELTOPDIR) $(AUTOHEADERFLAGS) || $(AUTOHEADER) --localdir=$(CONFIG_RELTOPDIR) $(AUTOHEADERFLAGS))
+include/db-config.h: $(srcdir)/include/db-config.h.in
+       cd $(thisconfigdir) && $(SHELL) config.status
+
 clean-includes::
        $(RM) $(HDRS)
 # @lib_frag@
index 6fe60397a76baf5e4a24a4e7130c6674426b38f3..b64a126d2e219c363500521041b1399ba573bc10 100644 (file)
@@ -63,7 +63,8 @@ AC_COMPILE_TYPE(u_int32_t, unsigned int)
 
 dnl checks for structures
 dnl checks for compiler characteristics
-AC_C_BIGENDIAN
+dnl AC_C_BIGENDIAN
+AC_CHECK_HEADERS(endian.h)
 AC_C_CONST
 AC_CHECK_SIZEOF(int)
 
index eacdbc8b7bfc4666b4fdcf139f644e2eb7e51b34..3ca9befe5b2eaad40049f48e8abc4269e996c35d 100644 (file)
@@ -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.
index 2c21fb207a787b4201ee75d5063a1db981604e3c..ddc2d47642dd921e8d9d6a3859789e9160655017 100644 (file)
 #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 */