tag editor: fix middle column binds if titles_visibility is disabled
[ncmpcpp.git] / configure.ac
blob37380e73827171d7b62b3e84550d471a63c01c8c
1 AC_INIT(configure.ac)
3 AC_CONFIG_HEADERS(config.h)
4 AM_INIT_AUTOMAKE(ncmpcpp, 0.6_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(pdcurses, AS_HELP_STRING([--with-pdcurses[=LIBNAME]], [Link against pdcurses instead of ncurses @<:@default=XCurses@:>@]), [pdcurses=$withval], [pdcurses=no])
19 AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto])
21 if test "$outputs" = "yes"; then
22         AC_DEFINE([ENABLE_OUTPUTS], [1], [enables outputs screen])
25 if test "$clock" = "yes"; then
26         AC_DEFINE([ENABLE_CLOCK], [1], [enables clock screen])
29 dnl ================================
30 dnl = checking for -std=c++0x flag =
31 dnl ================================
32 AC_MSG_CHECKING([whether compiler supports -std=c++0x])
33 old_CXXFLAGS="$CXXFLAGS"
34 CXXFLAGS="-std=c++0x"
35 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]])],
36         AC_MSG_RESULT([yes])
37                 std_cpp0x="-std=c++0x",
38         AC_MSG_RESULT([no])
39                 AC_MSG_ERROR([[Your compiler doesn't seem to support C++0x, please upgrade (GCC >= 4.6)]])
41 CXXFLAGS="$old_CXXFLAGS $std_cpp0x"
43 dnl ==========================================
44 dnl = checking for initializer lists support =
45 dnl ==========================================
46 AC_MSG_CHECKING([whether compiler supports initializer lists])
47 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <vector>], [[std::vector<int> test = { 1, 2, 3 }; test.push_back(4);]])],
48         AC_MSG_RESULT([yes]),
49         AC_MSG_RESULT([no])
50                 AC_MSG_ERROR([[Your compiler doesn't seem to support initializer lists, please upgrade (GCC >= 4.6)]])
53 dnl =====================================
54 dnl = checking for auto keyword support =
55 dnl =====================================
56 AC_MSG_CHECKING([whether compiler supports auto keyword])
57 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[auto test = new int; *test = 1;]])],
58         AC_MSG_RESULT([yes]),
59         AC_MSG_RESULT([no])
60                 AC_MSG_ERROR([[Your compiler doesn't seem to support auto keyword, please upgrade (GCC >= 4.6)]])
63 dnl =========================================
64 dnl = checking for lambda functions support =
65 dnl =========================================
66 AC_MSG_CHECKING([whether compiler supports lambda functions])
67 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <functional>], [[int a = 5; std::function<int(int)> f = [&a](int b) { return a + b; }; f(8);]])],
68         AC_MSG_RESULT([yes]),
69         AC_MSG_RESULT([no])
70                 AC_MSG_ERROR([[Your compiler doesn't seem to support lambda functions, please upgrade (GCC >= 4.6)]])
73 dnl ================================================================
74 dnl = checking whether calling derived member function of object   =
75 dnl = passed to lambda without explicit 'this' usage works         =
76 dnl ================================================================
77 AC_MSG_CHECKING([whether calling derived member function passed to lambda without explicit this usage works ])
78 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <functional>], [[struct A { void foo() { } };  struct B : public A { void bar() { std::function<void()> f = [this]() { foo(); }; f();  } } foo; foo.bar();]])],
79         AC_MSG_RESULT([yes]),
80         AC_MSG_RESULT([no])
81                 AC_MSG_ERROR([[Your compiler doesn't seem to support calling derived member function of an object passed to lambda as 'this' without explicit 'this' usage, please upgrade (GCC >= 4.6)]])
84 dnl =========================================
85 dnl = checking for override keyword support =
86 dnl =========================================
87 AH_TEMPLATE([OVERRIDE], [override keyword used in C++11])
88 AC_MSG_CHECKING([whether compiler supports override keyword])
89 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[struct A { virtual void foo() { } }; struct B : public A { virtual void foo() override { } };]], [])],
90         AC_MSG_RESULT([yes])
91                 AC_DEFINE([OVERRIDE], [override]),
92         AC_MSG_RESULT([no])
93                 AC_DEFINE([OVERRIDE], []),
96 dnl =============================
97 dnl = setting boost environment =
98 dnl =============================
99 AS_IF([test -z "${BOOST_LIB_SUFFIX+x}"], [BOOST_LIB_SUFFIX=-mt])
100 AC_ARG_VAR([BOOST_LIB_SUFFIX], [Boost library name suffix [default=-mt]])
102 dnl ======================================
103 dnl = checking for various boost headers =
104 dnl ======================================
105 AC_CHECK_HEADERS([boost/bind.hpp], ,
106         AC_MSG_ERROR(boost/bind.hpp is missing))
107 AC_CHECK_HEADERS([boost/lexical_cast.hpp], ,
108         AC_MSG_ERROR(boost/lexical_cast.hpp is missing))
109 AC_CHECK_HEADERS([boost/algorithm/string.hpp], ,
110         AC_MSG_ERROR(boost/algorithm/string.hpp is missing))
112 dnl =================================
113 dnl = checking for boost.filesystem =
114 dnl =================================
115 AC_CHECK_HEADERS([boost/filesystem.hpp], ,
116         AC_MSG_ERROR(boost/filesystem.hpp is missing)
118 AC_CHECK_LIB(boost_filesystem$BOOST_LIB_SUFFIX, main, LDFLAGS="$LDFLAGS -lboost_filesystem$BOOST_LIB_SUFFIX",
119         AC_MSG_ERROR([no boost.filesystem library found])
121 AC_CHECK_LIB(boost_system$BOOST_LIB_SUFFIX, main, LDFLAGS="$LDFLAGS -lboost_system$BOOST_LIB_SUFFIX",
122         AC_MSG_ERROR([no boost.system library found])
126 dnl =============================
127 dnl = checking for boost.locale =
128 dnl =============================
129 AC_CHECK_HEADERS([boost/locale.hpp], ,
130         AC_MSG_ERROR(boost/locale.hpp is missing)
132 AC_CHECK_LIB(boost_locale$BOOST_LIB_SUFFIX, main, LDFLAGS="$LDFLAGS -lboost_locale$BOOST_LIB_SUFFIX",
133         AC_MSG_ERROR([no boost.locale library found])
136 dnl ============================
137 dnl = checking for boost.regex =
138 dnl ============================
139 AC_CHECK_HEADERS([boost/regex.hpp], ,
140         AC_MSG_ERROR(boost/regex.hpp is missing)
142 AC_CHECK_LIB(boost_regex$BOOST_LIB_SUFFIX, main, LDFLAGS="$LDFLAGS -lboost_regex$BOOST_LIB_SUFFIX",
143         AC_MSG_ERROR([no boost.regex library found])
146 dnl =============================
147 dnl = checking for boost.thread =
148 dnl =============================
149 AC_DEFINE([BOOST_THREAD_VERSION], [3], [require boost.thread v3])
150 AC_CHECK_HEADERS([boost/thread.hpp], ,
151         AC_MSG_ERROR([boost/thread.hpp is missing or your boost version is too old (boost.thread v3 is required)])
153 AC_CHECK_LIB(boost_thread$BOOST_LIB_SUFFIX, main, LDFLAGS="$LDFLAGS -lboost_thread$BOOST_LIB_SUFFIX",
154         AC_MSG_ERROR([no boost.thread library found])
157 dnl ==============================
158 dnl = checking for regex (win32) =
159 dnl ==============================
160 AC_CHECK_LIB(regex, regcomp, LDFLAGS="$LDFLAGS -lregex", )
162 dnl ================================
163 dnl = checking for various headers =
164 dnl ================================
165 AC_CHECK_HEADERS([dirent.h regex.h], , AC_MSG_ERROR(vital headers missing))
166 AC_CHECK_HEADERS([langinfo.h], , AC_MSG_WARN(locale detection disabled))
168 dnl ==============================
169 dnl = checking for libmpdclient2 =
170 dnl ==============================
171 PKG_CHECK_MODULES([libmpdclient], [libmpdclient >= 2.8], [
172         AC_SUBST(libmpdclient_LIBS)
173         AC_SUBST(libmpdclient_CFLAGS)
174         CPPFLAGS="$CPPFLAGS $libmpdclient_CFLAGS"
175         AC_CHECK_HEADERS([mpd/client.h],
176                 LDFLAGS="$LDFLAGS $libmpdclient_LIBS"
177         ,
178                 AC_MSG_ERROR([missing mpd/client.h header])
179         )
181         AC_MSG_ERROR([libmpdclient >= 2.8 is required!])
184 dnl ========================
185 dnl = checking for pthread =
186 dnl ========================
187 AC_CHECK_HEADERS([pthread.h],
188         AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread",
189                 AC_MSG_ERROR([pthread.h found but there is no pthread library to make use of])
190         ),
193 dnl ========================
194 dnl = checking for ncurses =
195 dnl ========================
196 if test "$pdcurses" = "no" ; then
197         if test "$unicode" = "yes" ; then
198                 curses_config_bin="ncursesw6-config ncursesw5-config"
199                 AC_DEFINE([NCMPCPP_UNICODE], [1], [enables unicode support])
200         else
201                 curses_config_bin="ncurses6-config ncurses5-config"
202         fi
203 else
204         if test "$pdcurses" = "yes" ; then
205                 pdcurses_lib=XCurses
206                 curses_config_bin=xcurses-config
207         else
208                 pdcurses_lib=$pdcurses
209         fi
210         AC_DEFINE([USE_PDCURSES], [1], [enables pdcurses support])
212 AC_PATH_PROGS(CURSES_CONFIG, $curses_config_bin)
213 if test "$CURSES_CONFIG" != "" ; then
214         CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
215         LDFLAGS="$LDFLAGS `$CURSES_CONFIG --libs`"
217 if test "$pdcurses" = "no" ; then
218         AC_CHECK_LIB(ncursesw, initscr,
219                 curses_lib=ncursesw,
220                 curses_lib=ncurses
221         )
222 else
223         curses_lib=$pdcurses_lib
225 AC_CHECK_LIB($curses_lib, initscr,
226         if test "$CURSES_CONFIG" = "" ; then
227                 LDFLAGS="$LDFLAGS -l$curses_lib"
228         fi
229         ,
230         AC_MSG_ERROR([$curses_lib library is required])
231         )
232 if test "$pdcurses" != "no" ; then
233         AC_CHECK_LIB($curses_lib, Xinitscr, AC_DEFINE([XCURSES], [1], [x11 pdcurses available]), )
235 AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing curses.h header]))
237 dnl ======================
238 dnl = checking for fftw3 =
239 dnl ======================
240 if test "$visualizer" = "yes" ; then
241         if test "$fftw" != "no" ; then
242                 PKG_CHECK_MODULES([fftw3], [fftw3 >= 3], [
243                         AC_SUBST(fftw3_LIBS)
244                         AC_SUBST(fftw3_CFLAGS)
245                         CPPFLAGS="$CPPFLAGS $fftw3_CFLAGS"
246                         AC_CHECK_HEADERS([fftw3.h],
247                                 LDFLAGS="$LDFLAGS $fftw3_LIBS"
248                         ,
249                                 if test "$fftw" = "yes" ; then
250                                         AC_MSG_ERROR([missing fftw3.h header])
251                                 fi
252                         )
253                 ],
254                         if test "$fftw" = "yes" ; then
255                                 AC_MSG_ERROR([fftw3 library is required!])
256                         fi
257                 )
258         fi
259         AC_DEFINE([ENABLE_VISUALIZER], [1], [enables music visualizer screen])
262 dnl =====================
263 dnl = checking for curl =
264 dnl =====================
265 if test "$curl" != "no" ; then
266         AC_PATH_PROG(CURL_CONFIG, curl-config)
267         if test "$CURL_CONFIG" != "" ; then
268                 CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
269                 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS `$CURL_CONFIG --libs`",
270                         if test "$curl" = "yes" ; then
271                                 AC_MSG_ERROR([curl library is required])
272                         fi
273                 )
274                 AC_CHECK_HEADERS([curl/curl.h], ,
275                         if test "$curl" = "yes" ; then
276                                 AC_MSG_ERROR([missing curl.h header])
277                         fi
278                 )
279         else
280                 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS -lcurl",
281                         if test "$curl" = "yes" ; then
282                                 AC_MSG_ERROR([curl library is required])
283                         fi
284                 )
285         fi
288 dnl =======================
289 dnl = checking for taglib =
290 dnl =======================
291 if test "$taglib" != "no" ; then
292         AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
293         if test "$TAGLIB_CONFIG" != "" ; then
294                 CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
295                 LDFLAGS="$LDFLAGS `$TAGLIB_CONFIG --libs`"
296                 AC_CHECK_HEADERS([taglib.h], ,
297                         if test "$taglib" = "yes" ; then
298                                 AC_MSG_ERROR([missing taglib.h header])
299                         fi
300                 )
301         else
302                 if test "$taglib" = "yes" ; then
303                         AC_MSG_ERROR([taglib-config executable is missing])
304                 fi
305         fi
308 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
309 AC_OUTPUT