2 AC_INIT(ncmpc, 0.22~git, 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 '^\#' 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.14],,
103 [AC_MSG_ERROR([glib 2.14 is required])])
105 dnl Check for libmpdclient 2.3
106 PKG_CHECK_MODULES([LIBMPDCLIENT], [libmpdclient >= 2.3],,
107 [AC_MSG_ERROR([libmpdclient2 is required])])
109 dnl Check for libmpdclient 2.5 (the chat screen requires this version)
110 PKG_CHECK_EXISTS([libmpdclient >= 2.5],
111 [have_libmpdclient_2_5=yes], [have_libmpdclient_2_5=no])
115 AC_ARG_ENABLE([locale],
116 AS_HELP_STRING([--disable-locale],
117 [Disable locale support @<:@default=auto@:>@]),,
118 [enable_locale=$auto_mini])
120 if test x$enable_locale = xyes; then
121 AC_CHECK_HEADER([locale.h],,
122 [AC_MSG_ERROR(locale.h is unavailable)])
125 if test x$enable_locale = xauto; then
126 AC_CHECK_HEADER([locale.h],
131 if test x$enable_locale = xyes; then
132 AC_DEFINE([ENABLE_LOCALE], [1], [Locale support is enabled])
135 if test x$enable_mini != xyes; then
141 if test x$USE_NLS = xyes; then
143 GETTEXT_PACKAGE=$PACKAGE
144 AC_SUBST(GETTEXT_PACKAGE)
145 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],
146 ["${GETTEXT_PACKAGE}"],
148 USE_NLS=$gt_cv_have_gettext
149 if test x$USE_NLS != xyes; then
150 AC_MSG_WARN([NLS support disabled!])
157 AC_ARG_ENABLE([colors],
158 AS_HELP_STRING([--enable-colors],
159 [Enable color support]),
160 [enable_colors=$enableval],
161 [enable_colors=auto])
162 AC_MSG_CHECKING([whether to include color support])
163 AS_IF([ test "x$enable_colors" = xyes || test "x$enable_colors" = xauto ],
164 [AS_IF([ test "x$disable_mini" = xyes],
165 [AS_IF([ test "x$ax_cv_curses_color" = xyes ],
166 [AC_MSG_RESULT([yes])
167 AC_DEFINE([ENABLE_COLORS], [1], [Enable color support])],
168 [AS_IF([ test "x$enable_colors" = xyes ],
169 AC_MSG_ERROR(["No color support found in curses library"])
176 AC_MSG_WARN(["Colors disabled due to mini mode being enabled."])]
178 [AC_MSG_RESULT([no])])
180 dnl test for LIRC support
182 AC_ARG_ENABLE([lirc],
183 AS_HELP_STRING([--enable-lirc],
184 [Enable LIRC support]),,
186 if test x$enable_lirc = xyes; then
187 PKG_CHECK_MODULES([LIBLIRCCLIENT], [liblircclient0],,
188 [AC_MSG_ERROR([liblircclient0 not found])])
189 AC_DEFINE([ENABLE_LIRC], [1], [Enable LIRC support])
192 AM_CONDITIONAL(ENABLE_LIRC, test x$enable_lirc = xyes)
195 dnl Optional screen - help screen
196 AC_MSG_CHECKING([whether to include the help screen])
197 AC_ARG_ENABLE([help-screen],
198 AS_HELP_STRING([--enable-help-screen],
199 [Enable the help screen @<:@default=yes@:>@]),,
200 [enable_help_screen=$disable_mini])
201 AC_MSG_RESULT([$enable_help_screen])
202 if test "x$enable_help_screen" = "xyes" ; then
203 AC_DEFINE(ENABLE_HELP_SCREEN, 1, [Enable the help screen])
206 AM_CONDITIONAL(ENABLE_HELP_SCREEN, test x$enable_help_screen = xyes)
208 dnl Optional - curses getmouse support
210 dnl AC_CHECK_LIB depends on being able to prepend a '-l', remove the '-l' from CURSES_LIB first
211 AC_CHECK_LIB([$(expr substr $CURSES_LIB 3 99)],
213 [ax_cv_curses_mouse=yes],
214 [ax_cv_curses_mouse=no])
216 AC_ARG_ENABLE([mouse],
217 AS_HELP_STRING([--enable-mouse],
218 [Enable curses getmouse support @<:@default=yes@:>@]),
219 [enable_mouse=$enableval],
222 AC_MSG_CHECKING([whether to include mouse support])
224 AS_IF([ test "x$enable_mouse" = xyes || test "x$enable_mouse" = xauto ],
225 [AS_IF([ test "x$disable_mini" = xyes],
226 [AS_IF([ test "x$ax_cv_curses_mouse" = xyes ],
227 [AC_MSG_RESULT([yes])
228 AC_DEFINE([HAVE_GETMOUSE], [1], [Enable mouse support])],
230 AS_IF([ test "x$enable_mouse" = xyes ],
231 [AC_MSG_ERROR(["No mouse support found in curses library"])
236 AC_MSG_WARN("Mouse disabled due to mini mode being enabled.")]
238 [AC_MSG_RESULT([no])])
240 dnl Optional screen - artist
241 AC_MSG_CHECKING([whether to include the artist screen])
242 AC_ARG_ENABLE([artist-screen],
243 AS_HELP_STRING([--enable-artist-screen],
244 [Enable artist screen @<:@default=yes@:>@]),,
245 [enable_artist_screen=$disable_mini])
246 AC_MSG_RESULT([$enable_artist_screen])
247 if test "x$enable_artist_screen" = "xyes" ; then
248 AC_DEFINE(ENABLE_ARTIST_SCREEN, 1, [Enable artist screen])
251 AM_CONDITIONAL(ENABLE_ARTIST_SCREEN, test x$enable_artist_screen = xyes)
253 dnl Optional screen - search
254 AC_MSG_CHECKING([whether to include the search screen])
255 AC_ARG_ENABLE([search-screen],
256 AS_HELP_STRING([--enable-search-screen],
257 [Enable search screen (EXPERIMENTAL) @<:@default=yes@:>@]),,
258 [enable_search_screen=$disable_mini])
259 AC_MSG_RESULT([$enable_search_screen])
260 if test "x$enable_search_screen" = "xyes" ; then
261 AC_DEFINE(ENABLE_SEARCH_SCREEN, 1, [Enable search screen])
264 AM_CONDITIONAL(ENABLE_SEARCH_SCREEN, test x$enable_search_screen = xyes)
266 dnl Optional screen - song viewer
267 AC_MSG_CHECKING([whether to include the song viewer screen])
268 AC_ARG_ENABLE([song-screen],
269 AS_HELP_STRING([--enable-song-screen],
270 [Enable song viewer screen @<:@default=yes@:>@]),,
271 [enable_song_screen=$disable_mini])
272 AC_MSG_RESULT([$enable_song_screen])
273 if test "x$enable_song_screen" = "xyes" ; then
274 AC_DEFINE(ENABLE_SONG_SCREEN, 1, [Enable song viewer screen])
277 AM_CONDITIONAL(ENABLE_SONG_SCREEN, test x$enable_song_screen = xyes)
279 dnl Optional screen - key editor
280 AC_MSG_CHECKING([whether to include the key editor screen])
281 AC_ARG_ENABLE([key-screen],
282 AS_HELP_STRING([--enable-key-screen],
283 [Enable key editor screen @<:@default=yes@:>@]),,
284 [enable_key_screen=$disable_mini])
285 AC_MSG_RESULT([$enable_key_screen])
286 if test "x$enable_key_screen" = "xyes" ; then
287 AC_DEFINE(ENABLE_KEYDEF_SCREEN, 1, [Enable key editor screen])
290 AM_CONDITIONAL(ENABLE_KEYDEF_SCREEN, test x$enable_key_screen = xyes)
292 dnl Optional screen - lyrics
293 AC_MSG_CHECKING([whether to include the lyrics screen])
294 AC_ARG_ENABLE([lyrics-screen],
295 AS_HELP_STRING([--enable-lyrics-screen],
296 [Enable lyrics screen @<:@default=no@:>@]),
297 [enable_lyrics_screen=$enableval],
298 [enable_lyrics_screen=no])
302 AS_IF([ test "x$enable_lyrics_screen" = xyes ],
303 [AC_MSG_ERROR([Lyrics screen is not yet compatible with windows.])
307 if test "x$enable_lyrics_screen" = "xyes" ; then
308 AC_DEFINE(ENABLE_LYRICS_SCREEN, 1, [Enable lyrics screen])
311 AM_CONDITIONAL(ENABLE_LYRICS_SCREEN, test x$enable_lyrics_screen = xyes)
313 AC_MSG_RESULT([$enable_lyrics_screen])
315 AC_ARG_WITH([lyrics-plugin-dir],
316 AS_HELP_STRING([[--with-lyrics-plugin-dir[=DIRECTORY]]],
317 [Directory where lyrics plugins are stored @<:@default=PREFIX/lib/ncmpc/lyrics@:>@]),
318 [lyrics_plugin_dir=$withval],
319 [lyrics_plugin_dir=""])
320 if test "x${lyrics_plugin_dir}" = "x"; then
321 if test "x${prefix}" = "xNONE"; then
322 lyrics_plugin_dir="${ac_default_prefix}/lib/ncmpc/lyrics"
324 lyrics_plugin_dir="${prefix}/lib/ncmpc/lyrics"
327 AC_DEFINE_UNQUOTED([LYRICS_PLUGIN_DIR], ["$lyrics_plugin_dir"],
328 [Directory to search for lyrics plugins])
329 AC_SUBST(lyrics_plugin_dir)
331 AM_CONDITIONAL(ENABLE_PLUGIN_LIBRARY, test x$enable_lyrics_screen = xyes)
333 dnl Optional screen - outputs
334 AC_MSG_CHECKING([whether to include the outputs screen])
335 AC_ARG_ENABLE([outputs-screen],
336 AS_HELP_STRING([--enable-outputs-screen],
337 [Enable outputs screen @<:@default=yes@:>@]),,
338 [enable_outputs_screen=$disable_mini])
340 if test "x$enable_outputs_screen" = "xyes" ; then
341 AC_DEFINE(ENABLE_OUTPUTS_SCREEN, 1, [Enable outputs screen])
344 AM_CONDITIONAL(ENABLE_OUTPUTS_SCREEN, test x$enable_outputs_screen = xyes)
345 AC_MSG_RESULT([$enable_outputs_screen])
348 dnl Optional screen - client-to-client chat
349 AC_MSG_CHECKING([whether to include the chat screen])
350 AC_ARG_ENABLE([chat-screen],
351 AC_HELP_STRING([--enable-chat-screen],
352 [Enable chat screen @<:@default=no@:>@]),,
353 [enable_chat_screen=no])
354 if test "x$enable_chat_screen" = "xauto"; then
355 enable_chat_screen=$have_libmpdclient_2_5
357 AC_MSG_RESULT([$enable_chat_screen])
358 if test "x$enable_chat_screen" = "xyes" ; then
359 if test "x$have_libmpdclient_2_5" = "xno"; then
360 AC_MSG_ERROR(The chat screen requires at least libmpclient 2.5)
362 AC_DEFINE(ENABLE_CHAT_SCREEN, 1, [Enable chat screen])
364 AM_CONDITIONAL(ENABLE_CHAT_SCREEN, test x$enable_chat_screen = xyes)
366 AM_CONDITIONAL(ENABLE_SCREEN_TEXT,
367 test x$enable_lyrics_screen = xyes -o x$enable_chat_screen = xyes)
370 dnl Windows OS Resource File
372 AC_SUBST(VERSION_MAJOR)
373 AC_SUBST(VERSION_MINOR)
374 AC_SUBST(VERSION_REVISION)
375 AC_SUBST(VERSION_EXTRA)
381 AC_ARG_ENABLE(werror,
382 AS_HELP_STRING([--enable-werror],
383 [Treat warnings as errors @<:@default=no@:>@]),,
386 if test "x$enable_werror" = xyes; then
387 AX_APPEND_COMPILE_FLAGS([-Werror])
391 AS_HELP_STRING([--enable-debug],
392 [Enable debugging @<:@default=no@:>@]),,
395 if test "x$enable_debug" = xno; then
396 AM_CFLAGS="$AM_CFLAGS -DNDEBUG"
398 AX_APPEND_COMPILE_FLAGS([-ffunction-sections])
399 AX_APPEND_COMPILE_FLAGS([-fdata-sections])
401 AX_APPEND_LINK_FLAGS([-Wl,--gc-sections])
405 AS_HELP_STRING([--enable-test],
406 [build the test programs @<:@default=no@:>@]),,
407 enable_test=$enable_debug)
409 AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
412 dnl autogenerated documentation
415 AC_ARG_ENABLE(documentation,
416 AS_HELP_STRING([--enable-documentation],
417 [build doxygen documentation @<:@default=no@:>@]),,
418 enable_documentation=no)
420 if test x$enable_documentation = xyes; then
421 AC_PATH_PROG(DOXYGEN, doxygen)
422 if test x$DOXYGEN = x; then
423 AC_MSG_ERROR([doxygen not found])
428 AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
436 AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden])
437 AX_APPEND_COMPILE_FLAGS([-ffast-math])
438 AX_APPEND_COMPILE_FLAGS([-ftree-vectorize])
440 AX_APPEND_COMPILE_FLAGS([-Wall])
441 AX_APPEND_COMPILE_FLAGS([-Wextra])
442 AX_APPEND_COMPILE_FLAGS([-Wno-deprecated-declarations])
443 AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes])
444 AX_APPEND_COMPILE_FLAGS([-Wshadow])
445 AX_APPEND_COMPILE_FLAGS([-Wpointer-arith])
446 AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes])
447 AX_APPEND_COMPILE_FLAGS([-Wcast-qual])
448 AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
452 dnl Generate output files
455 AC_CONFIG_FILES([Makefile po/Makefile.in po/Makefile])
456 AC_OUTPUT(doc/doxygen.conf)