settings: provide a way to disable asking for locked screen's width
[ncmpcpp.git] / configure.in
blob30ff3f1eb560ac3d51a2e67434a08c6380c394bd
1 AC_INIT(configure.in)
3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(ncmpcpp, 0.5.9_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         ,
40         AC_MSG_RESULT([no])
42 CXXFLAGS="$old_CXXFLAGS $no_exceptions"
45 dnl ====================================
46 dnl = checking for win32 related stuff =
47 dnl ====================================
48 AC_CHECK_LIB(ws2_32, _head_libws2_32_a, LDFLAGS="$LDFLAGS -lws2_32", )
49 AC_CHECK_LIB(regex, regcomp, LDFLAGS="$LDFLAGS -lregex", )
51 dnl ================================
52 dnl = checking for various headers =
53 dnl ================================
54 AC_CHECK_HEADERS([dirent.h regex.h], , AC_MSG_ERROR(vital headers missing))
55 AC_CHECK_HEADERS([langinfo.h], , AC_MSG_WARN(locale detection disabled))
57 dnl ==============================
58 dnl = checking for libmpdclient2 =
59 dnl ==============================
60 PKG_CHECK_MODULES([libmpdclient], [libmpdclient >= 2.1], [
61         AC_SUBST(libmpdclient_LIBS)
62         AC_SUBST(libmpdclient_CFLAGS)
63         CPPFLAGS="$CPPFLAGS $libmpdclient_CFLAGS"
64         AC_CHECK_HEADERS([mpd/client.h],
65                 LDFLAGS="$LDFLAGS $libmpdclient_LIBS"
66         ,
67                 AC_MSG_ERROR([missing mpd/client.h header])
68         )
70         AC_MSG_ERROR([libmpdclient >= 2.1 is required!])
73 dnl ========================
74 dnl = checking for pthread =
75 dnl ========================
76 AC_CHECK_HEADERS([pthread.h],
77         AC_CHECK_LIB(pthread, pthread_create, LDFLAGS="$LDFLAGS -lpthread",
78                 AC_MSG_ERROR([pthread.h found but there is no pthread library to make use of])
79         ),
82 dnl ======================
83 dnl = checking for iconv =
84 dnl ======================
85 if test "$iconv" != "no" ; then
86         AC_CHECK_HEADERS([iconv.h],
87                 AC_MSG_CHECKING([whether iconv takes const char **])
88                 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <iconv.h>]], [[iconv(0, (const char **)0, 0, 0, 0);]]),
89                         AC_MSG_RESULT([yes]) AC_DEFINE([ICONV_CONST], [const], [pass const pointer to iconv]),
90                         AC_MSG_RESULT([no]) AC_DEFINE([ICONV_CONST], [], [pass non-const pointer to iconv]))
91                 AC_CHECK_LIB(iconv, libiconv, LDFLAGS="$LDFLAGS -liconv", )
92         ,
93         if test "$iconv" = "yes"; then
94                 AC_MSG_ERROR([iconv.h header is required])
95         fi
96         )
99 dnl ========================
100 dnl = checking for ncurses =
101 dnl ========================
102 if test "$pdcurses" = "no" ; then
103         if test "$unicode" = "yes" ; then
104                 curses_config_bin="ncursesw6-config ncursesw5-config"
105                 AC_DEFINE([_UTF8], [1], [enables unicode support])
106         else
107                 curses_config_bin="ncurses6-config ncurses5-config"
108         fi
109 else
110         if test "$pdcurses" = "yes" ; then
111                 pdcurses_lib=XCurses
112                 curses_config_bin=xcurses-config
113         else
114                 pdcurses_lib=$pdcurses
115         fi
116         AC_DEFINE([USE_PDCURSES], [1], [enables pdcurses support])
118 AC_PATH_PROGS(CURSES_CONFIG, $curses_config_bin)
119 if test "$CURSES_CONFIG" != "" ; then
120         CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags`"
121         LDFLAGS="$LDFLAGS `$CURSES_CONFIG --libs`"
123 if test "$pdcurses" = "no" ; then
124         AC_CHECK_LIB(ncursesw, initscr,
125                 curses_lib=ncursesw,
126                 curses_lib=ncurses
127         )
128 else
129         curses_lib=$pdcurses_lib
131 AC_CHECK_LIB($curses_lib, initscr,
132         if test "$CURSES_CONFIG" = "" ; then
133                 LDFLAGS="$LDFLAGS -l$curses_lib"
134         fi
135         ,
136         AC_MSG_ERROR([$curses_lib library is required])
137         )
138 if test "$pdcurses" != "no" ; then
139         AC_CHECK_LIB($curses_lib, Xinitscr, AC_DEFINE([XCURSES], [1], [x11 pdcurses available]), )
141 AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing curses.h header]))
143 dnl ======================
144 dnl = checking for fftw3 =
145 dnl ======================
146 if test "$visualizer" = "yes" ; then
147         if test "$fftw" != "no" ; then
148                 PKG_CHECK_MODULES([fftw3], [fftw3 >= 3], [
149                         AC_SUBST(fftw3_LIBS)
150                         AC_SUBST(fftw3_CFLAGS)
151                         CPPFLAGS="$CPPFLAGS $fftw3_CFLAGS"
152                         AC_CHECK_HEADERS([fftw3.h],
153                                 LDFLAGS="$LDFLAGS $fftw3_LIBS"
154                         ,
155                                 if test "$fftw" = "yes" ; then
156                                         AC_MSG_ERROR([missing fftw3.h header])
157                                 fi
158                         )
159                 ],
160                         if test "$fftw" = "yes" ; then
161                                 AC_MSG_ERROR([fftw3 library is required!])
162                         fi
163                 )
164         fi
165         AC_DEFINE([ENABLE_VISUALIZER], [1], [enables music visualizer screen])
168 dnl =====================
169 dnl = checking for curl =
170 dnl =====================
171 if test "$curl" != "no" ; then
172         AC_PATH_PROG(CURL_CONFIG, curl-config)
173         if test "$CURL_CONFIG" != "" ; then
174                 CPPFLAGS="$CPPFLAGS `$CURL_CONFIG --cflags`"
175                 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS `$CURL_CONFIG --libs`",
176                         if test "$curl" = "yes" ; then
177                                 AC_MSG_ERROR([curl library is required])
178                         fi
179                 )
180                 AC_CHECK_HEADERS([curl/curl.h], ,
181                         if test "$curl" = "yes" ; then
182                                 AC_MSG_ERROR([missing curl.h header])
183                         fi
184                 )
185         else
186                 AC_CHECK_LIB(curl, curl_easy_init, LDFLAGS="$LDFLAGS -lcurl",
187                         if test "$curl" = "yes" ; then
188                                 AC_MSG_ERROR([curl library is required])
189                         fi
190                 )
191         fi
195 dnl =======================
196 dnl = checking for taglib =
197 dnl =======================
198 if test "$taglib" != "no" ; then
199         AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
200         if test "$TAGLIB_CONFIG" != "" ; then
201                 CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
202                 LDFLAGS="$LDFLAGS `$TAGLIB_CONFIG --libs`"
203                 AC_CHECK_HEADERS([taglib.h], ,
204                         if test "$taglib" = "yes" ; then
205                                 AC_MSG_ERROR([missing taglib.h header])
206                         fi
207                 )
208         else
209                 if test "$taglib" = "yes" ; then
210                         AC_MSG_ERROR([taglib-config executable is missing])
211                 fi
212         fi
215 AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
216 AC_OUTPUT