haskell.m4 1.0 KB

1234567891011121314151617181920212223242526272829
  1. dnl ghc.m4 for checking the Glasgow Haskell Compiler
  2. dnl GHC_TRY_COMPILE_HASKELL has 4 arguments
  3. dnl $1 : Haskell program
  4. dnl $2 : GHC options (cannot be omitted
  5. dnl $3 : if succeed to compile
  6. dnl $4 : if failed to compile
  7. dnl Usually, compiling takes long time, so you should use this function
  8. dnl with AC_MSG_CHECKING and AC_MSG_RESULT to notice users.
  9. dnl
  10. dnl Note: Haskell has an indentation style. So, you should write Haskell code carefully
  11. dnl though sh scripts does not matter indentation. If you have some strange errors,
  12. dnl see config.log to catch your problems.
  13. AC_DEFUN(GHC_TRY_COMPILE_HASKELL,
  14. [cat >CompileTest.hs <<EOF
  15. module CompileTest where
  16. [$1]
  17. EOF
  18. ghc_compile_haskell='${GHC} -c $GHCFLAGS $2 CompileTest.hs 1>&AC_FD_CC'
  19. if AC_TRY_EVAL(ghc_compile_haskell) && test -s CompileTest.o; then
  20. ifelse([$3], , :, [rm -f CompileTest* Main.hi; $3])
  21. else
  22. echo "configure: failed program was:" >&AC_FD_CC
  23. cat CompileTest.hs >&AC_FD_CC
  24. ifelse([$4], , , [rm -f CompileTest* Main.hi; $4])
  25. fi
  26. rm -f CompileTest* Main.hi
  27. ])