configure.ac 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. # Copyright (C) 1999-2013 Erik de Castro Lopo <erikd@mega-nerd.com>.
  2. dnl Require autoconf version
  3. AC_PREREQ(2.57)
  4. AC_INIT([libsndfile],[1.0.26pre5],[sndfile@mega-nerd.com],
  5. [libsndfile],[http://www.mega-nerd.com/libsndfile/])
  6. # Put config stuff in Cfg.
  7. AC_CONFIG_AUX_DIR(Cfg)
  8. AC_CONFIG_SRCDIR([src/sndfile.c])
  9. AC_CANONICAL_TARGET([])
  10. AC_CONFIG_MACRO_DIR([M4])
  11. AC_CONFIG_HEADERS([src/config.h])
  12. CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
  13. CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
  14. LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
  15. AM_INIT_AUTOMAKE
  16. AC_SUBST(ACLOCAL_AMFLAGS, "-I M4")
  17. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  18. AC_LANG([C])
  19. AC_PROG_CC_STDC
  20. AC_USE_SYSTEM_EXTENSIONS
  21. AM_PROG_CC_C_O
  22. AC_PROG_CXX
  23. MN_C_COMPILER_IS_CLANG
  24. MN_GCC_REALLY_IS_GCC
  25. AC_PROG_SED
  26. # Do not check for F77.
  27. define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
  28. AM_PROG_LIBTOOL
  29. LT_PROG_RC
  30. AC_PROG_INSTALL
  31. AC_PROG_LN_S
  32. AC_CHECK_PROG(HAVE_AUTOGEN, autogen, yes, no)
  33. AC_CHECK_PROG(HAVE_WINE, wine, yes, no)
  34. AC_CHECK_PROG(HAVE_XCODE_SELECT, xcode-select, yes, no)
  35. #------------------------------------------------------------------------------------
  36. # Rules for library version information:
  37. #
  38. # 1. Start with version information of `0:0:0' for each libtool library.
  39. # 2. Update the version information only immediately before a public release of
  40. # your software. More frequent updates are unnecessary, and only guarantee
  41. # that the current interface number gets larger faster.
  42. # 3. If the library source code has changed at all since the last update, then
  43. # increment revision (`c:r:a' becomes `c:r+1:a').
  44. # 4. If any interfaces have been added, removed, or changed since the last update,
  45. # increment current, and set revision to 0.
  46. # 5. If any interfaces have been added since the last public release, then increment
  47. # age.
  48. # 6. If any interfaces have been removed since the last public release, then set age
  49. # to 0.
  50. CLEAN_VERSION=`echo $PACKAGE_VERSION | $SED "s/p.*//"`
  51. VERSION_MINOR=`echo $CLEAN_VERSION | $SED "s/.*\.//"`
  52. SHARED_VERSION_INFO="1:$VERSION_MINOR:0"
  53. #------------------------------------------------------------------------------------
  54. AC_HEADER_STDC
  55. AC_CHECK_HEADERS(endian.h)
  56. AC_CHECK_HEADERS(byteswap.h)
  57. AC_CHECK_HEADERS(locale.h)
  58. AC_CHECK_HEADERS(sys/time.h)
  59. AC_HEADER_SYS_WAIT
  60. AC_CHECK_DECLS(S_IRGRP)
  61. if test x$ac_cv_have_decl_S_IRGRP = xyes ; then
  62. AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],1,[Set to 1 if S_IRGRP is defined.])
  63. else
  64. AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],0)
  65. fi
  66. AM_CONDITIONAL([LINUX_MINGW_CROSS_TEST],
  67. [test "$build_os:$target_os:$host_os:$HAVE_WINE" = "linux-gnu:mingw32msvc:mingw32msvc:yes"])
  68. #====================================================================================
  69. # Couple of initializations here. Fill in real values later.
  70. SHLIB_VERSION_ARG=""
  71. #====================================================================================
  72. # Finished checking, handle options.
  73. AC_ARG_ENABLE(experimental,
  74. AC_HELP_STRING([--enable-experimental], [enable experimental code]))
  75. EXPERIMENTAL_CODE=0
  76. if test x$enable_experimental = xyes ; then
  77. EXPERIMENTAL_CODE=1
  78. fi
  79. AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE],${EXPERIMENTAL_CODE}, [Set to 1 to enable experimental code.])
  80. AC_ARG_ENABLE(werror,
  81. AC_HELP_STRING([--enable-werror], [enable -Werror in all Makefiles]))
  82. AC_ARG_ENABLE(stack-smash-protection,
  83. AC_HELP_STRING([--enable-stack-smash-protection], [Enable GNU GCC stack smash protection]))
  84. AC_ARG_ENABLE(gcc-pipe,
  85. AC_HELP_STRING([--disable-gcc-pipe], [disable gcc -pipe option]))
  86. AC_ARG_ENABLE(gcc-opt,
  87. AC_HELP_STRING([--disable-gcc-opt], [disable gcc optimisations]))
  88. AC_ARG_ENABLE(cpu-clip,
  89. AC_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]))
  90. AC_ARG_ENABLE(bow-docs,
  91. AC_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs]))
  92. AC_ARG_ENABLE(sqlite,
  93. AC_HELP_STRING([--disable-sqlite], [disable use of sqlite]))
  94. AC_ARG_ENABLE(alsa,
  95. AC_HELP_STRING([--disable-alsa], [disable use of ALSA]))
  96. AC_ARG_ENABLE(external-libs,
  97. AC_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis [[default=no]]]))
  98. AC_ARG_ENABLE(octave,
  99. AC_HELP_STRING([--enable-octave], [disable building of GNU Octave module]))
  100. AC_ARG_ENABLE(test-coverage,
  101. AC_HELP_STRING([--enable-test-coverage], [enable test coverage]))
  102. AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "$enable_test_coverage" = yes])
  103. #====================================================================================
  104. # Check types and their sizes.
  105. AC_CHECK_SIZEOF(wchar_t,4)
  106. AC_CHECK_SIZEOF(short,2)
  107. AC_CHECK_SIZEOF(int,4)
  108. AC_CHECK_SIZEOF(long,4)
  109. AC_CHECK_SIZEOF(float,4)
  110. AC_CHECK_SIZEOF(double,4)
  111. AC_CHECK_SIZEOF(void*,8)
  112. AC_CHECK_SIZEOF(size_t,4)
  113. AC_CHECK_SIZEOF(int64_t,8)
  114. AC_CHECK_SIZEOF(long long,8)
  115. #====================================================================================
  116. # Find an appropriate type for sf_count_t.
  117. # On systems supporting files larger than 2 Gig, sf_count_t must be a 64 bit value.
  118. # Unfortunately there is more than one way of ensuring this so need to do some
  119. # pretty rigourous testing here.
  120. # Check for common 64 bit file offset types.
  121. AC_CHECK_SIZEOF(off_t,1)
  122. AC_CHECK_SIZEOF(loff_t,1)
  123. AC_CHECK_SIZEOF(off64_t,1)
  124. if test "$enable_largefile:$ac_cv_sizeof_off_t" = "no:8" ; then
  125. echo
  126. echo "Error : Cannot disable large file support because sizeof (off_t) == 8."
  127. echo
  128. exit 1
  129. fi
  130. case "$host_os" in
  131. mingw32msvc | mingw32)
  132. TYPEOF_SF_COUNT_T="__int64"
  133. SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
  134. SIZEOF_SF_COUNT_T=8
  135. AC_DEFINE([__USE_MINGW_ANSI_STDIO],1,[Set to 1 to use C99 printf/snprintf in MinGW.])
  136. ;;
  137. *)
  138. SIZEOF_SF_COUNT_T=0
  139. if test "x$ac_cv_sizeof_off_t" = "x8" ; then
  140. # If sizeof (off_t) is 8, no further checking is needed.
  141. TYPEOF_SF_COUNT_T="int64_t"
  142. SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
  143. SIZEOF_SF_COUNT_T=8
  144. elif test "x$ac_cv_sizeof_loff_t" = "x8" ; then
  145. TYPEOF_SF_COUNT_T="int64_t"
  146. SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
  147. SIZEOF_SF_COUNT_T=8
  148. elif test "x$ac_cv_sizeof_off64_t" = "x8" ; then
  149. TYPEOF_SF_COUNT_T="int64_t"
  150. SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
  151. SIZEOF_SF_COUNT_T=8
  152. else
  153. # Save the old sizeof (off_t) value and then unset it to see if it
  154. # changes when Large File Support is enabled.
  155. pre_largefile_sizeof_off_t=$ac_cv_sizeof_off_t
  156. unset ac_cv_sizeof_off_t
  157. AC_SYS_LARGEFILE
  158. if test "x$ac_cv_sys_largefile_CFLAGS" = "xno" ; then
  159. ac_cv_sys_largefile_CFLAGS=""
  160. fi
  161. if test "x$ac_cv_sys_largefile_LDFLAGS" = "xno" ; then
  162. ac_cv_sys_largefile_LDFLAGS=""
  163. fi
  164. if test "x$ac_cv_sys_largefile_LIBS" = "xno" ; then
  165. ac_cv_sys_largefile_LIBS=""
  166. fi
  167. AC_CHECK_SIZEOF(off_t,1)
  168. if test "x$ac_cv_sizeof_off_t" = "x8" ; then
  169. TYPEOF_SF_COUNT_T="int64_t"
  170. SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
  171. elif test "x$TYPEOF_SF_COUNT_T" = "xunknown" ; then
  172. echo
  173. echo "*** The configure process has determined that this system is capable"
  174. echo "*** of Large File Support but has not been able to find a type which"
  175. echo "*** is an unambiguous 64 bit file offset."
  176. echo "*** Please contact the author to help resolve this problem."
  177. echo
  178. AC_MSG_ERROR([[Bad file offset type.]])
  179. fi
  180. fi
  181. ;;
  182. esac
  183. if test $SIZEOF_SF_COUNT_T = 4 ; then
  184. SF_COUNT_MAX="0x7FFFFFFF"
  185. fi
  186. AC_DEFINE_UNQUOTED([TYPEOF_SF_COUNT_T],${TYPEOF_SF_COUNT_T}, [Set to long if unknown.])
  187. AC_SUBST(TYPEOF_SF_COUNT_T)
  188. AC_DEFINE_UNQUOTED([SIZEOF_SF_COUNT_T],${SIZEOF_SF_COUNT_T}, [Set to sizeof (long) if unknown.])
  189. AC_SUBST(SIZEOF_SF_COUNT_T)
  190. AC_DEFINE_UNQUOTED([SF_COUNT_MAX],${SF_COUNT_MAX}, [Set to maximum allowed value of sf_count_t type.])
  191. AC_SUBST(SF_COUNT_MAX)
  192. AC_CHECK_TYPES(ssize_t)
  193. AC_CHECK_SIZEOF(ssize_t,4)
  194. #====================================================================================
  195. # Determine endian-ness of target processor.
  196. MN_C_FIND_ENDIAN
  197. AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
  198. [Target processor is big endian.])
  199. AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
  200. [Target processor is little endian.])
  201. AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
  202. [Target processor is big endian.])
  203. #====================================================================================
  204. # Check for functions.
  205. AC_CHECK_FUNCS(malloc calloc realloc free)
  206. AC_CHECK_FUNCS(open read write lseek lseek64)
  207. AC_CHECK_FUNCS(fstat fstat64 ftruncate fsync)
  208. AC_CHECK_FUNCS(snprintf vsnprintf)
  209. AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r gettimeofday)
  210. AC_CHECK_FUNCS(mmap getpagesize)
  211. AC_CHECK_FUNCS(setlocale)
  212. AC_CHECK_FUNCS(pipe waitpid)
  213. AC_CHECK_LIB([m],floor)
  214. AC_CHECK_FUNCS(floor ceil fmod lround)
  215. MN_C99_FUNC_LRINT
  216. MN_C99_FUNC_LRINTF
  217. #====================================================================================
  218. # Check for requirements for building plugins for other languages/enviroments.
  219. dnl Octave maths environment http://www.octave.org/
  220. if test x$cross_compiling = xno ; then
  221. if test x$enable_octave = xno ; then
  222. AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
  223. else
  224. AC_OCTAVE_BUILD
  225. fi
  226. else
  227. AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
  228. fi
  229. #====================================================================================
  230. # Check for Ogg, Vorbis and FLAC.
  231. HAVE_EXTERNAL_LIBS=0
  232. EXTERNAL_CFLAGS=""
  233. EXTERNAL_LIBS=""
  234. # Check for pkg-config outside the if statement.
  235. #PKG_PROG_PKG_CONFIG
  236. #m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], AC_SUBST([pkgconfigdir], ${libdir}/pkgconfig))
  237. #if test -n "$PKG_CONFIG" ; then
  238. # if test x$enable_external_libs = xno ; then
  239. # AC_MSG_WARN([[*** External libs (FLAC, Ogg, Vorbis) disabled. ***]])
  240. # else
  241. # PKG_CHECK_MOD_VERSION([FLAC], [flac >= 1.2.1], [ac_cv_flac=yes], [ac_cv_flac=no])
  242. # Make sure the FLAC_CFLAGS value is sane.
  243. # FLAC_CFLAGS=`echo $FLAC_CFLAGS | $SED "s|include/FLAC|include|"`
  244. # PKG_CHECK_MOD_VERSION([OGG], [ogg >= 1.1.3], [ac_cv_ogg=yes], [ac_cv_ogg=no])
  245. # if test x$enable_experimental = xyes ; then
  246. # PKG_CHECK_MOD_VERSION([SPEEX], [speex >= 1.2], [ac_cv_speex=yes], [ac_cv_speex=no])
  247. # else
  248. # SPEEX_CFLAGS=""
  249. # SPEEX_LIBS=""
  250. # fi
  251. # Vorbis versions earlier than 1.2.3 have bugs that cause the libsndfile
  252. # test suite to fail on MIPS, PowerPC and others.
  253. # See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549899
  254. # PKG_CHECK_MOD_VERSION([VORBIS], [vorbis >= 1.2.3], [ac_cv_vorbis=yes], [ac_cv_vorbis=no])
  255. # PKG_CHECK_MOD_VERSION([VORBISENC], [vorbisenc >= 1.2.3], [ac_cv_vorbisenc=yes], [ac_cv_vorbisenc=no])
  256. # enable_external_libs=yes
  257. # fi
  258. # if test x$ac_cv_flac$ac_cv_ogg$ac_cv_vorbis$ac_cv_vorbisenc = "xyesyesyesyes" ; then
  259. # HAVE_EXTERNAL_LIBS=1
  260. # enable_external_libs=yes
  261. # EXTERNAL_CFLAGS="$FLAC_CFLAGS $OGG_CFLAGS $VORBIS_CFLAGS $VORBISENC_CFLAGS $SPEEX_CFLAGS"
  262. # EXTERNAL_LIBS="$FLAC_LIBS $OGG_LIBS $VORBIS_LIBS $VORBISENC_LIBS $SPEEX_LIBS "
  263. # else
  264. # echo
  265. # AC_MSG_WARN([[*** One or more of the external libraries (ie libflac, libogg and]])
  266. # AC_MSG_WARN([[*** libvorbis) is either missing (possibly only the development]])
  267. # AC_MSG_WARN([[*** headers) or is of an unsupported version.]])
  268. # AC_MSG_WARN([[***]])
  269. # AC_MSG_WARN([[*** Unfortunately, for ease of maintenance, the external libs]])
  270. # AC_MSG_WARN([[*** are an all or nothing affair.]])
  271. # echo
  272. # enable_external_libs=no
  273. # fi
  274. # fi
  275. AC_DEFINE_UNQUOTED([HAVE_EXTERNAL_LIBS], $HAVE_EXTERNAL_LIBS, [Will be set to 1 if flac, ogg and vorbis are available.])
  276. #====================================================================================
  277. # Check for libsqlite3 (only used in regtest).
  278. ac_cv_sqlite3=no
  279. #if test x$enable_sqlite != xno ; then
  280. # PKG_CHECK_MOD_VERSION([SQLITE3], [sqlite3 >= 3.2], [ac_cv_sqlite3=yes], [ac_cv_sqlite3=no])
  281. # fi
  282. if test x$ac_cv_sqlite3 = "xyes" ; then
  283. HAVE_SQLITE3=1
  284. else
  285. HAVE_SQLITE3=0
  286. fi
  287. AC_DEFINE_UNQUOTED([HAVE_SQLITE3],$HAVE_SQLITE3,[Set to 1 if you have libsqlite3.])
  288. #====================================================================================
  289. # Determine if the processor can do clipping on float to int conversions.
  290. if test x$enable_cpu_clip != "xno" ; then
  291. MN_C_CLIP_MODE
  292. else
  293. echo "checking processor clipping capabilities... disabled"
  294. ac_cv_c_clip_positive=0
  295. ac_cv_c_clip_negative=0
  296. fi
  297. AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive},
  298. [Target processor clips on positive float to int conversion.])
  299. AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative},
  300. [Target processor clips on negative float to int conversion.])
  301. #====================================================================================
  302. # Target OS specific stuff.
  303. OS_SPECIFIC_CFLAGS=""
  304. OS_SPECIFIC_LINKS=""
  305. os_is_win32=0
  306. use_windows_api=0
  307. osx_darwin_version=0
  308. case "$host_os" in
  309. darwin* | rhapsody*)
  310. osx_darwin_version=$(echo "$host_os" | sed 's/\..*//;s/darwin//g')
  311. if test x$HAVE_XCODE_SELECT = xyes ; then
  312. developer_path=`xcode-select --print-path`
  313. else
  314. developer_path="/Developer"
  315. fi
  316. OS_SPECIFIC_CFLAGS="-I${developer_path}/Headers/FlatCarbon"
  317. OS_SPECIFIC_LINKS="-framework CoreAudio -framework AudioToolbox -framework CoreFoundation"
  318. ;;
  319. mingw*)
  320. os_is_win32=1
  321. use_windows_api=1
  322. OS_SPECIFIC_LINKS="-lwinmm"
  323. ;;
  324. esac
  325. AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32])
  326. AC_DEFINE_UNQUOTED(USE_WINDOWS_API, ${use_windows_api}, [Set to 1 to use the native windows API])
  327. AC_DEFINE_UNQUOTED(OSX_DARWIN_VERSION, ${osx_darwin_version}, [The darwin version, no-zero is valid])
  328. AM_CONDITIONAL(USE_WIN_VERSION_FILE, test ${use_windows_api} -eq 1)
  329. #====================================================================================
  330. # Check for ALSA.
  331. ALSA_LIBS=""
  332. if test x$enable_alsa != xno ; then
  333. AC_CHECK_HEADERS(alsa/asoundlib.h)
  334. if test x$ac_cv_header_alsa_asoundlib_h = xyes ; then
  335. ALSA_LIBS="-lasound"
  336. enable_alsa=yes
  337. fi
  338. fi
  339. #====================================================================================
  340. # Check for OpenBSD's sndio.
  341. SNDIO_LIBS=""
  342. AC_CHECK_HEADERS(sndio.h)
  343. if test x$ac_cv_header_sndio_h = xyes ; then
  344. SNDIO_LIBS="-lsndio"
  345. fi
  346. #====================================================================================
  347. # Test for sanity when cross-compiling.
  348. if test $ac_cv_sizeof_short != 2 ; then
  349. AC_MSG_WARN([[******************************************************************]])
  350. AC_MSG_WARN([[*** sizeof (short) != 2. ]])
  351. AC_MSG_WARN([[******************************************************************]])
  352. fi
  353. if test $ac_cv_sizeof_int != 4 ; then
  354. AC_MSG_WARN([[******************************************************************]])
  355. AC_MSG_WARN([[*** sizeof (int) != 4 ]])
  356. AC_MSG_WARN([[******************************************************************]])
  357. fi
  358. if test $ac_cv_sizeof_float != 4 ; then
  359. AC_MSG_WARN([[******************************************************************]])
  360. AC_MSG_WARN([[*** sizeof (float) != 4. ]])
  361. AC_MSG_WARN([[******************************************************************]])
  362. fi
  363. if test $ac_cv_sizeof_double != 8 ; then
  364. AC_MSG_WARN([[******************************************************************]])
  365. AC_MSG_WARN([[*** sizeof (double) != 8. ]])
  366. AC_MSG_WARN([[******************************************************************]])
  367. fi
  368. if test x"$ac_cv_prog_HAVE_AUTOGEN" = "xno" ; then
  369. AC_MSG_WARN([[Touching files in directory tests/.]])
  370. touch tests/*.c tests/*.h
  371. fi
  372. #====================================================================================
  373. # Settings for the HTML documentation.
  374. if test x$enable_bow_docs = "xyes" ; then
  375. HTML_BGCOLOUR="white"
  376. HTML_FGCOLOUR="black"
  377. else
  378. HTML_BGCOLOUR="black"
  379. HTML_FGCOLOUR="white"
  380. fi
  381. #====================================================================================
  382. # Now use the information from the checking stage.
  383. win32_target_dll=0
  384. COMPILER_IS_GCC=0
  385. if test x$ac_cv_c_compiler_gnu = xyes ; then
  386. MN_ADD_CFLAGS(-std=gnu99)
  387. MN_GCC_VERSION
  388. if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
  389. AC_MSG_WARN([****************************************************************])
  390. AC_MSG_WARN([** GCC version 4.2 warns about the inline keyword for no good **])
  391. AC_MSG_WARN([** reason but the maintainers do not see it as a bug. **])
  392. AC_MSG_WARN([** See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33995 **])
  393. AC_MSG_WARN([** Using -fgnu-inline to avoid this stupidity. **])
  394. AC_MSG_WARN([****************************************************************])
  395. MN_ADD_CFLAGS([-fgnu89-inline])
  396. fi
  397. CFLAGS="$CFLAGS -Wall"
  398. CXXFLAGS="$CXXFLAGS -Wall"
  399. MN_ADD_CFLAGS([-Wextra])
  400. AC_LANG_PUSH([C++])
  401. MN_ADD_CXXFLAGS([-Wextra])
  402. AC_LANG_POP([C++])
  403. MN_ADD_CFLAGS([-Wdeclaration-after-statement])
  404. MN_ADD_CFLAGS([-Wpointer-arith])
  405. MN_ADD_CFLAGS([-funsigned-char])
  406. MN_ADD_CFLAGS([-D_FORTIFY_SOURCE=2])
  407. if test x$enable_stack_smash_protection = "xyes" ; then
  408. XIPH_GCC_STACK_PROTECTOR
  409. XIPH_GXX_STACK_PROTECTOR
  410. fi
  411. if test x$enable_test_coverage = "xyes" ; then
  412. # MN_ADD_CFLAGS([-ftest-coverage])
  413. MN_ADD_CFLAGS([-coverage])
  414. fi
  415. CFLAGS="$CFLAGS -Wcast-align -Wcast-qual -Wshadow -Wbad-function-cast -Wwrite-strings -Wundef -Wuninitialized -Winit-self -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return"
  416. # -Winline -Wconversion -Wunreachable-code"
  417. CXXFLAGS="$CXXFLAGS -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo -Wundef -Wuninitialized -Winit-self"
  418. if test "x$enable_gcc_opt" = "xno" ; then
  419. temp_CFLAGS=`echo $CFLAGS | $SED "s/O2/O0/"`
  420. CFLAGS=$temp_CFLAGS
  421. AC_MSG_WARN([[*** Compiler optimisations switched off. ***]])
  422. fi
  423. # OS specific tweaks.
  424. case "$host_os" in
  425. darwin* | rhapsody*)
  426. # Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody.
  427. # System headers on these systems are broken.
  428. temp_CFLAGS=`echo $CFLAGS | $SED "s/-Wall -pedantic//" | $SED "s/-Wshadow//" | $SED "s/-Waggregate-return//"`
  429. CFLAGS=$temp_CFLAGS
  430. SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(builddir)/Symbols.darwin"
  431. ;;
  432. linux*|kfreebsd*-gnu*|gnu*)
  433. SHLIB_VERSION_ARG="-Wl,--version-script=\$(builddir)/Symbols.gnu-binutils"
  434. ;;
  435. mingw*)
  436. # Linker flag '-Wl,--out-implib' does not work with mingw cross compiler
  437. # so we don't use it here.
  438. SHLIB_VERSION_ARG="-Wl,\$(builddir)/libsndfile-1.def"
  439. win32_target_dll=1
  440. if test x"$enable_shared" = xno ; then
  441. win32_target_dll=0
  442. fi
  443. ;;
  444. os2*)
  445. SHLIB_VERSION_ARG="-Wl,-export-symbols \$(builddir)/Symbols.os2"
  446. ;;
  447. *)
  448. ;;
  449. esac
  450. if test x$enable_gcc_pipe != "xno" ; then
  451. CFLAGS="$CFLAGS -pipe"
  452. fi
  453. COMPILER_IS_GCC=1
  454. fi
  455. if test x$enable_werror = "xyes" ; then
  456. MN_ADD_CFLAGS([-Werror])
  457. AC_LANG_PUSH([C++])
  458. MN_ADD_CXXFLAGS([-Werror])
  459. AC_LANG_POP([C++])
  460. fi
  461. AC_DEFINE_UNQUOTED([WIN32_TARGET_DLL], ${win32_target_dll}, [Set to 1 if windows DLL is being built.])
  462. AC_DEFINE_UNQUOTED([COMPILER_IS_GCC], ${COMPILER_IS_GCC}, [Set to 1 if the compile is GNU GCC.])
  463. CFLAGS="$CFLAGS $OS_SPECIFIC_CFLAGS"
  464. if test x"$CFLAGS" = x ; then
  465. echo "Error in configure script. CFLAGS has been screwed up."
  466. exit
  467. fi
  468. HOST_TRIPLET="${host_cpu}-${host_vendor}-${host_os}"
  469. AC_DEFINE_UNQUOTED([HOST_TRIPLET], "${HOST_TRIPLET}", [The host triplet of the compiled binary.])
  470. if test "$HOST_TRIPLET" = "x86_64-w64-mingw32" ; then
  471. OS_SPECIFIC_LINKS=" -static-libgcc $OS_SPECIFIC_LINKS"
  472. fi
  473. WIN_RC_VERSION=`echo $PACKAGE_VERSION | $SED -e "s/p.*//" -e "s/\./,/g"`
  474. if test "$enable_static" = no ; then
  475. SRC_BINDIR=src/.libs/
  476. TEST_BINDIR=tests/.libs/
  477. else
  478. SRC_BINDIR=src/
  479. TEST_BINDIR=tests/
  480. fi
  481. #-------------------------------------------------------------------------------
  482. AC_SUBST(HOST_TRIPLET)
  483. AC_SUBST(HTML_BGCOLOUR)
  484. AC_SUBST(HTML_FGCOLOUR)
  485. AC_SUBST(SHLIB_VERSION_ARG)
  486. AC_SUBST(SHARED_VERSION_INFO)
  487. AC_SUBST(CLEAN_VERSION)
  488. AC_SUBST(WIN_RC_VERSION)
  489. AC_SUBST(OS_SPECIFIC_CFLAGS)
  490. AC_SUBST(OS_SPECIFIC_LINKS)
  491. AC_SUBST(ALSA_LIBS)
  492. AC_SUBST(SNDIO_LIBS)
  493. AC_SUBST(EXTERNAL_CFLAGS)
  494. AC_SUBST(EXTERNAL_LIBS)
  495. AC_SUBST(SRC_BINDIR)
  496. AC_SUBST(TEST_BINDIR)
  497. dnl The following line causes the libtool distributed with the source
  498. dnl to be replaced if the build system has a more recent version.
  499. AC_SUBST(LIBTOOL_DEPS)
  500. AC_CONFIG_FILES([ \
  501. src/Makefile man/Makefile examples/Makefile tests/Makefile regtest/Makefile \
  502. M4/Makefile Win32/Makefile Octave/Makefile programs/Makefile \
  503. Makefile \
  504. src/version-metadata.rc tests/test_wrapper.sh tests/pedantic-header-test.sh \
  505. doc/libsndfile.css Scripts/build-test-tarball.mk libsndfile.spec sndfile.pc \
  506. src/sndfile.h \
  507. echo-install-dirs
  508. ])
  509. AC_OUTPUT
  510. # Make sure these are executable.
  511. chmod u+x tests/test_wrapper.sh build-test-tarball.mk echo-install-dirs
  512. #====================================================================================
  513. AC_MSG_RESULT([
  514. -=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
  515. Configuration summary :
  516. libsndfile version : .................. ${VERSION}
  517. Host CPU : ............................ ${host_cpu}
  518. Host Vendor : ......................... ${host_vendor}
  519. Host OS : ............................. ${host_os}
  520. Experimental code : ................... ${enable_experimental:-no}
  521. Using ALSA in example programs : ...... ${enable_alsa:-no}
  522. External FLAC/Ogg/Vorbis : ............ ${enable_external_libs:-no}
  523. ])
  524. if test -z "$PKG_CONFIG" ; then
  525. echo " *****************************************************************"
  526. echo " *** The pkg-config program is missing. ***"
  527. echo " *** External FLAC/Ogg/Vorbis libs cannot be found without it. ***"
  528. echo " *** http://pkg-config.freedesktop.org/wiki/ ***"
  529. echo " *****************************************************************"
  530. echo
  531. fi
  532. echo " Tools :"
  533. echo
  534. echo " Compiler is Clang : ................... ${mn_cv_c_compiler_clang}"
  535. echo " Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
  536. if test x$ac_cv_c_compiler_gnu = xyes ; then
  537. echo " GCC version : ......................... ${GCC_VERSION}"
  538. if test $GCC_MAJOR_VERSION -lt 3 ; then
  539. echo "\n"
  540. echo " ** This compiler version allows applications to write"
  541. echo " ** to static strings within the library."
  542. echo " ** Compile with GCC version 3.X or above to avoid this problem."
  543. fi
  544. fi
  545. ./echo-install-dirs
  546. # Remove symlink created by Scripts/android-configure.sh.
  547. test -h gdbclient && rm -f gdbclient
  548. (cd src && make genfiles)