cmake: look for iconv in libc, too (bug #5316.)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a02eb6..78e4099 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -841,7 +841,10 @@
     endif()
 
     check_library_exists(iconv iconv_open "" HAVE_LIBICONV)
-    if(HAVE_LIBICONV)
+    check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)
+    if(HAVE_BUILTIN_ICONV)
+      set(HAVE_ICONV 1)
+    elseif(HAVE_LIBICONV)
       list(APPEND EXTRA_LIBS iconv)
       set(HAVE_ICONV 1)
     endif()