fff8b5112db6243d315a57f7c1ea9b6d58718b87
1 AC_PREREQ(2.60)
2 AC_INIT(ncmpc, 0.21~git, max@duempel.org)
4 VERSION_MAJOR=0
5 VERSION_MINOR=21
6 VERSION_REVISION=0
7 VERSION_EXTRA=0
9 AC_CONFIG_SRCDIR([src/main.c])
10 AC_CONFIG_AUX_DIR(build)
11 AM_INIT_AUTOMAKE([foreign 1.10 dist-bzip2 subdir-objects])
12 AC_CONFIG_HEADERS([config.h])
13 AC_CONFIG_MACRO_DIR([m4])
15 dnl Check for programs
16 AC_PROG_CC_C99
17 AC_PROG_INSTALL
18 AX_WITH_CURSES
20 AS_IF([ test "x$ax_cv_curses" = xno ],
21 [AC_MSG_ERROR([No curses support detected.])
22 ])
24 dnl =======================================================
25 dnl initialize variables
26 dnl =======================================================
28 dnl i18n
29 ALL_LINGUAS=`grep -v '^\#' po/LINGUAS`
31 set -- $CFLAGS
34 dnl
35 dnl ncmpc-mini
36 dnl
38 AC_ARG_ENABLE(mini,
39 AS_HELP_STRING([--enable-mini],
40 [Build ncmpc-mini, i.e. without all optional features @<:@default=no@:>@]),,
41 [enable_mini=no])
43 AM_CONDITIONAL(NCMPC_MINI, test x$enable_mini = xyes)
44 if test "x$enable_mini" = xyes; then
45 AC_DEFINE([NCMPC_MINI], [1], [Build ncmpc-mini, which disables lots of features])
46 auto=no
47 disable_mini=no
48 auto_mini=no
49 else
50 auto=auto
51 disable_mini=yes
52 auto_mini=auto
53 fi
55 AC_CANONICAL_HOST
57 case "$host_os" in
58 mingw32* | windows*)
59 LIBS="$LIBS -lws2_32"
61 AC_CONFIG_FILES([
62 src/win/ncmpc_win32_rc.rc
63 ])
64 AC_CHECK_TOOL(WINDRES, windres)
65 HAVE_WINDOWS=1
66 ;;
67 *)
68 AC_CHECK_FUNC([socket],
69 [],
70 [AC_CHECK_LIB([socket],[socket],[LIBS="$LIBS -lsocket"],
71 [AC_MSG_ERROR(No UNIX socket API found)])
72 ])
74 AC_CHECK_FUNC([gethostbyname],
75 [],
76 [AC_CHECK_LIB([nsl],[gethostbyname],[LIBS="$LIBS -lnsl"],
77 [AC_MSG_ERROR(No UNIX gethostbyname API found)])
78 ])
79 esac
80 AM_CONDITIONAL([HAVE_WINDOWS], [test $HAVE_WINDOWS -eq 1])
82 dnl multi-byte character support
84 AC_ARG_ENABLE([multibyte],
85 AS_HELP_STRING([--disable-multibyte],
86 [Disable multibyte character support @<:@default=yes@:>@]),,
87 [enable_multibyte=$disable_mini])
89 if test x$enable_multibyte = xyes; then
90 AC_DEFINE([ENABLE_MULTIBYTE], [1], [Enable multibyte character support])
91 else
92 if test "x$ax_cv_curses_enhanced" = xyes; then
93 AC_MSG_WARN(wide characters without multibyte characters makes little sense)
94 fi
95 fi
97 dnl Check for glib-2.12
98 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12],,
99 [AC_MSG_ERROR([glib 2.12 is required])])
101 dnl Check for libmpdclient 2.2
102 PKG_CHECK_MODULES([LIBMPDCLIENT], [libmpdclient >= 2.2],,
103 [AC_MSG_ERROR([libmpdclient2 is required])])
105 dnl Check for libmpdclient 2.5 (the chat screen requires this version)
106 PKG_CHECK_EXISTS([libmpdclient >= 2.5],
107 [have_libmpdclient_2_5=yes], [have_libmpdclient_2_5=no])
109 dnl i18n
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)])
119 fi
121 if test x$enable_locale = xauto; then
122 AC_CHECK_HEADER([locale.h],
123 [enable_locale=yes],
124 [enable_locale=no])
125 fi
127 if test x$enable_locale = xyes; then
128 AC_DEFINE([ENABLE_LOCALE], [1], [Locale support is enabled])
129 fi
131 if test x$enable_mini != xyes; then
132 AM_NLS
133 else
134 USE_NLS=no
135 fi
137 if test x$USE_NLS = xyes; then
138 AM_GLIB_GNU_GETTEXT
139 GETTEXT_PACKAGE=$PACKAGE
140 AC_SUBST(GETTEXT_PACKAGE)
141 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],
142 ["${GETTEXT_PACKAGE}"],
143 [gettext domain])
144 USE_NLS=$gt_cv_have_gettext
145 if test x$USE_NLS != xyes; then
146 AC_MSG_WARN([NLS support disabled!])
147 fi
148 else
149 AM_PO_SUBDIRS
150 fi
152 dnl enable colors
153 AC_ARG_ENABLE([colors],
154 AS_HELP_STRING([--enable-colors],
155 [Enable color support]),
156 [enable_colors=$enableval],
157 [enable_colors=auto])
158 AC_MSG_CHECKING([whether to include color support])
159 AS_IF([ test "x$enable_colors" = xyes || test "x$enable_colors" = xauto ],
160 [AS_IF([ test "x$disable_mini" = xyes],
161 [AS_IF([ test "x$ax_cv_curses_color" = xyes ],
162 [AC_MSG_RESULT([yes])
163 AC_DEFINE([ENABLE_COLORS], [1], [Enable color support])],
164 [AS_IF([ test "x$enable_colors" = xyes ],
165 AC_MSG_ERROR(["No color support found in curses library"])
166 AC_MSG_RESULT([no]),
167 AC_MSG_RESULT([no])
168 )
169 ])
170 ],
171 [AC_MSG_RESULT([no])
172 AC_MSG_WARN(["Colors disabled due to mini mode being enabled."])]
173 )],
174 [AC_MSG_RESULT([no])])
176 dnl test for LIRC support
178 AC_ARG_ENABLE([lirc],
179 AS_HELP_STRING([--enable-lirc],
180 [Enable LIRC support]),,
181 [enable_lirc=no])
182 if test x$enable_lirc = xyes; then
183 PKG_CHECK_MODULES([LIBLIRCCLIENT], [liblircclient0],,
184 [AC_MSG_ERROR([liblircclient0 not found])])
185 AC_DEFINE([ENABLE_LIRC], [1], [Enable LIRC support])
186 fi
188 AM_CONDITIONAL(ENABLE_LIRC, test x$enable_lirc = xyes)
191 dnl Optional screen - help screen
192 AC_MSG_CHECKING([whether to include the help screen])
193 AC_ARG_ENABLE([help-screen],
194 AS_HELP_STRING([--enable-help-screen],
195 [Enable the help screen @<:@default=yes@:>@]),,
196 [enable_help_screen=$disable_mini])
197 AC_MSG_RESULT([$enable_help_screen])
198 if test "x$enable_help_screen" = "xyes" ; then
199 AC_DEFINE(ENABLE_HELP_SCREEN, 1, [Enable the help screen])
200 fi
202 AM_CONDITIONAL(ENABLE_HELP_SCREEN, test x$enable_help_screen = xyes)
204 dnl Optional - curses getmouse support
206 dnl AC_CHECK_LIB depends on being able to prepend a '-l', remove the '-l' from CURSES_LIB first
207 AC_CHECK_LIB([$(expr substr $CURSES_LIB 3 99)],
208 [getmouse],
209 [ax_cv_curses_mouse=yes],
210 [ax_cv_curses_mouse=no])
212 AC_ARG_ENABLE([mouse],
213 AS_HELP_STRING([--enable-mouse],
214 [Enable curses getmouse support @<:@default=yes@:>@]),
215 [enable_mouse=$enableval],
216 [enable_mouse=auto])
218 AC_MSG_CHECKING([whether to include mouse support])
220 AS_IF([ test "x$enable_mouse" = xyes || test "x$enable_mouse" = xauto ],
221 [AS_IF([ test "x$disable_mini" = xyes],
222 [AS_IF([ test "x$ax_cv_curses_mouse" = xyes ],
223 [AC_MSG_RESULT([yes])
224 AC_DEFINE([HAVE_GETMOUSE], [1], [Enable mouse support])],
225 [AC_MSG_RESULT([no])
226 AS_IF([ test "x$enable_mouse" = xyes ],
227 [AC_MSG_ERROR(["No mouse support found in curses library"])
228 ])
229 ])
230 ],
231 [AC_MSG_RESULT([no])
232 AC_MSG_WARN("Mouse disabled due to mini mode being enabled.")]
233 )],
234 [AC_MSG_RESULT([no])])
236 dnl Optional screen - artist
237 AC_MSG_CHECKING([whether to include the artist screen])
238 AC_ARG_ENABLE([artist-screen],
239 AS_HELP_STRING([--enable-artist-screen],
240 [Enable artist screen @<:@default=yes@:>@]),,
241 [enable_artist_screen=$disable_mini])
242 AC_MSG_RESULT([$enable_artist_screen])
243 if test "x$enable_artist_screen" = "xyes" ; then
244 AC_DEFINE(ENABLE_ARTIST_SCREEN, 1, [Enable artist screen])
245 fi
247 AM_CONDITIONAL(ENABLE_ARTIST_SCREEN, test x$enable_artist_screen = xyes)
249 dnl Optional screen - search
250 AC_MSG_CHECKING([whether to include the search screen])
251 AC_ARG_ENABLE([search-screen],
252 AS_HELP_STRING([--enable-search-screen],
253 [Enable search screen (EXPERIMENTAL) @<:@default=yes@:>@]),,
254 [enable_search_screen=$disable_mini])
255 AC_MSG_RESULT([$enable_search_screen])
256 if test "x$enable_search_screen" = "xyes" ; then
257 AC_DEFINE(ENABLE_SEARCH_SCREEN, 1, [Enable search screen])
258 fi
260 AM_CONDITIONAL(ENABLE_SEARCH_SCREEN, test x$enable_search_screen = xyes)
262 dnl Optional screen - song viewer
263 AC_MSG_CHECKING([whether to include the song viewer screen])
264 AC_ARG_ENABLE([song-screen],
265 AS_HELP_STRING([--enable-song-screen],
266 [Enable song viewer screen @<:@default=yes@:>@]),,
267 [enable_song_screen=$disable_mini])
268 AC_MSG_RESULT([$enable_song_screen])
269 if test "x$enable_song_screen" = "xyes" ; then
270 AC_DEFINE(ENABLE_SONG_SCREEN, 1, [Enable song viewer screen])
271 fi
273 AM_CONDITIONAL(ENABLE_SONG_SCREEN, test x$enable_song_screen = xyes)
275 dnl Optional screen - key editor
276 AC_MSG_CHECKING([whether to include the key editor screen])
277 AC_ARG_ENABLE([key-screen],
278 AS_HELP_STRING([--enable-key-screen],
279 [Enable key editor screen @<:@default=yes@:>@]),,
280 [enable_key_screen=$disable_mini])
281 AC_MSG_RESULT([$enable_key_screen])
282 if test "x$enable_key_screen" = "xyes" ; then
283 AC_DEFINE(ENABLE_KEYDEF_SCREEN, 1, [Enable key editor screen])
284 fi
286 AM_CONDITIONAL(ENABLE_KEYDEF_SCREEN, test x$enable_key_screen = xyes)
288 dnl Optional screen - lyrics
289 AC_MSG_CHECKING([whether to include the lyrics screen])
290 AC_ARG_ENABLE([lyrics-screen],
291 AS_HELP_STRING([--enable-lyrics-screen],
292 [Enable lyrics screen @<:@default=no@:>@]),
293 [enable_lyrics_screen=$enableval],
294 [enable_lyrics_screen=no])
296 case "$host_os" in
297 mingw32* | windows*)
298 AS_IF([ test "x$enable_lyrics_screen" = xyes ],
299 [AC_MSG_ERROR([Lyrics screen is not yet compatible with windows.])
300 ])
301 esac
303 if test "x$enable_lyrics_screen" = "xyes" ; then
304 AC_DEFINE(ENABLE_LYRICS_SCREEN, 1, [Enable lyrics screen])
305 fi
307 AM_CONDITIONAL(ENABLE_LYRICS_SCREEN, test x$enable_lyrics_screen = xyes)
309 AC_MSG_RESULT([$enable_lyrics_screen])
311 AC_ARG_WITH([lyrics-plugin-dir],
312 AS_HELP_STRING([[--with-lyrics-plugin-dir[=DIRECTORY]]],
313 [Directory where lyrics plugins are stored @<:@default=PREFIX/lib/ncmpc/lyrics@:>@]),
314 [lyrics_plugin_dir=$withval],
315 [lyrics_plugin_dir=""])
316 if test "x${lyrics_plugin_dir}" = "x"; then
317 if test "x${prefix}" = "xNONE"; then
318 lyrics_plugin_dir="${ac_default_prefix}/lib/ncmpc/lyrics"
319 else
320 lyrics_plugin_dir="${prefix}/lib/ncmpc/lyrics"
321 fi
322 fi
323 AC_DEFINE_UNQUOTED([LYRICS_PLUGIN_DIR], ["$lyrics_plugin_dir"],
324 [Directory to search for lyrics plugins])
325 AC_SUBST(lyrics_plugin_dir)
327 AM_CONDITIONAL(ENABLE_PLUGIN_LIBRARY, test x$enable_lyrics_screen = xyes)
328 AM_CONDITIONAL(ENABLE_SCREEN_TEXT, test x$enable_lyrics_screen = xyes)
330 dnl Optional screen - outputs
331 AC_MSG_CHECKING([whether to include the outputs screen])
332 AC_ARG_ENABLE([outputs-screen],
333 AS_HELP_STRING([--enable-outputs-screen],
334 [Enable outputs screen @<:@default=yes@:>@]),,
335 [enable_outputs_screen=$disable_mini])
337 if test "x$enable_outputs_screen" = "xyes" ; then
338 AC_DEFINE(ENABLE_OUTPUTS_SCREEN, 1, [Enable outputs screen])
339 fi
341 AM_CONDITIONAL(ENABLE_OUTPUTS_SCREEN, test x$enable_outputs_screen = xyes)
342 AC_MSG_RESULT([$enable_outputs_screen])
345 dnl Optional screen - client-to-client chat
346 AC_MSG_CHECKING([whether to include the chat screen])
347 AC_ARG_ENABLE([chat-screen],
348 AC_HELP_STRING([--enable-chat-screen],
349 [Enable chat screen @<:@default=no@:>@]),,
350 [enable_chat_screen=no])
351 if test "x$enable_chat_screen" = "xauto"; then
352 enable_chat_screen=$have_libmpdclient_2_5
353 fi
354 AC_MSG_RESULT([$enable_chat_screen])
355 if test "x$enable_chat_screen" = "xyes" ; then
356 if test "x$have_libmpdclient_2_5" = "xno"; then
357 AC_MSG_ERROR(The chat screen requires at least libmpclient 2.5)
358 fi
359 AC_DEFINE(ENABLE_CHAT_SCREEN, 1, [Enable chat screen])
360 fi
361 AM_CONDITIONAL(ENABLE_CHAT_SCREEN, test x$enable_chat_screen = xyes)
364 dnl
365 dnl Windows OS Resource File
366 dnl
367 AC_SUBST(VERSION_MAJOR)
368 AC_SUBST(VERSION_MINOR)
369 AC_SUBST(VERSION_REVISION)
370 AC_SUBST(VERSION_EXTRA)
372 dnl
373 dnl build options
374 dnl
376 AC_ARG_ENABLE(werror,
377 AS_HELP_STRING([--enable-werror],
378 [Treat warnings as errors @<:@default=no@:>@]),,
379 enable_werror=no)
381 if test "x$enable_werror" = xyes; then
382 AX_APPEND_COMPILE_FLAGS([-Werror])
383 fi
385 AC_ARG_ENABLE(debug,
386 AS_HELP_STRING([--enable-debug],
387 [Enable debugging @<:@default=no@:>@]),,
388 enable_debug=no)
390 if test "x$enable_debug" = xno; then
391 AM_CFLAGS="$AM_CFLAGS -DNDEBUG"
392 fi
394 AC_ARG_ENABLE(test,
395 AS_HELP_STRING([--enable-test],
396 [build the test programs @<:@default=no@:>@]),,
397 enable_test=$enable_debug)
399 AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
401 dnl
402 dnl autogenerated documentation
403 dnl
405 AC_ARG_ENABLE(documentation,
406 AS_HELP_STRING([--enable-documentation],
407 [build doxygen documentation @<:@default=no@:>@]),,
408 enable_documentation=no)
410 if test x$enable_documentation = xyes; then
411 AC_PATH_PROG(DOXYGEN, doxygen)
412 if test x$DOXYGEN = x; then
413 AC_MSG_ERROR([doxygen not found])
414 fi
415 AC_SUBST(DOXYGEN)
416 fi
418 AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
420 dnl
421 dnl CFLAGS
422 dnl
424 AC_SUBST(AM_CFLAGS)
426 AX_APPEND_COMPILE_FLAGS([-Wall])
427 AX_APPEND_COMPILE_FLAGS([-Wextra])
428 AX_APPEND_COMPILE_FLAGS([-Wno-deprecated-declarations])
429 AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes])
430 AX_APPEND_COMPILE_FLAGS([-Wshadow])
431 AX_APPEND_COMPILE_FLAGS([-Wpointer-arith])
432 AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes])
433 AX_APPEND_COMPILE_FLAGS([-Wcast-qual])
434 AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
437 dnl
438 dnl Generate output files
439 dnl
441 AC_CONFIG_FILES([Makefile po/Makefile.in po/Makefile])
442 AC_OUTPUT(doc/doxygen.conf)