allow to enable iconv when building

and ensure declaring all the variables used inside the ifdef HAVE_ICONV blocks