Code

4aa392e5008a1674d4f80840934e947ca2b29269
[ncmpc.git] / configure.ac
1 dnl
2 dnl  $Id$
3 dnl
5 AC_INIT(ncurses MPD client, 0.12~git, max@duempel.org, ncmpc)
6 AC_CONFIG_SRCDIR([src/main.c])
7 AM_INIT_AUTOMAKE([gnu 1.6 dist-bzip2])
8 AM_CONFIG_HEADER([config.h])
9 AC_CONFIG_MACRO_DIR([m4])
11 dnl Check for programs
12 AC_PROG_CC_C99
13 AC_PROG_INSTALL
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([locale.h],
36                 AC_DEFINE([HAVE_LOCALE_H], [1], [locale.h]),
37                 ,)
40 dnl
41 dnl Check for functions
42 dnl
43 AC_CHECK_FUNCS([strcasestr])
46 dnl
47 dnl Check for libraries
48 dnl
50 dnl Try to find the socket functions
51 AC_CHECK_FUNC([socket],
52               [], 
53               [AC_CHECK_LIB([socket],[socket],[LIBS="$LIBS -lsocket"],
54                             [AC_MSG_ERROR(No UNIX socket API found)])
55               ])
57 dnl Try to find the gethostbyname functions
58 AC_CHECK_FUNC([gethostbyname],
59               [], 
60               [AC_CHECK_LIB([nsl],[gethostbyname],[LIBS="$LIBS -lnsl"],
61                             [AC_MSG_ERROR(No UNIX gethostbyname API found)])
62               ])
65 dnl ncurses
66 ncurses=auto
67 AC_ARG_WITH([ncurses],
68             AC_HELP_STRING([--with-ncurses], [compile/link with ncurses library] ),
69             [ncurses=ncurses])
70 AC_ARG_WITH(ncursesw,
71             AC_HELP_STRING([--with-ncursesw], [compile/link with wide-char ncurses library @<:@default@:>@]),
72             [ncurses=ncursesw])
74 if test "x$ncurses" = "xauto"; then
75         AC_CHECK_LIB([ncursesw], 
76                      [initscr],
77                      [ncurses=ncursesw],
78                      [ncurses=ncurses])
79 fi
81 AC_CHECK_LIB([$ncurses], 
82              [initscr],
83              [LIBS="$LIBS -l$ncurses"], 
84              [AC_MSG_ERROR($ncurses library is required)])
88 dnl Check for glib-2.4
89 PKG_CHECK_MODULES([GLIB], 
90                   [glib-2.0 >= 2.4],
91                   [glib24=yes],
92                   [AC_MSG_WARN([glib-2.4 is required for NLS support!])])
93 if test "x$glib24" != "xyes"; then
94    PKG_CHECK_MODULES([GLIB], 
95                      [glib-2.0 >= 2.2],
96                      [nls=no],
97                      [AC_MSG_ERROR([glib-2.2 is required])])
98 fi
101 dnl i18n
102 AM_NLS
103 if test "x$glib24" = "xyes"; then
104   nls=$USE_NLS
105 else
106   USE_NLS=no
107   AC_SUBST(USE_NLS)
108 fi
110 if test "x$nls" = "xyes"; then
111    AM_GLIB_GNU_GETTEXT
112    GETTEXT_PACKAGE=$PACKAGE
113    AC_SUBST(GETTEXT_PACKAGE)
114    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], 
115                       ["${GETTEXT_PACKAGE}"], 
116                       [gettext domain])
117   nls=$gt_cv_have_gettext
118   if test "x$nls" != "xyes"; then
119      AC_MSG_WARN([NLS support disabled!])
120   fi
121 else
122   AM_PO_SUBDIRS
123 fi
125 dnl enable colors
126 AC_MSG_CHECKING([color support])
127 AC_ARG_ENABLE([colors],
128         AC_HELP_STRING([--enable-colors],
129                        [Enable color support]),
130                        [use_colors=$enableval], 
131                        [use_colors=no])
132 AC_MSG_RESULT([$use_colors])
133 if test "x$use_colors" = "xyes" ; then
134     AC_DEFINE([ENABLE_COLORS], [1], [Enable color support])
135 fi
137 dnl Debugging 
138 AC_MSG_CHECKING([whether to build with debug support])
139 AC_ARG_ENABLE([debug], 
140               AC_HELP_STRING([--enable-debug],
141                              [Enable debugging @<:@default=no@:>@]),
142               [enable_debug="$enableval"], 
143               [enable_debug=no])
144 AC_MSG_RESULT([$enable_debug])
145 if test "x$enable_debug" = "xyes" ; then
146     CFLAGS="$CFLAGS -g"
147 else
148     CFLAGS="$CFLAGS -DNDEBUG"
149 fi
151 dnl CFLAGS
153 AC_SUBST(AM_CFLAGS)
155 CHECK_CFLAG([-Wall])
156 CHECK_CFLAG([-Wextra])
157 CHECK_CFLAG([-Wno-deprecated-declarations])
158 CHECK_CFLAG([-Wmissing-prototypes])
159 CHECK_CFLAG([-Wdeclaration-after-statement])
160 CHECK_CFLAG([-Wshadow])
161 CHECK_CFLAG([-Wpointer-arith])
162 CHECK_CFLAG([-Wstrict-prototypes])
163 CHECK_CFLAG([-Wcast-qual])
164 CHECK_CFLAG([-Wwrite-strings])
166 dnl Optional screen - help screen
167 #AC_MSG_CHECKING([whether to include the help screen])
168 #AC_ARG_ENABLE([help-screen], 
169 #              AC_HELP_STRING([--enable-help-screen],
170 #                            [Enable the help screen @<:@default=yes@:>@]),
171 #             [help_screen="$enableval"],
172 #             [help_screen=yes])
173 #AC_MSG_RESULT([$help_screen])
174 #if test "x$help_screen" = "xyes" ; then
175 #   AC_DEFINE(ENABLE_HELP_SCREEN, 1, [Enable the help screen])
176 #fi
178 dnl Optional screen - browse screen
179 #AC_MSG_CHECKING([whether to include the browse screen])r
180 #AC_ARG_ENABLE([browse-screen], 
181 #              AC_HELP_STRING([--enable-browse-screen],
182 #                            [Enable the browse screen @<:@default=yes@:>@]),
183 #             [browse_screen="$enableval"],
184 #             [browse_screen=yes])
185 #AC_MSG_RESULT([$browse_screen])
186 #if test "x$browse_screen" = "xyes" ; then
187 #   AC_DEFINE(ENABLE_BROWSE_SCREEN, 1, [Enable the browse screen])
188 #fi
190 dnl Optional - curses getmouse support
191 AC_MSG_CHECKING([whether to include mouse support])
192 AC_ARG_ENABLE([mouse], 
193               AC_HELP_STRING([--enable-mouse],
194                              [Enable curses getmouse support @<:@default=yes@:>@]),
195               [getmouse="$enableval"],
196               [getmouse=yes])
197 AC_MSG_RESULT([$getmouse])
198 if test "x$getmouse" = "xyes" ; then
199    AC_CHECK_LIB([$ncurses], 
200                 [getmouse],
201                 [AC_DEFINE([HAVE_GETMOUSE], [1], [$ncurses - getmouse()])],
202                 [])
203 fi
205 dnl Optional screen - artist
206 AC_MSG_CHECKING([whether to include the artist screen])
207 AC_ARG_ENABLE([artist-screen], 
208               AC_HELP_STRING([--enable-artist-screen],
209                              [Enable artist screen (EXPERIMENTAL) @<:@default=no@:>@]),
210               [artist_screen="$enableval"],
211               [artist_screen=no])
212 AC_MSG_RESULT([$artist_screen])
213 if test "x$artist_screen" = "xyes" ; then
214     AC_DEFINE(ENABLE_ARTIST_SCREEN, 1, [Enable artist screen])
215 fi
217 AM_CONDITIONAL(ENABLE_ARTIST_SCREEN, test x$artist_screen = xyes)
219 dnl Optional screen - search
220 AC_MSG_CHECKING([whether to include the search screen])
221 AC_ARG_ENABLE([search-screen], 
222               AC_HELP_STRING([--enable-search-screen],
223                              [Enable search screen (EXPERIMENTAL) @<:@default=yes@:>@]),
224               [search_screen="$enableval"],
225               [search_screen=yes])
226 AC_MSG_RESULT([$search_screen])
227 if test "x$search_screen" = "xyes" ; then
228     AC_DEFINE(ENABLE_SEARCH_SCREEN, 1, [Enable search screen])
229 fi
231 AM_CONDITIONAL(ENABLE_SEARCH_SCREEN, test x$search_screen = xyes)
232   
233 dnl Optional screen - key editor
234 AC_MSG_CHECKING([whether to include the key editor screen])
235 AC_ARG_ENABLE([key-screen], 
236               AC_HELP_STRING([--enable-key-screen],
237                              [Enable key editor screen @<:@default=yes@:>@]),
238               [keydef_screen="$enableval"],
239               [keydef_screen=yes])
240 AC_MSG_RESULT([$keydef_screen])
241 if test "x$keydef_screen" = "xyes" ; then
242     AC_DEFINE(ENABLE_KEYDEF_SCREEN, 1, [Enable key editor screen])
243 fi
245 AM_CONDITIONAL(ENABLE_KEYDEF_SCREEN, test x$keydef_screen = xyes)
247 dnl Optional screen - lyrics
248 AC_MSG_CHECKING([whether to include the lyrics screen]) 
249 AC_ARG_ENABLE([lyrics-screen], 
250               AC_HELP_STRING([--enable-lyrics-screen],
251                              [Enable lyrics screen @<:@default=no@:>@]),
252               [lyrics_screen="$enableval"],
253               [lyrics_screen=no])       
254 if test "x$lyrics_screen" = "xyes" ; then
255     AC_DEFINE(ENABLE_LYRICS_SCREEN, 1, [Enable lyrics screen])
256 fi
258 AM_CONDITIONAL(ENABLE_LYRICS_SCREEN, test x$lyrics_screen = xyes)
260 AC_MSG_RESULT([$lyrics_screen])
262 AC_ARG_WITH([lyrics-plugin-dir],
263         AC_HELP_STRING([[--with-lyrics-plugin-dir[=DIRECTORY]]],
264                        [Directory where lyrics plugins are stored @<:@default=PREFIX/lib/ncmpc/lyrics@:>@]),
265        [lyrics_plugin_dir=$withval],
266        [lyrics_plugin_dir=""])
267 if test "x${lyrics_plugin_dir}" = "x"; then
268     if test "x${prefix}" = "xNONE"; then
269         lyrics_plugin_dir="${ac_default_prefix}/lib/ncmpc/lyrics"
270     else
271         lyrics_plugin_dir="${prefix}/lib/ncmpc/lyrics"
272     fi
273 fi
274 AC_DEFINE_UNQUOTED([LYRICS_PLUGIN_DIR], ["$lyrics_plugin_dir"],
275                   [Directory to search for lyrics plugins])
276 AC_SUBST(lyrics_plugin_dir)
278 dnl Default host
279 AC_MSG_CHECKING([for default MPD host])
280 AC_ARG_WITH([default-host],
281             AC_HELP_STRING([--with-default-host=ARG],
282                            [Default MPD host @<:@localhost@:>@]),
283             [DEFAULT_HOST="$withval"],
284             [DEFAULT_HOST="localhost"])
285 AC_MSG_RESULT([$DEFAULT_HOST])
286 AC_DEFINE_UNQUOTED([DEFAULT_HOST], ["$DEFAULT_HOST"], [Default MPD host])
288 dnl Default port
289 AC_MSG_CHECKING([for default MPD port])
290 AC_ARG_WITH([default-port],
291             AC_HELP_STRING([--with-default-port=ARG],
292                            [Default port @<:@6600@:>@]),
293             [DEFAULT_PORT="$withval"],
294             [DEFAULT_PORT="6600"])
295 AC_MSG_RESULT([$DEFAULT_PORT])
296 AC_DEFINE_UNQUOTED([DEFAULT_PORT],     [$DEFAULT_PORT],   [Default MPD port])
297 AC_DEFINE_UNQUOTED([DEFAULT_PORT_STR], ["$DEFAULT_PORT"], [Default MPD port])
299 dnl Default timedisplay type
300 AC_MSG_CHECKING([for default timedisplay type])
301 AC_ARG_WITH([default-timedisplay_type],
302             AC_HELP_STRING([--with-default-timedisplay_type=ARG],
303                            [default_timedisplay]),
304             [DEFAULT_TIMEDISPLAY_TYPE="$withval"],
305             [DEFAULT_TIMEDISPLAY_TYPE="elapsed"])
306 AC_MSG_RESULT([$DEFAULT_TIMEDISPLAY_TYPE])
307 AC_DEFINE_UNQUOTED([DEFAULT_TIMEDISPLAY_TYPE], ["$DEFAULT_TIMEDISPLAY_TYPE"], [Default way to display time, either 'elapsed' or 'remaining'])
308 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile po/Makefile.in po/Makefile])
309 AC_OUTPUT