2 AC_CONFIG_HEADERS(config.h)
3 AM_INIT_AUTOMAKE(ncmpcpp, 0.8_dev)
5 m4_include([m4/ax_lib_readline.m4])
13 AC_ARG_ENABLE(outputs, AS_HELP_STRING([--enable-outputs], [Enable outputs screen @<:@default=no@:>@]), [outputs=$enableval], [outputs=no])
14 AC_ARG_ENABLE(visualizer, AS_HELP_STRING([--enable-visualizer], [Enable music visualizer screen @<:@default=no@:>@]), [visualizer=$enableval], [visualizer=no])
15 AC_ARG_ENABLE(clock, AS_HELP_STRING([--enable-clock], [Enable clock screen @<:@default=no@:>@]), [clock=$enableval], [clock=no])
16 AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode], [Enable utf8 support @<:@default=yes@:>@]), [unicode=$enableval], [unicode=yes])
18 AC_ARG_WITH(fftw, AS_HELP_STRING([--with-fftw], [Enable fftw support (required for frequency spectrum vizualization) @<:@default=auto@:>@]), [fftw=$withval], [fftw=auto])
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++14 flag =
31 dnl ================================
32 AC_MSG_CHECKING([whether compiler supports -std=c++14])
33 old_CXXFLAGS="$CXXFLAGS"
35 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]])],
37 std_cpp14="-std=c++14",
39 AC_MSG_ERROR([[Your compiler doesn't seem to support C++14, please upgrade (GCC >= 5)]])
41 CXXFLAGS="$old_CXXFLAGS $std_cpp14"
43 dnl ===================================================
44 dnl = checking for generic lambda expressions support =
45 dnl ===================================================
46 AC_MSG_CHECKING([whether compiler supports generic lambda expressions])
47 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[auto f = [](auto n) { return n*n; }; f(7);]])],
50 AC_MSG_ERROR([[Your compiler doesn't seem to support generic lambda expressions, please upgrade (GCC >= 5)]])
53 dnl =============================
54 dnl = setting boost environment =
55 dnl =============================
56 AS_IF([test -z "${BOOST_LIB_SUFFIX+x}"], [BOOST_LIB_SUFFIX=])
57 AC_ARG_VAR([BOOST_LIB_SUFFIX], [Boost library name suffix [default=]])
59 dnl ======================================
60 dnl = checking for various boost headers =
61 dnl ======================================
62 AC_CHECK_HEADERS([boost/bind.hpp], ,
63 AC_MSG_ERROR(boost/bind.hpp is missing))
64 AC_CHECK_HEADERS([boost/lexical_cast.hpp], ,
65 AC_MSG_ERROR(boost/lexical_cast.hpp is missing))
66 AC_CHECK_HEADERS([boost/algorithm/string.hpp], ,
67 AC_MSG_ERROR(boost/algorithm/string.hpp is missing))
69 dnl =================================
70 dnl = checking for boost.filesystem =
71 dnl =================================
72 AC_CHECK_HEADERS([boost/filesystem.hpp], ,
73 AC_MSG_ERROR(boost/filesystem.hpp is missing)
75 AC_CHECK_LIB(boost_filesystem$BOOST_LIB_SUFFIX, main, LIBS="$LIBS -lboost_filesystem$BOOST_LIB_SUFFIX",
76 AC_MSG_ERROR([no boost.filesystem library found])
78 AC_CHECK_LIB(boost_system$BOOST_LIB_SUFFIX, main, LIBS="$LIBS -lboost_system$BOOST_LIB_SUFFIX",
79 AC_MSG_ERROR([no boost.system library found])
82 dnl =============================
83 dnl = checking for boost.format =
84 dnl =============================
85 AC_CHECK_HEADERS([boost/format.hpp], ,
86 AC_MSG_ERROR(boost/format.hpp is missing)
89 dnl =============================
90 dnl = checking for boost.locale =
91 dnl =============================
92 AC_CHECK_HEADERS([boost/locale.hpp], ,
93 AC_MSG_ERROR(boost/locale.hpp is missing)
95 AC_CHECK_LIB(boost_locale$BOOST_LIB_SUFFIX, main, LIBS="$LIBS -lboost_locale$BOOST_LIB_SUFFIX",
96 AC_MSG_ERROR([no boost.locale library found])
99 dnl =================================
100 dnl = checking for boost.posix_time =
101 dnl =================================
102 AC_CHECK_HEADERS([boost/date_time/posix_time/posix_time.hpp], ,
103 AC_MSG_ERROR(boost/date_time/posix_time/posix_time.hpp is missing)
106 dnl ======================================
107 dnl = checking for boost.program_options =
108 dnl ======================================
109 AC_CHECK_HEADERS([boost/program_options.hpp], ,
110 AC_MSG_ERROR(boost/program_options.hpp is missing)
112 AC_CHECK_LIB(boost_program_options$BOOST_LIB_SUFFIX, main, LIBS="$LIBS -lboost_program_options$BOOST_LIB_SUFFIX",
113 AC_MSG_ERROR([no boost.program_options library found])
116 dnl ============================
117 dnl = checking for boost.regex =
118 dnl ============================
119 AC_CHECK_HEADERS([boost/regex.hpp], ,
120 AC_MSG_ERROR(boost/regex.hpp is missing)
122 AC_CHECK_LIB(boost_regex$BOOST_LIB_SUFFIX, main, LIBS="$LIBS -lboost_regex$BOOST_LIB_SUFFIX",
123 AC_MSG_ERROR([no boost.regex library found])
126 dnl ====================
127 dnl = checking for icu =
128 dnl ====================
129 AH_TEMPLATE([BOOST_REGEX_ICU], [boost.regex was compiled with ICU support])
130 PKG_CHECK_MODULES([ICU], [icu-uc], [
131 old_CPPFLAGS="$CPPFLAGS"
135 CPPFLAGS="$CPPFLAGS $ICU_CFLAGS"
136 LIBS="$LIBS $ICU_LIBS"
137 AC_MSG_CHECKING([whether boost.regex was compiled with ICU support])
138 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <boost/regex/icu.hpp>]], [[boost::u32regex rx = boost::make_u32regex("foo"); if (boost::u32regex_search("foobar", rx)) { }]])],
140 AC_DEFINE([BOOST_REGEX_ICU], [1]),
142 CPPFLAGS="$old_CPPFLAGS"
147 dnl ================================
148 dnl = checking for various headers =
149 dnl ================================
150 AC_CHECK_HEADERS([netinet/tcp.h netinet/in.h], , AC_MSG_ERROR(vital headers missing))
151 AC_CHECK_HEADERS([langinfo.h], , AC_MSG_WARN(locale detection disabled))
153 dnl ==============================
154 dnl = checking for libmpdclient2 =
155 dnl ==============================
156 PKG_CHECK_MODULES([libmpdclient], [libmpdclient >= 2.8], [
157 AC_SUBST(libmpdclient_CFLAGS)
158 AC_SUBST(libmpdclient_LIBS)
159 CPPFLAGS="$CPPFLAGS $libmpdclient_CFLAGS"
160 AC_CHECK_HEADERS([mpd/client.h],
161 LIBS="$LIBS $libmpdclient_LIBS"
163 AC_MSG_ERROR([missing mpd/client.h header])
166 AC_MSG_ERROR([libmpdclient >= 2.8 is required!])
169 dnl =========================
170 dnl = checking for readline =
171 dnl =========================
173 if test "$ax_cv_lib_readline" = "no"; then
174 AC_MSG_ERROR([no readline compatible library found])
176 if test "$ax_cv_lib_readline_history" = "no"; then
177 AC_MSG_WARN([readline library has no history functionality])
180 dnl ========================
181 dnl = checking for ncurses =
182 dnl ========================
183 if test "$unicode" = "yes" ; then
184 curses_config_bin="ncursesw6-config ncursesw5-config"
185 AC_DEFINE([NCMPCPP_UNICODE], [1], [enables unicode support])
187 curses_config_bin="ncurses6-config ncurses5-config"
190 AC_PATH_PROGS(CURSES_CONFIG, $curses_config_bin)
191 if test "$CURSES_CONFIG" != "" ; then
192 CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
193 LIBS="$LIBS `$CURSES_CONFIG --libs`"
195 AC_CHECK_LIB(ncursesw, initscr,
200 AC_CHECK_LIB($curses_lib, initscr,
201 if test "$CURSES_CONFIG" = "" ; then
202 LIBS="$LIBS -l$curses_lib"
205 AC_MSG_ERROR([$curses_lib library is required])
207 AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing curses.h header]))
209 dnl ======================
210 dnl = checking for fftw3 =
211 dnl ======================
212 if test "$visualizer" = "yes" ; then
213 if test "$fftw" != "no" ; then
214 PKG_CHECK_MODULES([fftw3], [fftw3 >= 3], [
216 AC_SUBST(fftw3_CFLAGS)
217 CPPFLAGS="$CPPFLAGS $fftw3_CFLAGS"
218 AC_CHECK_HEADERS([fftw3.h],
219 LIBS="$LIBS $fftw3_LIBS"
221 if test "$fftw" = "yes" ; then
222 AC_MSG_ERROR([missing fftw3.h header])
226 if test "$fftw" = "yes" ; then
227 AC_MSG_ERROR([fftw3 library is required!])
231 AC_DEFINE([ENABLE_VISUALIZER], [1], [enables music visualizer screen])
234 dnl ========================
235 dnl = checking for libcurl =
236 dnl ========================
237 PKG_CHECK_MODULES([libcurl], [libcurl], [
238 AC_SUBST(libcurl_CFLAGS)
239 AC_SUBST(libcurl_LIBS)
240 CPPFLAGS="$CPPFLAGS $libcurl_CFLAGS"
241 AC_CHECK_HEADERS([curl/curl.h],
242 LIBS="$LIBS $libcurl_LIBS"
244 AC_MSG_ERROR([missing curl/curl.h header])
247 AC_MSG_ERROR([libcurl is required!])
250 dnl AC_PATH_PROG(CURL_CONFIG, curl-config)
251 dnl if test "$CURL_CONFIG" != "" ; then
252 dnl CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
253 dnl AC_CHECK_LIB(curl, curl_easy_init, LIBS="$LIBS `$CURL_CONFIG --libs`",
254 dnl if test "$curl" = "yes" ; then
255 dnl AC_MSG_ERROR([curl library is required])
258 dnl AC_CHECK_HEADERS([curl/curl.h], ,
259 dnl if test "$curl" = "yes" ; then
260 dnl AC_MSG_ERROR([missing curl.h header])
264 dnl AC_CHECK_LIB(curl, curl_easy_init, LIBS="$LIBS -lcurl",
265 dnl if test "$curl" = "yes" ; then
266 dnl AC_MSG_ERROR([curl library is required])
271 dnl =======================
272 dnl = checking for taglib =
273 dnl =======================
274 if test "$taglib" != "no" ; then
275 AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
276 if test "$TAGLIB_CONFIG" != "" ; then
277 CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
278 LIBS="$LIBS `$TAGLIB_CONFIG --libs`"
279 AC_CHECK_HEADERS([taglib.h], ,
280 if test "$taglib" = "yes" ; then
281 AC_MSG_ERROR([missing taglib.h header])
285 if test "$taglib" = "yes" ; then
286 AC_MSG_ERROR([taglib-config executable is missing])
291 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])