1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
AC_INIT(configure.in)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(ncmpcpp, 0.5.9_pre)
AC_PREREQ(2.59)
AC_LANG_CPLUSPLUS
AC_PROG_CXX
AM_PROG_LIBTOOL
AC_ARG_ENABLE(outputs, AS_HELP_STRING([--enable-outputs], [Enable outputs screen @<:@default=no@:>@]), [outputs=$enableval], [outputs=no])
AC_ARG_ENABLE(visualizer, AS_HELP_STRING([--enable-visualizer], [Enable music visualizer screen @<:@default=no@:>@]), [visualizer=$enableval], [visualizer=no])
AC_ARG_ENABLE(clock, AS_HELP_STRING([--enable-clock], [Enable clock screen @<:@default=no@:>@]), [clock=$enableval], [clock=no])
AC_ARG_ENABLE(unicode, AS_HELP_STRING([--enable-unicode], [Enable utf8 support @<:@default=yes@:>@]), [unicode=$enableval], [unicode=yes])
AC_ARG_WITH(curl, AS_HELP_STRING([--with-curl], [Enable fetching lyrics from the Internet @<:@default=auto@:>@]), [curl=$withval], [curl=auto])
AC_ARG_WITH(fftw, AS_HELP_STRING([--with-fftw], [Enable fftw support (required for frequency spectrum vizualization) @<:@default=auto@:>@]), [fftw=$withval], [fftw=auto])
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])
AC_ARG_WITH(pdcurses, AS_HELP_STRING([--with-pdcurses[=LIBNAME]], [Link against pdcurses instead of ncurses @<:@default=XCurses@:>@]), [pdcurses=$withval], [pdcurses=no])
AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto])
if test "$outputs" = "yes"; then
AC_DEFINE([ENABLE_OUTPUTS], [1], [enables outputs screen])
fi
if test "$clock" = "yes"; then
AC_DEFINE([ENABLE_CLOCK], [1], [enables clock screen])
fi
dnl =====================================
dnl = checking for -fno-exceptions flag =
dnl =====================================
AC_MSG_CHECKING([whether compiler supports -fno-exceptions])
old_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="-fno-exceptions"
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ ]]),
AC_MSG_RESULT([yes])
no_exceptions="-fno-exceptions"
,
AC_MSG_RESULT([no])
)
CXXFLAGS="$old_CXXFLAGS $no_exceptions"
dnl ====================================
dnl = checking for win32 related stuff =
dnl ====================================
AC_CHECK_LIB(ws2_32, _head_libws2_32_a, LDFLAGS="$LDFLAGS -lws2_32", )
AC_CHECK_LIB(regex, regcomp, LDFLAGS="$LDFLAGS -lregex", )
dnl ================================
dnl = checking for various headers =
dnl ================================
AC_CHECK_HEADERS([dirent.h regex.h], , AC_MSG_ERROR(vital headers missing))
AC_CHECK_HEADERS([langinfo.h], , AC_MSG_WARN(locale detection disabled))
dnl ==============================
dnl = checking for libmpdclient2 =
dnl ==============================
PKG_CHECK_MODULES([libmpdclient], [libmpdclient >= 2.1], [
AC_SUBST(libmpdclient_LIBS)
AC_SUBST(libmpdclient_CFLAGS)
CPPFLAGS="$CPPFLAGS $libmpdclient_CFLAGS"
AC_CHECK_HEADERS([mpd/client.h],
LDFLAGS="$LDFLAGS $libmpdclient_LIBS"
,
AC_MSG_ERROR([missing mpd/client.h header])
)
],
AC_MSG_ERROR([libmpdclient >= 2.1 is required!])
)
dnl ========================
dnl = checking for pthread =
dnl ========================
AC_CHECK_HEADERS([pthread.h],
AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread",
AC_MSG_ERROR([pthread.h found but there is no pthread library to make use of])
),
)
dnl ======================
dnl = checking for iconv =
dnl ======================
if test "$iconv" != "no" ; then
AC_CHECK_HEADERS([iconv.h],
AC_MSG_CHECKING([whether iconv takes const char **])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <iconv.h>]], [[iconv(0, (const char **)0, 0, 0, 0);]]),
AC_MSG_RESULT([yes]) AC_DEFINE([ICONV_CONST], [const], [pass const pointer to iconv]),
AC_MSG_RESULT([no]) AC_DEFINE([ICONV_CONST], [], [pass non-const pointer to iconv]))
AC_CHECK_LIB(iconv, libiconv, LDFLAGS="$LDFLAGS -liconv", )
,
if test "$iconv" = "yes"; then
AC_MSG_ERROR([iconv.h header is required])
fi
)
fi
dnl ========================
dnl = checking for ncurses =
dnl ========================
if test "$pdcurses" = "no" ; then
if test "$unicode" = "yes" ; then
curses_config_bin="ncursesw6-config ncursesw5-config"
AC_DEFINE([_UTF8], [1], [enables unicode support])
else
curses_config_bin="ncurses6-config ncurses5-config"
fi
else
if test "$pdcurses" = "yes" ; then
pdcurses_lib=XCurses
curses_config_bin=xcurses-config
else
pdcurses_lib=$pdcurses
fi
AC_DEFINE([USE_PDCURSES], [1], [enables pdcurses support])
fi
AC_PATH_PROGS(CURSES_CONFIG, $curses_config_bin)
if test "$CURSES_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
LDFLAGS="$LDFLAGS `$CURSES_CONFIG --libs`"
fi
if test "$pdcurses" = "no" ; then
AC_CHECK_LIB(ncursesw, initscr,
curses_lib=ncursesw,
curses_lib=ncurses
)
else
curses_lib=$pdcurses_lib
fi
AC_CHECK_LIB($curses_lib, initscr,
if test "$CURSES_CONFIG" = "" ; then
LDFLAGS="$LDFLAGS -l$curses_lib"
fi
,
AC_MSG_ERROR([$curses_lib library is required])
)
if test "$pdcurses" != "no" ; then
AC_CHECK_LIB($curses_lib, Xinitscr, AC_DEFINE([XCURSES], [1], [x11 pdcurses available]), )
fi
AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing curses.h header]))
dnl ======================
dnl = checking for fftw3 =
dnl ======================
if test "$visualizer" = "yes" ; then
if test "$fftw" != "no" ; then
PKG_CHECK_MODULES([fftw3], [fftw3 >= 3], [
AC_SUBST(fftw3_LIBS)
AC_SUBST(fftw3_CFLAGS)
CPPFLAGS="$CPPFLAGS $fftw3_CFLAGS"
AC_CHECK_HEADERS([fftw3.h],
LDFLAGS="$LDFLAGS $fftw3_LIBS"
,
if test "$fftw" = "yes" ; then
AC_MSG_ERROR([missing fftw3.h header])
fi
)
],
if test "$fftw" = "yes" ; then
AC_MSG_ERROR([fftw3 library is required!])
fi
)
fi
AC_DEFINE([ENABLE_VISUALIZER], [1], [enables music visualizer screen])
fi
dnl =====================
dnl = checking for curl =
dnl =====================
if test "$curl" != "no" ; then
AC_PATH_PROG(CURL_CONFIG, curl-config)
if test "$CURL_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS `$CURL_CONFIG --libs`",
if test "$curl" = "yes" ; then
AC_MSG_ERROR([curl library is required])
fi
)
AC_CHECK_HEADERS([curl/curl.h], ,
if test "$curl" = "yes" ; then
AC_MSG_ERROR([missing curl.h header])
fi
)
else
AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS -lcurl",
if test "$curl" = "yes" ; then
AC_MSG_ERROR([curl library is required])
fi
)
fi
fi
dnl =======================
dnl = checking for taglib =
dnl =======================
if test "$taglib" != "no" ; then
AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
if test "$TAGLIB_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
LDFLAGS="$LDFLAGS `$TAGLIB_CONFIG --libs`"
AC_CHECK_HEADERS([taglib.h], ,
if test "$taglib" = "yes" ; then
AC_MSG_ERROR([missing taglib.h header])
fi
)
else
if test "$taglib" = "yes" ; then
AC_MSG_ERROR([taglib-config executable is missing])
fi
fi
fi
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
AC_OUTPUT
|