1dnl Process this file with autoconf to produce a configure script. 2AC_INIT(darkice, 1.4) 3AC_CONFIG_SRCDIR(src/DarkIce.cpp) 4AM_CONFIG_HEADER(src/config.h) 5 6AM_INIT_AUTOMAKE 7 8AC_PROG_CC 9AC_PROG_CXX 10AC_PROG_INSTALL 11 12PKG_PROG_PKG_CONFIG 13 14dnl AC_STDC_HEADERS 15AC_HAVE_HEADERS(errno.h fcntl.h stdio.h stdlib.h string.h unistd.h limits.h) 16AC_HAVE_HEADERS(signal.h time.h sys/time.h sys/types.h sys/wait.h math.h) 17AC_HAVE_HEADERS(netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/stat.h) 18AC_HAVE_HEADERS(sched.h pthread.h termios.h) 19AC_HAVE_HEADERS(sys/soundcard.h sys/audio.h sys/audioio.h) 20AC_HEADER_SYS_WAIT() 21 22AC_TYPE_PID_T() 23AC_TYPE_SIZE_T() 24AC_C_BIGENDIAN() 25 26AC_CHECK_LIB(socket, socket) 27AC_CHECK_LIB(nsl, gethostbyname) 28AC_CHECK_LIB(rt, sched_getscheduler) 29 30AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO, 1, [Does function getaddrinfo exist?] )) 31 32dnl----------------------------------------------------------------------------- 33dnl funky posix threads checking, thanks to 34dnl Steven G. Johnson <stevenj@alum.mit.edu> 35dnl and Alejandro Forero Cuervo <bachue@bachue.com> 36dnl see http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html 37dnl----------------------------------------------------------------------------- 38ACX_PTHREAD(, AC_MSG_ERROR( [pthread library not found] )) 39 40SYSTEM_INCLUDE=/usr/include 41 42 43dnl----------------------------------------------------------------------------- 44dnl link the lame library if requested 45dnl----------------------------------------------------------------------------- 46AC_SUBST(LAME_CFLAGS) 47AC_SUBST(LAME_LIBS) 48 49AC_ARG_WITH(lame, 50 AS_HELP_STRING([--with-lame], [use lame for encoding mp3 streams @<:@check@:>@]), 51 [], with_lame=check) 52AC_ARG_WITH(lame-prefix, 53 AS_HELP_STRING([--with-lame-prefix=DIR], 54 [alternate location for lame @<:@/usr@:>@. 55 Look for libraries in LAME-PREFIX/lib, 56 for headers in LAME-PREFIX/include]), 57 CONFIG_LAME_PREFIX="${withval}", CONFIG_LAME_PREFIX="/usr") 58 59if test "x$with_lame" != xno ; then 60 AC_MSG_CHECKING( [for lame library at ${CONFIG_LAME_PREFIX}] ) 61 LA_SEARCH_LIB( LAME_LIB_LOC, LAME_INC_LOC, libmp3lame.a libmp3lame.so, lame/lame.h, 62 ${CONFIG_LAME_PREFIX}) 63 if test "x${LAME_LIB_LOC}" != "x" ; then 64 AC_DEFINE( HAVE_LAME_LIB, 1, [build with lame library] ) 65 if test "x${LAME_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then 66 LAME_CFLAGS="-I${LAME_INC_LOC}" 67 fi 68 LAME_LIBS="-L${LAME_LIB_LOC} -lmp3lame" 69 AC_MSG_RESULT( [found at ${CONFIG_LAME_PREFIX}] ) 70 elif test "x$with_lame" = xyes ; then 71 AC_MSG_ERROR([unable to find lame library]) 72 else 73 AC_MSG_WARN( [not found, building without lame]) 74 fi 75else 76 AC_MSG_RESULT( [building without lame] ) 77fi 78 79 80dnl----------------------------------------------------------------------------- 81dnl link the ogg vorbis libraries if requested 82dnl----------------------------------------------------------------------------- 83AC_ARG_WITH(vorbis, 84 AS_HELP_STRING([--with-vorbis], [use Ogg Vorbis for encoding vorbis streams @<:@check@:>@]), 85 [], with_vorbis=check) 86AS_CASE([$with_vorbis], 87 check, [PKG_CHECK_MODULES(VORBIS, [ogg vorbis vorbisenc], [], true)], 88 yes, [PKG_CHECK_MODULES(VORBIS, [ogg vorbis vorbisenc])], 89 AC_MSG_RESULT([building without Ogg Vorbis])) 90AS_IF(test -n "$VORBIS_LIBS", 91 AC_DEFINE(HAVE_VORBIS_LIB, 1, [build with Ogg Vorbis library])) 92 93dnl----------------------------------------------------------------------------- 94dnl link the ogg / opus libraries if requested 95dnl----------------------------------------------------------------------------- 96AC_ARG_WITH(opus, 97 AS_HELP_STRING([--with-opus], [use Ogg Opus for encoding opus streams @<:@check@:>@]), 98 [], with_opus=check) 99AS_CASE([$with_opus], 100 check, [PKG_CHECK_MODULES(OPUS, [ogg opus], [], true)], 101 yes, [PKG_CHECK_MODULES(OPUS, [ogg opus])], 102 AC_MSG_RESULT([building without Ogg Opus])) 103AS_IF(test -n "$OPUS_LIBS", 104 AC_DEFINE(HAVE_OPUS_LIB, 1, [build with Ogg Opus library])) 105 106dnl----------------------------------------------------------------------------- 107dnl link the faac library if requested 108dnl----------------------------------------------------------------------------- 109AC_SUBST(FAAC_CFLAGS) 110AC_SUBST(FAAC_LIBS) 111 112AC_ARG_WITH(faac, 113 AS_HELP_STRING([--with-faac], [use faac for encoding AAC streams @<:@check@:>@]), 114 [], with_faac=check) 115AC_ARG_WITH(faac-prefix, 116 AS_HELP_STRING([--with-faac-prefix=DIR], 117 [alternate location for faac @<:@/usr@:>@. 118 Look for libraries in FAAC-PREFIX/lib, 119 for headers in FAAC-PREFIX/include]), 120 CONFIG_FAAC_PREFIX="${withval}", CONFIG_FAAC_PREFIX="/usr") 121 122if test "x$with_faac" != xno ; then 123 AC_MSG_CHECKING( [for faac library at ${CONFIG_FAAC_PREFIX}] ) 124 LA_SEARCH_LIB( FAAC_LIB_LOC, FAAC_INC_LOC, libfaac.a libfaac.so, faac.h, 125 ${CONFIG_FAAC_PREFIX}) 126 if test "x${FAAC_LIB_LOC}" != "x" ; then 127 AC_DEFINE( HAVE_FAAC_LIB, 1, [build with faac library] ) 128 if test "x${FAAC_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then 129 FAAC_CFLAGS="-I${FAAC_INC_LOC}" 130 fi 131 FAAC_LIBS="-L${FAAC_LIB_LOC} -lfaac" 132 AC_MSG_RESULT( [found at ${CONFIG_FAAC_PREFIX}] ) 133 elif test "x$with_faac" = yes ; then 134 AC_MSG_ERROR([unable to find faac library]) 135 else 136 AC_MSG_WARN( [not found, building without faac]) 137 fi 138else 139 AC_MSG_RESULT( [building without faac] ) 140fi 141 142 143dnl----------------------------------------------------------------------------- 144dnl link the aacplus library if requested 145dnl----------------------------------------------------------------------------- 146AC_ARG_WITH(aacplus, 147 AS_HELP_STRING([--with-aacplus], [use aacplus for encoding AAC HEv2 streams @<:@check@:>@]), 148 [], with_aacplus=check) 149AS_CASE([$with_aacplus], 150 check, [PKG_CHECK_MODULES(AACPLUS, aacplus, [], true)], 151 yes, [PKG_CHECK_MODULES(AACPLUS, aacplus)], 152 AC_MSG_RESULT([building without aacplus])) 153AS_IF(test -n "$AACPLUS_LIBS", 154 AC_DEFINE(HAVE_AACPLUS_LIB, 1, [build with aacplus library])) 155 156dnl----------------------------------------------------------------------------- 157dnl link the twolame library if requested 158dnl----------------------------------------------------------------------------- 159AC_ARG_WITH(twolame, 160 AS_HELP_STRING([--with-twolame], [use twolame for encoding MP2 streams @<:@check@:>@]), 161 [], with_twolame=check) 162AS_CASE([$with_twolame], 163 check, [PKG_CHECK_MODULES(TWOLAME, twolame, [], true)], 164 yes, [PKG_CHECK_MODULES(TWOLAME, twolame)], 165 AC_MSG_RESULT([building without twolame])) 166AS_IF(test -n "$TWOLAME_LIBS", 167 AC_DEFINE(HAVE_TWOLAME_LIB, 1, [build with twolame library])) 168 169dnl----------------------------------------------------------------------------- 170dnl make sure at least one of lame and vorbis present 171dnl----------------------------------------------------------------------------- 172if test -z "x${LAME_LIBS}" \ 173 -a -z "${VORBIS_LIBS}" \ 174 -a -z "${OPUS_LIBS}" \ 175 -a -z "${FAAC_LIBS}" \ 176 -a -z "${AACPLUS_LIBS}" \ 177 -a -z "${TWOLAME_LIBS}" ; then 178 AC_MSG_ERROR([neither lame, Ogg Vorbis, opus, faac, aac+ nor twolame configured]) 179fi 180 181 182dnl----------------------------------------------------------------------------- 183dnl link ALSA sound system if requested 184dnl----------------------------------------------------------------------------- 185AC_ARG_WITH(alsa, 186 AS_HELP_STRING([--with-alsa], [use ALSA sound system @<:@check@:>@]), 187 [], with_alsa=check) 188AS_CASE([$with_alsa], 189 check, [PKG_CHECK_MODULES(ALSA, alsa, [], true)], 190 yes, [PKG_CHECK_MODULES(ALSA, alsa)], 191 AC_MSG_RESULT([building without ALSA support])) 192AS_IF(test -n "$ALSA_LIBS", 193 AC_DEFINE(HAVE_ALSA_LIB, 1, [build with ALSA sound system])) 194 195dnl----------------------------------------------------------------------------- 196dnl link PULSEAUDIO sound system if requested 197dnl----------------------------------------------------------------------------- 198AC_ARG_WITH(pulseaudio, 199 AS_HELP_STRING([--with-pulseaudio], [use PULSEAUDIO sound system @<:@check@:>@]), 200 [], with_pulseaudio=check) 201AS_CASE([$with_pulseaudio], 202 check, [PKG_CHECK_MODULES(PULSEAUDIO, libpulse-simple libpulse, [], true)], 203 yes, [PKG_CHECK_MODULES(PULSEAUDIO, libpulse-simple libpulse)], 204 AC_MSG_RESULT([building without PULSEAUDIO support])) 205AS_IF(test -n "$PULSEAUDIO_LIBS", 206 AC_DEFINE(HAVE_PULSEAUDIO_LIB, 1, [build with PULSEAUDIO sound system])) 207 208dnl----------------------------------------------------------------------------- 209dnl link JACK sound server if requested 210dnl----------------------------------------------------------------------------- 211AC_ARG_WITH(jack, 212 AS_HELP_STRING([--with-jack], [use JACK sound system @<:@check@:>@]), 213 [], with_jack=check) 214AS_CASE([$with_jack], 215 check, [PKG_CHECK_MODULES(JACK, jack, [], true)], 216 yes, [PKG_CHECK_MODULES(JACK, jack)], 217 AC_MSG_RESULT([building without JACK support])) 218AS_IF(test -n "$JACK_LIBS", 219 AC_DEFINE(HAVE_JACK_LIB, 1, [build with JACK audio server support])) 220 221dnl----------------------------------------------------------------------------- 222dnl link Secret Rabbit Code (aka libsamplerate) if requested 223dnl----------------------------------------------------------------------------- 224AC_ARG_WITH(samplerate, 225 AS_HELP_STRING([--with-samplerate], [use Secret Rabbit Code (aka libsamplerate) for samplerate conversion @<:@check@:>@]), 226 [], with_samplerate=check) 227AS_CASE([$with_samplerate], 228 check, [PKG_CHECK_MODULES(SRC, samplerate, [], true)], 229 yes, [PKG_CHECK_MODULES(SRC, samplerate)], 230 AC_MSG_RESULT([building without libsamplerate support])) 231AS_IF(test -n "$SRC_LIBS", 232 AC_DEFINE(HAVE_SRC_LIB, 1, [build with samplerate conversion through libsamplerate])) 233 234AM_CONDITIONAL(HAVE_SRC_LIB, test -n "${SRC_LIBS}") 235dnl----------------------------------------------------------------------------- 236dnl check for MSG_NOSIGNAL for the send() function in libsocket 237dnl----------------------------------------------------------------------------- 238AC_MSG_CHECKING(for MSG_NOSIGNAL) 239AC_TRY_COMPILE([#include <sys/socket.h>], [ 240 int f = MSG_NOSIGNAL; 241], [ 242 # Yes, we have it... 243 AC_MSG_RESULT(yes) 244 AC_DEFINE(HAVE_MSG_NOSIGNAL, 1, [use MSG_NOSIGNAL for send()]) 245], [ 246 # We'll have to use signals 247 AC_MSG_RESULT(no) 248]) 249 250 251dnl----------------------------------------------------------------------------- 252dnl check for POSIX real-time scheduling 253dnl----------------------------------------------------------------------------- 254AC_CHECK_FUNCS( sched_getscheduler sched_getparam ) 255 256 257dnl----------------------------------------------------------------------------- 258dnl enable compilation with debug flags 259dnl----------------------------------------------------------------------------- 260AC_SUBST(DEBUG_CXXFLAGS) 261 262AC_ARG_ENABLE(debug, 263 AS_HELP_STRING([--enable-debug], [enable debug mode @<:@no@:>@]), 264 [], enable_debug=no) 265AS_IF([test "x$enable_debug" = xyes], 266 [DEBUG_CXXFLAGS="-g" 267 AC_MSG_RESULT([compiling in debug mode])], 268 AC_MSG_RESULT([not compiling in debug mode])) 269 270AC_OUTPUT(Makefile src/Makefile man/Makefile) 271 272