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 278
|
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT([butt], [1.46.0], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE([subdir-objects foreign])
AC_CANONICAL_HOST
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
#predefined CXXFLAGS so AC_PROG_CXX does not add the -g flag
CXXFLAGS="$CXXFLAGS -O2"
# Compile with address sanitizer
# CXXFLAGS="$CXXFLAGS -O2 -g -fsanitize=address"
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_OBJC
LDFLAGS="$LDFLAGS -L/usr/local/lib"
# Compile with address sanitizer
#LDFLAGS="$LDFLAGS -L/usr/local/lib -fsanitize=address"
AC_ARG_WITH([radioco],
AS_HELP_STRING([--with-radioco], [Include support for Radio.co]))
AC_ARG_WITH([client],
AS_HELP_STRING([--with-client], [Build butt and butt-client]),
[with_client=yes],
[]
)
AC_ARG_WITH([butt],
AS_HELP_STRING([--without-butt], [Build only butt-client]),
[client_only=yes],
[],
)
AC_ARG_ENABLE([aac],
AS_HELP_STRING([--disable-aac], [Disable aac support]))
AS_IF([test "x$with_radioco" = "xyes"],
[
AC_DEFINE([WITH_RADIOCO], [1], [Enable support for Radio.co authentification])
])
AS_IF([test "x$client_only" = "xyes"],
[
AC_DEFINE([CLIENT_ONLY], [1], [build only butt-client])
])
AS_IF([test "x$with_client" = "xyes"],
[
AC_DEFINE([WITH_CLIENT], [1], [build butt and butt-client])
])
AS_IF([test "x$client_only" != "xyes"],
[
# Checks for libraries.
AC_CHECK_LIB([ogg], [ogg_stream_init], [],
[AC_MSG_ERROR([**** Could not find libogg ****])]
)
AC_CHECK_LIB([vorbis], [vorbis_info_init], [],
[AC_MSG_ERROR([**** Could not find libvorbis ****])]
)
AC_CHECK_LIB([vorbisenc], [vorbis_encode_init], [],
[AC_MSG_ERROR([**** Could not find libvorbisenc ****])]
)
AC_CHECK_LIB([opus], [opus_encoder_create], [],
[AC_MSG_ERROR([**** Could not find libopus ****])]
)
AC_CHECK_LIB([mp3lame], [lame_init], [],
[AC_MSG_ERROR([**** Could not find libmp3lame ****])]
)
AC_CHECK_LIB([FLAC], [FLAC__stream_encoder_new], [],
[AC_MSG_ERROR([**** Could not find libFLAC ****])]
)
AC_CHECK_LIB([portaudio], [Pa_Initialize], [],
[AC_MSG_ERROR([**** Could not find libportaudio ****])]
)
AC_CHECK_LIB([portmidi], [Pm_Initialize], [],
[AC_MSG_ERROR([**** Could not find libportmidi ****])]
)
AC_CHECK_LIB([samplerate], [src_new], [],
[AC_MSG_ERROR([**** Could not find samplerate ****])]
)
AC_CHECK_LIB([pthread], [pthread_create], [],
[AC_MSG_ERROR([**** Could not find libpthread ****])]
)
AC_CHECK_LIB([curl], [curl_global_init], [],
[AC_MSG_ERROR([**** Could not find libcurl ****])]
)
AC_CHECK_LIB([ssl], [SSL_CTX_new], [],
[AC_MSG_ERROR([**** Could not find libssl ****])]
)
AC_CHECK_LIB([crypto], [EVP_EncryptInit], [],
[AC_MSG_ERROR([**** Could not find libcrypto ****])]
)
])
AC_CHECK_HEADER([winsock2.h],
[
LIBS="$LIBS -lws2_32"
host_os="windows"
],
)
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19])
AM_CONDITIONAL(WINDOWS, test "$host_os" = "windows")
build_linux=no
build_windows=no
build_mac=no
build_freebsd=no
# Detect the target system
case "${host_os}" in
linux*)
build_linux=yes
AC_MSG_NOTICE([Linux detected])
AS_IF([test "x$enable_aac" != "xno" -a "x$client_only" != "xyes"],
[
AC_CHECK_LIB([fdk-aac], [aacEncOpen],
[
CPPFLAGS="$CPPFLAGS -DHAVE_LIBFDK_AAC"
LIBS="$LIBS -ldl"
],
[AC_MSG_ERROR([**** Could not find libfdk-aac - run ./configure --disable-aac to build without aac support ****])]
)
])
AC_ARG_ENABLE([webrtc],
AS_HELP_STRING([--enable-webrtc], [Enable WebRTC support]),
[
AS_IF([test "x$client_only" != "xyes"],
[
AC_CHECK_LIB([datachannel], [rtcCreatePeerConnection], [],
[AC_MSG_ERROR([**** Could not find datachannel ****])])
])
])
;;
cygwin*|mingw*|windows)
build_windows=yes
AC_MSG_NOTICE([Windows detected])
# Do NOT check for aac lib here because butt must not depend on libfdk-aac dll.
# Instead define HAVE_LIBFDK_AAC manually, so butt runs with and without the dll
CPPFLAGS="$CPPFLAGS -DHAVE_LIBFDK_AAC"
AS_IF([test "x$client_only" != "xyes"],
[
AC_CHECK_LIB([datachannel], [rtcCreatePeerConnection], [],
[AC_MSG_ERROR([**** Could not find datachannel ****])])
])
;;
darwin*)
build_mac=yes
AC_MSG_NOTICE([MacOS detected])
CPPFLAGS="$CPPFLAGS -x objective-c++"
LIBS="$LIBS -framework AVFoundation -lintl -framework ScriptingBridge"
LDFLAGS="$LDFLAGS -rpath /usr/local/lib"
AS_IF([test "x$client_only" != "xyes"],
[
AC_CHECK_LIB([datachannel], [rtcCreatePeerConnection], [],
[AC_MSG_ERROR([**** Could not find datachannel ****])])
])
;;
freebsd*)
build_freebsd=yes
AC_MSG_NOTICE([FreeBSD detected])
AS_IF([test "x$enable_aac" != "xno" -a "x$client_only" != "xyes"],
[
# By default AC_CHECK_LIB adds -lfdk-aac to the linker flags if the check succeeds. But as the library is loaded with dlopen() during runtime
# the linker flag is not needed. So we only define HAVE_LIBFDK_AAC in case the library was found
AC_CHECK_LIB([fdk-aac], [aacEncOpen], [CPPFLAGS="$CPPFLAGS -DHAVE_LIBFDK_AAC"],
[AC_MSG_ERROR([**** Could not find libfdk-aac - run ./configure --disable-aac to build without aac support ****])]
)
])
AC_ARG_ENABLE([webrtc],
AS_HELP_STRING([--enable-webrtc], [Enable WebRTC support]),
[
AS_IF([test "x$client_only" != "xyes"],
[
AC_CHECK_LIB([datachannel], [rtcCreatePeerConnection], [],
[AC_MSG_ERROR([**** Could not find datachannel ****])])
])
])
;;
*)
AC_MSG_ERROR(["OS $host_os is not supported"])
;;
esac
# Pass the conditionals to automake
AM_CONDITIONAL([LINUX], [test "$build_linux" = "yes"])
AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"])
AM_CONDITIONAL([OSX], [test "$build_mac" = "yes"])
AM_CONDITIONAL([FREEBSD], [test "$build_freebsd" = "yes"])
AM_CONDITIONAL([WITH_RADIOCO], [test "x$with_radioco" = "xyes"])
AM_CONDITIONAL([WITH_CLIENT], [test "x$with_client" = "xyes" -o "x$client_only" = "xyes"])
AM_CONDITIONAL([CLIENT_ONLY], [test "x$client_only" = "xyes"])
AC_CHECK_PROG([FLTKCONFIG],[fltk-config], [fltk-config])
if test "x$client_only" != "xyes"; then
if test "$FLTKCONFIG" = "fltk-config"; then
AC_CHECK_LIB([fltk], [main],
[
LIBS="$LIBS `fltk-config --ldflags --use-images`"
CXXFLAGS="$CXXFLAGS `fltk-config --cxxflags`"
],
[AC_MSG_ERROR([**** Could not find libfltk ****])]
)
else
AC_MSG_ERROR([**** Could not find fltk-config ****])
fi
fi
#Add dbus library for Linux
if test "$build_linux" = "yes" -a "x$client_only" != "xyes"; then
AC_MSG_NOTICE([])
PKG_CHECK_MODULES([DBUS], [dbus-1], [
AC_DEFINE([HAVE_DBUS], [1], [Use dbus to get current tracks])
LIBS="$LIBS $DBUS_LIBS"
CFLAGS="$CFLAGS $LIBS $DBUS_CFLAGS"
CXXFLAGS="$CXXFLAGS $DBUS_CFLAGS"
], [
AC_DEFINE([HAVE_DBUS], [0], [Use dbus to get current tracks])
AC_MSG_ERROR([**** Coud not find dbus dev files])
])
# Explicitly add X11 library because it is not added by fltk-config on OpenSUSE
LIBS="$LIBS -lX11"
fi
#Add dbus library for FreeBSD
if test "$build_freebsd" = "yes" -a "x$client_only" != "xyes"; then
AC_MSG_NOTICE([])
PKG_CHECK_MODULES([DBUS], [dbus-1], [
AC_DEFINE([HAVE_DBUS], [1], [Use dbus to get current tracks])
LIBS="$LIBS $DBUS_LIBS"
CFLAGS="$CFLAGS $LIBS $DBUS_CFLAGS"
CXXFLAGS="$CXXFLAGS $DBUS_CFLAGS"
], [
AC_DEFINE([HAVE_DBUS], [0], [Use dbus to get current tracks])
AC_MSG_ERROR([**** Coud not find dbus dev files])
])
fi
# Checks for header files.
AC_PATH_X
AC_CHECK_HEADERS([fcntl.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
# Checks for library functions.
#AC_FUNC_MALLOC
#AC_FUNC_REALLOC
AC_CHECK_FUNCS([gethostbyaddr gethostbyname memset pow select socket strchr strdup strpbrk strrchr strstr X509_check_host])
AC_CONFIG_FILES([Makefile po/Makefile.in src/Makefile])
AC_OUTPUT
|