configure.ac 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. AC_INIT([libopenmpt], [!!MPT_LIBOPENMPT_VERSION_MAJOR!!.!!MPT_LIBOPENMPT_VERSION_MINOR!!.!!MPT_LIBOPENMPT_VERSION_PATCH!!!!MPT_LIBOPENMPT_VERSION_PREREL!!+!!MPT_SEMVER_METADATA_PREFIX!!.autotools], [https://bugs.openmpt.org/], [libopenmpt], [https://lib.openmpt.org/])
  2. AC_PREREQ([2.68])
  3. AC_CONFIG_MACRO_DIR([m4])
  4. AC_CONFIG_AUX_DIR([build-aux])
  5. AC_CONFIG_FILES([Makefile libopenmpt/libopenmpt.pc Doxyfile])
  6. AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign subdir-objects])
  7. AM_PROG_AR
  8. LT_INIT
  9. AC_SYS_LARGEFILE
  10. PKG_PROG_PKG_CONFIG([0.24])
  11. AC_PROG_CC
  12. AM_PROG_CC_C_O
  13. AC_PROG_CXX
  14. AC_PROG_INSTALL
  15. LIBOPENMPT_LTVER_CURRENT=!!MPT_LIBOPENMPT_LTVER_CURRENT!!
  16. LIBOPENMPT_LTVER_REVISION=!!MPT_LIBOPENMPT_LTVER_REVISION!!
  17. LIBOPENMPT_LTVER_AGE=!!MPT_LIBOPENMPT_LTVER_AGE!!
  18. AC_SUBST([LIBOPENMPT_LTVER_CURRENT])
  19. AC_SUBST([LIBOPENMPT_LTVER_REVISION])
  20. AC_SUBST([LIBOPENMPT_LTVER_AGE])
  21. AC_DEFINE([MPT_SVNURL], ["!!MPT_SVNURL!!"], [svn version])
  22. AC_DEFINE([MPT_SVNVERSION], ["!!MPT_SVNVERSION!!"], [svn version])
  23. AC_DEFINE([MPT_SVNDATE], ["!!MPT_SVNDATE!!"], [svn date])
  24. AC_DEFINE([MPT_PACKAGE], [!!MPT_PACKAGE!!], [is package])
  25. AC_ARG_VAR(CXXSTDLIB_PCLIBSPRIVATE, [C++ standard library (or libraries) required for static linking. This will be put in the pkg-config file libopenmpt.pc Libs.private field and used for nothing else.])
  26. AC_CANONICAL_HOST
  27. case $host_os in
  28. mingw32*)
  29. LIBOPENMPT_WIN32_LIBS="-lole32 -lrpcrt4"
  30. LIBOPENMPT_LIBS_PRIVATE_WIN32="-lole32 -lrpcrt4"
  31. OPENMPT123_WIN32_LIBS=-lwinmm
  32. WIN32_CPPFLAGS=
  33. WIN32_CXXFLAGS="-municode -mthreads"
  34. WIN32_CFLAGS="-municode -mthreads"
  35. WIN32_CONSOLE_CXXFLAGS=-mconsole
  36. WIN32_CONSOLE_CFLAGS=-mconsole
  37. ;;
  38. *)
  39. LIBOPENMPT_WIN32_LIBS=
  40. LIBOPENMPT_LIBS_PRIVATE_WIN32=
  41. OPENMPT123_WIN32_LIBS=
  42. WIN32_CPPFLAGS=
  43. WIN32_CXXFLAGS=
  44. WIN32_CFLAGS=
  45. WIN32_CONSOLE_CXXFLAGS=
  46. WIN32_CONSOLE_CFLAGS=
  47. ;;
  48. esac
  49. AC_SUBST([LIBOPENMPT_WIN32_LIBS])
  50. AC_SUBST([OPENMPT123_WIN32_LIBS])
  51. AC_SUBST([WIN32_CPPFLAGS])
  52. AC_SUBST([WIN32_CXXFLAGS])
  53. AC_SUBST([WIN32_CFLAGS])
  54. AC_SUBST([WIN32_CONSOLE_CXXFLAGS])
  55. AC_SUBST([WIN32_CONSOLE_CFLAGS])
  56. LIBOPENMPT_REQUIRES_PRIVATE=
  57. LIBOPENMPT_LIBS_PRIVATE=
  58. # Required libopenmpt dependency: zlib
  59. ZLIB_PKG=
  60. AC_ARG_WITH([zlib], AS_HELP_STRING([--without-zlib], [Disable use of zlib.]))
  61. AS_IF([test "x$with_zlib" != "xno"],
  62. [
  63. PKG_CHECK_MODULES([ZLIB], [zlib],
  64. [
  65. ZLIB_PKG=zlib
  66. AC_DEFINE([MPT_WITH_ZLIB], [], [with zlib])
  67. ], [AC_MSG_ERROR([Unable to find zlib.])])
  68. ]
  69. )
  70. # Required libopenmpt dependency: mpg123
  71. MPG123_PKG=
  72. AC_ARG_WITH([mpg123], AS_HELP_STRING([--without-mpg123], [Disable use of libmpg123.]))
  73. AS_IF([test "x$with_mpg123" != "xno"],
  74. [
  75. PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.14.0],
  76. [
  77. MPG123_PKG=libmpg123
  78. AC_DEFINE([MPT_WITH_MPG123], [], [with mpg123])
  79. ], [AC_MSG_ERROR([Unable to find libmpg123.])])
  80. ]
  81. )
  82. # Required libopenmpt dependency: ogg
  83. OGG_PKG=
  84. AC_ARG_WITH([ogg], AS_HELP_STRING([--without-ogg], [Disable use of libogg.]))
  85. AS_IF([test "x$with_ogg" != "xno"],
  86. [
  87. PKG_CHECK_MODULES([OGG], [ogg],
  88. [
  89. OGG_PKG=ogg
  90. AC_DEFINE([MPT_WITH_OGG], [], [with ogg])
  91. ], [AC_MSG_ERROR([Unable to find libogg.])])
  92. ]
  93. )
  94. # Required libopenmpt dependency: vorbis
  95. VORBIS_PKG=
  96. AC_ARG_WITH([vorbis], AS_HELP_STRING([--without-vorbis], [Disable use of libvorbis.]))
  97. AS_IF([test "x$with_vorbis" != "xno"],
  98. [
  99. PKG_CHECK_MODULES([VORBIS], [vorbis],
  100. [
  101. VORBIS_PKG=vorbis
  102. AC_DEFINE([MPT_WITH_VORBIS], [], [with vorbis])
  103. ], [AC_MSG_ERROR([Unable to find libvorbis.])])
  104. ]
  105. )
  106. # Required libopenmpt dependency: vorbisfile
  107. VORBISFILE_PKG=
  108. AC_ARG_WITH([vorbisfile], AS_HELP_STRING([--without-vorbisfile], [Disable use of libvorbisfile.]))
  109. AS_IF([test "x$with_vorbisfile" != "xno"],
  110. [
  111. PKG_CHECK_MODULES([VORBISFILE], [vorbisfile],
  112. [
  113. VORBISFILE_PKG=vorbisfile
  114. AC_DEFINE([MPT_WITH_VORBISFILE], [], [with vorbisfile])
  115. ], [AC_MSG_ERROR([Unable to find libvorbisfile.])])
  116. ]
  117. )
  118. LIBOPENMPT_REQUIRES_PRIVATE="$ZLIB_PKG $MPG123_PKG $OGG_PKG $VORBIS_PKG $VORBISFILE_PKG"
  119. LIBOPENMPT_LIBS_PRIVATE="$CXXSTDLIB_PCLIBSPRIVATE $LIBOPENMPT_LIBS_PRIVATE_WIN32"
  120. AC_SUBST([LIBOPENMPT_REQUIRES_PRIVATE])
  121. AC_SUBST([LIBOPENMPT_LIBS_PRIVATE])
  122. # openmpt123
  123. AC_ARG_ENABLE([openmpt123], AS_HELP_STRING([--disable-openmpt123], [Disable the openmpt123 command line player.]))
  124. AM_CONDITIONAL([ENABLE_OPENMPT123], [test "x$enable_openmpt123" != "xno"])
  125. # examples
  126. AC_ARG_ENABLE([examples], AS_HELP_STRING([--disable-examples], [Disable the example programs.]))
  127. AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" != "xno"])
  128. # tests
  129. AC_ARG_ENABLE([tests], AS_HELP_STRING([--disable-tests], [Disable the test suite.]))
  130. AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" != "xno"])
  131. # Optional openmpt123 dependency
  132. AC_ARG_WITH([pulseaudio], AS_HELP_STRING([--with-pulseaudio], [Enable use of libpulse and libpulse-simple (enabled by default on Linux).]))
  133. AS_IF([test "x$enable_openmpt123" != "xno"],[
  134. case $host_os in
  135. linux*)
  136. AS_IF([test "x$with_pulseaudio" != "xno"],
  137. [
  138. PKG_CHECK_MODULES([PULSEAUDIO], [libpulse libpulse-simple],
  139. [
  140. have_pulseaudio=1
  141. AC_DEFINE([MPT_WITH_PULSEAUDIO], [], [with libpulseaudio])
  142. ],
  143. [
  144. have_pulseaudio=0
  145. AC_MSG_ERROR([Unable to find libpulse and/or libpulse-simple.])
  146. ]
  147. )
  148. ],
  149. [
  150. have_pulseaudio=0
  151. ]
  152. )
  153. ;;
  154. *)
  155. AS_IF([test "x$with_pulseaudio" = "xyes"],
  156. [
  157. PKG_CHECK_MODULES([PULSEAUDIO], [libpulse libpulse-simple],
  158. [
  159. have_pulseaudio=1
  160. AC_DEFINE([MPT_WITH_PULSEAUDIO], [], [with libpulseaudio])
  161. ],
  162. [
  163. have_pulseaudio=0
  164. AC_MSG_ERROR([Unable to find libpulse and/or libpulse-simple.])
  165. ]
  166. )
  167. ],
  168. [
  169. have_pulseaudio=0
  170. ]
  171. )
  172. ;;
  173. esac
  174. ],[have_pulseaudio=0])
  175. # Optional openmpt123 and examples dependency
  176. AC_ARG_WITH([portaudio], AS_HELP_STRING([--without-portaudio], [Disable use of libportaudio.]))
  177. AS_IF([test "x$enable_openmpt123$enable_examples" != "xnono"],[
  178. AS_IF([test "x$with_portaudio" != "xno"],
  179. [
  180. PKG_CHECK_MODULES([PORTAUDIO], [portaudio-2.0],
  181. [
  182. have_portaudio=1
  183. AC_DEFINE([MPT_WITH_PORTAUDIO], [], [with libportaudio])
  184. ],
  185. [
  186. have_portaudio=0
  187. AC_MSG_ERROR([Unable to find libportaudio.])
  188. ]
  189. )
  190. ],
  191. [
  192. have_portaudio=0
  193. ]
  194. )
  195. ],[have_portaudio=0])
  196. AM_CONDITIONAL([HAVE_PORTAUDIO], [test x$have_portaudio = x1])
  197. # Optional examples dependency: PortAudio C++
  198. AC_ARG_WITH([portaudiocpp], AS_HELP_STRING([--without-portaudiocpp], [Disable use of libportaudiocpp.]))
  199. AS_IF([test "x$enable_examples" != "xno"],[
  200. AS_IF([test "x$with_portaudiocpp" != "xno"],
  201. [
  202. PKG_CHECK_MODULES([PORTAUDIOCPP], [portaudiocpp],
  203. [
  204. have_portaudiocpp=1
  205. AC_DEFINE([MPT_WITH_PORTAUDIOCPP], [], [with libportaudiocpp])
  206. ],
  207. [
  208. have_portaudiocpp=0
  209. AC_MSG_ERROR([Unable to find libportaudiocpp.])
  210. ]
  211. )
  212. ],
  213. [
  214. have_portaudiocpp=0
  215. ]
  216. )
  217. ],[have_portaudiocpp=0])
  218. AM_CONDITIONAL([HAVE_PORTAUDIOCPP], [test x$have_portaudiocpp = x1])
  219. # Optional disabled openmpt123 dependency: libsdl2
  220. AC_ARG_WITH([sdl2], AS_HELP_STRING([--with-sdl2], [Enable use of libsdl2.]))
  221. AS_IF([test "x$enable_openmpt123" != "xno"],[
  222. AS_IF([test "x$with_sdl2" = "xyes"],
  223. [
  224. PKG_CHECK_MODULES([SDL2], [sdl2 >= 2.0.4], [AC_DEFINE([MPT_WITH_SDL2], [], [with libsdl2])], [AC_MSG_ERROR([Unable to find libsdl2.])])
  225. ]
  226. )
  227. ])
  228. # Optional openmpt123 dependency: libsndfile
  229. AC_ARG_WITH([sndfile], AS_HELP_STRING([--without-sndfile], [Disable use of libsndfile.]))
  230. AS_IF([test "x$enable_openmpt123" != "xno"],[
  231. AS_IF([test "x$with_sndfile" != "xno"],
  232. [
  233. PKG_CHECK_MODULES([SNDFILE], [sndfile], [AC_DEFINE([MPT_WITH_SNDFILE], [], [with libsndfile])], [AC_MSG_ERROR([Unable to find libsndfile.])])
  234. ]
  235. )
  236. ])
  237. # Optional openmpt123 dependency: libFLAC
  238. AC_ARG_WITH([flac], AS_HELP_STRING([--without-flac], [Disable use of libflac.]))
  239. AS_IF([test "x$enable_openmpt123" != "xno"],[
  240. AS_IF([test "x$with_flac" != "xno"],
  241. [
  242. PKG_CHECK_MODULES([FLAC], [flac >= 1.3.0], [AC_DEFINE([MPT_WITH_FLAC], [], [with libflac])], [AC_MSG_ERROR([Unable to find libflac >= 1.3.0.])])
  243. ]
  244. )
  245. ])
  246. # We want a modern C compiler
  247. AC_PROG_CC_STDC
  248. #AC_PROG_CC_C99
  249. # We need C++17 support
  250. #AX_CXX_COMPILE_STDCXX(20, [noext], [optional])
  251. #AS_IF([test "x$HAVE_CXX20" != "x1"],
  252. # [
  253. # AX_CXX_COMPILE_STDCXX(17, [noext], [mandatory])
  254. # ],[]
  255. #)
  256. AX_CXX_COMPILE_STDCXX(17, [noext], [mandatory])
  257. AC_LANG_PUSH([C])
  258. AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [CFLAGS="$CFLAGS -fvisibility=hidden"])
  259. AX_CFLAGS_WARN_ALL
  260. AC_LANG_POP([C])
  261. AC_LANG_PUSH([C++])
  262. AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [CXXFLAGS="$CXXFLAGS -fvisibility=hidden"])
  263. AX_CXXFLAGS_WARN_ALL
  264. AC_LANG_POP([C++])
  265. # mingw c++ thread
  266. AC_LANG_PUSH([C++])
  267. case $host_os in
  268. mingw32*)
  269. AC_CHECK_HEADER([mingw.mutex.h],
  270. [
  271. have_mingwstdtthreads=1
  272. ],
  273. [
  274. have_mingwstdtthreads=0
  275. ]
  276. )
  277. ;;
  278. *)
  279. have_mingwstdtthreads=0
  280. ;;
  281. esac
  282. AC_LANG_POP([C++])
  283. AS_IF([test "x$have_mingwstdtthreads" = "x1"],
  284. [
  285. MINGWSTDTHREADS_CPPFLAGS=-DMPT_WITH_MINGWSTDTHREADS
  286. ],
  287. [
  288. MINGWSTDTHREADS_CPPFLAGS=
  289. ]
  290. )
  291. AC_SUBST([MINGWSTDTHREADS_CPPFLAGS])
  292. DX_DOXYGEN_FEATURE(ON)
  293. DX_DOT_FEATURE(OFF)
  294. DX_HTML_FEATURE(ON)
  295. DX_MAN_FEATURE(OFF)
  296. DX_CHM_FEATURE(OFF)
  297. DX_CHI_FEATURE(OFF)
  298. DX_RTF_FEATURE(OFF)
  299. DX_XML_FEATURE(OFF)
  300. DX_PDF_FEATURE(OFF)
  301. DX_PS_FEATURE(OFF)
  302. DX_INIT_DOXYGEN([libopenmpt], [Doxyfile], [doxygen-doc])
  303. AC_OUTPUT