From 65bbbc196591a4b47ac90e85fbbeff319d69bb84 Mon Sep 17 00:00:00 2001
From: Alexander Vershilov <alexander.vershilov@gmail.com>
Date: Wed, 20 May 2015 20:54:17 +0300
Subject: [PATCH] Provide cabal_macros in c2hs invocation.

This commit includes cabal_macros in c2hs call, so it will
be possible to use MIN_VERSION macros in chs files.
---
 Cabal/Distribution/Simple/PreProcess.hs | 1 +
 Cabal/changelog                         | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Cabal/Distribution/Simple/PreProcess.hs b/Cabal/Distribution/Simple/PreProcess.hs
index a98bbf0790..eadb148ff0 100644
--- a/Cabal/Distribution/Simple/PreProcess.hs
+++ b/Cabal/Distribution/Simple/PreProcess.hs
@@ -486,6 +486,7 @@ ppC2hs bi lbi =
           -- Options from the current package:
            [ "--cpp=" ++ programPath gccProg, "--cppopts=-E" ]
         ++ [ "--cppopts=" ++ opt | opt <- getCppOptions bi lbi ]
+        ++ [ "--cppopts=-include" ++ (autogenModulesDir lbi </> cppHeaderName) ]
         ++ [ "--include=" ++ outBaseDir ]
 
           -- Options from dependent packages
diff --git a/Cabal/changelog b/Cabal/changelog
index e6d1c5e9f6..fa83cb34ba 100644
--- a/Cabal/changelog
+++ b/Cabal/changelog
@@ -2,6 +2,7 @@
 
 1.23.x.x (current development version) 
 	* Deal with extra C sources from preprocessors (#238).
+	* Include cabal_macros.h when running c2hs.
 
 1.22.0.0 Johan Tibell <johan.tibell@gmail.com> January 2015
 	* Support GHC 7.10.
-- 
GitLab