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 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
|
AC_INIT([ncmpcpp], [0.9.2])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
AC_PREREQ(2.59)
AC_LANG_CPLUSPLUS
AC_PROG_CXX
AC_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_WITH(fftw, AS_HELP_STRING([--with-fftw], [Enable fftw support (required for frequency spectrum vizualization) @<:@default=auto@:>@]), [fftw=$withval], [fftw=auto])
AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto])
AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable LTO (link time optimization) @<:@default=yes@:>@]), [lto=$withval], [lto=yes])
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
# -flto
if test "$lto" != "no"; then
AC_MSG_CHECKING([whether compiler supports -flto])
old_CXXFLAGS="$CXXFLAGS"
# support specifying the number of threads
if test "$lto" != "yes"; then
flto="-flto=$lto"
else
flto="-flto"
fi
CXXFLAGS="$flto"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]])],
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
flto=""
)
CXXFLAGS="$old_CXXFLAGS $flto"
fi
# -ftree-vectorize
AC_MSG_CHECKING([whether compiler supports -ftree-vectorize])
old_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="-ftree-vectorize"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]])],
AC_MSG_RESULT([yes])
tree_vectorize="-ftree-vectorize",
AC_MSG_RESULT([no])
tree_vectorize=""
)
CXXFLAGS="$old_CXXFLAGS $tree_vectorize"
# -ffast-math
AC_MSG_CHECKING([whether compiler supports -ffast-math])
old_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="-ffast-math"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]])],
AC_MSG_RESULT([yes])
fast_math="-ffast-math",
AC_MSG_RESULT([no])
fast_math=""
)
CXXFLAGS="$old_CXXFLAGS $fast_math"
# -std=c++14
AC_MSG_CHECKING([whether compiler supports -std=c++14])
old_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="-std=c++14"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]])],
AC_MSG_RESULT([yes])
std_cpp14="-std=c++14",
AC_MSG_RESULT([no])
AC_MSG_ERROR([[Your compiler doesn't seem to support C++14, please upgrade (GCC >= 5)]])
)
CXXFLAGS="$old_CXXFLAGS $std_cpp14"
# generic lambda expressions support
AC_MSG_CHECKING([whether compiler supports generic lambda expressions])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[auto f = [](auto n) { return n*n; }; f(7);]])],
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
AC_MSG_ERROR([[Your compiler doesn't seem to support generic lambda expressions, please upgrade (GCC >= 5)]])
)
# boost
BOOST_REQUIRE([1.60])
AC_SUBST(BOOST_CPPFLAGS)
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
BOOST_STRING_ALGO
BOOST_FORMAT
BOOST_HASH
BOOST_CONVERSION
BOOST_MATH
BOOST_OPTIONAL
BOOST_RANGE
BOOST_TOKENIZER
BOOST_TUPLE
BOOST_VARIANT
BOOST_DATE_TIME
AC_SUBST(BOOST_DATE_TIME_LDFLAGS)
AC_SUBST(BOOST_DATE_TIME_LIBS)
LDFLAGS="$LDFLAGS $BOOST_DATE_TIME_LDFLAGS"
LIBS="$LIBS $BOOST_DATE_TIME_LIBS"
BOOST_FILESYSTEM
AC_SUBST(BOOST_FILESYSTEM_LDFLAGS)
AC_SUBST(BOOST_FILESYSTEM_LIBS)
LDFLAGS="$LDFLAGS $BOOST_FILESYSTEM_LDFLAGS"
LIBS="$LIBS $BOOST_FILESYSTEM_LIBS"
BOOST_LOCALE
AC_SUBST(BOOST_LOCALE_LDFLAGS)
AC_SUBST(BOOST_LOCALE_LIBS)
LDFLAGS="$LDFLAGS $BOOST_LOCALE_LDFLAGS"
LIBS="$LIBS $BOOST_LOCALE_LIBS"
BOOST_PROGRAM_OPTIONS
AC_SUBST(BOOST_PROGRAM_OPTIONS_LDFLAGS)
AC_SUBST(BOOST_PROGRAM_OPTIONS_LIBS)
LDFLAGS="$LDFLAGS $BOOST_PROGRAM_OPTIONS_LDFLAGS"
LIBS="$LIBS $BOOST_PROGRAM_OPTIONS_LIBS"
BOOST_REGEX
AC_SUBST(BOOST_REGEX_LDFLAGS)
AC_SUBST(BOOST_REGEX_LIBS)
LDFLAGS="$LDFLAGS $BOOST_REGEX_LDFLAGS"
LIBS="$LIBS $BOOST_REGEX_LIBS"
BOOST_THREAD
AC_SUBST(BOOST_THREAD_LDFLAGS)
AC_SUBST(BOOST_THREAD_LIBS)
LDFLAGS="$LDFLAGS $BOOST_THREAD_LDFLAGS"
LIBS="$LIBS $BOOST_THREAD_LIBS"
# icu
AH_TEMPLATE([BOOST_REGEX_ICU], [boost.regex was compiled with ICU support])
PKG_CHECK_MODULES([ICU], [icu-i18n icu-uc], [
old_CPPFLAGS="$CPPFLAGS"
old_LIBS="$LIBS"
AC_SUBST(ICU_CFLAGS)
AC_SUBST(ICU_LIBS)
CPPFLAGS="$CPPFLAGS $ICU_CFLAGS -DU_USING_ICU_NAMESPACE=0"
LIBS="$LIBS $ICU_LIBS"
AC_MSG_CHECKING([whether boost.regex was compiled with ICU support])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <boost/regex/icu.hpp>
], [boost::u32regex rx = boost::make_u32regex("foo"); if (boost::u32regex_search("foobar", rx)) { }])],
AC_MSG_RESULT([yes])
AC_DEFINE([BOOST_REGEX_ICU], [1]),
AC_MSG_RESULT([no])
CPPFLAGS="$old_CPPFLAGS"
LIBS="$old_LIBS",
)
], [[]])
# various headers
AC_CHECK_HEADERS([netinet/tcp.h netinet/in.h], , AC_MSG_ERROR(vital headers missing))
AC_CHECK_HEADERS([langinfo.h], , AC_MSG_WARN(locale detection disabled))
# libmpdclient2
PKG_CHECK_MODULES([libmpdclient], [libmpdclient >= 2.8], [
AC_SUBST(libmpdclient_CFLAGS)
AC_SUBST(libmpdclient_LIBS)
CPPFLAGS="$CPPFLAGS $libmpdclient_CFLAGS"
AC_CHECK_HEADERS([mpd/client.h],
LIBS="$LIBS $libmpdclient_LIBS"
,
AC_MSG_ERROR([missing mpd/client.h header])
)
],
AC_MSG_ERROR([libmpdclient >= 2.8 is required!])
)
# readline
AX_LIB_READLINE
if test "$ax_cv_lib_readline" = "no"; then
AC_MSG_ERROR([no readline compatible library found])
fi
if test "$ax_cv_lib_readline_history" = "no"; then
AC_MSG_WARN([readline library has no history functionality])
fi
# pthread
AC_CHECK_LIB(pthread, pthread_create, LIBS="$LIBS -lpthread",
AC_MSG_ERROR([pthread library is required])
)
# ncursesw
PKG_CHECK_MODULES([ncursesw], [ncursesw], [
AC_SUBST(ncursesw_CFLAGS)
AC_SUBST(ncursesw_LIBS)
CPPFLAGS="$CPPFLAGS $ncursesw_CFLAGS"
AC_CHECK_HEADERS([curses.h],
LIBS="$LIBS $ncursesw_LIBS"
,
AC_MSG_ERROR([missing curses.h header])
)
AC_CHECK_LIB(ncursesw, initscr, , AC_MSG_ERROR([ncursesw doesn't provide initscr]))
AC_MSG_CHECKING([whether curses.h exposes wide-char functions by default])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <curses.h>
], [waddnwstr(stdscr, L"123", 3)])],
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED",
)
],
AC_MSG_ERROR([ncursesw is required!])
)
# fftw3
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],
LIBS="$LIBS $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
# libcurl
PKG_CHECK_MODULES([libcurl], [libcurl], [
AC_SUBST(libcurl_CFLAGS)
AC_SUBST(libcurl_LIBS)
CPPFLAGS="$CPPFLAGS $libcurl_CFLAGS"
AC_CHECK_HEADERS([curl/curl.h],
LIBS="$LIBS $libcurl_LIBS"
,
AC_MSG_ERROR([missing curl/curl.h header])
)
],
AC_MSG_ERROR([libcurl is required!])
)
# taglib
if test "$taglib" != "no" ; then
AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
if test "$TAGLIB_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
LIBS="$LIBS `$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
|