1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 04:17:33 +00:00

Get $iconv vars working again

This commit is contained in:
Pavel Labath 2010-01-20 18:17:30 +01:00
parent 9bee219adf
commit 6e89ed7e2d
5 changed files with 28 additions and 22 deletions

View File

@ -142,3 +142,5 @@ if(BUILD_WEATHER_XOAP)
endif(BUILD_WEATHER_XOAP)
option(BUILD_APCUPSD "Enable APCUPSD support" true)
option(BUILD_ICONV "Enable iconv support" false)

View File

@ -105,18 +105,22 @@ endif(BUILD_PORT_MONITORS)
# Check for iconv
check_include_file(iconv.h HAVE_ICONV_H)
find_library(ICONV_LIBRARY NAMES iconv)
if(HAVE_ICONV_H AND ICONV_LIBRARY)
set(conky_includes ${conky_includes} ${ICONV_INCLUDE_DIR})
set(conky_libs ${conky_libs} ${ICONV_LIBRARY})
set(HAVE_ICONV true)
else(HAVE_ICONV_H AND ICONV_LIBRARY)
# too annoying
# message(WARNING "Unable to find iconv library")
set(HAVE_ICONV false)
endif(HAVE_ICONV_H AND ICONV_LIBRARY)
if(BUILD_ICONV)
check_include_file(iconv.h HAVE_ICONV_H)
find_library(ICONV_LIBRARY NAMES iconv)
if(NOT ICONV_LIBRARY)
# maybe iconv() is provided by libc
set(ICONV_LIBRARY "" CACHE FILEPATH "Path to the iconv library, if iconv is not provided by libc" FORCE)
endif(NOT ICONV_LIBRARY)
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
check_function_exists(iconv ICONV_FUNC)
if(HAVE_ICONV_H AND ICONV_FUNC)
set(conky_includes ${conky_includes} ${ICONV_INCLUDE_DIR})
set(conky_libs ${conky_libs} ${ICONV_LIBRARY})
else(HAVE_ICONV_H AND ICONV_FUNC)
message(FATAL_ERROR "Unable to find iconv library")
endif(HAVE_ICONV_H AND ICONV_FUNC)
endif(BUILD_ICONV)
# check for Xlib

View File

@ -85,7 +85,7 @@
#cmakedefine BUILD_WLAN 1
#cmakedefine HAVE_ICONV 1
#cmakedefine BUILD_ICONV 1
#cmakedefine BUILD_LUA_CAIRO 1

View File

@ -80,7 +80,7 @@
#ifdef BUILD_X11
#include "fonts.h"
#endif
#ifdef HAVE_ICONV
#ifdef BUILD_ICONV
#include "iconv_tools.h"
#endif
#ifdef BUILD_LUA
@ -728,12 +728,12 @@ void generate_text_internal(char *p, int p_max_size, struct text_object root)
{
struct text_object *obj;
size_t a;
#ifdef HAVE_ICONV
#ifdef BUILD_ICONV
char *buff_in;
buff_in = (char *)malloc(p_max_size);
memset(buff_in, 0, p_max_size);
#endif /* HAVE_ICONV */
#endif /* BUILD_ICONV */
p[0] = 0;
obj = root.next;
@ -761,9 +761,9 @@ void generate_text_internal(char *p, int p_max_size, struct text_object root)
}
a = strlen(p);
#ifdef HAVE_ICONV
#ifdef BUILD_ICONV
iconv_convert(&a, buff_in, p, p_max_size);
#endif /* HAVE_ICONV */
#endif /* BUILD_ICONV */
if (!obj->verbatim_output)
substitute_newlines(p, a - 2);
p += a;
@ -776,9 +776,9 @@ void generate_text_internal(char *p, int p_max_size, struct text_object root)
/* load any new fonts we may have had */
load_fonts();
#endif /* BUILD_X11 */
#ifdef HAVE_ICONV
#ifdef BUILD_ICONV
free(buff_in);
#endif /* HAVE_ICONV */
#endif /* BUILD_ICONV */
}
void evaluate(const char *text, char *p, int p_max_size)

View File

@ -50,7 +50,7 @@
#include "ibm.h"
#include "smapi.h"
#endif
#ifdef HAVE_ICONV
#ifdef BUILD_ICONV
#include "iconv_tools.h"
#endif
#ifdef BUILD_LUA
@ -1051,7 +1051,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
scan_tztime(obj, arg);
obj->callbacks.print = &print_tztime;
obj->callbacks.free = &free_tztime;
#ifdef HAVE_ICONV
#ifdef BUILD_ICONV
END OBJ_ARG(iconv_start, 0, "Iconv requires arguments")
init_iconv_start(obj, free_at_crash, arg);
obj->callbacks.print = &print_iconv_start;