Code

lyrics: converted in-process plugins to external programs
[ncmpc.git] / configure.ac
1 dnl
2 dnl  $Id$
3 dnl
5 AC_INIT
6 AC_CONFIG_SRCDIR([src/main.c])
7 AM_INIT_AUTOMAKE([ncmpc], [0.12~git])
8 AM_CONFIG_HEADER([config.h])
10 dnl Check for programs
11 AC_PROG_CC
12 AC_PROG_INSTALL
13 dnl AC_PROG_LIBTOOL
14 AC_PROG_LIBTOOL
16 dnl =======================================================
17 dnl initialize variables
18 dnl =======================================================
20 dnl i18n
21 ALL_LINGUAS="es da de fr gl no ru sv"
23 set -- $CFLAGS
25 dnl
26 dnl Check for types
27 dnl
29 AC_MSG_RESULT([$ac_have_socklen_t]) 
31 dnl
32 dnl Check for headers
33 dnl
35 AC_CHECK_HEADER([libgen.h],
36                 AC_DEFINE([HAVE_LIBGEN_H], [1], [glibc - libgen.h]),
37                 ,)
39 AC_CHECK_HEADER([locale.h],
40                 AC_DEFINE([HAVE_LOCALE_H], [1], [locale.h]),
41                 ,)
44 dnl
45 dnl Check for functions
46 dnl
47 AC_CHECK_FUNCS([basename strcasestr])
50 dnl
51 dnl Check for libraries
52 dnl
54 dnl Try to find the socket functions
55 AC_CHECK_FUNC([socket],
56               [], 
57               [AC_CHECK_LIB([socket],[socket],[LIBS="$LIBS -lsocket"],
58                             [AC_MSG_ERROR(No UNIX socket API found)])
59               ])
61 dnl Try to find the gethostbyname functions
62 AC_CHECK_FUNC([gethostbyname],
63               [], 
64               [AC_CHECK_LIB([nsl],[gethostbyname],[LIBS="$LIBS -lnsl"],
65                             [AC_MSG_ERROR(No UNIX gethostbyname API found)])
66               ])
69 dnl ncurses
70 ncurses=auto
71 AC_ARG_WITH([ncurses],
72             AC_HELP_STRING([--with-ncurses], [compile/link with ncurses library] ),
73             [ncurses=ncurses])
74 AC_ARG_WITH(ncursesw,
75             AC_HELP_STRING([--with-ncursesw], [compile/link with wide-char ncurses library @<:@default@:>@]),
76             [ncurses=ncursesw])
78 if test "x$ncurses" = "xauto"; then
79         AC_CHECK_LIB([ncursesw], 
80                      [initscr],
81                      [ncurses=ncursesw],
82                      [ncurses=ncurses])
83 fi
85 AC_CHECK_LIB([$ncurses], 
86              [initscr],
87              [LIBS="$LIBS -l$ncurses"], 
88              [AC_MSG_ERROR($ncurses library is required)])
92 dnl Check for glib-2.4
93 PKG_CHECK_MODULES([GLIB], 
94                   [glib-2.0 >= 2.4],
95                   [glib24=yes],
96                   [AC_MSG_WARN([glib-2.4 is required for NLS support!])])
97 if test "x$glib24" != "xyes"; then
98    PKG_CHECK_MODULES([GLIB], 
99                      [glib-2.0 >= 2.2],
100                      [nls=no],
101                      [AC_MSG_ERROR([glib-2.2 is required])])
102 fi
105 dnl i18n
106 AM_NLS
107 if test "x$glib24" = "xyes"; then
108   nls=$USE_NLS
109 else
110   USE_NLS=no
111   AC_SUBST(USE_NLS)
112 fi
114 if test "x$nls" = "xyes"; then
115    AM_GLIB_GNU_GETTEXT
116    GETTEXT_PACKAGE=$PACKAGE
117    AC_SUBST(GETTEXT_PACKAGE)
118    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], 
119                       ["${GETTEXT_PACKAGE}"], 
120                       [gettext domain])
121   nls=$gt_cv_have_gettext
122   if test "x$nls" != "xyes"; then
123      AC_MSG_WARN([NLS support disabled!])
124   fi
125 else
126   AM_PO_SUBDIRS
127 fi
129 dnl check for gthreads
130 PKG_CHECK_MODULES([GTHREAD], 
131                   [gthread-2.0],
132                   [gthread=yes],
133                   [AC_MSG_WARN([gthread-2.0 >= 0.20 is required the lyrics screen])])
134 AC_SUBST(GTHREAD_LIBS)
135 AC_SUBST(GTHREAD_CFLAGS)
136                   
137 #if test "x$gthread-2.0" != "xyes"; then
138 #  PKG_CHECK_MODULES([GTHREAD], 
139 #                    [glib-2.0 >= 2.2],
140 #                    [nls=no],
141 #                    [AC_MSG_ERROR([glib-2.2 is required])])
142 #fi
144 dnl disbale raw mode
145 AC_MSG_CHECKING([Place the terminal into raw mode])
146 AC_ARG_ENABLE([raw-mode],
147         AC_HELP_STRING([--disable-raw-mode],
148                        [Disable raw terminal mode]),
149                        [use_raw=$enableval], 
150                        [use_raw=yes])
151 AC_MSG_RESULT([$use_raw])
152 if test "x$use_raw" = "xyes" ; then
153   AC_DEFINE([ENABLE_RAW_MODE], [1], [Place the terminal into raw mode])
154 fi
156 dnl Debugging 
157 AC_MSG_CHECKING([whether to build with debug support])
158 AC_ARG_ENABLE([debug], 
159               AC_HELP_STRING([--enable-debug],
160                              [Enable debugging @<:@default=no@:>@]),
161               [enable_debug="$enableval"], 
162               [enable_debug=no])
163 AC_MSG_RESULT([$enable_debug])
164 if test "x$enable_debug" = "xyes" ; then
165     CFLAGS="$CFLAGS -g"
166 else
167     CFLAGS="$CFLAGS -DNDEBUG"
168 fi
170 dnl CFLAGS
172 AC_SUBST(AM_CFLAGS)
174 CHECK_CFLAG([-Wall])
175 CHECK_CFLAG([-Wextra])
176 CHECK_CFLAG([-Wno-deprecated-declarations])
177 CHECK_CFLAG([-Wmissing-prototypes])
178 CHECK_CFLAG([-Wdeclaration-after-statement])
179 CHECK_CFLAG([-Wshadow])
180 CHECK_CFLAG([-Wpointer-arith])
181 CHECK_CFLAG([-Wstrict-prototypes])
182 CHECK_CFLAG([-Wcast-qual])
183 CHECK_CFLAG([-Wwrite-strings])
185 dnl Optional screen - help screen
186 #AC_MSG_CHECKING([whether to include the help screen])
187 #AC_ARG_ENABLE([help-screen], 
188 #              AC_HELP_STRING([--enable-help-screen],
189 #                            [Enable the help screen @<:@default=yes@:>@]),
190 #             [help_screen="$enableval"],
191 #             [help_screen=yes])
192 #AC_MSG_RESULT([$help_screen])
193 #if test "x$help_screen" = "xyes" ; then
194 #   AC_DEFINE(ENABLE_HELP_SCREEN, 1, [Enable the help screen])
195 #fi
197 dnl Optional screen - browse screen
198 #AC_MSG_CHECKING([whether to include the browse screen])r
199 #AC_ARG_ENABLE([browse-screen], 
200 #              AC_HELP_STRING([--enable-browse-screen],
201 #                            [Enable the browse screen @<:@default=yes@:>@]),
202 #             [browse_screen="$enableval"],
203 #             [browse_screen=yes])
204 #AC_MSG_RESULT([$browse_screen])
205 #if test "x$browse_screen" = "xyes" ; then
206 #   AC_DEFINE(ENABLE_BROWSE_SCREEN, 1, [Enable the browse screen])
207 #fi
209 dnl Optional - curses getmouse support
210 AC_MSG_CHECKING([whether to include mouse support])
211 AC_ARG_ENABLE([mouse], 
212               AC_HELP_STRING([--enable-mouse],
213                              [Enable curses getmouse support @<:@default=yes@:>@]),
214               [getmouse="$enableval"],
215               [getmouse=yes])
216 AC_MSG_RESULT([$getmouse])
217 if test "x$getmouse" = "xyes" ; then
218    AC_CHECK_LIB([$ncurses], 
219                 [getmouse],
220                 [AC_DEFINE([HAVE_GETMOUSE], [1], [$ncurses - getmouse()])],
221                 [])
222 fi
224 dnl Optional screen - artist
225 AC_MSG_CHECKING([whether to include the artist screen])
226 AC_ARG_ENABLE([artist-screen], 
227               AC_HELP_STRING([--enable-artist-screen],
228                              [Enable artist screen (EXPERIMENTAL) @<:@default=no@:>@]),
229               [artist_screen="$enableval"],
230               [artist_screen=no])
231 AC_MSG_RESULT([$artist_screen])
232 if test "x$artist_screen" != "xyes" ; then
233    AC_DEFINE(DISABLE_ARTIST_SCREEN, 1, [Disable artist screen])
234 fi
236 dnl Optional screen - search
237 AC_MSG_CHECKING([whether to include the search screen])
238 AC_ARG_ENABLE([search-screen], 
239               AC_HELP_STRING([--enable-search-screen],
240                              [Enable search screen (EXPERIMENTAL) @<:@default=yes@:>@]),
241               [search_screen="$enableval"],
242               [search_screen=yes])
243 AC_MSG_RESULT([$search_screen])
244 if test "x$search_screen" != "xyes" ; then
245    AC_DEFINE(DISABLE_SEARCH_SCREEN, 1, [Disable search screen])
246 fi
247   
248 dnl Optional screen - key editor
249 AC_MSG_CHECKING([whether to include the key editor screen])
250 AC_ARG_ENABLE([key-screen], 
251               AC_HELP_STRING([--enable-key-screen],
252                              [Enable key editor screen @<:@default=yes@:>@]),
253               [keydef_screen="$enableval"],
254               [keydef_screen=yes])
255 AC_MSG_RESULT([$keydef_screen])
256 if test "x$keydef_screen" != "xyes" ; then
257    AC_DEFINE(DISABLE_KEYDEF_SCREEN, 1, [Disable key editor screen])
258 fi
260 dnl Optional screen - clock
261 AC_MSG_CHECKING([whether to include the clock screen])
262 AC_ARG_ENABLE([clock-screen], 
263               AC_HELP_STRING([--enable-clock-screen],
264                              [Enable clock screen @<:@default=yes@:>@]),
265               [clock_screen="$enableval"],
266               [clock_screen=yes])
267 AC_MSG_RESULT([$clock_screen])
268 if test "x$clock_screen" != "xyes" ; then
269    AC_DEFINE(DISABLE_CLOCK_SCREEN, 1, [Disable clock screen])
270 fi
272 dnl Optional screen - lyrics
273 AC_MSG_CHECKING([whether to include the lyrics screen]) 
274 AC_ARG_ENABLE([lyrics-screen], 
275               AC_HELP_STRING([--enable-lyrics-screen],
276                              [Enable lyrics screen @<:@default=no@:>@]),
277               [lyrics_screen="$enableval"],
278               [lyrics_screen=yes])      
279 if test "x$lyrics_screen" != "xyes" ; then
280    AC_DEFINE(DISABLE_LYRICS_SCREEN, 1, [Disable lyrics screen])
281    lyrics_screen=no
282 fi
283 #lyrics_screen=yes
284 #if test "x$libcurl" != "xyes" ; then
285 # AC_MSG_RESULT([$lyrics_screen])  
286  # AC_DEFINE(DISABLE_LYRICS_SCREEN, 1, [Disable lyrics screen])
287   # lyrics_screen=no
288 #fi
289 if test "x$gthread" != "xyes" ; then
290    AC_DEFINE(DISABLE_LYRICS_SCREEN, 1, [Disable lyrics screen])
291    lyrics_screen=no
292 fi
293 #if test "x$have_expat" != "xyes" ; then
294 #   AC_DEFINE(DISABLE_LYRICS_SCREEN, 1, [Disable lyrics screen])
295 #   lyrics_screen=no
296 #fi
298 AC_MSG_RESULT([$lyrics_screen])
300 dnl Default host
301 AC_MSG_CHECKING([for default MPD host])
302 AC_ARG_WITH([default-host],
303             AC_HELP_STRING([--with-default-host=ARG],
304                            [Default MPD host @<:@localhost@:>@]),
305             [DEFAULT_HOST="$withval"],
306             [DEFAULT_HOST="localhost"])
307 AC_MSG_RESULT([$DEFAULT_HOST])
308 AC_DEFINE_UNQUOTED([DEFAULT_HOST], ["$DEFAULT_HOST"], [Default MPD host])
310 dnl Default port
311 AC_MSG_CHECKING([for default MPD port])
312 AC_ARG_WITH([default-port],
313             AC_HELP_STRING([--with-default-port=ARG],
314                            [Default port @<:@6600@:>@]),
315             [DEFAULT_PORT="$withval"],
316             [DEFAULT_PORT="6600"])
317 AC_MSG_RESULT([$DEFAULT_PORT])
318 AC_DEFINE_UNQUOTED([DEFAULT_PORT],     [$DEFAULT_PORT],   [Default MPD port])
319 AC_DEFINE_UNQUOTED([DEFAULT_PORT_STR], ["$DEFAULT_PORT"], [Default MPD port])
321 dnl Default timedisplay type
322 AC_MSG_CHECKING([for default timedisplay type])
323 AC_ARG_WITH([default-timedisplay_type],
324             AC_HELP_STRING([--with-default-timedisplay_type=ARG],
325                            [default_timedisplay]),
326             [DEFAULT_TIMEDISPLAY_TYPE="$withval"],
327             [DEFAULT_TIMEDISPLAY_TYPE="elapsed"])
328 AC_MSG_RESULT([$DEFAULT_TIMEDISPLAY_TYPE])
329 AC_DEFINE_UNQUOTED([DEFAULT_TIMEDISPLAY_TYPE], ["$DEFAULT_TIMEDISPLAY_TYPE"], [Default way to display time, either 'elapsed' or 'remaining'])
330 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile po/Makefile])
331 AC_OUTPUT