command: white space cosmetics
[ncmpc.git] / configure.ac
blob84a922996ad82d3a3d3420f2bd281ae4d2967286
1 AC_PREREQ(2.60)
2 AC_INIT(ncmpc, 0.20~git, max@duempel.org)
3 AC_CONFIG_SRCDIR([src/main.c])
4 AC_CONFIG_AUX_DIR(build)
5 AM_INIT_AUTOMAKE([foreign 1.10 dist-bzip2 subdir-objects])
6 AM_CONFIG_HEADER([config.h])
7 AC_CONFIG_MACRO_DIR([m4])
9 dnl Check for programs
10 AC_PROG_CC_C99
11 AC_PROG_INSTALL
13 dnl =======================================================
14 dnl initialize variables
15 dnl =======================================================
17 dnl i18n
18 ALL_LINGUAS=`grep -v '^\#' po/LINGUAS`
20 set -- $CFLAGS
23 dnl
24 dnl ncmpc-mini
25 dnl
27 AC_ARG_ENABLE(mini,
28     AS_HELP_STRING([--enable-mini],
29                 [Build ncmpc-mini, i.e. without all optional features (default: disabled)]),,
30     [enable_mini=no])
32 AM_CONDITIONAL(NCMPC_MINI, test x$enable_mini = xyes)
33 if test "x$enable_mini" = xyes; then
34     AC_DEFINE([NCMPC_MINI], [1], [Build ncmpc-mini, which disables lots of features])
35     auto=no
36     disable_mini=no
37     auto_mini=no
38     ncurses=ncurses
39 else
40     auto=auto
41     disable_mini=yes
42     auto_mini=auto
43     ncurses=auto
47 dnl
48 dnl Check for libraries
49 dnl
51 dnl Try to find the socket functions
52 AC_CHECK_FUNC([socket],
53               [], 
54               [AC_CHECK_LIB([socket],[socket],[LIBS="$LIBS -lsocket"],
55                             [AC_MSG_ERROR(No UNIX socket API found)])
56               ])
58 dnl Try to find the gethostbyname functions
59 AC_CHECK_FUNC([gethostbyname],
60               [], 
61               [AC_CHECK_LIB([nsl],[gethostbyname],[LIBS="$LIBS -lnsl"],
62                             [AC_MSG_ERROR(No UNIX gethostbyname API found)])
63               ])
66 dnl wide character support
67 AC_ARG_ENABLE([wide],
68     AC_HELP_STRING([--enable-wide],
69                 [Enable wide character support]),,
70                    [enable_wide=auto])
73 dnl ncurses
74 AC_ARG_WITH([ncurses],
75             AC_HELP_STRING([--with-ncurses], [compile/link with ncurses library] ),
76             [ncurses=ncurses])
77 AC_ARG_WITH(ncursesw,
78             AC_HELP_STRING([--with-ncursesw], [compile/link with wide-char ncurses library @<:@default@:>@]),
79             [ncurses=ncursesw])
81 if test "x$enable_wide" = "xno"; then
82     if test "x$ncurses" = "xauto"; then
83         dnl select narrow ncurses
84         ncurses=ncurses
85     fi
87     if test "x$ncurses" = "xncursesw"; then
88         AC_MSG_WARN([Narrow ncmpc linking against wide libncurses])
89     fi
92 if test "x$ncurses" = "xauto"; then
93         AC_CHECK_LIB([ncursesw], 
94                      [initscr],
95                      [ncurses=ncursesw],
96                      [ncurses=ncurses])
99 AC_CHECK_LIB([$ncurses], 
100              [initscr],
101              [LIBS="$LIBS -l$ncurses"], 
102              [AC_MSG_ERROR($ncurses library is required)])
104 if test "x$ncurses" = "xncursesw"; then
105     AC_CHECK_HEADER([ncursesw/ncurses.h],
106                     AC_DEFINE([HAVE_NCURSESW_NCURSES_H], [1], [ncursesw/ncurses.h]),
107                     ,)
111 dnl wide character support II
113 if test "x$enable_wide" = "xauto" ; then
114     AC_CHECK_LIB([$ncurses], 
115                  [wget_wch],
116                  [enable_wide=yes],
117                  [enable_wide=no])
120 AC_MSG_CHECKING([wide character support])
121 AC_MSG_RESULT([$enable_wide])
123 if test "x$enable_wide" = "xyes" ; then
124     AC_DEFINE([ENABLE_WIDE], [1], [Enable wide character support])
127 dnl multi-byte character support
129 AC_ARG_ENABLE([multibyte],
130         AC_HELP_STRING([--disable-multibyte],
131                 [Disable multibyte character support (default: enabled)]),,
132                 [enable_multibyte=$disable_mini])
134 if test x$enable_multibyte = xyes; then
135         AC_DEFINE([ENABLE_MULTIBYTE], [1], [Enable multibyte character support])
136 else
137         if test x$enable_wide = xyes; then
138                 AC_MSG_WARN(wide characters without multibyte characters makes little sense)
139         fi
142 dnl Check for glib-2.4
143 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.12],,
144         [AC_MSG_ERROR([glib 2.12 is required])])
146 dnl Check for libmpdclient 2.2
147 PKG_CHECK_MODULES([LIBMPDCLIENT], [libmpdclient >= 2.2],,
148         [AC_MSG_ERROR([libmpdclient2 is required])])
151 dnl i18n
153 AC_ARG_ENABLE([locale],
154         AC_HELP_STRING([--disable-locale],
155                 [Disable locale support (default: auto)]),,
156                 [enable_locale=$auto_mini])
158 if test x$enable_locale = xyes; then
159         AC_CHECK_HEADER([locale.h],,
160                 [AC_MSG_ERROR(locale.h is unavailable)])
163 if test x$enable_locale = xauto; then
164         AC_CHECK_HEADER([locale.h],
165                 [enable_locale=yes],
166                 [enable_locale=no])
169 if test x$enable_locale = xyes; then
170         AC_DEFINE([ENABLE_LOCALE], [1], [Locale support is enabled])
173 if test x$enable_mini != xyes; then
174         AM_NLS
175 else
176         USE_NLS=no
179 if test x$USE_NLS = xyes; then
180    AM_GLIB_GNU_GETTEXT
181    GETTEXT_PACKAGE=$PACKAGE
182    AC_SUBST(GETTEXT_PACKAGE)
183    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], 
184                       ["${GETTEXT_PACKAGE}"], 
185                       [gettext domain])
186         USE_NLS=$gt_cv_have_gettext
187         if test x$USE_NLS != xyes; then
188      AC_MSG_WARN([NLS support disabled!])
189   fi
190 else
191   AM_PO_SUBDIRS
194 dnl enable colors
195 AC_MSG_CHECKING([color support])
196 AC_ARG_ENABLE([colors],
197         AC_HELP_STRING([--enable-colors],
198                 [Enable color support]),,
199         [enable_colors=$disable_mini])
200 AC_MSG_RESULT([$enable_colors])
201 if test "x$enable_colors" = "xyes" ; then
202     AC_DEFINE([ENABLE_COLORS], [1], [Enable color support])
205 dnl test for LIRC support
207 AC_ARG_ENABLE([lirc],
208         AC_HELP_STRING([--enable-lirc],
209                 [Enable LIRC support]),,
210         [enable_lirc=no])
211 if test x$enable_lirc = xyes; then
212         PKG_CHECK_MODULES([LIBLIRCCLIENT], [liblircclient0],,
213                 [AC_MSG_ERROR([liblircclient0 not found])])
214         AC_DEFINE([ENABLE_LIRC], [1], [Enable LIRC support])
217 AM_CONDITIONAL(ENABLE_LIRC, test x$enable_lirc = xyes)
220 dnl Optional screen - help screen
221 AC_MSG_CHECKING([whether to include the help screen])
222 AC_ARG_ENABLE([help-screen],
223         AS_HELP_STRING([--enable-help-screen],
224                 [Enable the help screen @<:@default=yes@:>@]),,
225         [enable_help_screen=$disable_mini])
226 AC_MSG_RESULT([$enable_help_screen])
227 if test "x$enable_help_screen" = "xyes" ; then
228         AC_DEFINE(ENABLE_HELP_SCREEN, 1, [Enable the help screen])
231 AM_CONDITIONAL(ENABLE_HELP_SCREEN, test x$enable_help_screen = xyes)
233 dnl Optional screen - browse screen
234 #AC_MSG_CHECKING([whether to include the browse screen])r
235 #AC_ARG_ENABLE([browse-screen], 
236 #              AC_HELP_STRING([--enable-browse-screen],
237 #               [Enable the browse screen @<:@default=yes@:>@]),,
238 #       [enable_browse_screen=yes])
239 #AC_MSG_RESULT([$enable_browse_screen])
240 #if test "x$enable_browse_screen" = "xyes" ; then
241 #   AC_DEFINE(ENABLE_BROWSE_SCREEN, 1, [Enable the browse screen])
244 dnl Optional - curses getmouse support
245 AC_MSG_CHECKING([whether to include mouse support])
246 AC_ARG_ENABLE([mouse], 
247               AC_HELP_STRING([--enable-mouse],
248                 [Enable curses getmouse support @<:@default=yes@:>@]),,
249         [enable_mouse=$disable_mini])
250 AC_MSG_RESULT([$enable_mouse])
251 if test "x$enable_mouse" = "xyes" ; then
252    AC_CHECK_LIB([$ncurses], 
253                 [getmouse],
254                 [AC_DEFINE([HAVE_GETMOUSE], [1], [$ncurses - getmouse()])],
255                 [])
258 dnl Optional screen - artist
259 AC_MSG_CHECKING([whether to include the artist screen])
260 AC_ARG_ENABLE([artist-screen], 
261               AC_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               AC_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         AC_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)
296   
297 dnl Optional screen - key editor
298 AC_MSG_CHECKING([whether to include the key editor screen])
299 AC_ARG_ENABLE([key-screen], 
300               AC_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               AC_HELP_STRING([--enable-lyrics-screen],
314                 [Enable lyrics screen @<:@default=no@:>@]),,
315         [enable_lyrics_screen=no])
316 if test "x$enable_lyrics_screen" = "xyes" ; then
317     AC_DEFINE(ENABLE_LYRICS_SCREEN, 1, [Enable lyrics screen])
320 AM_CONDITIONAL(ENABLE_LYRICS_SCREEN, test x$enable_lyrics_screen = xyes)
322 AC_MSG_RESULT([$enable_lyrics_screen])
324 AC_ARG_WITH([lyrics-plugin-dir],
325         AC_HELP_STRING([[--with-lyrics-plugin-dir[=DIRECTORY]]],
326                        [Directory where lyrics plugins are stored @<:@default=PREFIX/lib/ncmpc/lyrics@:>@]),
327        [lyrics_plugin_dir=$withval],
328        [lyrics_plugin_dir=""])
329 if test "x${lyrics_plugin_dir}" = "x"; then
330     if test "x${prefix}" = "xNONE"; then
331         lyrics_plugin_dir="${ac_default_prefix}/lib/ncmpc/lyrics"
332     else
333         lyrics_plugin_dir="${prefix}/lib/ncmpc/lyrics"
334     fi
336 AC_DEFINE_UNQUOTED([LYRICS_PLUGIN_DIR], ["$lyrics_plugin_dir"],
337                   [Directory to search for lyrics plugins])
338 AC_SUBST(lyrics_plugin_dir)
340 AM_CONDITIONAL(ENABLE_PLUGIN_LIBRARY, test x$enable_lyrics_screen = xyes)
341 AM_CONDITIONAL(ENABLE_SCREEN_TEXT, test x$enable_lyrics_screen = xyes)
343 dnl Optional screen - outputs
344 AC_MSG_CHECKING([whether to include the outputs screen])
345 AC_ARG_ENABLE([outputs-screen],
346         AC_HELP_STRING([--enable-outputs-screen],
347                 [Enable outputs screen @<:@default=yes@:>@]),,
348         [enable_outputs_screen=$disable_mini])
349 if test "x$enable_outputs_screen" = "xyes" ; then
350         AC_DEFINE(ENABLE_OUTPUTS_SCREEN, 1, [Enable outputs screen])
353 AM_CONDITIONAL(ENABLE_OUTPUTS_SCREEN, test x$enable_outputs_screen = xyes)
357 dnl build options
360 AC_ARG_ENABLE(werror,
361         AS_HELP_STRING([--enable-werror],
362                 [Treat warnings as errors (default: disabled)]),,
363         enable_werror=no)
365 if test "x$enable_werror" = xyes; then
366         AM_CFLAGS="$AM_CFLAGS -Werror"
369 AC_ARG_ENABLE(debug,
370         AS_HELP_STRING([--enable-debug],
371                 [Enable debugging (default: disabled)]),,
372         enable_debug=no)
374 if test "x$enable_debug" = xno; then
375         AM_CFLAGS="$AM_CFLAGS -DNDEBUG"
378 AC_ARG_ENABLE(test,
379         AS_HELP_STRING([--enable-test],
380                 [build the test programs @<:@default=no@:>@]),,
381         enable_test=$enable_debug)
383 AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
387 dnl CFLAGS
390 AC_SUBST(AM_CFLAGS)
392 CHECK_CFLAG([-Wall])
393 CHECK_CFLAG([-Wextra])
394 CHECK_CFLAG([-Wno-deprecated-declarations])
395 CHECK_CFLAG([-Wmissing-prototypes])
396 CHECK_CFLAG([-Wshadow])
397 CHECK_CFLAG([-Wpointer-arith])
398 CHECK_CFLAG([-Wstrict-prototypes])
399 CHECK_CFLAG([-Wcast-qual])
400 CHECK_CFLAG([-Wwrite-strings])
404 dnl Generate output files
407 AC_CONFIG_FILES([Makefile po/Makefile.in po/Makefile])
408 AC_OUTPUT