changequote([, ])dnl
AC_MSG_CHECKING(Haskell type for $1)
AC_CACHE_VAL(AC_CV_NAME,
-[AC_CV_NAME_supported=yes;
+[AC_CV_NAME_supported=yes
+fp_check_htype_save_cppflags="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $X_CFLAGS"
AC_TRY_RUN([#include <stdio.h>
#include <stddef.h>
}],AC_CV_NAME=`cat conftestval`,
ifelse([$2], , [AC_CV_NAME=NotReallyAType; AC_CV_NAME_supported=no], AC_CV_NAME=$2),
ifelse([$3], , [AC_CV_NAME=NotReallyATypeCross; AC_CV_NAME_supported=no], AC_CV_NAME=$3))]) dnl
+CPPFLAGS="$fp_check_htype_save_cppflags"
if test "$AC_CV_NAME_supported" = yes; then
AC_MSG_RESULT($AC_CV_NAME)
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [Define to Haskell type for $1])
AC_LANG_RESTORE
])
+
+dnl @synopsis FP_EMPTY_STRUCTS
+dnl
+dnl Check whether empty structs is accepted by CC.
+dnl
+AC_DEFUN(FP_EMPTY_STRUCTS,
+[AC_CACHE_CHECK(empty struct support, fptools_cv_empty_structs,
+[AC_TRY_COMPILE([
+typedef struct { /*empty*/ } StgFoo;
+],
+[int i;],
+fptools_cv_empty_structs=yes,
+fptools_cv_empty_structs=no)])
+if test "$fptools_cv_empty_structs" = yes; then
+AC_DEFINE([SUPPORTS_EMPTY_STRUCTS], [1], [Define to 1 if C compiler supports declaration of empty structure types.])
+fi
+])
+
# LocalWords: fi