1dnl Copyright (C) 1999-2022 Erik de Castro Lopo <erikd@mega-nerd.com>. 2 3dnl Require autoconf version >= 2.69 4AC_PREREQ([2.69]) 5 6AC_INIT([libsndfile],[1.2.0],[sndfile@mega-nerd.com], 7 [libsndfile],[http://libsndfile.github.io/libsndfile/]) 8 9dnl Check whether we want to set defaults for CFLAGS, CXXFLAGS, CPPFLAGS and LDFLAGS 10AC_MSG_CHECKING([whether configure should try to set CFLAGS/CXXFLAGS/CPPFLAGS/LDFLAGS]) 11AS_IF([test "x${CFLAGS+set}" = "xset" || test "x${CXXFLAGS+set}" = "xset" || test "x${CPPFLAGS+set}" = "xset" || test "x${LDFLAGS+set}" = "xset"], [ 12 enable_flags_setting=no 13 : ${CFLAGS=""} 14 : ${CXXFLAGS=""} 15 ], [ 16 enable_flags_setting=yes 17 dnl Set to empty flags so AC_PROG_CC and 18 dnl AC_PROG_CXX do not add -g -O2 19 CFLAGS="" 20 CXXFLAGS="" 21 ]) 22AC_MSG_RESULT([${enable_flags_setting}]) 23 24dnl Put config stuff in 'build-aux'. 25AC_CONFIG_AUX_DIR([build-aux]) 26 27AC_CONFIG_SRCDIR([src/sndfile.c]) 28AC_CANONICAL_HOST 29 30AC_CONFIG_MACRO_DIR([m4]) 31AC_CONFIG_HEADERS([src/config.h]) 32 33AM_INIT_AUTOMAKE([1.14 foreign dist-xz no-dist-gzip serial-tests subdir-objects]) 34AM_SILENT_RULES([yes]) 35 36dnl ==================================================================================== 37 38AC_PROG_CC 39AC_PROG_CC_C99 40 41AS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [ 42 AC_MSG_ERROR([libsndfile requires a C99 capable compiler!]) 43 ]) 44 45AC_USE_SYSTEM_EXTENSIONS 46AC_PROG_CXX 47 48AC_LANG([C]) 49AX_COMPILER_VENDOR 50AX_COMPILER_VERSION 51 52AC_LANG_PUSH([C++]) 53AX_COMPILER_VENDOR 54AX_COMPILER_VERSION 55AC_LANG_POP([C++]) 56 57AC_PROG_SED 58AM_PROG_AR 59 60LT_INIT([disable-static win32-dll]) 61LT_PROG_RC 62 63AC_PROG_INSTALL 64AC_PROG_LN_S 65 66AM_PATH_PYTHON 67 68AC_CHECK_PROG([HAVE_AUTOGEN], [autogen], [yes], [no]) 69AC_CHECK_PROG([HAVE_WINE], [wine], [yes], [no]) 70AC_CHECK_PROG([HAVE_XCODE_SELECT], [xcode-select], [yes], [no]) 71 72dnl ------------------------------------------------------------------------------------ 73dnl Rules for library version information: 74dnl 75dnl 1. Start with version information of `0:0:0' for each libtool library. 76dnl 2. Update the version information only immediately before a public release of 77dnl your software. More frequent updates are unnecessary, and only guarantee 78dnl that the current interface number gets larger faster. 79dnl 3. If the library source code has changed at all since the last update, then 80dnl increment revision (`c:r:a' becomes `c:r+1:a'). 81dnl 4. If any interfaces have been added, removed, or changed since the last update, 82dnl increment current, and set revision to 0. 83dnl 5. If any interfaces have been added since the last public release, then increment 84dnl age. 85dnl 6. If any interfaces have been removed since the last public release, then set age 86dnl to 0. 87 88dnl This is libtool version of library, we add it to `--version-info` property. 89 90m4_define([lt_current], [1]) 91m4_define([lt_revision], [35]) 92m4_define([lt_age], [0]) 93 94dnl This is ABI version for linker scripts, CMake uses the same format for 95dnl VERSION property of shared library. 96dnl The formula is: c:r:a -> c-a:a:r 97 98m4_define([abi_version_major], [m4_eval(lt_current - lt_age)]) 99m4_define([abi_version_minor], [lt_age]) 100m4_define([abi_version_patch], [lt_revision]) 101 102dnl ------------------------------------------------------------------------------------ 103 104AC_CHECK_HEADERS([endian.h]) 105AC_CHECK_HEADERS([byteswap.h]) 106AC_CHECK_HEADERS([locale.h]) 107AC_CHECK_HEADERS([sys/time.h]) 108AC_CHECK_HEADERS([immintrin.h]) 109AC_CHECK_HEADERS([stdbool.h]) 110 111AC_HEADER_SYS_WAIT 112 113AC_CHECK_DECLS([S_IRGRP]) 114AS_IF([test "x$ac_cv_have_decl_S_IRGRP" = "xyes"], [ 115 AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP], [1], [Set to 1 if S_IRGRP is defined.]) 116 ], [ 117 AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP], [0], [Set to 0 if S_IRGRP is not defined.]) 118 ]) 119 120AM_CONDITIONAL([LINUX_MINGW_CROSS_TEST], 121 [test "x${build_os}:${host_os}:${HAVE_WINE}" = "xlinux-gnu:mingw32msvc:yes"]) 122 123dnl ==================================================================================== 124dnl Couple of initializations here. Fill in real values later. 125 126SHLIB_VERSION_ARG="" 127 128dnl ==================================================================================== 129dnl Finished checking, handle options. 130 131AC_ARG_ENABLE(experimental, 132 AS_HELP_STRING([--enable-experimental], [enable experimental code])) 133 134AS_IF([test "x$enable_experimental" = "xyes"], [ 135 EXPERIMENTAL_CODE=1 136 ], [ 137 EXPERIMENTAL_CODE=0 138 ]) 139AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE], [${EXPERIMENTAL_CODE}], [Set to 1 to enable experimental code.]) 140 141AC_ARG_ENABLE([werror], 142 [AS_HELP_STRING([--enable-werror], [enable -Werror in all Makefiles])]) 143 144AC_ARG_ENABLE([cpu-clip], 145 [AS_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper])]) 146 147AC_ARG_ENABLE([bow-docs], 148 [AS_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs])]) 149 150AC_ARG_ENABLE([sqlite], 151 [AS_HELP_STRING([--disable-sqlite], [disable use of sqlite])]) 152 153AC_ARG_ENABLE([alsa], 154 [AS_HELP_STRING([--disable-alsa], [disable ALSA support (default=autodetect)])], [], [enable_alsa=auto]) 155 156AC_ARG_ENABLE([external-libs], 157 [AS_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis [[default=no]]])]) 158 159AC_ARG_ENABLE([mpeg], 160 [AS_HELP_STRING([--disable-mpeg], [disable use of LAME/MPG123 for MPEG (MP3) [[defaults=no]]])]) 161 162AC_ARG_ENABLE(octave, 163 [AS_HELP_STRING([--enable-octave], [enable building of GNU Octave module])]) 164 165AC_ARG_ENABLE([full-suite], 166 [AS_HELP_STRING([--disable-full-suite], [disable building and installing programs, documentation, only build library [[default=no]]])]) 167AM_CONDITIONAL([FULL_SUITE], [test "x$enable_full_suite" != "xno"]) 168 169AC_ARG_ENABLE([test-coverage], 170 [AS_HELP_STRING([--enable-test-coverage], [enable test coverage])]) 171AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "x$enable_test_coverage" = "xyes"]) 172 173AC_ARG_ENABLE([ossfuzzers], 174 [AS_HELP_STRING([--enable-ossfuzzers], [Whether to generate the fuzzers for OSS-Fuzz])]) 175AM_CONDITIONAL([USE_OSSFUZZERS], [test "x$enable_ossfuzzers" = "xyes"]) 176 177AC_SUBST([LIB_FUZZING_ENGINE]) 178AM_CONDITIONAL([USE_OSSFUZZ_FLAG], [test "x$LIB_FUZZING_ENGINE" = "x-fsanitize=fuzzer"]) 179AM_CONDITIONAL([USE_OSSFUZZ_STATIC], [test -f "$LIB_FUZZING_ENGINE"]) 180 181dnl ==================================================================================== 182dnl Check types and their sizes. 183 184AC_CHECK_SIZEOF([wchar_t], [4]) 185AC_CHECK_SIZEOF([short], [2]) 186AC_CHECK_SIZEOF([int], [4]) 187AC_CHECK_SIZEOF([long], [4]) 188AC_CHECK_SIZEOF([float], [4]) 189AC_CHECK_SIZEOF([double], [4]) 190AC_CHECK_SIZEOF([void*], [8]) 191AC_CHECK_SIZEOF([size_t], [4]) 192AC_CHECK_SIZEOF([int64_t], [8]) 193AC_CHECK_SIZEOF([long long], [8]) 194 195dnl Check for common 64 bit file offset types. 196AC_CHECK_SIZEOF([off_t], [1]) 197 198AS_IF([test "x$enable_largefile:$ac_cv_sizeof_off_t" = "xno:8"], [ 199 AC_MSG_ERROR(["Error : Cannot disable large file support because sizeof (off_t) == 8."]) 200 ]) 201 202AS_CASE([$host_os], 203 [mingw32*], [ 204 AC_DEFINE([__USE_MINGW_ANSI_STDIO], [1], [Set to 1 to use C99 printf/snprintf in MinGW.]) 205 ], 206 207 [ 208 AS_IF([test "x$ac_cv_sizeof_off_t" = "x8"], [ 209 dnl If sizeof (off_t) is 8, no further checking is needed. 210 ], [ 211 dnl Save the old sizeof (off_t) value and then unset it to see if it 212 dnl changes when Large File Support is enabled. 213 pre_largefile_sizeof_off_t=$ac_cv_sizeof_off_t 214 unset ac_cv_sizeof_off_t 215 216 AC_SYS_LARGEFILE 217 AS_IF([test "x$ac_cv_sys_largefile_CFLAGS" = "xno"], [ 218 ac_cv_sys_largefile_CFLAGS="" 219 ]) 220 AS_IF([test "x$ac_cv_sys_largefile_LDFLAGS" = "xno"], [ 221 ac_cv_sys_largefile_LDFLAGS="" 222 ]) 223 AS_IF([test "x$ac_cv_sys_largefile_LIBS" = "xno"], [ 224 ac_cv_sys_largefile_LIBS="" 225 ]) 226 227 AC_CHECK_SIZEOF(off_t,1) 228 ]) 229 ]) 230 231AC_TYPE_SSIZE_T 232 233dnl ==================================================================================== 234dnl Determine endian-ness of host processor. 235 236AC_C_BIGENDIAN([ 237 dnl big-endian 238 ac_cv_c_big_endian=1 239 ac_cv_c_little_endian=0 240 ], [ 241 dnl little-endian 242 ac_cv_c_big_endian=0 243 ac_cv_c_little_endian=1 244 ]) 245 246AC_DEFINE_UNQUOTED([CPU_IS_BIG_ENDIAN], [${ac_cv_c_big_endian}], [Host processor is big endian.]) 247AC_DEFINE_UNQUOTED([CPU_IS_LITTLE_ENDIAN], [${ac_cv_c_little_endian}], [Host processor is little endian.]) 248 249dnl ==================================================================================== 250dnl Check for functions. 251 252AC_CHECK_FUNCS([malloc calloc realloc free]) 253AC_CHECK_FUNCS([open read write lseek lseek64]) 254AC_CHECK_FUNCS([fstat fstat64 ftruncate fsync]) 255AC_CHECK_FUNCS([snprintf vsnprintf]) 256AC_CHECK_FUNCS([gmtime gmtime_r localtime localtime_r gettimeofday]) 257AC_CHECK_FUNCS([mmap getpagesize]) 258AC_CHECK_FUNCS([setlocale]) 259AC_CHECK_FUNCS([pipe waitpid]) 260 261AC_SEARCH_LIBS([floor], [m], [], [ 262 AC_MSG_ERROR([unable to find the floor() function!]) 263 ]) 264AC_CHECK_FUNCS([floor ceil fmod lrint lrintf]) 265 266dnl ==================================================================================== 267dnl Check for requirements for building plugins for other languages/enviroments. 268 269dnl Octave maths environment http://www.octave.org/ 270AS_IF([test "x$cross_compiling" = "xno"], [ 271 AS_IF([test "x$enable_octave" = "xno"], [ 272 AM_CONDITIONAL(BUILD_OCTAVE_MOD, false) 273 ], [ 274 AC_OCTAVE_BUILD 275 ]) 276 ], [ 277 AM_CONDITIONAL(BUILD_OCTAVE_MOD, false) 278 ]) 279 280dnl ==================================================================================== 281dnl Check for Ogg, Vorbis and FLAC. 282 283HAVE_EXTERNAL_XIPH_LIBS=0 284EXTERNAL_XIPH_CFLAGS="" 285EXTERNAL_XIPH_LIBS="" 286EXTERNAL_XIPH_REQUIRE="" 287 288dnl Check for pkg-config outside the if statement. 289PKG_PROG_PKG_CONFIG 290AX_REQUIRE_DEFINED([PKG_INSTALLDIR]) 291PKG_INSTALLDIR 292 293AS_IF([test -n "$PKG_CONFIG"], [ 294 AS_IF([test "x$enable_external_libs" = "xno"], [ 295 AC_MSG_WARN([[*** External libs (FLAC, Ogg, Vorbis) disabled. ***]]) 296 ], [ 297 PKG_CHECK_MOD_VERSION(FLAC, flac >= 1.3.1, ac_cv_flac=yes, ac_cv_flac=no) 298 299 dnl Make sure the FLAC_CFLAGS value is sane. 300 FLAC_CFLAGS=`echo $FLAC_CFLAGS | $SED "s|include/FLAC|include|"` 301 302 PKG_CHECK_MOD_VERSION(OGG, ogg >= 1.3.0, ac_cv_ogg=yes, ac_cv_ogg=no) 303 304 AS_IF([test "x$enable_experimental" = "xyes"], [ 305 PKG_CHECK_MOD_VERSION(SPEEX, speex >= 1.2, ac_cv_speex=yes, ac_cv_speex=no) 306 ], [ 307 SPEEX_CFLAGS="" 308 SPEEX_LIBS="" 309 ]) 310 311 dnl Vorbis versions earlier than 1.2.3 have bugs that cause the libsndfile 312 dnl test suite to fail on MIPS, PowerPC and others. 313 dnl See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549899 314 PKG_CHECK_MOD_VERSION(VORBIS, vorbis >= 1.2.3, ac_cv_vorbis=yes, ac_cv_vorbis=no) 315 PKG_CHECK_MOD_VERSION(VORBISENC, vorbisenc >= 1.2.3, ac_cv_vorbisenc=yes, ac_cv_vorbisenc=no) 316 317 PKG_CHECK_MOD_VERSION(OPUS, opus >= 1.1, ac_cv_opus=yes, ac_cv_opus=no) 318 enable_external_libs=yes 319 ]) 320 321 AS_IF([test "x$ac_cv_flac$ac_cv_ogg$ac_cv_vorbis$ac_cv_vorbisenc$ac_cv_opus" = "xyesyesyesyesyes"], [ 322 HAVE_EXTERNAL_XIPH_LIBS=1 323 enable_external_libs=yes 324 325 EXTERNAL_XIPH_CFLAGS="$FLAC_CFLAGS $VORBIS_CFLAGS $VORBISENC_CFLAGS $SPEEX_CFLAGS $OPUS_CFLAGS $OGG_CFLAGS " 326 EXTERNAL_XIPH_LIBS="$FLAC_LIBS $VORBIS_LIBS $VORBISENC_LIBS $SPEEX_LIBS $OPUS_LIBS $OGG_LIBS " 327 EXTERNAL_XIPH_REQUIRE="flac ogg vorbis vorbisenc opus" 328 329 if test x$ac_cv_speex = "xyes" ; then 330 EXTERNAL_XIPH_REQUIRE="$EXTERNAL_XIPH_REQUIRE speex" 331 fi 332 ], [ 333 AS_ECHO([""]) 334 AC_MSG_WARN([[*** One or more of the external libraries (ie libflac, libogg,]]) 335 AC_MSG_WARN([[*** libvorbis and libopus) is either missing (possibly only the development]]) 336 AC_MSG_WARN([[*** headers) or is of an unsupported version.]]) 337 AC_MSG_WARN([[***]]) 338 AC_MSG_WARN([[*** Unfortunately, for ease of maintenance, the external libs]]) 339 AC_MSG_WARN([[*** are an all or nothing affair.]]) 340 AS_ECHO([""]) 341 enable_external_libs=no 342 ]) 343 ]) 344 345AC_DEFINE_UNQUOTED([HAVE_EXTERNAL_XIPH_LIBS], [$HAVE_EXTERNAL_XIPH_LIBS], [Will be set to 1 if flac, ogg, vorbis, and opus are available.]) 346 347dnl ==================================================================================== 348dnl Check for MPEG libraris liblame 349 350ac_cv_lame="no" 351ac_cv_mpg123="no" 352HAVE_MPEG=0 353EXTERNAL_MPEG_REQUIRE="" 354EXTERNAL_MPEG_LIBS="" 355 356AS_IF([test -n "$PKG_CONFIG"], [ 357 AS_IF([test "x$enable_mpeg" = "xno"], [ 358 AC_MSG_WARN([[*** MPEG (Lame/MPG123) disabled. ***]]) 359 ], [ 360 AC_CHECK_HEADER(lame/lame.h, 361 lame_header_found="yes", 362 lame_header_found="no") 363 AC_SEARCH_LIBS(lame_set_VBR_q, [lame mp3lame], [lame_lib_found="yes"], [lame_lib_found="no"]) 364 AS_IF([test "x$lame_lib_found$lame_header_found" = "xyesyes"], [ 365 ac_cv_lame="yes" 366 ], [ 367 AC_MSG_WARN([["MPEG support selected but external Lame library cannot be found.]]) 368 ]) 369 370 PKG_CHECK_MOD_VERSION([MPG123], [libmpg123 >= 1.25.10], [ 371 ac_cv_mpg123="yes" 372 ], [ 373 AC_MSG_WARN([["MPEG support selected but external MPG123 library cannot be found.]]) 374 ]) 375 376 AS_IF([test "x$ac_cv_lame$ac_cv_mpg123" = "xyesyes"], [ 377 enable_mpeg="yes" 378 HAVE_MPEG=1 379 EXTERNAL_MPEG_REQUIRE="libmpg123" 380 EXTERNAL_MPEG_LIBS="-lmp3lame" 381 MPEG_CFLAGS="$MPG123_CFLAGS" 382 MPEG_LIBS="$MPG123_LIBS" 383 ], [ 384 enable_mpeg="no" 385 AS_ECHO([""]) 386 AC_MSG_WARN([[*** MPEG support disabled.]]) 387 AS_ECHO([""]) 388 ]) 389 ]) 390 ]) 391 392AC_DEFINE_UNQUOTED([HAVE_MPEG], [$HAVE_MPEG], [Will be set to 1 if lame, mpg123 mpeg support is available.]) 393 394dnl ==================================================================================== 395dnl Check for libsqlite3 (only used in regtest). 396 397ac_cv_sqlite3=0 398AS_IF([test "x$enable_sqlite" != "xno"], [ 399 PKG_CHECK_MOD_VERSION([SQLITE3], [sqlite3 >= 3.2], [ac_cv_sqlite3=1], [ac_cv_sqlite3=0]) 400 ]) 401 402AC_DEFINE_UNQUOTED([HAVE_SQLITE3], [${ac_cv_sqlite3}], [Set to 1 if you have libsqlite3.]) 403AM_CONDITIONAL([HAVE_SQLITE3], [test "x$ac_cv_sqlite3" = "x1"]) 404 405dnl ==================================================================================== 406dnl Determine if the processor can do clipping on float to int conversions. 407 408AS_IF([test "x$enable_cpu_clip" != "xno"], [ 409 MN_C_CLIP_MODE 410 ], [ 411 AS_ECHO(["checking processor clipping capabilities... disabled"]) 412 ac_cv_c_clip_positive=0 413 ac_cv_c_clip_negative=0 414 ]) 415 416AC_DEFINE_UNQUOTED([CPU_CLIPS_POSITIVE], [${ac_cv_c_clip_positive}], 417 [Host processor clips on positive float to int conversion.]) 418AC_DEFINE_UNQUOTED([CPU_CLIPS_NEGATIVE], [${ac_cv_c_clip_negative}], 419 [Host processor clips on negative float to int conversion.]) 420 421dnl ==================================================================================== 422dnl Host OS specific stuff. 423 424OS_SPECIFIC_CFLAGS="" 425OS_SPECIFIC_LINKS="" 426os_is_win32=0 427os_is_openbsd=0 428use_windows_api=0 429AS_CASE([$host_os], 430 [darwin* | rhapsody*], [ 431 AS_IF([test "x$HAVE_XCODE_SELECT" = "xyes"], [ 432 developer_path=`xcode-select --print-path` 433 ], [ 434 developer_path="/Developer" 435 ]) 436 OS_SPECIFIC_LINKS="-framework CoreAudio -framework AudioToolbox -framework CoreFoundation"], 437 [mingw*], [ 438 os_is_win32=1 439 use_windows_api=1 440 OS_SPECIFIC_LINKS="-lwinmm"], 441 [openbsd*], [ 442 os_is_openbsd=1 443 ]) 444 445AC_DEFINE_UNQUOTED([OS_IS_WIN32], [${os_is_win32}], [Set to 1 if compiling for Win32]) 446AC_DEFINE_UNQUOTED([OS_IS_OPENBSD], [${os_is_openbsd}], [Set to 1 if compiling for OpenBSD]) 447AC_DEFINE_UNQUOTED([USE_WINDOWS_API], [${use_windows_api}], [Set to 1 to use the native windows API]) 448AM_CONDITIONAL(USE_WIN_VERSION_FILE, test ${use_windows_api} -eq 1) 449 450dnl ==================================================================================== 451dnl Check for ALSA. 452 453AS_IF([test "x$enable_alsa" != "xno"], [ 454 PKG_CHECK_MODULES([ALSA], [alsa], [ 455 dnl actually test whether ALSA really works, in 456 dnl order to dodge wrong cross-compilation pickups 457 save_CFLAGS="${CFLAGS}" 458 save_LIBS="${LIBS}" 459 CFLAGS="${CFLAGS} ${ALSA_CFLAGS}" 460 LIBS="${LIBS} ${ALSA_LIBS}" 461 AC_CHECK_HEADERS([alsa/asoundlib.h]) 462 AS_IF([test "x$ac_cv_header_alsa_asoundlib_h" = "xyes"], [ 463 dnl ALSA definitely works 464 AC_DEFINE([HAVE_ALSA], [1], [Set to 1 if you have alsa]) 465 alsa_works="yes" 466 ], [ 467 dnl picked up wrong ALSA 468 alsa_works="no" 469 470 dnl reset flags 471 ALSA_CFLAGS="" 472 ALSA_LIBS="" 473 ]) 474 CFLAGS="${save_CFLAGS}" 475 LIBS="${save_LIBS}" 476 ], [ 477 dnl could not find ALSA 478 alsa_works="no" 479 ]) 480 481 AS_IF([test "x$alsa_works" = "xno"], [ 482 AS_IF([test "x$enable_alsa" = "xyes"], [ 483 dnl explicitly passed --enable-alsa, hence error out loud and clearly 484 AC_MSG_ERROR([You explicitly requested alsa support, but alsa could not be found!]) 485 ], [ 486 dnl did not explicitly pass --enable-alsa, relying on default automagic on 487 enable_alsa="no (auto)" 488 ]) 489 ]) 490 ]) 491 492dnl ==================================================================================== 493dnl Check for OpenBSD's sndio. 494 495SNDIO_LIBS="" 496HAVE_SNDIO_H=0 497AS_CASE([$host_os], 498 [openbsd*], [ 499 AC_CHECK_HEADERS(sndio.h) 500 AS_IF([test "x$ac_cv_header_sndio_h" = "xyes"], [ 501 SNDIO_LIBS="-lsndio" 502 HAVE_SNDIO_H=1 503 ]) 504 ]) 505 506AC_DEFINE_UNQUOTED([HAVE_SNDIO_H], [${HAVE_SNDIO_H}], [Set to 1 if <sndio.h> is available.]) 507 508dnl ==================================================================================== 509dnl Test for sanity when cross-compiling. 510 511AS_IF([test "x$ac_cv_sizeof_short" != "x2"], [ 512 AC_MSG_WARN([[******************************************************************]]) 513 AC_MSG_WARN([[*** sizeof (short) != 2. ]]) 514 AC_MSG_WARN([[******************************************************************]]) 515 ]) 516 517AS_IF([test "x$ac_cv_sizeof_int" != "x4"], [ 518 AC_MSG_WARN([[******************************************************************]]) 519 AC_MSG_WARN([[*** sizeof (int) != 4 ]]) 520 AC_MSG_WARN([[******************************************************************]]) 521 ]) 522 523AS_IF([test "x$ac_cv_sizeof_float" != "x4"], [ 524 AC_MSG_WARN([[******************************************************************]]) 525 AC_MSG_WARN([[*** sizeof (float) != 4. ]]) 526 AC_MSG_WARN([[******************************************************************]]) 527 ]) 528 529AS_IF([test "x$ac_cv_sizeof_double" != "x8"], [ 530 AC_MSG_WARN([[******************************************************************]]) 531 AC_MSG_WARN([[*** sizeof (double) != 8. ]]) 532 AC_MSG_WARN([[******************************************************************]]) 533 ]) 534 535AS_IF([test "x$ac_cv_prog_HAVE_AUTOGEN" = "xno"], [ 536 AC_MSG_WARN([[Touching files in directory tests/.]]) 537 touch tests/*.c tests/*.h 538 ]) 539 540dnl ==================================================================================== 541dnl Settings for the HTML documentation. 542 543AS_IF([test "x$enable_bow_docs" = "xyes"], [ 544 HTML_BGCOLOUR="white" 545 HTML_FGCOLOUR="black" 546 ], [ 547 HTML_BGCOLOUR="black" 548 HTML_FGCOLOUR="white" 549 ]) 550 551dnl ==================================================================================== 552dnl Now use the information from the checking stage. 553 554win32_target_dll=0 555COMPILER_IS_GCC=0 556 557AS_IF([test "x$enable_flags_setting" = "xyes"], [ 558 AX_APPEND_COMPILE_FLAGS([-O2 -pipe], [CFLAGS]) 559 560 AC_LANG_PUSH([C++]) 561 AX_APPEND_COMPILE_FLAGS([-O2 -pipe], [CXXFLAGS]) 562 AC_LANG_POP([C++]) 563 564 AS_CASE([${host_os}], 565 [darwin*], [ 566 ldflags_test="-Wl,-dead_strip_dylibs"], 567 [linux*], [ 568 ldflags_test="-Wl,-O1 -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections"] 569 ) 570 AX_APPEND_LINK_FLAGS([${ldflags_test}], [LDFLAGS]) 571 ]) 572 573AS_IF([test "x$enable_werror" = "xyes"], [ 574 AX_APPEND_COMPILE_FLAGS([-Werror], [CFLAGS]) 575 576 AC_LANG_PUSH([C++]) 577 AX_APPEND_COMPILE_FLAGS([-Werror], [CXXFLAGS]) 578 AC_LANG_POP([C++]) 579 ]) 580 581common_flags="-Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wundef -Wuninitialized -Winit-self" 582common_cflags="${common_flags}" 583dnl Clang doesn't know about -Wno-format-truncation 584dnl and would spew tons of warnings otherwise. 585AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [ 586 common_cflags+=" -Wno-format-truncation" 587 ]) 588common_cxxflags="${common_flags}" 589AS_IF([test "x$ax_cv_cxx_compiler_vendor" = "xgnu"], [ 590 common_cxxflags+=" -Wno-format-truncation" 591 ]) 592 593AX_APPEND_COMPILE_FLAGS([${common_cflags} -Wvla -Wbad-function-cast -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return], [CFLAGS]) 594 595AC_LANG_PUSH([C++]) 596AX_APPEND_COMPILE_FLAGS([${common_cxxflags} -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo], [CXXFLAGS]) 597AC_LANG_POP([C++]) 598 599AS_IF([test "x$enable_test_coverage" = "xyes"], [ 600 AX_APPEND_COMPILE_FLAGS([-coverage], [CFLAGS]) 601 ]) 602 603dnl some distributions (such as Gentoo) have _FORTIFY_SOURCE always 604dnl enabled. We test for this situation in order to prevent polluting 605dnl the console with messages of macro redefinitions. 606AX_ADD_FORTIFY_SOURCE 607 608AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [ 609 dnl OS specific tweaks. 610 AS_CASE([$host_os], 611 [darwin* | rhapsody*], [ 612 dnl Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody. 613 dnl System headers on these systems are broken. 614 temp_CFLAGS=`echo $CFLAGS | $SED "s/-Wall -pedantic//" | $SED "s/-Wshadow//" | $SED "s/-Waggregate-return//"` 615 CFLAGS=$temp_CFLAGS 616 SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(top_srcdir)/src/Symbols.darwin"], 617 [mingw*], [ 618 SHLIB_VERSION_ARG="-Wc,-static-libgcc -Wl,\$(top_srcdir)/src/libsndfile-1.def" 619 win32_target_dll=1 620 AS_IF([test "x$enable_shared" = "xno"], [ 621 win32_target_dll=0 622 ]) 623 AX_APPEND_COMPILE_FLAGS([-mstackrealign], [CFLAGS]) 624 ], 625 [os2*], [ 626 SHLIB_VERSION_ARG="-Wl,-export-symbols \$(top_srcdir)/src/Symbols.os2" 627 ]) 628 629 COMPILER_IS_GCC=1 630 ]) 631 632AS_CASE([$host_os], [linux*|kfreebsd*-gnu*|gnu*], [SHLIB_VERSION_ARG="-Wl,--version-script=\$(top_srcdir)/src/Symbols.gnu-binutils"]) 633 634AC_DEFINE_UNQUOTED([WIN32_TARGET_DLL], [${win32_target_dll}], [Set to 1 if windows DLL is being built.]) 635AC_DEFINE_UNQUOTED([COMPILER_IS_GCC], [${COMPILER_IS_GCC}], [Set to 1 if the compile is GNU GCC.]) 636 637CFLAGS="$CFLAGS $OS_SPECIFIC_CFLAGS" 638 639AS_IF([test "x$CFLAGS" = "x"], [ 640 AC_MSG_ERROR(["Error in configure script. CFLAGS has been screwed up."]) 641 ]) 642 643HOST_TRIPLET="${host_cpu}-${host_vendor}-${host_os}" 644 645AC_DEFINE_UNQUOTED([HOST_TRIPLET], [${HOST_TRIPLET}], [The host triplet of the compiled binary.]) 646 647AS_IF([test "$HOST_TRIPLET" = "x86_64-w64-mingw32"], [ 648 OS_SPECIFIC_LINKS=" -static-libgcc $OS_SPECIFIC_LINKS" 649 ]) 650 651WIN_RC_VERSION=`echo $PACKAGE_VERSION | $SED -e "s/pre.*//" -e "s/beta.*//" -e "s/\./,/g"` 652 653 654AS_IF([test "x$enable_static" = "xno"], [ 655 SRC_BINDIR=src/.libs/ 656 TEST_BINDIR=tests/.libs/ 657 ], [ 658 SRC_BINDIR=src/ 659 TEST_BINDIR=tests/ 660 ]) 661 662dnl ------------------------------------------------------------------------------- 663 664AC_SUBST(HOST_TRIPLET) 665 666AC_SUBST(HTML_BGCOLOUR) 667AC_SUBST(HTML_FGCOLOUR) 668 669AC_SUBST(SHLIB_VERSION_ARG) 670AC_SUBST([SHARED_VERSION_INFO], [lt_current:lt_revision:lt_age]) 671AC_SUBST([ABI_VERSION], [abi_version_major.abi_version_minor.abi_version_patch]) 672AC_SUBST(CLEAN_VERSION) 673AC_SUBST(VERSION_MAJOR) 674AC_SUBST(GEN_TOOL) 675 676AC_SUBST(WIN_RC_VERSION) 677 678AC_SUBST(HAVE_EXTERNAL_XIPH_LIBS) 679AC_SUBST(HAVE_MPEG) 680AC_SUBST(OS_SPECIFIC_CFLAGS) 681AC_SUBST(OS_SPECIFIC_LINKS) 682AC_SUBST(SNDIO_LIBS) 683 684AC_SUBST(EXTERNAL_XIPH_CFLAGS) 685AC_SUBST(EXTERNAL_XIPH_LIBS) 686AC_SUBST(EXTERNAL_XIPH_REQUIRE) 687AC_SUBST(EXTERNAL_MPEG_LIBS) 688AC_SUBST(EXTERNAL_MPEG_REQUIRE) 689AC_SUBST(MPG123_CFLAGS) 690AC_SUBST(MPG123_LIBS) 691AC_SUBST(MPEG_CFLAGS) 692AC_SUBST(MPEG_LIBS) 693AC_SUBST(SRC_BINDIR) 694AC_SUBST(TEST_BINDIR) 695 696AC_CONFIG_FILES([ 697 Makefile Octave/Makefile 698 src/version-metadata.rc 699 tests/test_wrapper.sh tests/pedantic-header-test.sh 700 libsndfile.spec sndfile.pc 701 Scripts/build-test-tarball.mk 702 ]) 703AC_OUTPUT 704 705dnl ==================================================================================== 706 707AS_IF([test -z "$PKG_CONFIG"], [ 708 AS_ECHO([" *****************************************************************"]) 709 AS_ECHO([" *** The pkg-config program is missing. ***"]) 710 AS_ECHO([" *** External FLAC/Ogg/Vorbis libs cannot be found without it. ***"]) 711 AS_ECHO([" *** http://pkg-config.freedesktop.org/wiki/ ***"]) 712 AS_ECHO([" *****************************************************************"]) 713 ]) 714 715AX_RECURSIVE_EVAL([$libdir], [full_absolute_libdir]) 716AX_RECURSIVE_EVAL([$bindir], [full_absolute_bindir]) 717AX_RECURSIVE_EVAL([$pkgconfigdir], [full_absolute_pkgconfigdir]) 718AX_RECURSIVE_EVAL([$htmldir], [full_absolute_htmldir]) 719AC_MSG_RESULT([ 720-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-=- 721 722 Configuration summary : 723 724 libsndfile version : .................. ${VERSION} 725 726 Host CPU : ............................ ${host_cpu} 727 Host Vendor : ......................... ${host_vendor} 728 Host OS : ............................. ${host_os} 729 730 CFLAGS : .............................. ${CFLAGS} 731 CXXFLAGS : ............................ ${CXXFLAGS} 732 CPPFLAGS : ............................ ${CPPFLAGS} 733 LDFLAGS : ............................. ${LDFLAGS} 734 735 Experimental code : ................... ${enable_experimental:-no} 736 Using ALSA in example programs : ...... ${enable_alsa:-no} 737 External FLAC/Ogg/Vorbis/Opus : ....... ${enable_external_libs:-no} 738 External MPEG Lame/MPG123 : ........... ${enable_mpeg:-no} 739 Building Octave interface : ........... ${OCTAVE_BUILD} 740 741 Tools : 742 743 C Compiler Vendor is : ................ ${ax_cv_c_compiler_vendor} (${ax_cv_c_compiler_version}) 744 CXX Compiler Vendor is : .............. ${ax_cv_cxx_compiler_vendor} (${ax_cv_cxx_compiler_version}) 745 746 Sanitizer enabled : ................... ${enable_sanitizer:-no} 747 748 Installation directories : 749 750 Library directory : ................... ${full_absolute_libdir} 751 Program directory : ................... ${full_absolute_bindir} 752 Pkgconfig directory : ................. ${full_absolute_pkgconfigdir} 753 HTML docs directory : ................. ${full_absolute_htmldir} 754 755Compiling some other packages against libsndfile may require 756the addition of '$full_absolute_pkgconfigdir' to the 757PKG_CONFIG_PATH environment variable. 758]) 759 760dnl Remove symlink created by Scripts/android-configure.sh. 761rm -f gdbclient 762