editing lyrics shouldn't require mpd_music_dir variable to be set
[ncmpcpp.git] / configure.in
blob54e4971847a699ebb2afb6f9ac3e6710fef9d633
1 AC_INIT(configure.in)
3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(ncmpcpp, 0.4.2_pre)
6 AC_PREREQ(2.59)
8 AC_LANG_CPLUSPLUS
9 AC_PROG_CXX
10 AM_PROG_LIBTOOL
12 AC_ARG_ENABLE(outputs, AS_HELP_STRING([--enable-outputs], [Enable outputs screen @<:@default=no@:>@]), [outputs=$enableval], [outputs=no])
13 AC_ARG_ENABLE(visualizer, AS_HELP_STRING([--enable-visualizer], [Enable music visualizer screen @<:@default=no@:>@]), [visualizer=$enableval], [visualizer=no])
14 AC_ARG_ENABLE(clock, AS_HELP_STRING([--enable-clock], [Enable clock screen @<:@default=no@:>@]), [clock=$enableval], [clock=no])
15 AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode], [Enable utf8 support @<:@default=yes@:>@]), [unicode=$enableval], [unicode=yes])
16 AC_ARG_WITH(curl, AS_HELP_STRING([--with-curl], [Enable fetching lyrics from the Internet @<:@default=auto@:>@]), [curl=$withval], [curl=auto])
17 AC_ARG_WITH(fftw, AS_HELP_STRING([--with-fftw], [Enable fftw support (required for frequency spectrum vizualization) @<:@default=auto@:>@]), [fftw=$withval], [fftw=auto])
18 AC_ARG_WITH(iconv, AS_HELP_STRING([--with-iconv], [Enable iconv support (Note: if you use utf-8 system wide, you can disable this) @<:@default=auto@:>@]), [iconv=$withval], [iconv=auto])
19 AC_ARG_WITH(pdcurses, AS_HELP_STRING([--with-pdcurses[=LIBNAME]], [Link against pdcurses instead of ncurses @<:@default=XCurses@:>@]), [pdcurses=$withval], [pdcurses=no])
20 AC_ARG_WITH(threads, AS_HELP_STRING([--with-threads], [Enable threading support using posix threads @<:@default=auto@:>@]), [threads=$withval], [threads=auto])
21 AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto])
23 if test "$outputs" = "yes"; then
24         AC_DEFINE([ENABLE_OUTPUTS], [1], [enables outputs screen])
27 if test "$clock" = "yes"; then
28         AC_DEFINE([ENABLE_CLOCK], [1], [enables clock screen])
31 dnl =====================================
32 dnl = checking for -fno-exceptions flag =
33 dnl =====================================
34 AC_MSG_CHECKING([whether compiler supports -fno-exceptions])
35 old_CXXFLAGS="$CXXFLAGS"
36 CXXFLAGS="-fno-exceptions"
37 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ ]]),
38         AC_MSG_RESULT([yes])
39         no_exceptions="-fno-exceptions"
40         ,
41         AC_MSG_RESULT([no])
43 CXXFLAGS="$old_CXXFLAGS $no_exceptions"
46 dnl ====================================
47 dnl = checking for win32 related stuff =
48 dnl ====================================
49 AC_CHECK_LIB(ws2_32, _head_libws2_32_a, LDFLAGS="$LDFLAGS -lws2_32", )
50 AC_CHECK_LIB(regex, regcomp, LDFLAGS="$LDFLAGS -lregex", )
52 dnl ================================
53 dnl = checking for various headers =
54 dnl ================================
55 AC_CHECK_HEADERS([dirent.h regex.h], , AC_MSG_ERROR(vital headers missing))
56 AC_CHECK_HEADERS([langinfo.h], , AC_MSG_WARN(locale detection disabled))
58 dnl ==============================
59 dnl = checking for libmpdclient2 =
60 dnl ==============================
61 PKG_CHECK_MODULES([libmpdclient], [libmpdclient >= 2.0], [
62         AC_SUBST(libmpdclient_LIBS)
63         AC_SUBST(libmpdclient_CFLAGS)
64         CPPFLAGS="$CPPFLAGS $libmpdclient_CFLAGS"
65         AC_CHECK_HEADERS([mpd/client.h],
66                 LDFLAGS="$LDFLAGS $libmpdclient_LIBS"
67         ,
68                 AC_MSG_ERROR([missing mpd/client.h header])
69         )
71         if test "$fftw" = "yes" ; then
72                 AC_MSG_ERROR([libmpdclient2 is required!])
73         fi
76 dnl ======================
77 dnl = checking for iconv =
78 dnl ======================
79 if test "$iconv" != "no" ; then
80         AC_CHECK_HEADERS([iconv.h],
81                 AC_MSG_CHECKING([whether iconv takes const char **])
82                 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <iconv.h>]], [[iconv(0, (const char **)0, 0, 0, 0);]]),
83                         AC_MSG_RESULT([yes]) AC_DEFINE([ICONV_CONST], [const], [pass const pointer to iconv]),
84                         AC_MSG_RESULT([no]) AC_DEFINE([ICONV_CONST], [], [pass non-const pointer to iconv]))
85                 AC_CHECK_LIB(iconv, libiconv, LDFLAGS="$LDFLAGS -liconv", )
86         ,
87         if test "$iconv" = "yes"; then
88                 AC_MSG_ERROR([iconv.h header is required])
89         fi
90         )
93 dnl ========================
94 dnl = checking for ncurses =
95 dnl ========================
96 if test "$pdcurses" = "no" ; then
97         if test "$unicode" = "yes" ; then
98                 curses_config_bin=ncursesw5-config
99                 AC_DEFINE([_UTF8], [1], [enables unicode support])
100         else
101                 curses_config_bin=ncurses5-config
102         fi
103 else
104         if test "$pdcurses" = "yes" ; then
105                 pdcurses_lib=XCurses
106                 curses_config_bin=xcurses-config
107         else
108                 pdcurses_lib=$pdcurses
109         fi
110         AC_DEFINE([USE_PDCURSES], [1], [enables pdcurses support])
112 AC_PATH_PROG(CURSES_CONFIG, $curses_config_bin)
113 if test "$CURSES_CONFIG" != "" ; then
114         CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
115         LDFLAGS="$LDFLAGS `$CURSES_CONFIG --libs`"
117 if test "$pdcurses" = "no" ; then
118         AC_CHECK_LIB(ncursesw, initscr,
119                 curses_lib=ncursesw,
120                 curses_lib=ncurses
121         )
122 else
123         curses_lib=$pdcurses_lib
125 AC_CHECK_LIB($curses_lib, initscr,
126         if test "$CURSES_CONFIG" = "" ; then
127                 LDFLAGS="$LDFLAGS -l$curses_lib"
128         fi
129         ,
130         AC_MSG_ERROR([$curses_lib library is required])
131         )
132 if test "$pdcurses" != "no" ; then
133         AC_CHECK_LIB($curses_lib, Xinitscr, AC_DEFINE([XCURSES], [1], [x11 pdcurses available]), )
135 AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing curses.h header]))
137 dnl ======================
138 dnl = checking for fftw3 =
139 dnl ======================
140 if test "$visualizer" = "yes" ; then
141         if test "$fftw" != "no" ; then
142                 PKG_CHECK_MODULES([fftw3], [fftw3 >= 3], [
143                         AC_SUBST(fftw3_LIBS)
144                         AC_SUBST(fftw3_CFLAGS)
145                         CPPFLAGS="$CPPFLAGS $fftw3_CFLAGS"
146                         AC_CHECK_HEADERS([fftw3.h],
147                                 LDFLAGS="$LDFLAGS $fftw3_LIBS"
148                         ,
149                                 if test "$fftw" = "yes" ; then
150                                         AC_MSG_ERROR([missing fftw3.h header])
151                                 fi
152                         )
153                 ],
154                         if test "$fftw" = "yes" ; then
155                                 AC_MSG_ERROR([fftw3 library is required!])
156                         fi
157                 )
158         fi
159         AC_DEFINE([ENABLE_VISUALIZER], [1], [enables music visualizer screen])
162 dnl =================================
163 dnl = checking for curl and pthread =
164 dnl =================================
165 if test "$curl" != "no" ; then
166         if test "$threads" != "no" ; then
167                 AC_CHECK_HEADERS([pthread.h], AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread",
168                         if test "$threads" = "yes" ; then
169                                 AC_MSG_ERROR([pthread.h found but there is no pthread library to make use of])
170                         fi
171                 ), )
172         fi
173         AC_PATH_PROG(CURL_CONFIG, curl-config)
174         if test "$CURL_CONFIG" != "" ; then
175                 CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
176                 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS `$CURL_CONFIG --libs`",
177                         if test "$curl" = "yes" ; then
178                                 AC_MSG_ERROR([curl library is required])
179                         fi
180                 )
181                 AC_CHECK_HEADERS([curl/curl.h], ,
182                         if test "$curl" = "yes" ; then
183                                 AC_MSG_ERROR([missing curl.h header])
184                         fi
185                 )
186         else
187                 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS -lcurl",
188                         if test "$curl" = "yes" ; then
189                                 AC_MSG_ERROR([curl library is required])
190                         fi
191                 )
192         fi
195 dnl =======================
196 dnl = checking for taglib =
197 dnl =======================
198 if test "$taglib" != "no" ; then
199         AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
200         if test "$TAGLIB_CONFIG" != "" ; then
201                 CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
202                 LDFLAGS="$LDFLAGS `$TAGLIB_CONFIG --libs`"
203                 AC_CHECK_HEADERS([taglib.h], ,
204                         if test "$taglib" = "yes" ; then
205                                 AC_MSG_ERROR([missing taglib.h header])
206                         fi
207                 )
208         else
209                 if test "$taglib" = "yes" ; then
210                         AC_MSG_ERROR([taglib-config executable is missing])
211                 fi
212         fi
215 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
216 AC_OUTPUT