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