remove remaining exclamation marks from messages
[ncmpcpp.git] / configure.in
blobe0fc623bc53321847b9f82d60d78038a27f774c0
1 AC_INIT(configure.in)
3 AM_CONFIG_HEADER(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(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(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto])
22 if test "$outputs" = "yes"; then
23         AC_DEFINE([ENABLE_OUTPUTS], [1], [enables outputs screen])
26 if test "$clock" = "yes"; then
27         AC_DEFINE([ENABLE_CLOCK], [1], [enables clock screen])
30 dnl =====================================
31 dnl = checking for -fno-exceptions flag =
32 dnl =====================================
33 AC_MSG_CHECKING([whether compiler supports -fno-exceptions])
34 old_CXXFLAGS="$CXXFLAGS"
35 CXXFLAGS="-fno-exceptions"
36 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]])],
37         AC_MSG_RESULT([yes])
38                 no_exceptions="-fno-exceptions",
39         AC_MSG_RESULT([no])
41 CXXFLAGS="$old_CXXFLAGS $no_exceptions"
43 dnl ================================
44 dnl = checking for -std=c++0x flag =
45 dnl ================================
46 AC_MSG_CHECKING([whether compiler supports -std=c++0x])
47 old_CXXFLAGS="$CXXFLAGS"
48 CXXFLAGS="-std=c++0x"
49 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]])],
50         AC_MSG_RESULT([yes])
51                 std_cpp0x="-std=c++0x",
52         AC_MSG_RESULT([no])
53                 AC_MSG_ERROR([[Your compiler doesn't seem to support C++0x, please upgrade (GCC >= 4.5)]])
55 CXXFLAGS="$old_CXXFLAGS $std_cpp0x"
57 dnl ==========================================
58 dnl = checking for initializer lists support =
59 dnl ==========================================
60 AC_MSG_CHECKING([whether compiler supports initializer lists])
61 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <vector>], [[std::vector<int> test = { 1, 2, 3 }; test.push_back(4);]])],
62         AC_MSG_RESULT([yes]),
63         AC_MSG_RESULT([no])
64                 AC_MSG_ERROR([[Your compiler doesn't seem to support initializer lists, please upgrade (GCC >= 4.5)]])
67 dnl =====================================
68 dnl = checking for auto keyword support =
69 dnl =====================================
70 AC_MSG_CHECKING([whether compiler supports auto keyword])
71 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[auto test = new int; *test = 1;]])],
72         AC_MSG_RESULT([yes]),
73         AC_MSG_RESULT([no])
74                 AC_MSG_ERROR([[Your compiler doesn't seem to support auto keyword, please upgrade (GCC >= 4.5)]])
77 dnl =========================================
78 dnl = checking for lambda functions support =
79 dnl =========================================
80 AC_MSG_CHECKING([whether compiler supports lambda functions])
81 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <functional>], [[int a = 5; std::function<int(int)> f = [&a](int b) { return a + b; }; f(8);]])],
82         AC_MSG_RESULT([yes]),
83         AC_MSG_RESULT([no])
84                 AC_MSG_ERROR([[Your compiler doesn't seem to support lambda functions, please upgrade (GCC >= 4.5)]])
87 dnl =========================================
88 dnl = checking for override keyword support =
89 dnl =========================================
90 AH_TEMPLATE([OVERRIDE], [override keyword used in C++11])
91 AC_MSG_CHECKING([whether compiler supports override keyword])
92 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[struct A { virtual void foo() { } }; struct B : public A { virtual void foo() override { } };]], [])],
93         AC_MSG_RESULT([yes])
94                 AC_DEFINE([OVERRIDE], [override]),
95         AC_MSG_RESULT([no])
96                 AC_DEFINE([OVERRIDE], []),
99 dnl ==============================
100 dnl = checking for regex (win32) =
101 dnl ==============================
102 AC_CHECK_LIB(regex, regcomp, LDFLAGS="$LDFLAGS -lregex", )
104 dnl ================================
105 dnl = checking for various headers =
106 dnl ================================
107 AC_CHECK_HEADERS([dirent.h regex.h], , AC_MSG_ERROR(vital headers missing))
108 AC_CHECK_HEADERS([langinfo.h], , AC_MSG_WARN(locale detection disabled))
110 dnl ==============================
111 dnl = checking for libmpdclient2 =
112 dnl ==============================
113 PKG_CHECK_MODULES([libmpdclient], [libmpdclient >= 2.8], [
114         AC_SUBST(libmpdclient_LIBS)
115         AC_SUBST(libmpdclient_CFLAGS)
116         CPPFLAGS="$CPPFLAGS $libmpdclient_CFLAGS"
117         AC_CHECK_HEADERS([mpd/client.h],
118                 LDFLAGS="$LDFLAGS $libmpdclient_LIBS"
119         ,
120                 AC_MSG_ERROR([missing mpd/client.h header])
121         )
123         AC_MSG_ERROR([libmpdclient >= 2.8 is required!])
126 dnl ========================
127 dnl = checking for pthread =
128 dnl ========================
129 AC_CHECK_HEADERS([pthread.h],
130         AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread",
131                 AC_MSG_ERROR([pthread.h found but there is no pthread library to make use of])
132         ),
135 dnl ======================
136 dnl = checking for iconv =
137 dnl ======================
138 if test "$iconv" != "no" ; then
139         AC_CHECK_HEADERS([iconv.h],
140                 AC_MSG_CHECKING([whether iconv takes const char **])
141                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <iconv.h>]], [[iconv(0, (const char **)0, 0, 0, 0);]])],
142                         AC_MSG_RESULT([yes]) AC_DEFINE([ICONV_CONST], [const], [pass const pointer to iconv]),
143                         AC_MSG_RESULT([no]) AC_DEFINE([ICONV_CONST], [], [pass non-const pointer to iconv]))
144                 AC_CHECK_LIB(iconv, libiconv, LDFLAGS="$LDFLAGS -liconv", )
145         ,
146         if test "$iconv" = "yes"; then
147                 AC_MSG_ERROR([iconv.h header is required])
148         fi
149         )
152 dnl ========================
153 dnl = checking for ncurses =
154 dnl ========================
155 if test "$pdcurses" = "no" ; then
156         if test "$unicode" = "yes" ; then
157                 curses_config_bin="ncursesw6-config ncursesw5-config"
158                 AC_DEFINE([NCMPCPP_UNICODE], [1], [enables unicode support])
159         else
160                 curses_config_bin="ncurses6-config ncurses5-config"
161         fi
162 else
163         if test "$pdcurses" = "yes" ; then
164                 pdcurses_lib=XCurses
165                 curses_config_bin=xcurses-config
166         else
167                 pdcurses_lib=$pdcurses
168         fi
169         AC_DEFINE([USE_PDCURSES], [1], [enables pdcurses support])
171 AC_PATH_PROGS(CURSES_CONFIG, $curses_config_bin)
172 if test "$CURSES_CONFIG" != "" ; then
173         CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
174         LDFLAGS="$LDFLAGS `$CURSES_CONFIG --libs`"
176 if test "$pdcurses" = "no" ; then
177         AC_CHECK_LIB(ncursesw, initscr,
178                 curses_lib=ncursesw,
179                 curses_lib=ncurses
180         )
181 else
182         curses_lib=$pdcurses_lib
184 AC_CHECK_LIB($curses_lib, initscr,
185         if test "$CURSES_CONFIG" = "" ; then
186                 LDFLAGS="$LDFLAGS -l$curses_lib"
187         fi
188         ,
189         AC_MSG_ERROR([$curses_lib library is required])
190         )
191 if test "$pdcurses" != "no" ; then
192         AC_CHECK_LIB($curses_lib, Xinitscr, AC_DEFINE([XCURSES], [1], [x11 pdcurses available]), )
194 AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing curses.h header]))
196 dnl ======================
197 dnl = checking for fftw3 =
198 dnl ======================
199 if test "$visualizer" = "yes" ; then
200         if test "$fftw" != "no" ; then
201                 PKG_CHECK_MODULES([fftw3], [fftw3 >= 3], [
202                         AC_SUBST(fftw3_LIBS)
203                         AC_SUBST(fftw3_CFLAGS)
204                         CPPFLAGS="$CPPFLAGS $fftw3_CFLAGS"
205                         AC_CHECK_HEADERS([fftw3.h],
206                                 LDFLAGS="$LDFLAGS $fftw3_LIBS"
207                         ,
208                                 if test "$fftw" = "yes" ; then
209                                         AC_MSG_ERROR([missing fftw3.h header])
210                                 fi
211                         )
212                 ],
213                         if test "$fftw" = "yes" ; then
214                                 AC_MSG_ERROR([fftw3 library is required!])
215                         fi
216                 )
217         fi
218         AC_DEFINE([ENABLE_VISUALIZER], [1], [enables music visualizer screen])
221 dnl =====================
222 dnl = checking for curl =
223 dnl =====================
224 if test "$curl" != "no" ; then
225         AC_PATH_PROG(CURL_CONFIG, curl-config)
226         if test "$CURL_CONFIG" != "" ; then
227                 CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
228                 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS `$CURL_CONFIG --libs`",
229                         if test "$curl" = "yes" ; then
230                                 AC_MSG_ERROR([curl library is required])
231                         fi
232                 )
233                 AC_CHECK_HEADERS([curl/curl.h], ,
234                         if test "$curl" = "yes" ; then
235                                 AC_MSG_ERROR([missing curl.h header])
236                         fi
237                 )
238         else
239                 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS -lcurl",
240                         if test "$curl" = "yes" ; then
241                                 AC_MSG_ERROR([curl library is required])
242                         fi
243                 )
244         fi
247 dnl =======================
248 dnl = checking for taglib =
249 dnl =======================
250 if test "$taglib" != "no" ; then
251         AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
252         if test "$TAGLIB_CONFIG" != "" ; then
253                 CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
254                 LDFLAGS="$LDFLAGS `$TAGLIB_CONFIG --libs`"
255                 AC_CHECK_HEADERS([taglib.h], ,
256                         if test "$taglib" = "yes" ; then
257                                 AC_MSG_ERROR([missing taglib.h header])
258                         fi
259                 )
260         else
261                 if test "$taglib" = "yes" ; then
262                         AC_MSG_ERROR([taglib-config executable is missing])
263                 fi
264         fi
267 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
268 AC_OUTPUT