]> git.sesse.net Git - vlc/commitdiff
cmake: Set ICONV_CONST correctly.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 7 Feb 2008 17:20:33 +0000 (17:20 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 7 Feb 2008 17:20:33 +0000 (17:20 +0000)
extras/buildsystem/cmake/include/config.cmake

index 4d9d8b506a360c14512f7306bd392529d7c6ce7d..ea91d3c9a861cb5d3cb22f55311f1850f46e9202 100644 (file)
@@ -104,15 +104,18 @@ if(NOT HAVE_GETADDRINFO)
     check_library_exists(getaddrinfo nsl "" HAVE_GETADDRINFO)
 endif(NOT HAVE_GETADDRINFO)
 
-set(LIBICONV "")
 vlc_check_functions_exist(iconv)
-
 if(NOT HAVE_ICONV)
     set(LIBICONV "iconv")
     check_library_exists(iconv iconv "" HAVE_ICONV)
 endif(NOT HAVE_ICONV)
-# FIXME: this will break on *BSD:
-set( ICONV_CONST "" )
+CHECK_C_SOURCE_COMPILES(" #include <iconv.h>
+ int main() { return iconv(0, (char **)0, 0, (char**)0, 0); }" ICONV_NO_CONST)
+if( ICONV_NO_CONST )
+  set( ICONV_CONST "const" )
+else( ICONV_NO_CONST )
+  set( ICONV_CONST " ")
+endif( ICONV_NO_CONST )
 
 check_library_exists(rt clock_nanosleep "" HAVE_CLOCK_NANOSLEEP)
 if (HAVE_CLOCK_NANOSLEEP)