changeset 135:b4b1aac8761c

Add preprocessor guards around iconv stuff.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 02 Jun 2017 04:27:42 +0300
parents b9a3f93f69d1
children 641d0fe966ba
files sidinfo.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 <iconv.h>
+#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);