1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873
|
dnl This file will be processed by autoconf (which is called by autogen.sh) to
dnl generate configure
dnl comments starting with # are copied to configure (if after AC_INIT),
dnl comments starting with dnl ("do not list") are dropped.
dnl see http://www.gnu.org/software/autoconf/manual/ for further information
dnl Ensure that a recent enough version of Autoconf is being used.
dnl Only from version 2.65 PACKAGE_URL will be set in config.h.
dnl see http://www.mail-archive.com/autoconf@gnu.org/msg19725.html
dnl see http://www.gnu.org/software/autoconf/manual/autoconf.html#Versioning
AC_PREREQ([2.65])
dnl initialize autoconf, this should be the first thing in configure.ac
dnl arguments: full package name, version, email address for bug reports,
dnl tarball name, homepage
AC_INIT([SSR (SoundScape Renderer)],
[m4_esyscmd_s([./debian/scripts/upstreamversion.sh])],
[ssr@spatialaudio.net],
[ssr],
[http://spatialaudio.net/ssr/])
SSR_COPYRIGHT="Copyright © 2016 Division of Applied Acoustics, Chalmers University of Technology\nCopyright © 2014 Institut für Nachrichtentechnik, Universität Rostock\nCopyright © 2012 Quality & Usability Lab, Telekom Innovation Laboratories, TU Berlin\n\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
AC_DEFINE_UNQUOTED([SSR_COPYRIGHT], ["$SSR_COPYRIGHT"], [SSR copyright notice])
dnl read AUTHORS file and save (reformatted by sed) to SSR_AUTHORS(_QT)
SSR_AUTHORS=esyscmd([cat AUTHORS | sed -e :a -e '$!N;s/\n\n/\\n/;ta' -e '$!N;s/\n/\\n/;ta' -e 's/.*/"&"/'])
SSR_AUTHORS_QT=esyscmd([cat AUTHORS | sed -e 's|^.*:|<EM>&</EM>|' -e 's/ /\ /g' -e 's/é/\é/g' -e 's/ö/\ö/g' | sed -e :a -e '$!N;s/\n/<BR>/;ta' -e 's/.*/"&"/'])
AC_DEFINE_UNQUOTED([SSR_AUTHORS], ["$SSR_AUTHORS"], [List of SSR authors])
AC_DEFINE_UNQUOTED([SSR_AUTHORS_QT], ["$SSR_AUTHORS_QT"],
[List of SSR authors (with Qt markup)])
dnl include macro definitions
m4_include([macros.m4])
dnl Check if the correct source directory is used by specifying a file in it
AC_CONFIG_SRCDIR([src/controller.h])
dnl Automake looks here for various helper scripts
AC_CONFIG_AUX_DIR(autotools/config)
dnl this gets rid of a warning message from libtoolize
AC_CONFIG_MACRO_DIR([autotools/m4])
dnl Compute the canonical target-system type variable, 'target', and its three
dnl individual parts 'target_cpu', 'target_vendor', and 'target_os'
AC_CANONICAL_TARGET
dnl Compute the canonical host-system type variable, 'host', and its three
dnl individual parts 'host_cpu', 'host_vendor', and 'host_os'.
dnl AC_CANONICAL_HOST
dnl Runs many macros required for proper operation of the generated Makefiles.
dnl see http://sources.redhat.com/automake/automake.html#Options for options
dnl
dnl We use the option "foreign" because we do not provide a ChangeLog-file.
dnl Major changes are documented in the NEWS file.
dnl
dnl The tar-ustar option allows file names longer than 99 characters
AM_INIT_AUTOMAKE([foreign std-options subdir-objects -Wall tar-ustar])
dnl Check for pkg-config manually first. If it's not installed the
dnl PKG_PROG_PKG_CONFIG macro won't be defined.
AC_CHECK_PROG([have_pkg_config], [pkg-config], [yes], [no])
AS_IF([test x$have_pkg_config != xyes],
AC_MSG_ERROR(['pkg-config' is required to install this program]))
dnl check for pkg-config version
PKG_PROG_PKG_CONFIG
dnl Create header file(s) with C preprocessor #define statements (e.g. ENABLE_*)
AC_CONFIG_HEADERS(src/config.h)
dnl AM_MAINTAINER_MODE enables automatic rebuild rules only using
dnl ./configure --enable-maintainer-mode. This can lead to insecurity.
dnl We avoid using this Macro.
dnl see: http://www.gnu.org/software/hello/manual/automake/maintainer_002dmode.html#maintainer_002dmode
dnl see: https://cims.nyu.edu/cgi-systems/info2html?(automake)Rebuilding
dnl set the relevant programming language (e.g. for AC_CHECK_HEADER)
dnl this is e.g. necessary for the C++ header eca-control-interface.h
AC_LANG([C++])
dnl check if the user specified CXXFLAGS (as environment variable or
dnl in $prefix/share/config.site
AS_IF([test -n "${CXXFLAGS+x}"], [usercxxflags=yes], [usercxxflags=no])
dnl AC_PROG_CC sets default CFLAGS, this can be disabled with
dnl : ${CFLAGS=""}
dnl AC_PROG_CXX sets default CXXFLAGS, this can be disabled with
dnl : ${CXXFLAGS=""}
dnl Determine a C compiler to use (this is done anyway, we do it explicitly)
AC_PROG_CC
dnl Determine a C++ compiler to use
AC_PROG_CXX
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], ,
AC_MSG_ERROR([C++ compiler ($CXX) not found!]))
dnl Add support for the `--enable-shared' and `--disable-shared' configure flags
dnl we don't need that (yet)
LT_INIT
dnl set the output variable LN_S (used in data/Makefile.am)
AC_PROG_LN_S
dnl If the C compiler does not accept the -c and -o options simultaneously,
dnl define NO_MINUS_C_MINUS_O.
dnl TODO: check if we need AM_PROG_CC_C_O!
dnl AM_PROG_CC_C_O
dnl Check how the architecture deals with big-endian.
dnl The default for action-if-true is to define ‘WORDS_BIGENDIAN’. The default
dnl for action-if-false is to do nothing.
dnl AC_C_BIGENDIAN
dnl AC_DEFINE writes values in config.h
dnl AC_DEFINE_UNQUOTED performs additional shell expansions, e.g. substitution
dnl of variable with value.
ENABLE_AUTO([all],
[all renderers (use --enable-xyz to re-enable certain renderers)],
[
AS_IF([test x$enable_all = xno], [have_all=no])
])
ENABLE_AUTO([binaural], [binaural renderer (using HRIRs)],
[
AS_IF([test x$enable_binaural = xyes -o x$have_all = xyes],
[SSR_executables="$SSR_executables ssr-binaural"])
])
ENABLE_AUTO([brs], [Binaural Room Synthesis renderer (using BRIRs)],
[
AS_IF([test x$enable_brs = xyes -o x$have_all = xyes],
[SSR_executables="$SSR_executables ssr-brs"])
])
ENABLE_AUTO([wfs], [Wave Field Synthesis renderer],
[
AS_IF([test x$enable_wfs = xyes -o x$have_all = xyes],
[SSR_executables="$SSR_executables ssr-wfs"])
])
ENABLE_AUTO([vbap], [Vector Base Amplitude Panning renderer],
[
AS_IF([test x$enable_vbap = xyes -o x$have_all = xyes],
[SSR_executables="$SSR_executables ssr-vbap"])
])
ENABLE_AUTO([aap], [Ambisonics Amplitude Panning renderer],
[
AS_IF([test x$enable_aap = xyes -o x$have_all = xyes],
[SSR_executables="$SSR_executables ssr-aap"])
])
ENABLE_AUTO([generic], [generic renderer],
[
AS_IF([test x$enable_generic = xyes -o x$have_all = xyes],
[SSR_executables="$SSR_executables ssr-generic"])
])
ENABLE_AUTO([dca],[Distance-coded Ambisonics renderer],
[
AS_IF([test x$enable_dca = xyes -o x$have_all = xyes],
[SSR_executables="$SSR_executables ssr-dca"])
])
dnl Note: For what happens with SSR_executables see src/Makefile.am
AC_SUBST(SSR_executables)
AC_MSG_CHECKING([for pre-built manpages])
have_manpages=yes
for exe in $SSR_executables
do
AS_IF([test -f $srcdir/man/$exe.1], [], [have_manpages=no])
done
AS_IF([test x$have_manpages != xyes], [
AC_MSG_RESULT([no])
AC_CHECK_PROG([have_help2man], [help2man], [yes], [no])
have_manpages=$have_help2man
], [
AS_IF([test $srcdir != .], [
AC_CONFIG_COMMANDS([manpages], [cp $srcdir/man/*.1 man/])
])
AC_MSG_RESULT([yes])
])
AM_CONDITIONAL([HAVE_MANPAGES], [test x$have_manpages = xyes])
AS_IF([test x$have_manpages != xyes],
AC_MSG_WARN([Disabling manpage generation due to missing help2man]),
)
dnl Checking for sndfile
PKG_CHECK_MODULES([SNDFILE], [sndfile >= 1.0],
[
PKG_FLAGS="$PKG_FLAGS $SNDFILE_CFLAGS"
LIBS="$LIBS $SNDFILE_LIBS"
])
dnl Checking for FFTW3
PKG_CHECK_MODULES([FFTW], [fftw3f >= 3.0.0],
[
PKG_FLAGS="$PKG_FLAGS $FFTW_CFLAGS"
LIBS="$LIBS $FFTW_LIBS"
])
dnl Checking for JACK
PKG_CHECK_MODULES([JACK], [jack >= 0.118.0],
[
PKG_FLAGS="$PKG_FLAGS $JACK_CFLAGS"
LIBS="$LIBS $JACK_LIBS"
])
dnl Checking for libxml2
PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.0],
[
PKG_FLAGS="$PKG_FLAGS $LIBXML_CFLAGS"
LIBS="$LIBS $LIBXML_LIBS"
])
dnl by the way, AC_HELP_STRING is deprecated, use AS_HELP_STRING instead!
ENABLE_EXPLICIT([debugging],[debugging symbols, asserts, ...])
AS_IF([test x$have_debugging = xyes],
[
dnl DEBUGGING_FLAGS="$DEBUGGING_FLAGS -D_GLIBCXX_DEBUG"
DEBUGGING_FLAGS="$DEBUGGING_FLAGS -DAPF_JACK_POLICY_DEBUG"
DEBUGGING_FLAGS="$DEBUGGING_FLAGS -DAPF_JACKCLIENT_DEBUG"
],
[
DEBUGGING_FLAGS="$DEBUGGING_FLAGS -DNDEBUG"
])
dnl overwrite default CXXFLAGS set by AC_PROG_CXX
AS_IF([test x$usercxxflags = xno], [CXXFLAGS="-g"])
dnl select C++17 (unconditionally)
CXXFLAGS="$CXXFLAGS -std=c++17"
AC_MSG_CHECKING([if $CXX supports "-std=c++17"])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
[
AC_MSG_RESULT([no])
AC_MSG_ERROR([C++17 not supported! Please upgrade.])
])
dnl JACK1 problem with C++17: https://github.com/jackaudio/jack1/issues/84
AS_IF([test x$GCC = xyes],
[WARNING_FLAGS="$WARNING_FLAGS -Wno-register"])
dnl see http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1123
dnl and http://stackoverflow.com/q/11497252/500098
AC_MSG_CHECKING([if $CXX implements core/1123])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[
struct X { virtual ~X() = default; };
struct Y : X { virtual ~Y() = default; };
], [])], AC_MSG_RESULT([yes]),
[
AC_MSG_RESULT([no])
AC_MSG_ERROR([core/1123 not implemented! Please upgrade.])
])
dnl NOTE: -pthread works on GCC, other compilers may need differnt flags!
AS_IF([test x$GCC = xyes],
[CXXFLAGS="$CXXFLAGS -pthread"])
dnl https://github.com/ilmola/gml
CPPFLAGS_backup="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$srcdir/gml/include"
AC_CHECK_HEADER([gml/vec.hpp], , [AC_MSG_ERROR([GML library cannot be found. Update your Git submodules with:
git submodule update --init
])])
CPPFLAGS="$CPPFLAGS_backup"
ENABLE_AUTO([optimization], [code optimization],
[
dnl for now, we have only optimization if GCC is used
AS_IF([test x$GCC = xyes],
[
dnl add -O3 to CXXFLAGS (only if the user didn't specify CXXFLAGS):
AS_IF([test x$usercxxflags = xno], [CXXFLAGS="$CXXFLAGS -O3"])
dnl common x86 optimization flags
OPT_FLAGS="$OPT_FLAGS -fomit-frame-pointer -ffast-math -funroll-loops"
dnl OPT_FLAGS="$OPT_FLAGS -fexpensive-optimizations"
dnl its a little sad that OS X doesn't make it possible to identify
dnl the target_cpu a little more precisely. on os x we always get "i386"
dnl as the CPU type. we miss out on some possible optimizations as
dnl a result. oh well.
dnl anyway, the user can specify -march with CXXFLAGS, if desired
AS_IF([test $target_cpu = i586], [OPT_FLAGS="$OPT_FLAGS -march=i586"],
[test $target_cpu = i686], [OPT_FLAGS="$OPT_FLAGS -march=i686"],
[test $target_cpu = x86_64], [OPT_FLAGS="$OPT_FLAGS -march=k8"])
], dnl this is the end of "if GCC", else:
[
AC_MSG_WARN([no optimization.........................])
have_optimization=no
])
])
ENABLE_AUTO([mmx], [MMX support],
[
AS_IF([test x$have_optimization != xyes],
[
have_mmx=no
AS_IF([test x$enable_mmx != x],
AC_MSG_ERROR([You have to --enable-optimization in order to use MMX!]))
],
[
AS_IF([echo $target_cpu | egrep '(i.86|x86_64)' >/dev/null],
[
AS_IF([test -r /proc/cpuinfo],
[
procflags=`grep '^flags' /proc/cpuinfo`
AS_IF([echo $procflags | grep -s mmx >/dev/null], , [have_mmx=no])
],
[
# this is not linux, but assume that if the processor
# is x86 then it doesn't need MMX
AS_IF([test x$enable_mmx = x],
[
have_mmx=no
AC_MSG_WARN([Assuming your x86/x86_64 system does not need to use MMX. Use --enable-mmx if this is not the case])
])
dnl if --enable-mmx was called explicitly, have_mmx=yes automatically!
])
dnl now actually check for MMX support (if requested)
AS_IF([test x$have_mmx = xyes],
[
AC_MSG_CHECKING([whether we can compile MMX code])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[]], [[asm ("movq 0, %mm0");]])
],[
OPT_FLAGS="$OPT_FLAGS -mmmx"
AC_MSG_RESULT([yes])
],[
have_mmx=no
AC_MSG_RESULT([no])
AC_MSG_WARN([The assembler does not support the MMX command set.])
])
])
])
])
])
ENABLE_AUTO([sse], [SSE support],
[
AS_IF([test x$have_optimization != xyes],
[
have_sse=no
AS_IF([test x$enable_sse != x],
AC_MSG_ERROR([You have to --enable-optimization in order to use SSE!]))
],
[
AS_IF([echo $target_cpu | egrep '(i.86|x86_64)' >/dev/null],
[
AS_IF([test -r /proc/cpuinfo],
[
procflags=`grep '^flags' /proc/cpuinfo`
AS_IF([echo $procflags | grep -s sse >/dev/null], , [have_sse=no])
],
[
# this is not linux, but assume that if the processor
# is x86 then it supports SSE
AS_IF([test x$enable_mmx = xno], [have_sse=no],
AC_MSG_WARN([Assuming your x86/x86_64 system can support SSE. Use --disable-sse if this is not the case]))
])
dnl now actually check for SSE support (if requested)
AS_IF([test x$have_sse = xyes],
[
AC_MSG_CHECKING([whether we can compile SSE code])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[]], [[asm ("movntps %xmm0, 0");]])
],[
OPT_FLAGS="$OPT_FLAGS -msse -mfpmath=sse"
AC_MSG_RESULT([yes])
dnl the convolver checks for __SSE__
dnl we check if __SSE__ is defined, just to be sure:
AC_MSG_CHECKING([for __SSE__])
AS_IF([test x$usercxxflags = xno],
[
CXXFLAGS_BACKUP="$CXXFLAGS"
dnl add OPT_FLAGS just for the AC_LINK_IFELSE test:
CXXFLAGS="$CXXFLAGS $OPT_FLAGS"
])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[]], [[
#ifndef __SSE__
#error
#endif
]])
],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AC_MSG_ERROR([__SSE__ is undefined! Contact $PACKAGE_BUGREPORT!])
])
AS_IF([test x$usercxxflags = xno], [CXXFLAGS="$CXXFLAGS_BACKUP"])
],[
have_sse=no
AC_MSG_RESULT([no])
AC_MSG_WARN([The assembler does not support the SSE command set.])
])
])
])
])
])
ENABLE_AUTO([sse2], [SSE2 support],
[
AS_IF([test x$have_optimization != xyes],
[
have_sse2=no
AS_IF([test x$enable_sse2 != x],
AC_MSG_ERROR([You have to --enable-optimization in order to use SSE2!]))
],
[
AS_IF([echo $target_cpu | egrep '(i.86|x86_64)' >/dev/null],
[
AS_IF([test -r /proc/cpuinfo],
[
procflags=`grep '^flags' /proc/cpuinfo`
AS_IF([echo $procflags | grep -s sse2 >/dev/null], , [have_sse2=no])
],
[
AS_IF([test x$enable_sse = xno], [have_sse2=no],
AC_MSG_WARN([Assuming your x86/x86_64 system can support SSE2. Use --disable-sse2 if this is not the case]))
])
dnl now actually check for SSE2 support (if requested)
AS_IF([test x$have_sse2 = xyes],
[
AC_MSG_CHECKING([whether we can compile SSE2 code])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <emmintrin.h>]], [[__m128i one;]])
],[
OPT_FLAGS="$OPT_FLAGS -msse2 -mfpmath=sse"
AC_MSG_RESULT([yes])
dnl check if __SSE2__ is defined, just to be sure:
AC_MSG_CHECKING([for __SSE2__])
AS_IF([test x$usercxxflags = xno],
[
CXXFLAGS_BACKUP="$CXXFLAGS"
dnl add OPT_FLAGS just for the AC_LINK_IFELSE test:
CXXFLAGS="$CXXFLAGS $OPT_FLAGS"
])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[]], [[
#ifndef __SSE2__
#error
#endif
]])
],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AC_MSG_ERROR([__SSE2__ is undefined! Contact $PACKAGE_BUGREPORT!])
])
AS_IF([test x$usercxxflags = xno], [CXXFLAGS="$CXXFLAGS_BACKUP"])
],[
have_sse=no
AC_MSG_RESULT([no])
AC_MSG_WARN([The assembler does not support the SSE2 command set.])
])
])
])
])
])
dnl enable/disable GUI, default: enabled
ENABLE_FORCED([gui], [graphical user interface (using Qt)],
[
# Checking for Qt
PKG_CHECK_MODULES([QT], [Qt5Core >= 5.0.0 Qt5Gui >= 5.0.0 Qt5OpenGL >= 5.0.0],
[],
[have_gui=no])
dnl BTW, the use of AC_CHECK_LIB is discouraged in favor of AC_SEARCH_LIBS!
# Checking for glu (depending on the platform, it's in GL/ or OpenGL/)
AC_CHECK_HEADER([GL/glu.h], ,
[
# this is only needed on MacOSX:
CPPFLAGS="$CPPFLAGS -iframeworkOpenGL"
AC_CHECK_HEADER([OpenGL/glu.h], , [have_gui=no])
LIBS="$LIBS -framework OpenGL"
])
AC_SEARCH_LIBS([gluNewQuadric], [GLU], , [have_gui=no])
# on some systems this is needed, on the others it doesn't hurt:
AC_SEARCH_LIBS([glSelectBuffer], [GL], , [have_gui=no])
])
AS_IF([test x$have_gui = xyes],
[
# settings for Qt
LIBS="$LIBS $QT_LIBS"
PKG_FLAGS="$PKG_FLAGS $QT_CFLAGS"
AC_MSG_CHECKING([if we have to add -fPIC to make Qt happy])
CPPFLAGS_backup="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $QT_CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[
#include <QtCore/QObject>
], [])], AC_MSG_RESULT([no]),
[
AC_MSG_RESULT([yes])
PKG_FLAGS="$PKG_FLAGS -fPIC"
])
CPPFLAGS="$CPPFLAGS_backup"
MOCFLAGS="$QT_CFLAGS"
AS_IF([which moc 2>&1 >/dev/null],
[
QTMOC="moc"
],
[
QTMOC=`$PKG_CONFIG --variable=moc_location Qt5Core`
])
QTLIBDIR=`$PKG_CONFIG --variable=libdir Qt5Gui`
AC_SUBST(QTMOC)
AC_SUBST(QTLIBDIR)
AC_SUBST(MOCFLAGS)
])
ENABLE_FORCED([ip-interface], [network (TCP/IP) interface (needs Asio, https://think-async.com/)],
[
CPPFLAGS="$CPPFLAGS -DASIO_STANDALONE"
AC_CHECK_HEADER([asio.hpp], , [have_ip_interface=no])
])
ENABLE_FORCED([websocket-interface], [WebSocket interface (needs WebSocket++ and Asio)],
[
CPPFLAGS="$CPPFLAGS -DASIO_STANDALONE"
AC_CHECK_HEADER([asio.hpp], , [have_websocket_interface=no])
AC_CHECK_HEADER([websocketpp/server.hpp], , [have_websocket_interface=no])
CPPFLAGS_backup="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$srcdir/rapidjson/include"
AC_CHECK_HEADER([rapidjson/document.h], , [have_websocket_interface=no])
CPPFLAGS="$CPPFLAGS_backup"
])
ENABLE_AUTO([fudi-interface], [FUDI interface (needs Asio and {fmt})],
[
CPPFLAGS="$CPPFLAGS -DASIO_STANDALONE"
AC_CHECK_HEADER([asio.hpp], , [have_fudi_interface=no])
PKG_CHECK_MODULES([FMT], [fmt >= 5.0],
[
PKG_FLAGS="$PKG_FLAGS $FMT_CFLAGS"
LIBS="$LIBS $FMT_LIBS"
],
[have_fudi_interface=no])
])
ENABLE_FORCED([ecasound], [Ecasound soundfile playback/recording],
[
dnl Checking for libecasoundc. It does not provide pkg-config and installs
dnl on some systems to non-standard path /usr/include/libecasoundc.
AC_MSG_CHECKING([for non-default libecasoundc include directory])
for incdir in /{usr,opt}/{,local/}include/libecasoundc; do
AS_IF([test -d $incdir], [ECASOUND_INCLUDE="$incdir"])
done
AS_IF([test x$ECASOUND_INCLUDE = x], [AC_MSG_RESULT([none found.])],
[
AC_MSG_RESULT([$ECASOUND_INCLUDE])
CPPFLAGS="$CPPFLAGS -I$ECASOUND_INCLUDE"
])
# now check with possibly redefined CPPFLAGS
AC_CHECK_HEADER([ecasoundc.h], , [have_ecasound=no])
AC_CHECK_HEADER([eca-control-interface.h], , [have_ecasound=no])
AC_SEARCH_LIBS([eci_init], [ecasoundc], , [have_ecasound=no])
AC_MSG_CHECKING([Ecasound library support (see above)])
AC_MSG_RESULT([$have_ecasound])
])
AS_IF([test x$have_ecasound != xno],
[
dnl check for Ecasound program (required for soundfile playback)
AC_CHECK_PROG([have_ecasound_program], [ecasound], [yes], [no])
])
ENABLE_AUTO([sofa], [SOFA support for binaural renderer],
[
AC_CHECK_HEADER([mysofa.h], , [have_sofa=no])
AC_SEARCH_LIBS([mysofa_open], [mysofa], , [have_sofa=no])
])
dnl Checking for Polhemus Fastrak/Patriot support
ENABLE_AUTO([polhemus], [Polhemus Fastrak/Patriot tracker support],
[
AC_MSG_CHECKING([various header files for Polhemus Fastrak/Patriot tracker support])
AC_MSG_RESULT([see below])
AC_CHECK_HEADER([termios.h], , [have_polhemus=no])
AC_CHECK_HEADER([unistd.h], , [have_polhemus=no])
AC_CHECK_HEADER([fcntl.h], , [have_polhemus=no])
AC_CHECK_HEADER([poll.h], , [have_polhemus=no])
AC_MSG_CHECKING([Polhemus Fastrak/Patriot support])
AC_MSG_RESULT([$have_polhemus])
])
dnl Checking for Razor AHRS support
ENABLE_AUTO([razor], [Razor AHRS tracker support],
[
AC_MSG_CHECKING([various header files for Razor AHRS tracker support])
AC_MSG_RESULT([see below])
AC_CHECK_HEADER([termios.h], , [have_razor=no])
AC_CHECK_HEADER([unistd.h], , [have_razor=no])
AC_CHECK_HEADER([fcntl.h], , [have_razor=no])
AC_CHECK_HEADER([poll.h], , [have_razor=no])
AC_MSG_CHECKING([Razor AHRS support])
AC_MSG_RESULT([$have_razor])
])
dnl Checking for VRPN tracker support
ENABLE_AUTO([vrpn], [VRPN tracker support],
[
AC_MSG_CHECKING([various header files for VRPN tracker support])
AC_MSG_RESULT([see below])
AC_CHECK_HEADER([vrpn_Tracker.h], , [have_vrpn=no])
AC_SEARCH_LIBS([q_from_axis_angle], [quat], , [have_vrpn=no])
AC_SEARCH_LIBS([vrpn_MAGIC], [vrpn], , [have_vrpn=no])
AC_MSG_CHECKING([VRPN tracker support])
AC_MSG_RESULT([$have_vrpn])
])
dnl Checking for InterSense support
ENABLE_AUTO([intersense], [InterSense tracker support],
[
AC_MSG_CHECKING([various header files for InterSense tracker support])
AC_MSG_RESULT([see below])
dnl the InterSense people changed the API with version 4.04!
dnl Checking for InterSense header
AC_CHECK_HEADER([isense.h], , [have_intersense=no])
AC_CHECK_HEADER([types.h], , [have_intersense=no])
AS_IF([test x$have_intersense = xyes],
[
dnl first we check for the newer function
AC_SEARCH_LIBS([ISD_GetTrackingData], [isense], [have_intersense_404=yes],
dnl then we check for the older function
[AC_SEARCH_LIBS([ISD_GetData], [isense],
[have_intersense_404=no], [have_intersense=no])])
])
])
AS_IF([test x$have_intersense = xyes -a x$have_intersense_404 = xyes],
[
AC_DEFINE([HAVE_INTERSENSE_404], 1,[Using InterSense library version >= 4.04])
])
dnl enable/disable compiler warnings
ENABLE_AUTO([warnings], [compiler warnings])
AS_IF([test x$have_warnings = xyes],
[
AS_IF([test x$GCC = xyes],
[
dnl all warnings ... and a few more!
WARNING_FLAGS="$WARNING_FLAGS -Wall -Wextra"
WARNING_FLAGS="$WARNING_FLAGS -pedantic"
dnl this makes -pedantic less pedantic (Qt often uses "long long"):
WARNING_FLAGS="$WARNING_FLAGS -Wno-long-long"
WARNING_FLAGS="$WARNING_FLAGS -Winit-self -Wcast-align"
WARNING_FLAGS="$WARNING_FLAGS -Wmissing-declarations -Wredundant-decls"
WARNING_FLAGS="$WARNING_FLAGS -Woverloaded-virtual -Wnon-virtual-dtor"
WARNING_FLAGS="$WARNING_FLAGS -Wwrite-strings"
dnl -Wall sets -Wstrict-overflow=1, we set it to 0:
WARNING_FLAGS="$WARNING_FLAGS -Wstrict-overflow=0"
dnl those should be enabled at some point:
dnl WARNING_FLAGS="$WARNING_FLAGS -Wold-style-cast"
dnl WARNING_FLAGS="$WARNING_FLAGS -Wshadow"
dnl this may be too annoying:
dnl WARNING_FLAGS="$WARNING_FLAGS -Wconversion"
dnl maybe only warn for sign conversions:
dnl WARNING_FLAGS="$WARNING_FLAGS -Wsign-conversion"
dnl interesting, but maybe too annoying:
dnl WARNING_FLAGS="$WARNING_FLAGS -Winline"
dnl suggestions from Meyers "Effective C++":
dnl WARNING_FLAGS="$WARNING_FLAGS -Weffc++"
dnl turn warnings into errors:
dnl WARNING_FLAGS="$WARNING_FLAGS -Werror"
dnl WARNING_FLAGS="$WARNING_FLAGS -pedantic-errors"
dnl part of -Wall and -Wextra:
dnl WARNING_FLAGS="$WARNING_FLAGS -Wuninitialized"
dnl part of -pedantic:
dnl WARNING_FLAGS="$WARNING_FLAGS -Wpointer-arith"
])
])
ENABLE_AUTO([isatty], [support for isatty()],
[
AC_CHECK_HEADER([unistd.h], , [have_isatty=no])
AC_SEARCH_LIBS([isatty], , , [have_isatty=no])
])
dnl trying to mimic the default setting
pkgdatadir="\$(datadir)/$PACKAGE"
ENABLE_EXPLICIT([app-bundle], [creation of a MacOSX application bundle],
[
AC_CHECK_PROG([have_dylibbundler], [dylibbundler], [yes], [no])
AS_IF([test x$enable_app_bundle = xyes -o x$enable_app_bundle = x],
[DMG_NAME=SoundScapeRenderer-$PACKAGE_VERSION.dmg],
[DMG_NAME=$enable_app_bundle])
dmgrootdir=$(pwd)/MacOSX-App-Bundle
bundledir=\${dmgrootdir}/SoundScapeRenderer-$PACKAGE_VERSION
dnl WARNING: any user-specified --prefix, --bindir, ... is overwritten!
dnl however, it can still be specified at make time (although kinda useless)!
prefix=\${bundledir}/SoundScapeRenderer.app/Contents
bindir=\${exec_prefix}/MacOS
datarootdir=\${prefix}/Resources
pkgdatadir="\$(datadir)"
docdir=${bundledir}/Documentation
dnl linker flag to add space to the output file header padding,
dnl so when dylibbundler is changing paths to shared libs later on,
dnl longer paths will fit in too.
LDFLAGS="$LDFLAGS -headerpad_max_install_names"
])
ENABLE_AUTO([browser-gui], [creation of HTML/JavaScript files for browser GUI],
[
AC_ARG_VAR([YARN], [Yarn package manager command])
AC_CHECK_PROGS([YARN], [yarnpkg yarn])
AC_MSG_CHECKING([for pre-generated browser GUI files])
AS_IF([test -f $srcdir/data/websocket_resources/index.html], [
AC_MSG_RESULT([yes])
AS_IF([test $srcdir != .], [
AC_CONFIG_COMMANDS(
[data/websocket_resources/index.html],
[cp $srcdir/data/websocket_resources/index.html data/websocket_resources])
AC_CONFIG_COMMANDS(
[data/websocket_resources/chunks],
[cp -rf $srcdir/data/websocket_resources/chunks data/websocket_resources])
])
], [
AC_MSG_RESULT([no])
AS_IF([test -n "$YARN"], [], [have_browser_gui=no])
])
])
AC_SUBST(DMG_NAME)
AC_SUBST(dmgrootdir)
AC_SUBST(bundledir)
AC_SUBST(pkgdatadir)
AC_SUBST(OPT_FLAGS)
AC_SUBST(PKG_FLAGS)
AC_SUBST(WARNING_FLAGS)
AC_SUBST(DEBUGGING_FLAGS)
dnl List of output files generated by AC_OUTPUT from their respective *.in files
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile browser-gui/Makefile])
AC_CONFIG_FILES([tests/Makefile])
AC_CONFIG_FILES([data/Makefile data/MacOSX/Makefile])
AC_CONFIG_FILES([data/MacOSX/Info.plist data/MacOSX/DMG-Layout.applescript])
dnl AC_OUTPUT should be the last command (except maybe some status messages)
dnl It generates and runs config.status, which in turn creates the Makefiles and
dnl any other files resulting from configuration
dnl usage with arguments, e.g. AC_OUTPUT(Makefile src/Makefile), is deprecated!
AC_OUTPUT
echo
echo SSR_executables: $SSR_executables
echo
echo CXX: $CXX
echo
echo CFLAGS: $CFLAGS
echo
echo CXXFLAGS: $CXXFLAGS
echo
echo CPPFLAGS: $CPPFLAGS
echo
echo PKG_FLAGS: $PKG_FLAGS
echo
echo OPT_FLAGS: $OPT_FLAGS
echo
echo WARNING_FLAGS: $WARNING_FLAGS
echo
echo DEBUGGING_FLAGS: $DEBUGGING_FLAGS
echo
echo LIBS: $LIBS
echo
echo LDFLAGS: $LDFLAGS
echo
echo YARN: $YARN
echo
echo
echo
echo ' ___ '
echo ' / ___ '
echo ' ___/ / ___ '
echo ' ___/ / ' $PACKAGE_STRING:
echo ' / '
echo ' '
AS_IF([test x$have_intersense = xyes],
AS_IF([test x$have_intersense_404 = xyes],
[intersense_version="version >= 4.04"],
[intersense_version="version < 4.04"]),
[intersense_version=no])
echo "|"
echo "| Build with tracker support:"
echo "| InterSense .......................... : $intersense_version"
echo "| Polhemus Fastrak/Patriot ............ : $have_polhemus"
echo "| Razor AHRS .......................... : $have_razor"
echo "| VRPN ................................ : $have_vrpn"
echo "|"
echo "| Ecasound/SOFA support .................. : $have_ecasound/$have_sofa"
echo "| Network: legacy/WebSocket/FUDI ......... : $have_ip_interface/$have_websocket_interface/$have_fudi_interface"
echo "| Qt GUI/Browser GUI ..................... : $have_gui/$have_browser_gui"
echo "|"
echo "| Enable debugging/optimization .......... : $have_debugging/$have_optimization"
AS_IF([test x$have_app_bundle = xyes],
[
echo "| Mac OS X application bundle (disk image) : $DMG_NAME"
],
[
echo "| Install prefix ......................... : $prefix"
])
AS_IF([test x$have_ecasound = xyes -a x$have_ecasound_program != xyes],
[
echo "|"
echo "|> WARNING: Ecasound (the program, not the library) was not found!"
echo "|> It is needed for playing (and recording) sound files with the SSR."
])
AS_IF([test x$have_manpages != xyes],
[
echo "|"
echo "|> WARNING: help2man was not found!"
echo "|> Disabling building of manpages"
])
AS_IF([test x$have_app_bundle = xyes -a x$have_dylibbundler != xyes],
[
echo "|"
echo "|> WARNING: dylibbundler was not found!"
echo "|> It is needed for creating the app bundle."
])
echo "|"
echo
AS_IF([test x$have_app_bundle = xyes],
[
echo 'If everything looks OK, continue with "make" and "make dmg".'
],
[
echo 'If everything looks OK, continue with "make" and "make install".'
])
echo
|