Commit 817e88c4 authored by David Goodell's avatar David Goodell
Browse files

[svn-r5666] Work around Darwin strict behavior and sys/stat.h in ROMIO.

When MPICH2 is configured with --enable-strict it has the effect of
removing the u_char, u_short, u_int, and u_long types from sys/types.h.
Unfortunately, sys/stat.h still uses these types whether or not they are
defined.  So we define them ourselves if they are not present so that
our checks involving sys/stat.h will succeed later.

Reviewed by balaji@.
parent bc877e89
......@@ -721,8 +721,27 @@ AC_C_INLINE
# Header files
# Find the CPP before the header check
AC_CHECK_HEADERS(unistd.h fcntl.h malloc.h stddef.h)
AC_CHECK_HEADERS([unistd.h fcntl.h malloc.h stddef.h sys/types.h])
# When compiling ROMIO on Darwin with _POSIX_C_SOURCE defined (such as when
# using --enable-strict in MPICH2), sys/types.h does not define u_short and
# friends unless _DARWIN_C_SOURCE is also defined (see compat(5) on a Darwin
# box). This would normally be fine, except sys/stat.h defines struct stat to
# use u_long, so strict compiles fail. One option is to also compile with
# _DARWIN_C_SOURCE, but this disables much of the strictness that is intended
# by _POSIX_C_SOURCE. Instead we just define our own types if they are not
# provided by the system. This isn't quite as safe as typedef'ing the
# replacement types, but it will apply to later configure tests, which is
# important.
AC_CHECK_TYPE([u_char],[],[AC_DEFINE_UNQUOTED([u_char],[unsigned char],[Define to "unsigned char" if sys/types.h does not define.])])
AC_CHECK_TYPE([u_short],[],[AC_DEFINE_UNQUOTED([u_short],[unsigned short],[Define to "unsigned short" if sys/types.h does not define.])])
AC_CHECK_TYPE([u_int],[],[AC_DEFINE_UNQUOTED([u_int],[unsigned int],[Define to "unsigned int" if sys/types.h does not define.])])
AC_CHECK_TYPE([u_long],[],[AC_DEFINE_UNQUOTED([u_long],[unsigned long],[Define to "unsigned long" if sys/types.h does not define.])])
# must come _after_ the above checks for u_char/u_short/u_int/u_long
AC_CACHE_CHECK([for int large enough for pointers],
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment