2 AC_INIT(ncmpc, 0.27, max@duempel.org)
9 AC_CONFIG_SRCDIR([src/main.c])
10 AC_CONFIG_AUX_DIR(build)
11 AM_INIT_AUTOMAKE([foreign 1.11 dist-xz subdir-objects])
13 AC_CONFIG_HEADERS([config.h])
14 AC_CONFIG_MACRO_DIR([m4])
17 dnl Check for programs
22 AS_IF([ test "x$ax_cv_curses" = xno ],
23 [AC_MSG_ERROR([No curses support detected.])
26 dnl =======================================================
27 dnl initialize variables
28 dnl =======================================================
31 ALL_LINGUAS=`grep -v '^\#' $srcdir/po/LINGUAS`
41 AS_HELP_STRING([--enable-mini],
42 [Build ncmpc-mini, i.e. without all optional features @<:@default=no@:>@]),,
45 AM_CONDITIONAL(NCMPC_MINI, test x$enable_mini = xyes)
46 if test "x$enable_mini" = xyes; then
47 AC_DEFINE([NCMPC_MINI], [1], [Build ncmpc-mini, which disables lots of features])
64 src/win/ncmpc_win32_rc.rc
66 AC_CHECK_TOOL(WINDRES, windres)
70 AC_CHECK_FUNC([socket],
72 [AC_CHECK_LIB([socket],[socket],[LIBS="$LIBS -lsocket"],
73 [AC_MSG_ERROR(No UNIX socket API found)])
76 AC_CHECK_FUNC([gethostbyname],
78 [AC_CHECK_LIB([nsl],[gethostbyname],[LIBS="$LIBS -lnsl"],
79 [AC_MSG_ERROR(No UNIX gethostbyname API found)])
84 AM_CONDITIONAL([HAVE_WINDOWS], [test $HAVE_WINDOWS -eq 1])
86 dnl multi-byte character support
88 AC_ARG_ENABLE([multibyte],
89 AS_HELP_STRING([--disable-multibyte],
90 [Disable multibyte character support @<:@default=yes@:>@]),,
91 [enable_multibyte=$disable_mini])
93 if test x$enable_multibyte = xyes; then
94 AC_DEFINE([ENABLE_MULTIBYTE], [1], [Enable multibyte character support])
96 if test "x$ax_cv_curses_enhanced" = xyes; then
97 AC_MSG_WARN(wide characters without multibyte characters makes little sense)
102 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.30],,
103 [AC_MSG_ERROR([glib 2.30 is required])])
105 dnl Check for libmpdclient 2.9
106 PKG_CHECK_MODULES([LIBMPDCLIENT], [libmpdclient >= 2.9],,
107 [AC_MSG_ERROR([libmpdclient2 is required])])
111 AC_ARG_ENABLE([locale],
112 AS_HELP_STRING([--disable-locale],
113 [Disable locale support @<:@default=auto@:>@]),,
114 [enable_locale=$auto_mini])
116 if test x$enable_locale = xyes; then
117 AC_CHECK_HEADER([locale.h],,
118 [AC_MSG_ERROR(locale.h is unavailable)])
121 if test x$enable_locale = xauto; then
122 AC_CHECK_HEADER([locale.h],
127 if test x$enable_locale = xyes; then
128 AC_DEFINE([ENABLE_LOCALE], [1], [Locale support is enabled])
131 if test x$enable_mini != xyes; then
137 if test x$USE_NLS = xyes; then
139 GETTEXT_PACKAGE=$PACKAGE
140 AC_SUBST(GETTEXT_PACKAGE)
141 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],
142 ["${GETTEXT_PACKAGE}"],
144 USE_NLS=$gt_cv_have_gettext
145 if test x$USE_NLS != xyes; then
146 AC_MSG_WARN([NLS support disabled!])
155 AS_HELP_STRING([--disable-tcp],
156 [Disable TCP support @<:@default=enabled@:>@]),,
157 [enable_tcp=$disable_mini])
158 if test "x$enable_tcp" = xyes; then
159 AC_DEFINE([ENABLE_TCP], 1, [Define to enable TCP support])
160 AC_SEARCH_LIBS([gethostbyname], [nsl])
161 AC_CHECK_FUNCS([getaddrinfo])
164 AC_ARG_ENABLE([async-connect],
165 AS_HELP_STRING([--enable-async-connect],
166 [Disable asynchronous connect @<:@default=yes@:>@]),,
167 [enable_async_connect=$disable_mini])
168 AM_CONDITIONAL(ENABLE_ASYNC_CONNECT, test x$enable_async_connect = xyes)
169 if test "x$enable_async_connect" = xyes; then
170 AC_DEFINE([ENABLE_ASYNC_CONNECT], [1], [Enable asynchronous connect?])
174 AC_ARG_ENABLE([colors],
175 AS_HELP_STRING([--enable-colors],
176 [Enable color support]),,
177 [enable_colors=auto])
178 AC_MSG_CHECKING([whether to include color support])
179 AS_IF([ test "x$enable_colors" = xyes || test "x$enable_colors" = xauto ],
180 [AS_IF([ test "x$disable_mini" = xyes],
181 [AS_IF([ test "x$ax_cv_curses_color" = xyes ],
182 [AC_MSG_RESULT([yes])
183 AC_DEFINE([ENABLE_COLORS], [1], [Enable color support])],
184 [AS_IF([ test "x$enable_colors" = xyes ],
185 AC_MSG_ERROR(["No color support found in curses library"])
192 AC_MSG_WARN(["Colors disabled due to mini mode being enabled."])]
194 [AC_MSG_RESULT([no])])
196 dnl test for LIRC support
198 AC_ARG_ENABLE([lirc],
199 AS_HELP_STRING([--enable-lirc],
200 [Enable LIRC support]),,
202 if test x$enable_lirc = xyes; then
203 PKG_CHECK_MODULES([LIBLIRCCLIENT], [lirc],,
204 [PKG_CHECK_MODULES([LIBLIRCCLIENT], [liblircclient0],,
205 [AC_MSG_ERROR([lirc not found])]
209 AC_DEFINE([ENABLE_LIRC], [1], [Enable LIRC support])
212 AM_CONDITIONAL(ENABLE_LIRC, test x$enable_lirc = xyes)
215 dnl Optional screen - help screen
216 AC_MSG_CHECKING([whether to include the help screen])
217 AC_ARG_ENABLE([help-screen],
218 AS_HELP_STRING([--enable-help-screen],
219 [Enable the help screen @<:@default=yes@:>@]),,
220 [enable_help_screen=$disable_mini])
221 AC_MSG_RESULT([$enable_help_screen])
222 if test "x$enable_help_screen" = "xyes" ; then
223 AC_DEFINE(ENABLE_HELP_SCREEN, 1, [Enable the help screen])
226 AM_CONDITIONAL(ENABLE_HELP_SCREEN, test x$enable_help_screen = xyes)
228 dnl Optional - curses getmouse support
230 MPD_WITH_LIBRARY([CURSES],
231 [AC_CHECK_FUNC([getmouse],
232 [ax_cv_curses_mouse=yes],
233 [ax_cv_curses_mouse=no])])
235 AC_ARG_ENABLE([mouse],
236 AS_HELP_STRING([--enable-mouse],
237 [Enable curses getmouse support @<:@default=yes@:>@]),,
240 AC_MSG_CHECKING([whether to include mouse support])
242 AS_IF([ test "x$enable_mouse" = xyes || test "x$enable_mouse" = xauto ],
243 [AS_IF([ test "x$disable_mini" = xyes],
244 [AS_IF([ test "x$ax_cv_curses_mouse" = xyes ],
245 [AC_MSG_RESULT([yes])
246 AC_DEFINE([HAVE_GETMOUSE], [1], [Enable mouse support])],
248 AS_IF([ test "x$enable_mouse" = xyes ],
249 [AC_MSG_ERROR(["No mouse support found in curses library"])
254 AC_MSG_WARN("Mouse disabled due to mini mode being enabled.")]
256 [AC_MSG_RESULT([no])])
258 dnl Optional screen - artist
259 AC_MSG_CHECKING([whether to include the artist screen])
260 AC_ARG_ENABLE([artist-screen],
261 AS_HELP_STRING([--enable-artist-screen],
262 [Enable artist screen @<:@default=yes@:>@]),,
263 [enable_artist_screen=$disable_mini])
264 AC_MSG_RESULT([$enable_artist_screen])
265 if test "x$enable_artist_screen" = "xyes" ; then
266 AC_DEFINE(ENABLE_ARTIST_SCREEN, 1, [Enable artist screen])
269 AM_CONDITIONAL(ENABLE_ARTIST_SCREEN, test x$enable_artist_screen = xyes)
271 dnl Optional screen - search
272 AC_MSG_CHECKING([whether to include the search screen])
273 AC_ARG_ENABLE([search-screen],
274 AS_HELP_STRING([--enable-search-screen],
275 [Enable search screen (EXPERIMENTAL) @<:@default=yes@:>@]),,
276 [enable_search_screen=$disable_mini])
277 AC_MSG_RESULT([$enable_search_screen])
278 if test "x$enable_search_screen" = "xyes" ; then
279 AC_DEFINE(ENABLE_SEARCH_SCREEN, 1, [Enable search screen])
282 AM_CONDITIONAL(ENABLE_SEARCH_SCREEN, test x$enable_search_screen = xyes)
284 dnl Optional screen - song viewer
285 AC_MSG_CHECKING([whether to include the song viewer screen])
286 AC_ARG_ENABLE([song-screen],
287 AS_HELP_STRING([--enable-song-screen],
288 [Enable song viewer screen @<:@default=yes@:>@]),,
289 [enable_song_screen=$disable_mini])
290 AC_MSG_RESULT([$enable_song_screen])
291 if test "x$enable_song_screen" = "xyes" ; then
292 AC_DEFINE(ENABLE_SONG_SCREEN, 1, [Enable song viewer screen])
295 AM_CONDITIONAL(ENABLE_SONG_SCREEN, test x$enable_song_screen = xyes)
297 dnl Optional screen - key editor
298 AC_MSG_CHECKING([whether to include the key editor screen])
299 AC_ARG_ENABLE([key-screen],
300 AS_HELP_STRING([--enable-key-screen],
301 [Enable key editor screen @<:@default=yes@:>@]),,
302 [enable_key_screen=$disable_mini])
303 AC_MSG_RESULT([$enable_key_screen])
304 if test "x$enable_key_screen" = "xyes" ; then
305 AC_DEFINE(ENABLE_KEYDEF_SCREEN, 1, [Enable key editor screen])
308 AM_CONDITIONAL(ENABLE_KEYDEF_SCREEN, test x$enable_key_screen = xyes)
310 dnl Optional screen - lyrics
311 AC_MSG_CHECKING([whether to include the lyrics screen])
312 AC_ARG_ENABLE([lyrics-screen],
313 AS_HELP_STRING([--enable-lyrics-screen],
314 [Enable lyrics screen @<:@default=no@:>@]),,
315 [enable_lyrics_screen=no])
319 AS_IF([ test "x$enable_lyrics_screen" = xyes ],
320 [AC_MSG_ERROR([Lyrics screen is not yet compatible with windows.])
324 if test "x$enable_lyrics_screen" = "xyes" ; then
325 AC_DEFINE(ENABLE_LYRICS_SCREEN, 1, [Enable lyrics screen])
328 AM_CONDITIONAL(ENABLE_LYRICS_SCREEN, test x$enable_lyrics_screen = xyes)
330 AC_MSG_RESULT([$enable_lyrics_screen])
332 AC_ARG_WITH([lyrics-plugin-dir],
333 AS_HELP_STRING([[--with-lyrics-plugin-dir[=DIRECTORY]]],
334 [Directory where lyrics plugins are stored @<:@default=PREFIX/lib/ncmpc/lyrics@:>@]),
335 [lyrics_plugin_dir=$withval],
336 [lyrics_plugin_dir=""])
337 if test "x${lyrics_plugin_dir}" = "x"; then
338 if test "x${prefix}" = "xNONE"; then
339 lyrics_plugin_dir="${ac_default_prefix}/lib/ncmpc/lyrics"
341 lyrics_plugin_dir="${prefix}/lib/ncmpc/lyrics"
344 AC_DEFINE_UNQUOTED([LYRICS_PLUGIN_DIR], ["$lyrics_plugin_dir"],
345 [Directory to search for lyrics plugins])
346 AC_SUBST(lyrics_plugin_dir)
348 AM_CONDITIONAL(ENABLE_PLUGIN_LIBRARY, test x$enable_lyrics_screen = xyes)
350 dnl Optional screen - outputs
351 AC_MSG_CHECKING([whether to include the outputs screen])
352 AC_ARG_ENABLE([outputs-screen],
353 AS_HELP_STRING([--enable-outputs-screen],
354 [Enable outputs screen @<:@default=yes@:>@]),,
355 [enable_outputs_screen=$disable_mini])
357 if test "x$enable_outputs_screen" = "xyes" ; then
358 AC_DEFINE(ENABLE_OUTPUTS_SCREEN, 1, [Enable outputs screen])
361 AM_CONDITIONAL(ENABLE_OUTPUTS_SCREEN, test x$enable_outputs_screen = xyes)
362 AC_MSG_RESULT([$enable_outputs_screen])
365 dnl Optional screen - client-to-client chat
366 AC_MSG_CHECKING([whether to include the chat screen])
367 AC_ARG_ENABLE([chat-screen],
368 AC_HELP_STRING([--enable-chat-screen],
369 [Enable chat screen @<:@default=no@:>@]),,
370 [enable_chat_screen=no])
371 if test "x$enable_chat_screen" = "xauto"; then
372 enable_chat_screen=yes
374 AC_MSG_RESULT([$enable_chat_screen])
375 if test "x$enable_chat_screen" = "xyes" ; then
376 AC_DEFINE(ENABLE_CHAT_SCREEN, 1, [Enable chat screen])
378 AM_CONDITIONAL(ENABLE_CHAT_SCREEN, test x$enable_chat_screen = xyes)
380 AM_CONDITIONAL(ENABLE_SCREEN_TEXT,
381 test x$enable_lyrics_screen = xyes -o x$enable_chat_screen = xyes)
384 dnl Windows OS Resource File
386 AC_SUBST(VERSION_MAJOR)
387 AC_SUBST(VERSION_MINOR)
388 AC_SUBST(VERSION_REVISION)
389 AC_SUBST(VERSION_EXTRA)
395 AC_ARG_ENABLE(werror,
396 AS_HELP_STRING([--enable-werror],
397 [Treat warnings as errors @<:@default=no@:>@]),,
400 if test "x$enable_werror" = xyes; then
401 AX_APPEND_COMPILE_FLAGS([-Werror])
405 AS_HELP_STRING([--enable-debug],
406 [Enable debugging @<:@default=no@:>@]),,
409 if test "x$enable_debug" = xno; then
410 AM_CFLAGS="$AM_CFLAGS -DNDEBUG"
412 AX_APPEND_COMPILE_FLAGS([-ffunction-sections])
413 AX_APPEND_COMPILE_FLAGS([-fdata-sections])
415 AX_APPEND_LINK_FLAGS([-Wl,--gc-sections])
419 AS_HELP_STRING([--enable-test],
420 [build the test programs @<:@default=no@:>@]),,
421 enable_test=$enable_debug)
423 AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
426 dnl autogenerated documentation
429 AC_ARG_ENABLE(documentation,
430 AS_HELP_STRING([--enable-documentation],
431 [build doxygen documentation @<:@default=no@:>@]),,
432 enable_documentation=no)
434 if test x$enable_documentation = xyes; then
435 AC_PATH_PROG(DOXYGEN, doxygen)
436 if test x$DOXYGEN = x; then
437 AC_MSG_ERROR([doxygen not found])
442 AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
450 AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden])
451 AX_APPEND_COMPILE_FLAGS([-ffast-math])
452 AX_APPEND_COMPILE_FLAGS([-ftree-vectorize])
454 AX_APPEND_COMPILE_FLAGS([-Wall])
455 AX_APPEND_COMPILE_FLAGS([-Wextra])
456 AX_APPEND_COMPILE_FLAGS([-Wno-deprecated-declarations])
457 AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes])
458 AX_APPEND_COMPILE_FLAGS([-Wshadow])
459 AX_APPEND_COMPILE_FLAGS([-Wpointer-arith])
460 AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes])
461 AX_APPEND_COMPILE_FLAGS([-Wcast-qual])
462 AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
466 dnl Generate output files
469 AC_CONFIG_FILES([Makefile po/Makefile.in po/Makefile])
470 AC_OUTPUT(doc/doxygen.conf)