Added an automatically generated module containing the sizes of bool and int in the C and C++ implementations on the host machine

This commit is contained in:
Neil Brown 2008-03-07 21:23:24 +00:00
parent 235ce3d3e5
commit 5714b5552a
2 changed files with 28 additions and 1 deletions

View File

@ -58,6 +58,15 @@ CompilerCommands.hs: Makefile
echo 'cxxCommand :: String -> String -> String' >> CompilerCommands.hs
echo 'cxxCommand inp out = "$(CXX) $(TOCK_CXXFLAGS) -o " ++ out ++ " " ++ inp ++ " $(TOCK_CXXLDFLAGS)"' >> CompilerCommands.hs
TypeSizes.hs: Makefile
echo 'module TypeSizes where' > TypeSizes.hs
echo '--This file is auto-generated by Makefile.am' >> TypeSizes.hs
echo 'cBoolSize, cxxBoolSize, cIntSize, cxxIntSize :: Int' >> TypeSizes.hs
echo 'cBoolSize = @C_BOOL_SIZE@' >> TypeSizes.hs
echo 'cxxBoolSize = @CXX_BOOL_SIZE@' >> TypeSizes.hs
echo 'cIntSize = @C_INT_SIZE@' >> TypeSizes.hs
echo 'cxxIntSize = @CXX_INT_SIZE@' >> TypeSizes.hs
# Both these results are near-identical. The -g flag to alex tells it to generate
# a lexer optimised for GHC. The other part of the rule inserts the
# -fno-warn-tabs flag under GHC >= 6.8, but doesn't add anything under previous
@ -89,7 +98,7 @@ data/TagAST.hs: GenTagAST$(EXEEXT)
data/OrdAST.hs: GenOrdAST$(EXEEXT)
./GenOrdAST$(EXEEXT) > data/OrdAST.hs
BUILT_SOURCES = frontends/LexOccam.hs frontends/LexRain.hs CompilerCommands.hs data/TagAST.hs data/OrdAST.hs
BUILT_SOURCES = frontends/LexOccam.hs frontends/LexRain.hs CompilerCommands.hs TypeSizes.hs data/TagAST.hs data/OrdAST.hs
CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST = docextra testcases/automatic

View File

@ -140,6 +140,24 @@ fi
AM_CONDITIONAL([GHC68],[test $ghc_version_major -ge 6 -a $ghc_version_mid -ge 8])
# Check the sizes of certain constructs. We'll need to be cleverer if in future
# we want to allow cross-compilation.
AC_LANG(C++)
AC_CHECK_SIZEOF(bool)
AC_COMPUTE_INT(CXX_BOOL_SIZE,SIZEOF_BOOL)
AC_SUBST(CXX_BOOL_SIZE)
AC_CHECK_SIZEOF(int)
AC_COMPUTE_INT(CXX_INT_SIZE,SIZEOF_INT)
AC_SUBST(CXX_INT_SIZE)
AC_LANG(C)
AC_CHECK_SIZEOF(_Bool)
AC_COMPUTE_INT(C_BOOL_SIZE,SIZEOF__BOOL)
AC_SUBST(C_BOOL_SIZE)
AC_CHECK_SIZEOF(int)
AC_COMPUTE_INT(C_INT_SIZE,SIZEOF_INT)
AC_SUBST(C_INT_SIZE)
AC_SUBST(gnu89_inline)
AC_SUBST(ccsp_kroc_available)
AC_SUBST(cppcsp_available)