From 047365efde4edf5983bfdb03942ff399fceeeb03 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sun, 15 Feb 2015 01:08:48 +0000 Subject: [PATCH] mips: move ABI check to configure.ac * configure.ac [MIPS]: Check for MIPS ABI. * defs.h [MIPS]: Remove MIPS ABI check. * ioctlsort.c: Likewise. --- configure.ac | 23 +++++++++++++++++++++++ defs.h | 13 ------------- ioctlsort.c | 13 ------------- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index 715db95e..8a28746c 100644 --- a/configure.ac +++ b/configure.ac @@ -143,6 +143,29 @@ AC_MSG_RESULT($arch) AC_SUBST(arch) +if test "$arch" = mips; then + AC_CACHE_CHECK([for MIPS ABI], [ac_cv_mips_abi], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[int i[_MIPS_SIM == _MIPS_SIM_ABI32 ? 1 : - 1];]])], + [ac_cv_mips_abi=o32], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[int i[_MIPS_SIM == _MIPS_SIM_NABI32 ? 1 : - 1];]])], + [ac_cv_mips_abi=n32], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[int i[_MIPS_SIM == _MIPS_SIM_ABI64 ? 1 : - 1];]])], + [ac_cv_mips_abi=n64], + [ac_cv_mips_abi=unknown])])])]) + case "$ac_cv_mips_abi" in + o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _MIPS_SIM_ABI32.]);; + n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _MIPS_SIM_NABI32.]);; + n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _MIPS_SIM_ABI64.]);; + *) AC_MSG_ERROR([Unsupported _MIPS_SIM]);; + esac +fi + AC_ARG_ENABLE([arm-oabi], [AS_HELP_STRING([--enable-arm-oabi], [enable OABI support on ARM EABI])], diff --git a/defs.h b/defs.h index cb2ae0d7..c1fd5954 100644 --- a/defs.h +++ b/defs.h @@ -31,19 +31,6 @@ # include "config.h" #endif -#ifdef MIPS -# include -# if _MIPS_SIM == _MIPS_SIM_ABI64 -# define LINUX_MIPSN64 -# elif _MIPS_SIM == _MIPS_SIM_NABI32 -# define LINUX_MIPSN32 -# elif _MIPS_SIM == _MIPS_SIM_ABI32 -# define LINUX_MIPSO32 -# else -# error Unsupported _MIPS_SIM -# endif -#endif - #include #ifdef HAVE_STDBOOL_H # include diff --git a/ioctlsort.c b/ioctlsort.c index c81c949c..333556c8 100644 --- a/ioctlsort.c +++ b/ioctlsort.c @@ -30,19 +30,6 @@ # include "config.h" #endif -#ifdef MIPS -# include -# if _MIPS_SIM == _MIPS_SIM_ABI64 -# define LINUX_MIPSN64 -# elif _MIPS_SIM == _MIPS_SIM_NABI32 -# define LINUX_MIPSN32 -# elif _MIPS_SIM == _MIPS_SIM_ABI32 -# define LINUX_MIPSO32 -# else -# error Unsupported _MIPS_SIM -# endif -#endif - #include #include #include