Skip to content

Commit

Permalink
configure.ac: drop custom big-endian macros, rely on <endian.h>
Browse files Browse the repository at this point in the history
  • Loading branch information
trofi committed Dec 4, 2024
1 parent 913a4d0 commit afa00ec
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 42 deletions.
20 changes: 0 additions & 20 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,7 @@ AC_DEFINE_UNQUOTED([PAGER], ["$PAGER"], [Define to the pager program.])
dnl Initialize maintainer mode
AM_MAINTAINER_MODE

dnl Check for host endianness
AC_CACHE_CHECK([whether host byte ordering is defined in sys/param.h],
ski_cv_c_bigendian_compile,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/param.h>
]],[[
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
#error bogus endian macros
#endif
]])],
[ski_cv_c_bigendian_compile=yes], [ski_cv_c_bigendian_compile=no])])

AS_IF([test "x$ski_cv_c_bigendian_compile" = xyes], [
AC_DEFINE(ENDIANESS_IN_SYS_PARAM_H, 1,
[define if sys/param.h defines the endiness])
])
AC_C_BIGENDIAN

dnl Check for variables & functions

AC_FUNC_ALLOCA

dnl Find libelf.h
Expand Down
2 changes: 2 additions & 0 deletions src/bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#ifndef _SKI_BITS_H
#define _SKI_BITS_H

#include <endian.h>

#include "std.h"

#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
Expand Down
1 change: 1 addition & 0 deletions src/decoder/_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ extern TemplateInfo templates[NUM_TEMPL_SBS];
#include <machine/inline.h>
#endif /* INLINE */

# include <endian.h>
# include "std.h"

#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
Expand Down
3 changes: 3 additions & 0 deletions src/simmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#ifndef _SKI_MEMORY_H_
#define _SKI_MEMORY_H_

#include <endian.h>
#include <stddef.h>

#include "types.h"
#include "sim.h"

Expand Down
22 changes: 0 additions & 22 deletions src/std.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,4 @@

typedef enum {NO, YES} BOOL;

/* What is the host endiannes? */
#if defined ENDIANESS_IN_SYS_PARAM_H
# include <sys/types.h>
# include <sys/param.h>
#else /* !defined ENDIANESS_IN_SYS_PARAM_H */
# if !defined HAVE_CONFIG_H
# warning "Assuming BIG_ENDIAN"
/* In case we do not have config.h assume BIG_ENDIAN */
# define BIG_ENDIAN 4321
# define LITTLE_ENDIAN 1234
# define BYTE_ORDER BIG_ENDIAN
# else
# define BIG_ENDIAN 4321
# define LITTLE_ENDIAN 1234
# ifdef WORDS_BIGENDIAN
# define BYTE_ORDER BIG_ENDIAN
# else
# define BYTE_ORDER LITTLE_ENDIAN
# endif
# endif /* !defined HAVE_CONFIG_H */
#endif /* !defined ENDIANESS_IN_SYS_PARAM_H */

#endif /* _SKI_STD_H */
2 changes: 2 additions & 0 deletions src/tlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#ifndef _SKI_TLB_H_
#define _SKI_TLB_H_

#include <stddef.h>

#include "simmem.h"

#define NDTRS 16
Expand Down

0 comments on commit afa00ec

Please sign in to comment.