9 cc = meson.get_compiler('c')
11 conf = configuration_data()
12 conf.set_quoted('PACKAGE', meson.project_name())
13 conf.set_quoted('VERSION', meson.project_version())
14 conf.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir')))
15 conf.set_quoted('LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir')))
17 mini = get_option('mini')
18 conf.set('NCMPC_MINI', mini)
20 enable_locale = get_option('locale')
21 if enable_locale == 'false' or mini
23 elif cc.has_header('locale.h')
25 elif enable_locale == 'auto'
28 error('locale.h not found')
30 conf.set('ENABLE_LOCALE', enable_locale)
32 enable_nls = get_option('nls')
33 if enable_nls == 'false' or mini
35 elif cc.has_header('libintl.h')
37 elif enable_nls == 'auto'
40 error('libintl.h not found')
42 conf.set('ENABLE_NLS', enable_nls)
44 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
49 conf.set('ENABLE_TCP', true)
50 conf.set('HAVE_GETADDRINFO', cc.has_function('getaddrinfo'))
53 async_connect = get_option('async_connect')
54 conf.set('ENABLE_ASYNC_CONNECT', async_connect)
56 conf.set('ENABLE_MULTIBYTE', get_option('multibyte'))
58 curses = get_option('curses')
59 if curses == 'ncursesw'
60 curses_dep = dependency('ncursesw')
61 elif curses == 'ncurses'
62 curses_dep = dependency('ncurses')
64 curses_dep = dependency('ncursesw', required: false)
68 curses_dep = dependency('ncurses', required: false)
73 # TODO: find other curses implementation (pdcurses?)
78 if curses == 'ncursesw'
79 conf.set('HAVE_NCURSESW', true)
80 curses_enhanced = true
82 if cc.has_header('ncursesw/curses.h', dependencies: curses_dep)
83 conf.set('HAVE_NCURSESW_CURSES_H', true)
84 elif cc.has_header('ncursesw.h', dependencies: curses_dep)
85 conf.set('HAVE_NCURSESW_H', true)
87 error('No ncursesw header found')
89 elif curses == 'ncurses'
90 conf.set('HAVE_NCURSES', true)
91 curses_enhanced = true
93 if cc.has_header('ncurses/curses.h', dependencies: curses_dep)
94 conf.set('HAVE_NCURSES_CURSES_H', true)
95 elif cc.has_header('ncurses.h', dependencies: curses_dep)
96 conf.set('HAVE_NCURSES_H', true)
98 error('No ncurses header found')
101 if cc.has_header('curses.h', dependencies: curses_dep)
102 conf.set('HAVE_CURSES_H', true)
104 # TODO: test this with pdcurses
105 curses_enhanced = cc.has_header_symbol('curses.h', '_XOPEN_CURSES', dependencies: curses_dep)
106 curses_color = curses_enhanced or cc.has_header_symbol('curses.h', 'COLOR_PAIR', dependencies: curses_dep)
108 error('No curses header found')
111 conf.set('HAVE_CURSES_ENHANCED', curses_enhanced)
113 enable_mouse = get_option('mouse')
114 if enable_mouse == 'false'
116 elif cc.has_function('getmouse', dependencies: curses_dep)
118 elif enable_mouse == 'auto'
121 error('getmouse() not available')
123 conf.set('HAVE_GETMOUSE', enable_mouse)
125 enable_lirc = get_option('lirc')
126 if enable_lirc == 'false'
130 lirc_dep = dependency('lirc', required: false)
131 if not lirc_dep.found()
132 lirc_dep = dependency('liblircclient0', required: false)
137 elif enable_lirc == 'auto'
140 error('liblirc not found')
143 conf.set('ENABLE_LIRC', enable_lirc)
145 conf.set('ENABLE_COLORS', curses_color)
148 # for getaddrinfo() and sigaction() with glibc
155 '-Wno-deprecated-declarations',
156 '-Wmissing-prototypes',
159 '-Wstrict-prototypes',
162 '-fvisibility=hidden',
168 if get_option('buildtype') != 'debug'
170 '-ffunction-sections',
178 foreach f: test_cflags
179 if cc.has_argument(f)
180 common_cflags += [ f ]
184 add_global_arguments(common_cflags, language: 'c')
186 foreach f: test_ldflags
187 if cc.has_argument(f)
188 add_global_link_arguments(f, language: 'c')
192 glib_dep = dependency('glib-2.0', version: '>= 2.30')
193 libmpdclient_dep = dependency('libmpdclient', version: '>= 2.9')
195 inc = include_directories(
198 # for the generated config.h
204 need_screen_text = false
205 need_plugin_library = false
207 if host_machine.system() != 'windows'
215 'src/db_completion.c',
226 'src/net/resolver.c',
227 'src/net/async_connect.c',
228 'src/net/async_rconnect.c',
239 enable_help_screen = get_option('help_screen') and not mini
240 conf.set('ENABLE_HELP_SCREEN', enable_help_screen)
241 if enable_help_screen
242 sources += ['src/screen_help.c']
245 enable_artist_screen = get_option('artist_screen') and not mini
246 conf.set('ENABLE_ARTIST_SCREEN', enable_artist_screen)
247 if enable_artist_screen
248 sources += ['src/screen_artist.c']
251 enable_search_screen = get_option('search_screen') and not mini
252 conf.set('ENABLE_SEARCH_SCREEN', enable_search_screen)
253 if enable_search_screen
254 sources += ['src/screen_search.c']
257 enable_song_screen = get_option('song_screen') and not mini
258 conf.set('ENABLE_SONG_SCREEN', enable_song_screen)
259 if enable_song_screen
260 sources += ['src/screen_song.c']
263 enable_keydef_screen = get_option('key_screen') and not mini
264 conf.set('ENABLE_KEYDEF_SCREEN', enable_keydef_screen)
265 if enable_keydef_screen
266 sources += ['src/screen_keydef.c']
269 enable_lyrics_screen = get_option('lyrics_screen') and not mini
270 conf.set('ENABLE_LYRICS_SCREEN', enable_lyrics_screen)
271 if enable_lyrics_screen
272 sources += ['src/screen_lyrics.c', 'src/lyrics.c']
274 lyrics_plugin_dir = join_paths(get_option('prefix'), get_option('libdir'), meson.project_name(), 'lyrics')
275 conf.set_quoted('LYRICS_PLUGIN_DIR', lyrics_plugin_dir)
278 'lyrics/20-lyricwiki.rb',
279 install_dir: lyrics_plugin_dir)
281 need_screen_text = true
282 need_plugin_library = true
285 enable_outputs_screen = get_option('outputs_screen') and not mini
286 conf.set('ENABLE_OUTPUTS_SCREEN', enable_outputs_screen)
287 if enable_outputs_screen
288 sources += ['src/screen_outputs.c']
291 enable_chat_screen = get_option('chat_screen') and not mini
292 conf.set('ENABLE_CHAT_SCREEN', enable_chat_screen)
293 if enable_chat_screen
294 sources += ['src/screen_chat.c']
295 need_screen_text = true
299 sources += ['src/screen_text.c']
302 if need_plugin_library
303 if host_machine.system() == 'windows'
304 error('Plugins not yet compatible with Windows')
307 sources += ['src/plugin.c']
310 if host_machine.system() == 'windows'
314 ncmpc = executable('ncmpc',
325 'src/player_command.c',
327 'src/progress_bar.c',
331 'src/screen_paint.c',
332 'src/screen_utils.c',
333 'src/screen_status.c',
336 'src/screen_client.c',
337 'src/screen_queue.c',
338 'src/screen_browser.c',
341 'src/save_playlist.c',
350 include_directories: inc,
360 configure_file(output: 'config.h', configuration: conf)
362 install_man('doc/ncmpc.1')
364 docdir = join_paths(get_option('datadir'), 'doc', meson.project_name())
365 install_data('AUTHORS', 'COPYING', 'NEWS', 'README.rst',
375 if get_option('documentation')
376 doxygen = find_program('doxygen', required: false)