configure.ac 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. dnl Ring - configure.ac for automake 1.9 and autoconf 2.59
  2. dnl Process this file with autoconf to produce a configure script.
  3. AC_PREREQ([2.65])
  4. AC_INIT([Ring],[3.0.0],[ring@lists.savoirfairelinux.net],[ring])
  5. AC_COPYRIGHT([[Copyright (c) Savoir-faire Linux 2004-2017]])
  6. AC_REVISION([$Revision$])
  7. dnl Where to find configure files
  8. AC_CONFIG_SRCDIR(src/ring_api.cpp)
  9. AC_CONFIG_AUX_DIR([build-aux])
  10. AC_CONFIG_MACRO_DIR([m4])
  11. AC_CANONICAL_BUILD
  12. AC_CANONICAL_HOST
  13. AM_INIT_AUTOMAKE([-Wno-portability])
  14. m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) # required by automake 1.12
  15. AC_CONFIG_HEADERS([config.h])
  16. # Silent build by default. Use make V=1 to increase verbosity
  17. m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
  18. dnl Check for programs
  19. AC_PROG_CC
  20. AC_PROG_CXX
  21. AC_PROG_OBJCXX
  22. AC_PROG_CPP
  23. AC_PROG_INSTALL
  24. AC_PROG_LN_S
  25. AC_PROG_MAKE_SET
  26. AC_LANG(C++)
  27. dnl
  28. dnl Check the operating system
  29. dnl
  30. HAVE_WIN64="0"
  31. HAVE_IOS="0"
  32. HAVE_OSX="0"
  33. case "${host_os}" in
  34. "")
  35. SYS=unknown
  36. ;;
  37. linux*)
  38. SYS=linux
  39. # Necessary for linking .a to a .so
  40. LDFLAGS+=" -Wl,-Bsymbolic"
  41. # Needed for plugin system
  42. LDFLAGS+=" -ldl"
  43. ;;
  44. darwin*)
  45. SYS=darwin
  46. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  47. [[#import <TargetConditionals.h>
  48. #if TARGET_OS_IPHONE == 0
  49. #error this is not an IPHONE
  50. #endif
  51. ]])],
  52. [HAVE_IOS="1"],
  53. [HAVE_OSX="1"])
  54. ;;
  55. mingw32*)
  56. SYS=mingw32
  57. AC_CHECK_TOOL(WINDRES, windres, :)
  58. AC_CHECK_TOOL(OBJCOPY, objcopy, :)
  59. AC_DEFINE([_UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
  60. AC_DEFINE([UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
  61. AC_DEFINE([_ISOC99_SOURCE], [1], [Extensions to ISO C89 from ISO C99.])
  62. AC_DEFINE([_ISOC11_SOURCE], [1], [Extensions to ISO C99 from ISO C11.])
  63. AC_DEFINE([_POSIX_SOURCE], [1], [IEEE Std 1003.1.])
  64. AC_DEFINE([_POSIX_C_SOURCE], [200809L], [IEEE Std 1003.1.])
  65. AC_DEFINE([_XOPEN_SOURCE], [700], [POSIX and XPG 7th edition])
  66. AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1], [XPG things and X/Open Unix extensions.])
  67. AC_DEFINE([_BSD_SOURCE], [1], [ISO C, POSIX, and 4.3BSD things.])
  68. AC_DEFINE([_SVID_SOURCE], [1], [ISO C, POSIX, and SVID things.])
  69. AC_DEFINE([WIN32_LEAN_AND_MEAN],[1], [Define to limit the scope of <windows.h>.])
  70. CPPFLAGS+="-D_WIN32_WINNT=0x0601 -DWINVER=0x0601 -D__USE_MINGW_ANSI_STDIO=1"
  71. LDFLAGS+="-Wl,--nxcompat -Wl,--dynamicbase"
  72. LIBS+=" -lws2_32"
  73. ac_default_prefix="`pwd`/_win32"
  74. DESTDIR="`pwd`/_win32/"
  75. AC_SUBST(WINDOWS_ARCH)
  76. AC_SUBST(PROGRAMFILES)
  77. case "${host}" in
  78. amd64*|x86_64*)
  79. HAVE_WIN64="1"
  80. ;;
  81. esac
  82. ;;
  83. *)
  84. SYS="${host_os}"
  85. ;;
  86. esac
  87. AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
  88. AM_CONDITIONAL(HAVE_LINUX, test "${SYS}" = "linux")
  89. AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
  90. AM_CONDITIONAL(HAVE_WIN64, test "${HAVE_WIN64}" = "1")
  91. AM_CONDITIONAL(HAVE_OSX, test "${HAVE_OSX}" = "1")
  92. AM_CONDITIONAL(HAVE_IOS, test "${HAVE_IOS}" = "1")
  93. dnl FIXME this should be deduced automatically
  94. AC_DEFINE_UNQUOTED([HAVE_COREAUDIO],
  95. `if test "${HAVE_OSX}" = "1" || test "${HAVE_IOS}" = "1"; then echo 1; else echo 0; fi`,
  96. [Define if you have CoreAudio])
  97. dnl Android is linux, but a bit different
  98. AS_IF([test "$SYS" = linux],[
  99. AC_MSG_CHECKING([for an Android system])
  100. AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
  101. [[#ifndef __ANDROID__
  102. # error Not Android
  103. #endif
  104. ]],[[;]])
  105. ],[
  106. HAVE_ANDROID="1"
  107. AC_MSG_RESULT([yes])
  108. ],[
  109. AC_MSG_RESULT([no])
  110. ])
  111. ])
  112. AM_CONDITIONAL(HAVE_ANDROID, test "${HAVE_ANDROID}" = "1")
  113. dnl override platform specific check for dependent libraries
  114. dnl otherwise libtool linking of shared libraries will
  115. dnl fail on anything other than pass_all.
  116. AC_CACHE_VAL(lt_cv_deplibs_check_method,
  117. [lt_cv_deplibs_check_method=pass_all])
  118. LT_INIT([dlopen win32-dll shared disable-static])
  119. dnl Define C++ as default language
  120. LT_LANG(C++)
  121. DOLT
  122. lt_cv_deplibs_check_method=pass_all
  123. dnl Check for C++11 support
  124. AX_CXX_COMPILE_STDCXX_11([ext],[mandatory])
  125. dnl Check for header files
  126. AC_FUNC_ALLOCA
  127. AC_HEADER_STDC
  128. AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h \
  129. netdb.h netinet/in.h stdlib.h string.h \
  130. sys/ioctl.h sys/socket.h sys/time.h unistd.h])
  131. dnl Check for typedefs, structures, and compiler characteristics
  132. AC_HEADER_STAT
  133. AC_HEADER_STDBOOL
  134. AC_C_CONST
  135. AC_C_INLINE
  136. AC_TYPE_PID_T
  137. AC_TYPE_SIZE_T
  138. AC_HEADER_TIME
  139. AC_C_VOLATILE
  140. AC_CHECK_TYPES([ptrdiff_t])
  141. PKG_PROG_PKG_CONFIG()
  142. dnl On some OS we need static linking
  143. AS_IF([test -n "${PKG_CONFIG}" ],[
  144. AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin"],[
  145. PKG_CONFIG="${PKG_CONFIG} --static"
  146. ])
  147. ])
  148. dnl Check if we are using clang
  149. AC_MSG_CHECKING([if compiling with clang])
  150. AC_COMPILE_IFELSE(
  151. [AC_LANG_PROGRAM([], [[
  152. #ifndef __clang__
  153. not clang
  154. #endif
  155. ]])],
  156. [CLANG=yes], [CLANG=no])
  157. AC_MSG_RESULT([$CLANG])
  158. dnl
  159. dnl Check for the contrib directory
  160. dnl
  161. AC_ARG_WITH(contrib,
  162. [AS_HELP_STRING([--with-contrib[=DIR]],
  163. [search for 3rd party libraries in DIR/include and DIR/lib])
  164. ])
  165. AC_MSG_CHECKING([for 3rd party libraries path])
  166. AS_IF([test -z "${with_contrib}" || test "${with_contrib}" = "yes"], [
  167. CONTRIB_DIR="${srcdir}/contrib/${host}"
  168. AS_IF([test ! -d "${CONTRIB_DIR}"], [
  169. echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
  170. CONTRIB_DIR="${srcdir}/contrib/`$CC -dumpmachine`"
  171. AS_IF([test ! -d "${CONTRIB_DIR}"], [
  172. echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
  173. CONTRIB_DIR=""
  174. AC_MSG_RESULT([not found])
  175. ])
  176. ])
  177. ], [
  178. AS_IF([test "${with_contrib}" != "no"], [
  179. CONTRIB_DIR="${with_contrib}"
  180. ], [
  181. CONTRIB_DIR=""
  182. AC_MSG_RESULT([disabled])
  183. ])
  184. ])
  185. AS_IF([test -n "${CONTRIB_DIR}"], [
  186. AS_IF([test -d "${CONTRIB_DIR}/lib"],[
  187. CONTRIB_DIR=`cd "${CONTRIB_DIR}" && pwd`
  188. ], [
  189. echo "${CONTRIB_DIR}/lib not found" >&AS_MESSAGE_LOG_FD
  190. CONTRIB_DIR=""
  191. AC_MSG_RESULT([not usable])
  192. ])
  193. ])
  194. AS_IF([test -n "${CONTRIB_DIR}"], [
  195. AC_MSG_RESULT([${CONTRIB_DIR}])
  196. export PATH=${CONTRIB_DIR}/bin:$PATH
  197. CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
  198. CFLAGS="${CFLAGS} -DPJ_AUTOCONF=1 "
  199. CXXFLAGS="${CXXFLAGS} -DPJ_AUTOCONF=1 "
  200. AS_IF([test "${HAVE_WIN64}" = "1"],[
  201. CFLAGS+=" -DPJ_WIN64=1"
  202. CXXFLAGS+=" -DPJ_WIN64=1"
  203. ])
  204. CFLAGS+=" -I${CONTRIB_DIR}/include"
  205. CXXFLAGS+=" -I${CONTRIB_DIR}/include"
  206. OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
  207. AS_IF([test "${SYS}" = "mingw32"],[
  208. PKG_CONFIG_PATH_CUSTOM="${CONTRIB_DIR}/lib/pkgconfig:${CONTRIB_DIR}/lib64/pkgconfig"
  209. AC_SUBST(PKG_CONFIG_PATH_CUSTOM)
  210. export PKG_CONFIG_PATH_CUSTOM
  211. ])
  212. export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:${CONTRIB_DIR}/lib64/pkgconfig:$PKG_CONFIG_PATH"
  213. LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
  214. AS_IF([test "${SYS}" = "darwin"], [
  215. export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
  216. export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
  217. ])
  218. ], [
  219. AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"], [
  220. AC_MSG_ERROR([Third party libraries not found!])
  221. ])
  222. ])
  223. AC_SUBST(CONTRIB_DIR)
  224. dnl Add extras/tools to the PATH
  225. TOOLS_DIR="${srcdir}/extras/tools/build/bin"
  226. AS_IF([test -d "${TOOLS_DIR}"], [
  227. TOOLS_DIR=`cd "${TOOLS_DIR}" && pwd`
  228. export PATH="${TOOLS_DIR}":$PATH
  229. ])
  230. dnl Check for zlib
  231. PKG_CHECK_MODULES(ZLIB, zlib,, AC_MSG_ERROR([zlib not found]))
  232. dnl Check for pjproject
  233. PKG_CHECK_MODULES(PJPROJECT, libpjproject,, AC_MSG_ERROR([Missing pjproject files]))
  234. PKG_CHECK_MODULES([YAMLCPP], [yaml-cpp >= 0.5.1],, AC_MSG_ERROR([yaml-cpp not found]))
  235. PKG_CHECK_MODULES([JSONCPP], [jsoncpp >= 1.6.5],, AC_MSG_ERROR([jsoncpp not found]))
  236. if test "${HAVE_ANDROID}" = "1"; then
  237. dnl Check for OpenSL
  238. AC_ARG_WITH([opensl],
  239. AS_HELP_STRING([--without-opensl],
  240. [Ignore presence of opensl and disable it]))
  241. AS_IF([test "x$with_opensl" != "xno"],
  242. [AC_CHECK_HEADER(["SLES/OpenSLES.h"],
  243. [have_opensl=yes], [have_opensl=no])],
  244. [have_opensl=no])
  245. AC_DEFINE_UNQUOTED([HAVE_OPENSL],
  246. `if test "x$have_opensl" = "xyes"; then echo 1; else echo 0; fi`,
  247. [Define if you have OpenSL])
  248. fi
  249. AM_CONDITIONAL([BUILD_OPENSL], test "x$have_opensl" = "xyes")
  250. if test "${SYS}" = "linux"; then
  251. dnl Check for alsa development package - name: libasound2-dev
  252. ALSA_MIN_VERSION=1.0
  253. AC_ARG_WITH([alsa],
  254. [AS_HELP_STRING([--without-alsa], [disable support for alsa])],
  255. [],
  256. [with_alsa=yes])
  257. AS_IF([test "x$with_alsa" = "xyes"], [
  258. PKG_CHECK_MODULES(ALSA, alsa >= ${ALSA_MIN_VERSION},, AC_MSG_ERROR([Missing alsa development files]))
  259. ]);
  260. AC_DEFINE_UNQUOTED([HAVE_ALSA], `if test "x$with_alsa" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have alsa])
  261. fi
  262. AM_CONDITIONAL(BUILD_ALSA, test "x$with_alsa" = "xyes")
  263. if test "${SYS}" = "linux"; then
  264. dnl Check for pulseaudio development package - name: libpulse-dev
  265. LIBPULSE_MIN_VERSION=0.9.15
  266. AC_ARG_WITH([pulse],
  267. [AS_HELP_STRING([--without-pulse], [disable support for pulseaudio])],
  268. [],
  269. [with_pulse=yes])
  270. AS_IF([test "x$with_pulse" = "xyes"], [
  271. PKG_CHECK_MODULES(PULSEAUDIO, libpulse >= ${LIBPULSE_MIN_VERSION},, AC_MSG_ERROR([Missing pulseaudio development files]))
  272. ]);
  273. AC_DEFINE_UNQUOTED([HAVE_PULSE], `if test "x$with_pulse" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have pulseaudio])
  274. fi
  275. AM_CONDITIONAL(BUILD_PULSE, test "x$with_pulse" = "xyes")
  276. AC_ARG_WITH([jack],
  277. AS_HELP_STRING([--without-jack], [Ignore presence of jack and disable it]))
  278. AS_IF([test "x$with_jack" != "xno"],
  279. [PKG_CHECK_MODULES(JACK, jack, [have_jack=yes], [have_jack=no])],
  280. [have_jack=no])
  281. AS_IF([test "x$have_jack" = "xyes"],,
  282. [AS_IF([test "x$with_jack" = "xyes"],
  283. [AC_MSG_ERROR([jack requested but not found])
  284. ])
  285. ])
  286. dnl check for libportaudio
  287. AS_IF([test "${SYS}" = "mingw32"],[
  288. AC_ARG_WITH([portaudio], [AS_HELP_STRING([--without-portaudio],
  289. [disable support for portaudio])], [], [with_portaudio=yes])
  290. ])
  291. AS_IF([test "x$with_portaudio" = "xyes"],
  292. [PKG_CHECK_MODULES(PORTAUDIO, [portaudio-2.0],
  293. [AC_DEFINE([HAVE_PORTAUDIO], 1, [Define if you have portaudio])],
  294. [AC_MSG_ERROR([Missing libportaudio development files])])
  295. ])
  296. AM_CONDITIONAL(BUILD_PORTAUDIO, test "x$with_portaudio" = "xyes")
  297. AM_CONDITIONAL(HAVE_PORTAUDIO, test "x$with_portaudio" = "xyes")
  298. AC_DEFINE_UNQUOTED([HAVE_JACK], `if test "x$have_jack" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have jack])
  299. AM_CONDITIONAL(BUILD_JACK, test "x$have_jack" = "xyes")
  300. dnl Check for the samplerate development package - name: libsamplerate0-dev
  301. LIBSAMPLERATE_MIN_VERSION=0.1.2
  302. PKG_CHECK_MODULES(SAMPLERATE, samplerate >= ${LIBSAMPLERATE_MIN_VERSION},, AC_MSG_ERROR([Missing libsamplerate development files]))
  303. dnl Check for the sndfile development package - name: libsndfile-dev
  304. PKG_CHECK_MODULES(SNDFILE, sndfile,, AC_MSG_ERROR([Missing sndfile development files]))
  305. dnl Coverage is default-disabled
  306. AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [Enable coverage]))
  307. AS_IF([test "x$enable_coverage" = "xyes"], [
  308. CXXFLAGS="${CXXFLAGS} --coverage"
  309. LDFLAGS="${LDFLAGS} --coverage"])
  310. # DBUSCPP
  311. dnl Check for dbuscpp, the C++ bindings for D-Bus
  312. AC_ARG_WITH([dbus],
  313. [AS_HELP_STRING([--without-dbus], [disable support for dbus])],
  314. [],
  315. [with_dbus=yes])
  316. AS_IF([test "x$with_dbus" = "xyes"], [
  317. PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,, AC_MSG_WARN([Missing dbus development files]))
  318. AS_AC_EXPAND(LIBDIR, $libdir)
  319. AC_SUBST(LIBDIR)
  320. AC_CONFIG_FILES([bin/dbus/Makefile
  321. bin/dbus/cx.ring.Ring.service])
  322. AC_CHECK_PROG(HAVE_DBUSXML2CPP, dbusxx-xml2cpp, true, false)
  323. if test "x$HAVE_DBUSXML2CPP" = "xfalse"; then
  324. AC_MSG_ERROR([dbusxx-xml2cpp not found])
  325. fi
  326. AS_IF([test "x$CLANG" = "xyes"], [
  327. AC_MSG_ERROR([dbus does not compile when clang is used, rerun with --without-dbus])
  328. ]);
  329. AM_CONDITIONAL(RING_DBUS, true)],
  330. AM_CONDITIONAL(RING_DBUS, false));
  331. dnl Ring name service is default-enabled
  332. AC_ARG_ENABLE([ringns], AS_HELP_STRING([--disable-ringns], [Enable Ring Name Service]))
  333. AM_CONDITIONAL([RINGNS], test "x$enable_ringns" != "xno", [Define if you use the Ring Name Service])
  334. AC_DEFINE_UNQUOTED([HAVE_RINGNS], `if test "x$enable_ringns" != "xno"; then echo 1; else echo 0; fi`, [Define if you use the Ring Name Service])
  335. # Rest C++ with restbed
  336. AC_ARG_WITH([restcpp],
  337. AS_HELP_STRING([--with-restcpp], [enable rest support with C++]))
  338. AC_ARG_ENABLE([restbed_old_api], AS_HELP_STRING([--enable-restbed-old-api], [Use the old restbed API]))
  339. AS_IF([test "x$enable_restbed_old_api" = "xyes"], [
  340. AC_DEFINE([RESTBED_OLD_API], [], [Defined if you use the old restbed API])
  341. ])
  342. AS_IF([test "x$enable_ringns" != "xno" || test "x$with_restcpp" = "xyes"],
  343. AC_CHECK_LIB(restbed, exit,, AC_MSG_ERROR([Missing restbed files])));
  344. AS_IF([test "x$with_restcpp" = "xyes"], [
  345. AS_AC_EXPAND(SBINDIR, $sbindir)
  346. AC_SUBST(SBINDIR)
  347. AC_CONFIG_FILES([bin/restcpp/Makefile])
  348. AM_CONDITIONAL(RING_RESTCPP, true)
  349. ],
  350. AM_CONDITIONAL(RING_RESTCPP, false)
  351. );
  352. dnl Check for libav
  353. PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 53.5.0,, AC_MSG_ERROR([Missing libavcodec development files]))
  354. LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS"
  355. PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= 54.20.3,, AC_MSG_ERROR([Missing libavformat development files]))
  356. PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 1.1.0,, AC_MSG_ERROR([Missing libswscale development files]))
  357. PKG_CHECK_MODULES(LIBAVDEVICE, libavdevice >= 53.0.0,, AC_MSG_ERROR([Missing libavdevice development files]))
  358. PKG_CHECK_MODULES(LIBAVUTIL, libavutil >= 52.5.0,, AC_MSG_ERROR([Missing libavutil development files]))
  359. dnl Video is default-enabled
  360. AC_ARG_ENABLE([video], AS_HELP_STRING([--disable-video], [Disable video]))
  361. AS_IF([test "x$enable_video" != "xno"],
  362. [
  363. AC_DEFINE(RING_VIDEO, [], [Video support enabled])
  364. AM_CONDITIONAL(RING_VIDEO, true)
  365. AS_IF([test "$SYS" = linux && test -z "${HAVE_ANDROID_FALSE}"],[
  366. PKG_CHECK_MODULES(UDEV, libudev,, AC_MSG_ERROR([Missing libudev development files]))
  367. ],[
  368. ])
  369. ],
  370. [
  371. AM_CONDITIONAL(RING_VIDEO, false)
  372. ]);
  373. dnl Ring video acceleration compile-time dependencies
  374. AS_IF([test "${SYS}" = linux && test -z "${HAVE_ANDROID_FALSE}"], [
  375. x11_available="no"
  376. vaapi_available="no"
  377. dnl ffmpeg's vaapi implementation depends on x11
  378. PKG_CHECK_MODULES([X11], [x11], [x11_available="yes"], [])
  379. AS_IF([test "${x11_available}" = "yes"], [
  380. PKG_CHECK_MODULES([LIBVA], [libva], [
  381. PKG_CHECK_MODULES([LIBVA_DRM], [libva-drm], [
  382. AC_DEFINE([HAVE_VAAPI_ACCEL_DRM], [1], [Vaapi via DRM found])
  383. ])
  384. PKG_CHECK_MODULES([LIBVA_X11], [libva-x11], [
  385. AC_DEFINE([HAVE_VAAPI_ACCEL_X11], [1], [Vaapi via X11 found])
  386. ])
  387. AC_CHECK_HEADERS([libavcodec/vaapi.h], [vaapi_available="yes"])
  388. ])
  389. ])
  390. ])
  391. AC_ARG_ENABLE([accel], AS_HELP_STRING([--disable-accel], [Disable all hardware accelerations]))
  392. AC_ARG_ENABLE([vaapi], AS_HELP_STRING([--disable-vaapi], [Disable VAAPI hardware acceleration]))
  393. dnl video acceleration only works if there's video
  394. AS_IF([test "x$enable_video" != "xno" -a "x$enable_accel" != "xno"], [
  395. ring_accel="yes"
  396. AC_DEFINE([RING_ACCEL], [1], [Hardware acceleration is enabled in Ring])
  397. AS_IF([test "x$enable_vaapi" != "xno"], [
  398. AS_IF([test "x${vaapi_available}" = "xyes"], [
  399. ring_vaapi="yes"
  400. AC_DEFINE([RING_VAAPI], [1], [VAAPI is available in Ring])
  401. ])
  402. ])
  403. ])
  404. AM_CONDITIONAL([RING_ACCEL], [test "x${ring_accel}" = "xyes"])
  405. AM_CONDITIONAL([RING_VAAPI], [test "x${ring_vaapi}" = "xyes"])
  406. dnl check for GnuTLS
  407. PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.4.14], [HAVE_GNUTLS=1], [HAVE_GNUTLS=0])
  408. # PTHREAD
  409. # required dependency(ies): libxpat
  410. AX_PTHREAD
  411. # SDES Key Exchange
  412. # required dependency(ies): libpcre
  413. AC_ARG_WITH([sdes],
  414. [AS_HELP_STRING([--without-sdes], [disable support for sdes key exchange])],
  415. [],
  416. [with_sdes=yes])
  417. AS_IF([test "x$with_sdes" = "xyes"], [
  418. PKG_CHECK_MODULES(PCRE, [libpcre],,AC_MSG_ERROR([libpcre not found]))]);
  419. AC_DEFINE_UNQUOTED([HAVE_SDES], `if test "x$with_sdes" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have sdes support])
  420. AM_CONDITIONAL(BUILD_SDES, test "x$with_sdes" = "xyes" )
  421. dnl Check for libcppunit-dev
  422. CPPUNIT_MIN_VERSION=1.12
  423. PKG_CHECK_MODULES(CPPUNIT, cppunit >= ${CPPUNIT_MIN_VERSION}, AM_CONDITIONAL(BUILD_TEST, test 1 = 1 ), AM_CONDITIONAL(BUILD_TEST, test 0 = 1 ))
  424. if test "${SYS}" != "mingw32"; then
  425. # GSM CODEC
  426. # required dependency(ies): libgsm
  427. dnl check for libgsm1 (doesn't use pkg-config)
  428. dnl Check for libgsm
  429. AC_ARG_WITH([gsm], [AS_HELP_STRING([--without-gsm],
  430. [disable support for gsm codec])], [], [with_gsm=yes])
  431. LIBGSM=
  432. AS_IF([test "x$with_gsm" != xno],
  433. [AC_CHECK_HEADER([gsm/gsm.h], , AC_MSG_FAILURE([Unable to find the libgsm1 headers (you may need to install the dev package). You may use --without-gsm to compile without gsm codec support.]))]
  434. [AC_CHECK_LIB([gsm], [gsm_decode], [], [
  435. AC_MSG_FAILURE([libgsm link test failed. You may use --without-gsm to compile without gsm codec support.])
  436. ])
  437. ])
  438. AC_DEFINE_UNQUOTED([HAVE_GSM], `if test "x$with_gsm" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have libgsm])
  439. fi
  440. AM_CONDITIONAL(BUILD_GSM, test "x$with_gsm" = "xyes" )
  441. # SPEEX CODEC
  442. # required dependency(ies): libspeex
  443. dnl Check for libspeex
  444. AC_ARG_WITH([speex],
  445. [AS_HELP_STRING([--without-speex], [disable support for speex codec])],
  446. [],
  447. [with_speex=yes])
  448. AS_IF([test "x$with_speex" != xno], [PKG_CHECK_MODULES([SPEEX], [speex])])
  449. AC_DEFINE_UNQUOTED([HAVE_SPEEX], `if test "x$with_speex" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have libspeex])
  450. AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" )
  451. # SPEEX DSP
  452. # required dependency(ies): libspeexdsp
  453. dnl check in case the libspeexdsp is not installed
  454. AC_ARG_WITH([speexdsp],
  455. [AS_HELP_STRING([--without-speexdsp],
  456. [disable support for speexdp Noise Suppression and Automatic Gain Control])],
  457. [],
  458. [with_speexdsp=yes])
  459. AS_IF([test "x$with_speexdsp" != xno], [PKG_CHECK_MODULES([SPEEXDSP], [speexdsp])])
  460. AC_DEFINE_UNQUOTED([HAVE_SPEEXDSP], `if test "x$with_speexdsp" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have libspeexdsp])
  461. AM_CONDITIONAL(BUILD_SPEEXDSP, test "x$with_speexdsp" = "xyes" )
  462. dnl iLBC is enabled if it's installed
  463. AC_ARG_WITH([libilbc],
  464. [AS_HELP_STRING([--with-libilbc],
  465. [support ilbc audio @<:@default=check@:>@])],
  466. [],
  467. [with_libilbc=check])
  468. AS_CASE(["$with_libilbc"],
  469. [yes], [PKG_CHECK_MODULES([libilbc], [libilbc], [HAVE_LIBILBC=1])],
  470. [no], [HAVE_LIBILBC=0],
  471. [PKG_CHECK_MODULES([libilbc], [libilbc], [HAVE_LIBILBC=1], [HAVE_LIBILBC=0])])
  472. AM_CONDITIONAL([BUILD_ILBC], [test "$HAVE_LIBILBC" -eq 1])
  473. dnl opus is enabled if it's installed
  474. AC_ARG_WITH([opus],
  475. [AS_HELP_STRING([--with-opus], [support opus audio @<:@default=check@:>@])], [], [with_opus=check])
  476. AS_CASE(["$with_opus"],
  477. [yes], [PKG_CHECK_MODULES([opus], [opus], [HAVE_OPUS=1])],
  478. [no], [HAVE_OPUS=0],
  479. [PKG_CHECK_MODULES([opus], [opus], [HAVE_OPUS=1], [HAVE_OPUS=0])])
  480. AM_CONDITIONAL([BUILD_OPUS], [test "$HAVE_OPUS" -eq 1])
  481. dnl check for openDHT
  482. PKG_CHECK_MODULES([OPENDHT], [opendht >= 0.6.1],, AC_MSG_WARN([Missing OpenDHT]))
  483. AC_CHECK_HEADER([cryptopp/cryptlib.h], , AC_MSG_FAILURE([Unable to find the cryptopp headers (you may need to install the dev package).]))
  484. LDFLAGS+=" -lcryptopp"
  485. AS_IF([test "${SYS}" = "mingw32"],[
  486. LDFLAGS+=" -lboost_random -lboost_system"
  487. CPPFLAGS+=" -DBOOST_SYSTEM_NO_DEPRECATED"
  488. ], [
  489. AX_BOOST_BASE([1.48],,[AC_MSG_ERROR([Ring needs Boost but it was not found in your system])])
  490. AC_CHECK_LIB([boost_system], exit, , [AC_MSG_FAILURE(['Can't find boost system'])])
  491. AC_CHECK_LIB([boost_random], exit, , [AC_MSG_FAILURE(['Can't find boost random'])])
  492. CPPFLAGS+=" -DBOOST_SYSTEM_NO_DEPRECATED"
  493. ])
  494. dnl IPv6 mode is default-disabled
  495. AC_ARG_ENABLE([ipv6], AS_HELP_STRING([--enable-ipv6], [Enable IPv6 support]))
  496. AC_DEFINE_UNQUOTED([HAVE_IPV6], `if test "x$enable_ipv6" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have IPv6])
  497. AM_CONDITIONAL(BUILD_IPV6, test "x$enable_ipv6" = "xyes" )
  498. # LIBUPNP
  499. dnl check for libupnp
  500. AC_ARG_WITH([upnp], [AS_HELP_STRING([--without-upnp],
  501. [disable support for upnp])], [], [with_upnp=yes])
  502. AS_IF([test "x$with_upnp" = "xyes"],
  503. [PKG_CHECK_MODULES(LIBUPNP, [libupnp],
  504. [AC_DEFINE([HAVE_LIBUPNP], 1, [Define if you have libupnp])],
  505. [AC_MSG_WARN([Missing libupnp development files])
  506. AC_DEFINE([HAVE_LIBUPNP], 0, [Define if you have libupnp])])
  507. ])
  508. # LIBNATPMP
  509. dnl check for libnatpmp
  510. AC_ARG_WITH([natpmp], [AS_HELP_STRING([--without-natpmp],
  511. [disable support for NAT-PMP])], [], [with_natpmp=yes])
  512. AS_IF([test "x$with_natpmp" != xno],
  513. [AC_CHECK_HEADER([natpmp.h],
  514. AC_CHECK_LIB([natpmp], [initnatpmp], [], [with_natpmp=no]),
  515. [AC_MSG_WARN([Unable to find the libnatpmp headers (you may need to install the dev package). You may use --without-natpmp to compile without NAT-PMP support.]);
  516. with_natpmp=no])
  517. ],[])
  518. AC_DEFINE_UNQUOTED([HAVE_LIBNATPMP], `if test "x$with_natpmp" != xno; then echo 1; else echo 0; fi`, [Define if you have libnatpmp])
  519. AC_DEFINE_UNQUOTED([HAVE_SHM], `if test -z "${HAVE_LINUX_TRUE}" && test -z "${HAVE_ANDROID_FALSE}" ; then echo 1; else echo 0; fi`,
  520. [Define if you have shared memory support])
  521. # DOXYGEN
  522. # required dependency(ies): doxygen
  523. # check for doxygen, mostly stolen from http://log4cpp.sourceforge.net/
  524. # ----------------------------------------------------------------------------
  525. AC_DEFUN([BB_ENABLE_DOXYGEN],
  526. [
  527. AC_ARG_ENABLE(doxygen, [ --enable-doxygen enable documentation generation with doxygen (disabled by default)])
  528. AC_ARG_ENABLE(dot, [ --enable-dot use 'dot' to generate graphs in doxygen (auto)])
  529. if test "x$enable_doxygen" = xyes; then
  530. AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
  531. test x$DOXYGEN = x && AC_MSG_ERROR([could not find doxygen])
  532. AC_PATH_PROG(DOT, dot, , $PATH)
  533. test x$DOT = x -a "x$enable_dot" = xyes && AC_MSG_ERROR([could not find dot])
  534. fi
  535. AM_CONDITIONAL(ENABLE_DOXYGEN, test "x$DOXYGEN" != "x")
  536. ])
  537. # Actually perform the doxygen check
  538. BB_ENABLE_DOXYGEN
  539. dnl debug mode is default-disabled
  540. AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Build in debug mode, adds stricter warnings, disables optimization]))
  541. AS_IF([test "x$enable_debug" = "xyes"],
  542. [CXXFLAGS="${CXXFLAGS} -g -fno-omit-frame-pointer -Wall -Wextra -Wnon-virtual-dtor -Wno-unknown-pragmas -O0"])
  543. dnl What Makefiles to generate
  544. #TODO: split this list across where the relevant check is performed
  545. AC_CONFIG_FILES([Makefile \
  546. bin/Makefile \
  547. src/Makefile \
  548. src/sip/Makefile \
  549. src/im/Makefile \
  550. src/ringdht/Makefile \
  551. src/ringdht/eth/libdevcore/Makefile \
  552. src/ringdht/eth/libdevcrypto/Makefile \
  553. src/media/Makefile \
  554. src/media/audio/Makefile \
  555. src/media/audio/pulseaudio/Makefile \
  556. src/media/audio/alsa/Makefile \
  557. src/media/audio/opensl/Makefile \
  558. src/media/audio/jack/Makefile \
  559. src/media/audio/coreaudio/Makefile \
  560. src/media/audio/portaudio/Makefile \
  561. src/media/audio/sound/Makefile \
  562. src/config/Makefile \
  563. src/client/Makefile \
  564. src/hooks/Makefile \
  565. src/media/video/Makefile \
  566. src/media/video/v4l2/Makefile \
  567. src/media/video/androidvideo/Makefile \
  568. src/media/video/osxvideo/Makefile \
  569. src/media/video/winvideo/Makefile \
  570. src/media/video/test/Makefile \
  571. src/security/Makefile \
  572. src/upnp/Makefile \
  573. ringtones/Makefile \
  574. man/Makefile \
  575. doc/Makefile \
  576. doc/doxygen/Makefile])
  577. # Go!
  578. AC_OUTPUT