make elm compile on Windows

SVN revision: 68946
This commit is contained in:
Vincent Torri 2012-03-07 13:27:06 +00:00
parent e479d536d6
commit 426c925717
2 changed files with 33 additions and 3 deletions

View File

@ -124,7 +124,7 @@ ELM_WINCE_DEF="#undef"
have_windows="no"
have_dlopen="no"
case "$host_os" in
mingw32ce* | cegcc*)
mingw32ce*)
PKG_CHECK_MODULES([EVIL], [evil])
AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed.])
lt_enable_auto_import="-Wl,--enable-auto-import"
@ -652,6 +652,8 @@ if test "x${have_mman}" = "xyes"; then
AC_DEFINE(HAVE_MMAN_H, 1, [Have sys/mman.h header file])
fi
AC_CHECK_HEADERS([locale.h langinfo.h])
my_libs="-lm"
AC_SUBST(my_libs)
AC_SUBST(requirement_elm)

View File

@ -1,8 +1,14 @@
#include <locale.h>
#include <langinfo.h>
#include <Elementary.h>
#include "elm_priv.h"
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
#ifdef HAVE_LANGINFO_H
# include <langinfo.h>
#endif
typedef struct _Widget_Data Widget_Data;
typedef struct _Datetime_Field Datetime_Field;
typedef struct _Datetime_Mod_Api Datetime_Mod_Api;
@ -545,6 +551,7 @@ _field_list_arrange(Evas_Object *obj)
_field_list_display(obj);
}
// FIXME: provide nl_langinfo on Windows if possible
// returns expanded format string for corresponding multi-field format character
static char *
_expanded_fmt_str_get(char ch)
@ -553,16 +560,32 @@ _expanded_fmt_str_get(char ch)
switch (ch)
{
case 'c':
#ifdef HAVE_LANGINFO_H
exp_fmt = nl_langinfo(D_T_FMT);
#else
exp_fmt = "";
#endif
break;
case 'x':
#ifdef HAVE_LANGINFO_H
exp_fmt = nl_langinfo(D_FMT);
#else
exp_fmt = "";
#endif
break;
case 'X':
#ifdef HAVE_LANGINFO_H
exp_fmt = nl_langinfo(T_FMT);
#else
exp_fmt = "";
#endif
break;
case 'r':
#ifdef HAVE_LANGINFO_H
exp_fmt = nl_langinfo(T_FMT_AMPM);
#else
exp_fmt = "";
#endif
break;
case 'R':
exp_fmt = "%H:%M";
@ -680,9 +703,14 @@ _reload_format(Evas_Object *obj)
wd = elm_widget_data_get(obj);
if (!wd) return;
// FIXME: provide nl_langinfo on Windows if possible
// fetch the default format from Libc.
if (!wd->user_format)
#ifdef HAVE_LANGINFO_H
strncpy(wd->format, nl_langinfo(D_T_FMT), MAX_FORMAT_LEN);
#else
strncpy(wd->format, "", MAX_FORMAT_LEN);
#endif
dt_fmt = (char *)malloc(MAX_FORMAT_LEN);
strncpy(dt_fmt, wd->format, MAX_FORMAT_LEN);