Skip to content

Commit

Permalink
Check for _NL_TIME_FIRST_WEEKDAY declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Nemo authored and CameronNemo committed Jul 2, 2020
1 parent 73e6971 commit 30f67a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/Services/Calendar/Store.vala
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ public class Calendar.Store : Object {
}

private Store () {
#if HAVE_NL_TIME_FIRST_WEEKDAY
int week_start = Posix.NLTime.FIRST_WEEKDAY.to_string ().data[0];
#else
int week_start = 1;
#endif
if (week_start >= 1 && week_start <= 7) {
week_starts_on = (GLib.DateWeekday) (week_start - 1);
}
Expand Down
12 changes: 11 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ else
add_project_arguments('--vapidir', join_paths(meson.current_source_dir(), 'vapi'), language: 'vala')
endif

m_dep = meson.get_compiler('c').find_library('m', required : false)
cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required : false)
libnotify_dep = dependency('libnotify', required: false)

if libnotify_dep.found()
add_project_arguments('--define=HAVE_LIBNOTIFY', language: 'vala')
endif

if cc.has_header_symbol('langinfo.h', '_NL_TIME_FIRST_WEEKDAY')
add_project_arguments('--define=HAVE_NL_TIME_FIRST_WEEKDAY', language: 'vala')
endif

gresource_calendar = gnome.compile_resources(
'gresource_calendar',
Expand Down

0 comments on commit 30f67a3

Please sign in to comment.