3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(ncmpcpp, 0.5.1_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(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([[ ]]),
39 no_exceptions="-fno-exceptions"
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.1], [
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"
68 AC_MSG_ERROR([missing mpd/client.h header])
71 AC_MSG_ERROR([libmpdclient2 is required!])
74 dnl ======================
75 dnl = checking for iconv =
76 dnl ======================
77 if test "$iconv" != "no" ; then
78 AC_CHECK_HEADERS([iconv.h],
79 AC_MSG_CHECKING([whether iconv takes const char **])
80 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <iconv.h>]], [[iconv(0, (const char **)0, 0, 0, 0);]]),
81 AC_MSG_RESULT([yes]) AC_DEFINE([ICONV_CONST], [const], [pass const pointer to iconv]),
82 AC_MSG_RESULT([no]) AC_DEFINE([ICONV_CONST], [], [pass non-const pointer to iconv]))
83 AC_CHECK_LIB(iconv, libiconv, LDFLAGS="$LDFLAGS -liconv", )
85 if test "$iconv" = "yes"; then
86 AC_MSG_ERROR([iconv.h header is required])
91 dnl ========================
92 dnl = checking for ncurses =
93 dnl ========================
94 if test "$pdcurses" = "no" ; then
95 if test "$unicode" = "yes" ; then
96 curses_config_bin=ncursesw5-config
97 AC_DEFINE([_UTF8], [1], [enables unicode support])
99 curses_config_bin=ncurses5-config
102 if test "$pdcurses" = "yes" ; then
104 curses_config_bin=xcurses-config
106 pdcurses_lib=$pdcurses
108 AC_DEFINE([USE_PDCURSES], [1], [enables pdcurses support])
110 AC_PATH_PROG(CURSES_CONFIG, $curses_config_bin)
111 if test "$CURSES_CONFIG" != "" ; then
112 CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
113 LDFLAGS="$LDFLAGS `$CURSES_CONFIG --libs`"
115 if test "$pdcurses" = "no" ; then
116 AC_CHECK_LIB(ncursesw, initscr,
121 curses_lib=$pdcurses_lib
123 AC_CHECK_LIB($curses_lib, initscr,
124 if test "$CURSES_CONFIG" = "" ; then
125 LDFLAGS="$LDFLAGS -l$curses_lib"
128 AC_MSG_ERROR([$curses_lib library is required])
130 if test "$pdcurses" != "no" ; then
131 AC_CHECK_LIB($curses_lib, Xinitscr, AC_DEFINE([XCURSES], [1], [x11 pdcurses available]), )
133 AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing curses.h header]))
135 dnl ======================
136 dnl = checking for fftw3 =
137 dnl ======================
138 if test "$visualizer" = "yes" ; then
139 if test "$fftw" != "no" ; then
140 PKG_CHECK_MODULES([fftw3], [fftw3 >= 3], [
142 AC_SUBST(fftw3_CFLAGS)
143 CPPFLAGS="$CPPFLAGS $fftw3_CFLAGS"
144 AC_CHECK_HEADERS([fftw3.h],
145 LDFLAGS="$LDFLAGS $fftw3_LIBS"
147 if test "$fftw" = "yes" ; then
148 AC_MSG_ERROR([missing fftw3.h header])
152 if test "$fftw" = "yes" ; then
153 AC_MSG_ERROR([fftw3 library is required!])
157 AC_DEFINE([ENABLE_VISUALIZER], [1], [enables music visualizer screen])
160 dnl =================================
161 dnl = checking for curl and pthread =
162 dnl =================================
163 if test "$curl" != "no" ; then
164 if test "$threads" != "no" ; then
165 AC_CHECK_HEADERS([pthread.h], AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread",
166 if test "$threads" = "yes" ; then
167 AC_MSG_ERROR([pthread.h found but there is no pthread library to make use of])
171 AC_PATH_PROG(CURL_CONFIG, curl-config)
172 if test "$CURL_CONFIG" != "" ; then
173 CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
174 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS `$CURL_CONFIG --libs`",
175 if test "$curl" = "yes" ; then
176 AC_MSG_ERROR([curl library is required])
179 AC_CHECK_HEADERS([curl/curl.h], ,
180 if test "$curl" = "yes" ; then
181 AC_MSG_ERROR([missing curl.h header])
185 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS -lcurl",
186 if test "$curl" = "yes" ; then
187 AC_MSG_ERROR([curl library is required])
193 dnl =======================
194 dnl = checking for taglib =
195 dnl =======================
196 if test "$taglib" != "no" ; then
197 AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
198 if test "$TAGLIB_CONFIG" != "" ; then
199 CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
200 LDFLAGS="$LDFLAGS `$TAGLIB_CONFIG --libs`"
201 AC_CHECK_HEADERS([taglib.h], ,
202 if test "$taglib" = "yes" ; then
203 AC_MSG_ERROR([missing taglib.h header])
207 if test "$taglib" = "yes" ; then
208 AC_MSG_ERROR([taglib-config executable is missing])
213 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])