From: Jan Engelhardt Date: Fri, 25 May 2012 07:18:40 +0000 (+0200) Subject: xfsprogs: build: remove home-baked long/ptr size detection X-Git-Tag: v3.1.9-rc2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=865f1075c3bc4e86625de1e91538bcbab319a4c6;p=thirdparty%2Fxfsprogs-dev.git xfsprogs: build: remove home-baked long/ptr size detection autoconf can do this for us. Signed-off-by: Jan Engelhardt Reviewed-by: Christoph Hellwig Signed-off-by: Ben Myers --- diff --git a/configure.ac b/configure.ac index be57501ee..0b03af952 100644 --- a/configure.ac +++ b/configure.ac @@ -113,10 +113,11 @@ AC_HAVE_PREADV AC_HAVE_SYNC_FILE_RANGE AC_HAVE_BLKID_TOPO($enable_blkid) +AC_CHECK_SIZEOF([long]) +AC_CHECK_SIZEOF([char *]) AC_TYPE_PSINT AC_TYPE_PSUNSIGNED AC_TYPE_U32 -AC_SIZEOF_POINTERS_AND_LONG AC_MANUAL_FORMAT AC_CONFIG_FILES([include/builddefs]) diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in index 0196cc443..4e1e0c403 100644 --- a/include/platform_defs.h.in +++ b/include/platform_defs.h.in @@ -33,6 +33,7 @@ #include #include #include +#include #undef HAVE___U32 #ifdef HAVE___U32 @@ -77,26 +78,17 @@ typedef struct filldir filldir_t; #endif /* long and pointer must be either 32 bit or 64 bit */ -#undef HAVE_32BIT_LONG -#undef HAVE_64BIT_LONG -#undef HAVE_32BIT_PTR -#undef HAVE_64BIT_PTR - -#if defined(HAVE_32BIT_LONG) -# define BITS_PER_LONG 32 -#elif defined(HAVE_64BIT_LONG) -# define BITS_PER_LONG 64 -#else -# error Unknown long size -#endif +#undef SIZEOF_LONG +#undef SIZEOF_CHAR_P +#define BITS_PER_LONG (SIZEOF_LONG * CHAR_BIT) /* Check if __psint_t is set to something meaningful */ #undef HAVE___PSINT_T #ifndef HAVE___PSINT_T -# ifdef HAVE_32BIT_PTR +# if (SIZEOF_CHAR_P * CHAR_BIT) == 32 typedef int __psint_t; -# elif defined HAVE_64BIT_PTR -# ifdef HAVE_64BIT_LONG +# elif (SIZEOF_CHAR_P * CHAR_BIT) == 64 +# if BITS_PER_LONG == 64 typedef long __psint_t; # else /* This is a very strange architecture, which has 64 bit pointers but */ @@ -111,10 +103,10 @@ typedef long long __psint_t; /* Check if __psunsigned_t is set to something meaningful */ #undef HAVE___PSUNSIGNED_T #ifndef HAVE___PSUNSIGNED_T -# ifdef HAVE_32BIT_PTR +# if (SIZEOF_CHAR_P * CHAR_BIT) == 32 typedef unsigned int __psunsigned_t; -# elif defined HAVE_64BIT_PTR -# ifdef HAVE_64BIT_LONG +# elif (SIZEOF_CHAR_P * CHAR_BIT) == 64 +# if BITS_PER_LONG == 64 typedef long __psunsigned_t; # else /* This is a very strange architecture, which has 64 bit pointers but */ diff --git a/m4/package_types.m4 b/m4/package_types.m4 index 0a0e08774..dfcb0d998 100644 --- a/m4/package_types.m4 +++ b/m4/package_types.m4 @@ -39,26 +39,3 @@ AC_DEFUN([AC_TYPE_U32], __u32 u32; ], AC_DEFINE(HAVE___U32) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no)) ]) - -# -# Check type sizes -# -AC_DEFUN([AC_SIZEOF_POINTERS_AND_LONG], - [ if test "$cross_compiling" = yes -a -z "$ac_cv_sizeof_long"; then - AC_MSG_WARN([Cross compiling; assuming 32bit long and 32bit pointers]) - fi - AC_CHECK_SIZEOF(long, 4) - AC_CHECK_SIZEOF(char *, 4) - if test $ac_cv_sizeof_long -eq 4 -o $ac_cv_sizeof_long -eq 0; then - AC_DEFINE(HAVE_32BIT_LONG) - fi - if test $ac_cv_sizeof_long -eq 8; then - AC_DEFINE(HAVE_64BIT_LONG) - fi - if test $ac_cv_sizeof_char_p -eq 4 -o $ac_cv_sizeof_char_p -eq 0; then - AC_DEFINE(HAVE_32BIT_PTR) - fi - if test $ac_cv_sizeof_char_p -eq 8; then - AC_DEFINE(HAVE_64BIT_PTR) - fi - ])