diff --git a/configure.ac b/configure.ac index 0410c83..4d2602f 100644 --- a/configure.ac +++ b/configure.ac @@ -74,6 +74,17 @@ AC_ARG_ENABLE(rebuilds, [ --disable-rebuilds disable all source autogenera # is found, so autogenerated sources can be rebuilt AC_CHECK_PROGS(PERL, perl5 perl) +# _NL_TIME_FIRST_WEEKDAY is an enum and not a define +AC_MSG_CHECKING([for _NL_TIME_FIRST_WEEKDAY]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[nl_langinfo(_NL_TIME_FIRST_WEEKDAY);]])], + [langinfo_ok=yes], [langinfo_ok=no]) +AC_MSG_RESULT([$langinfo_ok]) +if test "$langinfo_ok" = "yes"; then + AC_DEFINE([HAVE__NL_TIME_FIRST_WEEKDAY], [1], + [Define if _NL_TIME_FIRST_WEEKDAY is available]) +fi + REBUILD=\# if test "x$enable_rebuilds" = "xyes" && \ test -n "$PERL" && \ diff --git a/hildon/hildon-calendar.c b/hildon/hildon-calendar.c index b460e50..3c88f4c 100644 --- a/hildon/hildon-calendar.c +++ b/hildon/hildon-calendar.c @@ -986,6 +986,7 @@ hildon_calendar_init (HildonCalendar *calendar) else if (strcmp (year_before, "calendar:MY") != 0) g_warning ("Whoever translated calendar:MY did so wrongly.\n"); #endif +#ifdef HAVE__NL_TIME_FIRST_WEEKDAY langinfo = nl_langinfo (_NL_TIME_FIRST_WEEKDAY); first_weekday = langinfo[0]; langinfo = nl_langinfo (_NL_TIME_WEEK_1STDAY); @@ -1012,6 +1013,9 @@ hildon_calendar_init (HildonCalendar *calendar) } private_data->week_start = (week_1stday + first_weekday - 1) % 7; +#else + private_data->week_start = 0; +#endif locales_init (private_data); } diff --git a/hildon/hildon-weekday-picker.c b/hildon/hildon-weekday-picker.c index d357c91..e436940 100644 --- a/hildon/hildon-weekday-picker.c +++ b/hildon/hildon-weekday-picker.c @@ -211,6 +211,7 @@ hildon_weekday_picker_init (HildonWeekdayPicker *picker) sgroup = gtk_size_group_new (GTK_SIZE_GROUP_BOTH); +#ifdef HAVE__NL_TIME_FIRST_WEEKDAY /* Check our first weekday */ day = *nl_langinfo (_NL_TIME_FIRST_WEEKDAY); @@ -218,6 +219,9 @@ hildon_weekday_picker_init (HildonWeekdayPicker *picker) /* Shift the days by one. This is done because GDateWeekday * starts with Monday(1) and langinfo's first day is Sunday */ day--; +#else + day = 1; +#endif if (day < 1) day = 7;