]> source.dussan.org Git - rspamd.git/commitdiff
Find iconv.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 9 Feb 2015 10:52:23 +0000 (10:52 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 9 Feb 2015 10:52:23 +0000 (10:52 +0000)
CMakeLists.txt

index c3f13e5191805b385fa73006d447676c8b5f6e12..9038f646857ffb7787dd35f46d6bc1cae7f970f9 100644 (file)
@@ -737,6 +737,37 @@ int main(int argc, char** argv) {
   return cmkcheckweak == NULL;
 }" HAVE_WEAK_SYMBOLS)
 
+IF(NOT ICONV_INCLUDE_DIR OR NOT ICONV_LIBRARIES)
+       FIND_PATH(ICONV_INCLUDE_DIR iconv.h)
+       FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c)
+       IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
+               SET(ICONV_FOUND TRUE)
+       ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
+       LIST(APPEND CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
+       LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
+
+       IF(ICONV_FOUND)
+               CHECK_C_SOURCE_COMPILES("
+#include <iconv.h>
+int main(){
+       iconv_t conv = 0;
+       const char* in = 0;
+       size_t ilen = 0;
+       char* out = 0;
+       size_t olen = 0;
+       iconv(conv, &in, &ilen, &out, &olen);
+       return 0;
+}
+" ICONV_SECOND_ARGUMENT_IS_CONST)
+       ENDIF(ICONV_FOUND)
+
+       IF(ICONV_FOUND)
+               MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
+       ELSE(ICONV_FOUND)
+               MESSAGE(FATAL_ERROR "Could not find Iconv")
+       ENDIF(ICONV_FOUND)
+ENDIF(NOT ICONV_INCLUDE_DIR OR NOT ICONV_LIBRARIES)
+
 
 # Check macros
 CHECK_SYMBOL_EXISTS(PATH_MAX limits.h HAVE_PATH_MAX)