# HG changeset patch # User Matti Hamalainen # Date 1496366862 -10800 # Node ID b4b1aac8761c36e6e2dea3f9a82e011f6364e4f3 # Parent b9a3f93f69d156883fadc66602ed71307e2c8e01 Add preprocessor guards around iconv stuff. diff -r b9a3f93f69d1 -r b4b1aac8761c sidinfo.c --- a/sidinfo.c Fri Jun 02 02:45:00 2017 +0300 +++ b/sidinfo.c Fri Jun 02 04:27:42 2017 +0300 @@ -7,7 +7,9 @@ #include "th_string.h" #include "th_file.h" #include "sidlib.h" +#ifdef HAVE_ICONV #include +#endif // Some constants @@ -96,8 +98,10 @@ SIDLibSLDB *sidSLDB = NULL; +#ifdef HAVE_ICONV BOOL setUseChConv; iconv_t setChConv; +#endif // Define option arguments @@ -609,8 +613,6 @@ int main(int argc, char *argv[]) { - char *setLang = th_strdup(getenv("LANG")); - // Initialize th_init("SIDInfo", "PSID/RSID information displayer", "0.6.1", NULL, NULL); th_verbosityLevel = 0; @@ -618,6 +620,8 @@ memset(&optFormat, 0, sizeof(optFormat)); // Initialize iconv, check if we have language/charset +#ifdef HAVE_ICONV + char *setLang = th_strdup(getenv("LANG")); if (setLang != NULL) { char *ptr = strchr(setLang, '.'); @@ -627,6 +631,7 @@ setChConv = iconv_open(setLang != NULL ? setLang : SET_DEF_CHARSET, "iso88591"); setUseChConv = setChConv != (iconv_t) -1; th_free(setLang); +#endif // Parse command line arguments if (!th_args_process(argc, argv, optList, optListN, @@ -712,8 +717,10 @@ out: +#ifdef HAVE_ICONV if (setUseChConv) iconv_close(setChConv); +#endif th_free(setHVSCPath); th_free(setSLDBPath);