diff --git a/res/res_http_post.c b/res/res_http_post.c
index 9f5b1837a27921d02cace2feda95e84d37fdcfad..dca18a6ad3fb2bdcaa9320d867abb04f0f7611a5 100644
--- a/res/res_http_post.c
+++ b/res/res_http_post.c
@@ -55,7 +55,7 @@
 #ifdef GMIME_TYPE_CONTENT_TYPE
 #define AST_GMIME_VER_24
 #endif
-#if GMIME_MAJOR_VERSION >= 3
+#if defined(GMIME_MAJOR_VERSION) && (GMIME_MAJOR_VERSION >= 3)
 #define AST_GMIME_VER_30
 #endif