3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(ncmpcpp, 0.6_pre)
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"
35 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]])],
37 std_cpp0x="-std=c++0x",
39 AC_MSG_ERROR([[Your compiler doesn't seem to support C++0x, please upgrade (GCC >= 4.5)]])
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);]])],
50 AC_MSG_ERROR([[Your compiler doesn't seem to support initializer lists, please upgrade (GCC >= 4.5)]])
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;]])],
60 AC_MSG_ERROR([[Your compiler doesn't seem to support auto keyword, please upgrade (GCC >= 4.5)]])
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);]])],
70 AC_MSG_ERROR([[Your compiler doesn't seem to support lambda functions, please upgrade (GCC >= 4.5)]])
73 dnl =========================================
74 dnl = checking for override keyword support =
75 dnl =========================================
76 AH_TEMPLATE([OVERRIDE], [override keyword used in C++11])
77 AC_MSG_CHECKING([whether compiler supports override keyword])
78 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[struct A { virtual void foo() { } }; struct B : public A { virtual void foo() override { } };]], [])],
80 AC_DEFINE([OVERRIDE], [override]),
82 AC_DEFINE([OVERRIDE], []),
85 dnl =============================
86 dnl = setting boost environment =
87 dnl =============================
88 AS_IF([test -z "${BOOST_LIB_SUFFIX+x}"], [BOOST_LIB_SUFFIX=-mt])
89 AC_ARG_VAR([BOOST_LIB_SUFFIX], [Boost library name suffix [default=-mt]])
91 dnl =============================
92 dnl = checking for boost.locale =
93 dnl =============================
94 AC_CHECK_HEADERS([boost/locale/encoding.hpp], ,
95 AC_MSG_ERROR(boost/locale/encoding.hpp is missing)
97 AC_CHECK_LIB(boost_locale$BOOST_LIB_SUFFIX, main, LDFLAGS="$LDFLAGS -lboost_locale$BOOST_LIB_SUFFIX",
98 AC_MSG_ERROR([no boost.locale library found])
101 dnl ==============================
102 dnl = checking for regex (win32) =
103 dnl ==============================
104 AC_CHECK_LIB(regex, regcomp, LDFLAGS="$LDFLAGS -lregex", )
106 dnl ================================
107 dnl = checking for various headers =
108 dnl ================================
109 AC_CHECK_HEADERS([dirent.h regex.h], , AC_MSG_ERROR(vital headers missing))
110 AC_CHECK_HEADERS([langinfo.h], , AC_MSG_WARN(locale detection disabled))
112 dnl ==============================
113 dnl = checking for libmpdclient2 =
114 dnl ==============================
115 PKG_CHECK_MODULES([libmpdclient], [libmpdclient >= 2.8], [
116 AC_SUBST(libmpdclient_LIBS)
117 AC_SUBST(libmpdclient_CFLAGS)
118 CPPFLAGS="$CPPFLAGS $libmpdclient_CFLAGS"
119 AC_CHECK_HEADERS([mpd/client.h],
120 LDFLAGS="$LDFLAGS $libmpdclient_LIBS"
122 AC_MSG_ERROR([missing mpd/client.h header])
125 AC_MSG_ERROR([libmpdclient >= 2.8 is required!])
128 dnl ========================
129 dnl = checking for pthread =
130 dnl ========================
131 AC_CHECK_HEADERS([pthread.h],
132 AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread",
133 AC_MSG_ERROR([pthread.h found but there is no pthread library to make use of])
137 dnl ========================
138 dnl = checking for ncurses =
139 dnl ========================
140 if test "$pdcurses" = "no" ; then
141 if test "$unicode" = "yes" ; then
142 curses_config_bin="ncursesw6-config ncursesw5-config"
143 AC_DEFINE([NCMPCPP_UNICODE], [1], [enables unicode support])
145 curses_config_bin="ncurses6-config ncurses5-config"
148 if test "$pdcurses" = "yes" ; then
150 curses_config_bin=xcurses-config
152 pdcurses_lib=$pdcurses
154 AC_DEFINE([USE_PDCURSES], [1], [enables pdcurses support])
156 AC_PATH_PROGS(CURSES_CONFIG, $curses_config_bin)
157 if test "$CURSES_CONFIG" != "" ; then
158 CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
159 LDFLAGS="$LDFLAGS `$CURSES_CONFIG --libs`"
161 if test "$pdcurses" = "no" ; then
162 AC_CHECK_LIB(ncursesw, initscr,
167 curses_lib=$pdcurses_lib
169 AC_CHECK_LIB($curses_lib, initscr,
170 if test "$CURSES_CONFIG" = "" ; then
171 LDFLAGS="$LDFLAGS -l$curses_lib"
174 AC_MSG_ERROR([$curses_lib library is required])
176 if test "$pdcurses" != "no" ; then
177 AC_CHECK_LIB($curses_lib, Xinitscr, AC_DEFINE([XCURSES], [1], [x11 pdcurses available]), )
179 AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing curses.h header]))
181 dnl ======================
182 dnl = checking for fftw3 =
183 dnl ======================
184 if test "$visualizer" = "yes" ; then
185 if test "$fftw" != "no" ; then
186 PKG_CHECK_MODULES([fftw3], [fftw3 >= 3], [
188 AC_SUBST(fftw3_CFLAGS)
189 CPPFLAGS="$CPPFLAGS $fftw3_CFLAGS"
190 AC_CHECK_HEADERS([fftw3.h],
191 LDFLAGS="$LDFLAGS $fftw3_LIBS"
193 if test "$fftw" = "yes" ; then
194 AC_MSG_ERROR([missing fftw3.h header])
198 if test "$fftw" = "yes" ; then
199 AC_MSG_ERROR([fftw3 library is required!])
203 AC_DEFINE([ENABLE_VISUALIZER], [1], [enables music visualizer screen])
206 dnl =====================
207 dnl = checking for curl =
208 dnl =====================
209 if test "$curl" != "no" ; then
210 AC_PATH_PROG(CURL_CONFIG, curl-config)
211 if test "$CURL_CONFIG" != "" ; then
212 CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
213 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS `$CURL_CONFIG --libs`",
214 if test "$curl" = "yes" ; then
215 AC_MSG_ERROR([curl library is required])
218 AC_CHECK_HEADERS([curl/curl.h], ,
219 if test "$curl" = "yes" ; then
220 AC_MSG_ERROR([missing curl.h header])
224 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS -lcurl",
225 if test "$curl" = "yes" ; then
226 AC_MSG_ERROR([curl library is required])
232 dnl =======================
233 dnl = checking for taglib =
234 dnl =======================
235 if test "$taglib" != "no" ; then
236 AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
237 if test "$TAGLIB_CONFIG" != "" ; then
238 CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
239 LDFLAGS="$LDFLAGS `$TAGLIB_CONFIG --libs`"
240 AC_CHECK_HEADERS([taglib.h], ,
241 if test "$taglib" = "yes" ; then
242 AC_MSG_ERROR([missing taglib.h header])
246 if test "$taglib" = "yes" ; then
247 AC_MSG_ERROR([taglib-config executable is missing])
252 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])