Code

the updated sources
[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.11.2-svn])
8 AM_CONFIG_HEADER([config.h])
10 dnl Check for programs
11 AC_PROG_CC
12 AC_PROG_INSTALL
13 dnl AC_PROG_LIBTOOL
15 dnl =======================================================
16 dnl initialize variables
17 dnl =======================================================
19 dnl i18n
20 ALL_LINGUAS="es da de fr gl no ru sv"
22 set -- $CFLAGS
24 dnl
25 dnl Check for types
26 dnl
28 AC_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
84                      
86 AC_CHECK_LIB([$ncurses], 
87              [initscr],
88              [LIBS="$LIBS -l$ncurses"], 
89              [AC_MSG_ERROR($ncurses library is required)])
92 if test "x$ncurses" = "xncursesw" ; then
93    AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [wide-char wget_ch()])
94    AC_DEFINE(USE_NCURSESW, 1, [use wide-char ncurses library])
95 fi
98 dnl Check for glib-2.4
99 PKG_CHECK_MODULES([GLIB], 
100                   [glib-2.0 >= 2.4],
101                   [glib24=yes],
102                   [AC_MSG_WARN([glib-2.4 is required for NLS support!])])
103 if test "x$glib24" != "xyes"; then
104    PKG_CHECK_MODULES([GLIB], 
105                      [glib-2.0 >= 2.2],
106                      [nls=no],
107                      [AC_MSG_ERROR([glib-2.2 is required])])
108 fi
111 dnl i18n
112 AM_NLS
113 if test "x$glib24" = "xyes"; then
114   nls=$USE_NLS
115 else
116   USE_NLS=no
117   AC_SUBST(USE_NLS)
118 fi
120 if test "x$nls" = "xyes"; then
121    AM_GLIB_GNU_GETTEXT
122    GETTEXT_PACKAGE=$PACKAGE
123    AC_SUBST(GETTEXT_PACKAGE)
124    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], 
125                       ["${GETTEXT_PACKAGE}"], 
126                       [gettext domain])
127   nls=$gt_cv_have_gettext
128   if test "x$nls" != "xyes"; then
129      AC_MSG_WARN([NLS support disabled!])
130   fi
131 else
132   AM_PO_SUBDIRS
133 fi
135 dnl check for gthreads
136 PKG_CHECK_MODULES([GTHREAD], 
137                   [gthread-2.0],
138                   [gthread=yes],
139                   [AC_MSG_WARN([gthread-2.0 >= 0.20 is required the lyrics screen])])
140                   
141 dnl check for libcurl
142 PKG_CHECK_MODULES([libcurl], 
143                   [libcurl],
144                   [libcurl=yes],
145                   [AC_MSG_WARN([libcurl is required for the lyrics screen])])
146                   
147 dnl check for expat
148 expat=expat
149 AC_CHECK_LIB([$expat], 
150              [XML_ParserCreate],
151              [have_expat=yes], 
152              [AC_MSG_WARN($expat library is required for lyrics screen)])
153 if test "x$have_expat" = "xyes"; then
154 LIBS="$LIBS -l$expat"
155 fi
156                   
157 #if test "x$gthread-2.0" != "xyes"; then
158 #  PKG_CHECK_MODULES([GTHREAD], 
159 #                    [glib-2.0 >= 2.2],
160 #                    [nls=no],
161 #                    [AC_MSG_ERROR([glib-2.2 is required])])
162 #fi
164 dnl disbale raw mode
165 AC_MSG_CHECKING([Place the terminal into raw mode])
166 AC_ARG_ENABLE([raw-mode],
167         AC_HELP_STRING([--disable-raw-mode],
168                        [Disable raw terminal mode]),
169                        [use_raw=$enableval], 
170                        [use_raw=yes])
171 AC_MSG_RESULT([$use_raw])
172 if test "x$use_raw" = "xyes" ; then
173   AC_DEFINE([ENABLE_RAW_MODE], [1], [Place the terminal into raw mode])
174 fi
176 dnl Debugging 
177 AC_MSG_CHECKING([whether to build with debug support])
178 AC_ARG_ENABLE([debug], 
179               AC_HELP_STRING([--enable-debug],
180                              [Enable debugging @<:@default=no@:>@]),
181               [enable_debug="$enableval"], 
182               [enable_debug=no])
183 AC_MSG_RESULT([$enable_debug])
184 if test "x$enable_debug" = "xyes" ; then
185    CFLAGS="$CFLAGS -Wall -g -DDEBUG"
186 fi
188 dnl Optional screen - help screen
189 #AC_MSG_CHECKING([whether to include the help screen])
190 #AC_ARG_ENABLE([help-screen], 
191 #              AC_HELP_STRING([--enable-help-screen],
192 #                            [Enable the help screen @<:@default=yes@:>@]),
193 #             [help_screen="$enableval"],
194 #             [help_screen=yes])
195 #AC_MSG_RESULT([$help_screen])
196 #if test "x$help_screen" = "xyes" ; then
197 #   AC_DEFINE(ENABLE_HELP_SCREEN, 1, [Enable the help screen])
198 #fi
200 dnl Optional screen - browse screen
201 #AC_MSG_CHECKING([whether to include the browse screen])
202 #AC_ARG_ENABLE([browse-screen], 
203 #              AC_HELP_STRING([--enable-browse-screen],
204 #                            [Enable the browse screen @<:@default=yes@:>@]),
205 #             [browse_screen="$enableval"],
206 #             [browse_screen=yes])
207 #AC_MSG_RESULT([$browse_screen])
208 #if test "x$browse_screen" = "xyes" ; then
209 #   AC_DEFINE(ENABLE_BROWSE_SCREEN, 1, [Enable the browse screen])
210 #fi
212 dnl Optional - curses getmouse support
213 AC_MSG_CHECKING([whether to include mouse support])
214 AC_ARG_ENABLE([mouse], 
215               AC_HELP_STRING([--enable-mouse],
216                              [Enable curses getmouse support @<:@default=yes@:>@]),
217               [getmouse="$enableval"],
218               [getmouse=yes])
219 AC_MSG_RESULT([$getmouse])
220 if test "x$getmouse" = "xyes" ; then
221    AC_CHECK_LIB([$ncurses], 
222                 [getmouse],
223                 [AC_DEFINE([HAVE_GETMOUSE], [1], [$ncurses - getmouse()])],
224                 [])
225 fi
227 dnl Optional screen - artist
228 AC_MSG_CHECKING([whether to include the artist screen])
229 AC_ARG_ENABLE([artist-screen], 
230               AC_HELP_STRING([--enable-artist-screen],
231                              [Enable artist screen (EXPERIMENTAL) @<:@default=no@:>@]),
232               [artist_screen="$enableval"],
233               [artist_screen=no])
234 AC_MSG_RESULT([$artist_screen])
235 if test "x$artist_screen" != "xyes" ; then
236    AC_DEFINE(DISABLE_ARTIST_SCREEN, 1, [Disable artist screen])
237 fi
239 dnl Optional screen - search
240 AC_MSG_CHECKING([whether to include the search screen])
241 AC_ARG_ENABLE([search-screen], 
242               AC_HELP_STRING([--enable-search-screen],
243                              [Enable search screen (EXPERIMENTAL) @<:@default=yes@:>@]),
244               [search_screen="$enableval"],
245               [search_screen=no])
246 #AC_MSG_RESULT([$search_screen])
247 if test "x$search_screen" != "xyes" ; then
248    AC_DEFINE(DISABLE_SEARCH_SCREEN, 1, [Disable search screen])
249 fi
250 AC_MSG_WARN([search screen unavailable due to issues with libmpdclient update])
251 AC_DEFINE(DISABLE_SEARCH_SCREEN, 1, [Disable search screen]) 
252 AC_MSG_RESULT([$search_screen])  
254 dnl Optional screen - key editor
255 AC_MSG_CHECKING([whether to include the key editor screen])
256 AC_ARG_ENABLE([key-screen], 
257               AC_HELP_STRING([--enable-key-screen],
258                              [Enable key editor screen @<:@default=yes@:>@]),
259               [keydef_screen="$enableval"],
260               [keydef_screen=yes])
261 AC_MSG_RESULT([$keydef_screen])
262 if test "x$keydef_screen" != "xyes" ; then
263    AC_DEFINE(DISABLE_KEYDEF_SCREEN, 1, [Disable key editor screen])
264 fi
266 dnl Optional screen - clock
267 AC_MSG_CHECKING([whether to include the clock screen])
268 AC_ARG_ENABLE([clock-screen], 
269               AC_HELP_STRING([--enable-clock-screen],
270                              [Enable clock screen @<:@default=yes@:>@]),
271               [clock_screen="$enableval"],
272               [clock_screen=yes])
273 AC_MSG_RESULT([$clock_screen])
274 if test "x$clock_screen" != "xyes" ; then
275    AC_DEFINE(DISABLE_CLOCK_SCREEN, 1, [Disable clock screen])
276 fi
278 dnl Optional screen - lyrics
279 AC_MSG_CHECKING([whether to include the lyrics screen]) 
280 AC_ARG_ENABLE([lyrics-screen], 
281               AC_HELP_STRING([--enable-lyrics-screen],
282                              [Enable lyrics screen @<:@default=no@:>@]),
283               [lyrics_screen="$enableval"],
284               [lyrics_screen=no])       
285 if test "x$lyrics_screen" != "xyes" ; then
286    AC_DEFINE(DISABLE_LYRICS_SCREEN, 1, [Disable lyrics screen])
287    lyrics_screen=no
288 fi
289 #lyrics_screen=yes
290 if test "$libcurl" != "yes" ; then
291    AC_DEFINE(DISABLE_LYRICS_SCREEN, 1, [Disable lyrics screen])
292    lyrics_screen=no
293 fi
294 if test "$gthread" != "yes" ; then
295    AC_DEFINE(DISABLE_LYRICS_SCREEN, 1, [Disable lyrics screen])
296    lyrics_screen=no
297 fi
298 if test "$have_expat" != "yes" ; then
299    AC_DEFINE(DISABLE_LYRICS_SCREEN, 1, [Disable lyrics screen])
300    lyrics_screen=no
301 fi
303 AC_MSG_RESULT([$lyrics_screen])
305 dnl Default host
306 AC_MSG_CHECKING([for default MPD host])
307 AC_ARG_WITH([default-host],
308             AC_HELP_STRING([--with-default-host=ARG],
309                            [Default MPD host @<:@localhost@:>@]),
310             [DEFAULT_HOST="$withval"],
311             [DEFAULT_HOST="localhost"])
312 AC_MSG_RESULT([$DEFAULT_HOST])
313 AC_DEFINE_UNQUOTED([DEFAULT_HOST], ["$DEFAULT_HOST"], [Default MPD host])
315 dnl Default port
316 AC_MSG_CHECKING([for default MPD port])
317 AC_ARG_WITH([default-port],
318             AC_HELP_STRING([--with-default-port=ARG],
319                            [Default port @<:@6600@:>@]),
320             [DEFAULT_PORT="$withval"],
321             [DEFAULT_PORT="6600"])
322 AC_MSG_RESULT([$DEFAULT_PORT])
323 AC_DEFINE_UNQUOTED([DEFAULT_PORT],     [$DEFAULT_PORT],   [Default MPD port])
324 AC_DEFINE_UNQUOTED([DEFAULT_PORT_STR], ["$DEFAULT_PORT"], [Default MPD port])
326 dnl Default timedisplay type
327 AC_MSG_CHECKING([for default timedisplay type])
328 AC_ARG_WITH([default-timedisplay_type],
329             AC_HELP_STRING([--with-default-timedisplay_type=ARG],
330                            [default_timedisplay]),
331             [DEFAULT_TIMEDISPLAY_TYPE="$withval"],
332             [DEFAULT_TIMEDISPLAY_TYPE="elapsed"])
333 AC_MSG_RESULT([$DEFAULT_TIMEDISPLAY_TYPE])
334 AC_DEFINE_UNQUOTED([DEFAULT_TIMEDISPLAY_TYPE], ["$DEFAULT_TIMEDISPLAY_TYPE"], [Default way to display time, either 'elapsed' or 'remaining'])
336 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile po/Makefile.in])
337 AC_OUTPUT