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 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260
|
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([libmikmod],[3.3.7])
LIBMIKMOD_MAJOR_VERSION=3
LIBMIKMOD_MINOR_VERSION=3
LIBMIKMOD_MICRO_VERSION=7
LIBMIKMOD_VERSION=$LIBMIKMOD_MAJOR_VERSION.$LIBMIKMOD_MINOR_VERSION.$LIBMIKMOD_MICRO_VERSION
AC_CONFIG_AUX_DIR([autotools])
AM_INIT_AUTOMAKE([1.10 foreign subdir-objects])
AC_CONFIG_SRCDIR([include/mikmod_internals.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_LIBOBJ_DIR([posix])
AM_MAINTAINER_MODE
# Library versioning for libtool: CURRENT, REVISION, AGE
# - library source changed -> increment REVISION
# - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
# - interfaces added -> increment AGE
# - interfaces removed -> AGE = 0
MIKMOD_LT_CURRENT=6
MIKMOD_LT_REVISION=0
MIKMOD_LT_AGE=3
AC_SUBST(MIKMOD_LT_CURRENT)
AC_SUBST(MIKMOD_LT_REVISION)
AC_SUBST(MIKMOD_LT_AGE)
# ===================
# build target:
# ===================
AC_CANONICAL_HOST
# these for convenience
libmikmod_mingw=no
libmikmod_cygwin=no
libmikmod_linux=no
libmikmod_darwin=no
libmikmod_netbsd=no
libmikmod_openbsd=no
libmikmod_os2=no
libmikmod_djgpp=no
libmikmod_amiga=no
case $host_os in
mingw*) libmikmod_mingw=yes ;;
cygwin*) libmikmod_cygwin=yes ;;
linux*) libmikmod_linux=yes ;;
darwin*) libmikmod_darwin=yes ;;
netbsd*) libmikmod_netbsd=yes ;;
openbsd*) libmikmod_openbsd=yes ;;
emx*) libmikmod_os2=yes;;
*djgpp) libmikmod_djgpp=yes ;;
amigaos*|aros*|morphos*)
libmikmod_amiga=yes ;;
esac
# ==============================================================
# libmikmod specific control variables and their default values.
# ==============================================================
libmikmod_driver_af=no
libmikmod_driver_ahi=yes
libmikmod_driver_aix=no
libmikmod_driver_alsa=yes
libmikmod_driver_pulseaudio=yes
libmikmod_driver_esd=no
libmikmod_driver_nas=no
libmikmod_driver_hp=no
libmikmod_driver_sdl=no
libmikmod_driver_openal=no
libmikmod_driver_oss=yes
libmikmod_driver_sam9407=no
libmikmod_driver_sgi=no
libmikmod_driver_sun=no
libmikmod_driver_osx=yes
libmikmod_driver_mac=no
libmikmod_driver_win=yes
libmikmod_driver_ds=yes
libmikmod_driver_xaudio2=no
libmikmod_driver_ultra=no
libmikmod_driver_os2=yes
libmikmod_driver_dart=yes
libmikmod_driver_aiff=yes
libmikmod_driver_wav=yes
libmikmod_driver_raw=yes
libmikmod_driver_stdout=yes
libmikmod_driver_pipe=yes
# ANDROID and DRV_OSLES are not configury-integrated
libmikmod_driver_osles=no
libmikmod_dynload=yes
libmikmod_dynload_underscores=no
libmikmod_debug=no
libmikmod_threads=yes
libmikmod_simd=no
libmikmod_altivec=no
libmikmod_sse2=no
libmikmod_unix=default
libmikmod_docs=yes
# =========================
# Configure script options.
# =========================
AC_ARG_ENABLE([af], [AS_HELP_STRING([--enable-af],[include DEC AudioFile server driver [default=no]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_af=yes
else
libmikmod_driver_af=no
fi])
AC_ARG_ENABLE([alsa], [AS_HELP_STRING([--enable-alsa],[Linux only: include ALSA driver [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_alsa=yes
else
libmikmod_driver_alsa=no
fi])
AC_ARG_ENABLE([ahi], [AS_HELP_STRING([--enable-ahi],[Amiga only: include AHI driver [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_ahi=yes
else
libmikmod_driver_ahi=no
fi])
AC_ARG_ENABLE([pulseaudio], [AS_HELP_STRING([--enable-pulseaudio],[include PulseAudio driver [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_pulseaudio=yes
else
libmikmod_driver_pulseaudio=no
fi])
AC_ARG_ENABLE([esd], [AS_HELP_STRING([--enable-esd],[include EsounD (Enlightened Sound Daemon) driver [default=no]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_esd=yes
else
libmikmod_driver_esd=no
fi])
AC_ARG_ENABLE([nas], [AS_HELP_STRING([--enable-nas],[include the Network Audio System driver [default=no]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_nas=yes
else
libmikmod_driver_nas=no
fi])
case $host_os in
mingw*|emx*|*djgpp|amigaos*|aros*|morphos*)
# windows, dos, os2 don't need sdl, stdout, or pipe.
# so default to disabled, but still user-selectable.
libmikmod_driver_pipe=no
libmikmod_driver_pulseaudio=no
libmikmod_driver_stdout=no
libmikmod_driver_sdl=no ;;
cygwin*|darwin*)
# cygwin, osx don't need sdl.
libmikmod_driver_pulseaudio=no
libmikmod_driver_sdl=no ;;
*) ;;
esac
AC_ARG_ENABLE([aiff], [AS_HELP_STRING([--enable-aiff],[include support for output to an aiff file [default=yes]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_aiff=yes
else
libmikmod_driver_aiff=no
fi])
AC_ARG_ENABLE([wav], [AS_HELP_STRING([--enable-wav],[include support for output to a wav file [default=yes]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_wav=yes
else
libmikmod_driver_wav=no
fi])
AC_ARG_ENABLE([raw], [AS_HELP_STRING([--enable-raw],[include support for output raw data to a file [default=yes]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_raw=yes
else
libmikmod_driver_raw=no
fi])
AC_ARG_ENABLE([stdout], [AS_HELP_STRING([--enable-stdout],[include support for output to stdout [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_stdout=yes
else
libmikmod_driver_stdout=no
fi])
AC_ARG_ENABLE([pipe], [AS_HELP_STRING([--enable-pipe],[include support for output via a pipe to another command [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_pipe=yes
else
libmikmod_driver_pipe=no
fi])
AC_ARG_ENABLE([sdl], [AS_HELP_STRING([--enable-sdl],[include SDL driver [default=no]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_sdl=yes
else
libmikmod_driver_sdl=no
fi])
try_sdl2=yes
AC_ARG_ENABLE([sdl2], [AS_HELP_STRING([--enable-sdl2],[try SDL2 first, then SDL-1.2 as libsdl [default=yes]])],
[if test "$enableval" = "yes"
then
try_sdl2=yes
else
try_sdl2=no
fi])
AC_ARG_ENABLE([openal], [AS_HELP_STRING([--enable-openal],[include OpenAL driver [default=no]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_openal=yes
else
libmikmod_driver_openal=no
fi])
AC_ARG_ENABLE([oss], [AS_HELP_STRING([--enable-oss],[include OSS driver [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_oss=yes
else
libmikmod_driver_oss=no
fi])
AC_ARG_ENABLE([osx], [AS_HELP_STRING([--enable-osx],[Darwin only: include OSX CoreAudio driver [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_osx=yes
else
libmikmod_driver_osx=no
fi])
AC_ARG_ENABLE([mac], [AS_HELP_STRING([--enable-mac],[Darwin only: include MAC carbon driver [default=no]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_mac=yes
else
libmikmod_driver_mac=no
fi])
AC_ARG_ENABLE([win], [AS_HELP_STRING([--enable-win],[Windows only: include Windows MCI driver [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_win=yes
else
libmikmod_driver_win=no
fi])
AC_ARG_ENABLE([ds], [AS_HELP_STRING([--enable-ds],[Windows only: include Direct Sound driver [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_ds=yes
else
libmikmod_driver_ds=no
fi])
AC_ARG_ENABLE([xaudio2], [AS_HELP_STRING([--enable-xaudio2],[Windows only: include XAudio2 driver [default=no]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_xaudio2=yes
else
libmikmod_driver_xaudio2=no
fi])
use_xaudio28=no
AC_ARG_ENABLE([xaudio28], [AS_HELP_STRING([--enable-xaudio28],[Windows only: use XAudio2.8 for Windows8 instead of XAudio2.7 [default=no]])],
[if test "$enableval" = "yes"
then
use_xaudio28=yes
else
use_xaudio28=no
fi])
AC_ARG_ENABLE([os2], [AS_HELP_STRING([--enable-os2],[OS/2 only: include the OS/2 MCI driver [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_os2=yes
else
libmikmod_driver_os2=no
fi])
AC_ARG_ENABLE([dart], [AS_HELP_STRING([--enable-dart],[OS/2 (Warp 4) only: include OS/2 direct audio (DART) [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_dart=yes
else
libmikmod_driver_dart=no
fi])
AC_ARG_ENABLE([sam9407], [AS_HELP_STRING([--enable-sam9407],[Linux only: include sam9407 driver [default=no]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_sam9407=yes
else
libmikmod_driver_sam9407=no
fi])
AC_ARG_ENABLE([ultra], [AS_HELP_STRING([--enable-ultra],[Linux only: include Ultra driver [default=no]])],
[if test "$enableval" = "yes"
then
libmikmod_driver_ultra=yes
else
libmikmod_driver_ultra=no
fi])
AC_ARG_ENABLE([dl], [AS_HELP_STRING([--enable-dl],[load alsa, esound and ultra drivers at runtime [default=yes]])],
[if test "$enableval" = "yes"
then
libmikmod_dynload=yes
else
libmikmod_dynload=no
fi])
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],[build a debug version of libmikmod [default=no]])],
[if test "$enableval" = "yes"
then
libmikmod_debug=yes
else
libmikmod_debug=no
fi])
AC_ARG_ENABLE([threads], [AS_HELP_STRING([--enable-threads],[build a thread-safe version of libmikmod [guessed]])],
[if test "$enableval" = "yes"
then
libmikmod_threads=yes
else
libmikmod_threads=no
fi])
AC_ARG_ENABLE([simd], [AS_HELP_STRING([--enable-simd],[include SIMD (AltiVec or SSE2) mixer optimizations (Unstable!) [default=no]])],
[if test "$enableval" = "yes"
then
libmikmod_simd=yes
else
libmikmod_simd=no
fi])
AC_ARG_ENABLE([unix], [AS_HELP_STRING([--enable-unix],[override the default value of MIKMOD_UNIX in mikmod_internals.h (if you *really* need to.)])],
[if test "$enableval" = "yes" ;then
libmikmod_unix=1
elif test "$enableval" = "no" ;then
libmikmod_unix=0
fi])
AC_ARG_ENABLE([doc], [AS_HELP_STRING([--enable-doc],[Build and install the documentation [default=yes]])],
[if test "$enableval" = "yes" ;then
libmikmod_docs=yes
elif test "$enableval" = "no" ;then
libmikmod_docs=no
fi])
# ===================
# Check for programs.
# ===================
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
#LT_INIT([win32-dll])
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
# =============================================================
# Check for typedefs, structures, and compiler characteristics.
# =============================================================
AC_PROG_GCC_TRADITIONAL
AC_C_CONST
AC_CACHE_CHECK([if compiler understands the signed keyword],[libmikmod_cv_gcc_signed],
AC_LANG_SAVE
AC_LANG_C
AC_TRY_COMPILE(,[signed int t = 0;],[libmikmod_cv_gcc_signed=yes],[libmikmod_cv_gcc_signed=no])
AC_LANG_RESTORE)
if test $libmikmod_cv_gcc_signed = no; then
AC_DEFINE(signed,,[Define to empty if compiler does not understand the `signed' keyword.])
fi
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_C_BIGENDIAN
# =======================
# Check for header files.
# =======================
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h memory.h strings.h sys/ioctl.h unistd.h])
# ============================
# Check for library functions.
# ============================
AC_CHECK_FUNCS([posix_memalign setenv snprintf srandom])
AC_REPLACE_FUNCS([memcmp strcasecmp strdup strstr])
AC_CHECK_LIB([m],[floor],LIBRARY_LIB="-lm $LIBRARY_LIB")
AC_EGREP_HEADER([srandom],[math.h],AC_DEFINE([SRANDOM_IN_MATH_H], 1,
[Define if your system defines random(3) and srandom(3) in math.h instead of stdlib.h]))
# ====================
# Check for libraries.
# ====================
# dl functions
# ------------
if test $libmikmod_mingw = yes; then
# libmikmod_dynload variable is for dlopen() api only
libmikmod_dynload=no
fi
if test $libmikmod_dynload = yes
then
libmikmod_dynload=no
libmikmod_dllib=
# SunOS-style shared libraries
AC_CHECK_HEADERS([dlfcn.h])
if test $ac_cv_header_dlfcn_h = yes; then
AC_CHECK_LIB([c],[dlopen],[libmikmod_dynload=sun],
[AC_CHECK_LIB([dl],[dlopen],[libmikmod_dynload=sun
libmikmod_dllib="-ldl"],[libmikmod_dynload=no])])
else
# HP-UX-style shared libraries
AC_CHECK_HEADERS([dl.h])
if test $ac_cv_header_dl_h = yes
then
AC_CHECK_LIB([dld],[shl_load],[libmikmod_dynload=hp
libmikmod_dllib="-ldld"
CFLAGS="${CFLAGS} -DMIKMOD_DLAPI_HP=1 -I${srcdir}/dlapi"],
[libmikmod_dynload=no])
fi
fi
fi
if test $libmikmod_dynload = sun
then
AC_CACHE_CHECK([wherever dynamically loaded symbols need underscores],[libmikmod_cv_dynload_underscores],
libmikmod_oldlibs=$LIBS
LIBS="$LIBS $libmikmod_dllib"
AC_LANG_SAVE
AC_LANG_C
AC_TRY_RUN(
[#include <dlfcn.h>
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
int main(void) {
void *libc, *printfptr;
libc = dlopen("libc.so", RTLD_LAZY | RTLD_GLOBAL);
if (!libc) exit(1);
printfptr = dlsym(libc, "_printf");
dlclose(libc);
exit(!printfptr);
}],
[libmikmod_cv_dynload_underscores=yes],
[libmikmod_cv_dynload_underscores=no],
[libmikmod_cv_dynload_underscores=no])
AC_LANG_RESTORE
LIBS=$libmikmod_oldlibs
)
if test $libmikmod_cv_dynload_underscores = yes; then
AC_DEFINE([DLSYM_NEEDS_UNDERSCORE], 1, [Define if your system needs leading underscore to function names in dlsym() calls])
fi
fi
# POSIX.4 threads
# ---------------
if test $libmikmod_mingw = yes || test $libmikmod_amiga = yes ; then
dnl libmikmod_threads variable is for pthreads only
libmikmod_threads=no
fi
if test $libmikmod_threads = yes
then
libmikmod_threads=no
AC_CACHE_CHECK([if compiler recognizes -pthread],[libmikmod_cv_gcc_pthread],
ac_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -pthread"
AC_LANG_SAVE
AC_LANG_C
AC_TRY_LINK([#include <pthread.h>],
[int p = pthread_create(NULL,NULL,NULL,NULL);],
[libmikmod_cv_gcc_pthread=yes],
[libmikmod_cv_gcc_pthread=no])
AC_LANG_RESTORE
CFLAGS=$ac_save_CFLAGS
)
if test $libmikmod_cv_gcc_pthread = yes; then
dnl There is no need for -pthread on darwin, and gcc
dnl complains about unrecognized option -pthread
if test $libmikmod_darwin = no; then
libmikmod_threads=""
CFLAGS="$CFLAGS -pthread"
fi
else
dnl AC_CHECK_HEADERS(pthread.h) unreliable
AC_CHECK_LIB([pthread],[pthread_create],[libmikmod_threads=-lpthread],
[AC_CHECK_LIB([c_r],[pthread_create],[libmikmod_threads=-lc_r])])
fi
fi
# ALSA - Linux only
# -----------------
if test $libmikmod_linux = yes && test $libmikmod_driver_alsa = yes
then
libmikmod_driver_alsa=no
AC_CHECK_HEADERS([alsa/asoundlib.h],[AC_CHECK_LIB([asound],[snd_pcm_open],[libmikmod_driver_alsa=yes])])
else
libmikmod_driver_alsa=no
fi
# Amiga audio
# ---------------------
case $host_os in
amigaos*|aros*|morphos*) ;;
*) libmikmod_driver_ahi=no ;;
esac
# pulseaudio
# ----------
if test $libmikmod_driver_pulseaudio = yes
then
libmikmod_driver_pulseaudio=no
AC_CHECK_HEADERS([pulse/simple.h],[AC_CHECK_LIB([pulse-simple],[pa_simple_new],[libmikmod_driver_pulseaudio=yes])])
else
libmikmod_driver_pulseaudio=no
fi
# esd
# ---
if test $libmikmod_driver_esd = yes && test $libmikmod_mingw = no && test $libmikmod_darwin = no
then
libmikmod_driver_esd=no
AM_PATH_ESD("0.2.18",[libmikmod_driver_esd=yes])
else
libmikmod_driver_esd=no
fi
# nas
# ---
if test $libmikmod_driver_nas = yes && test $libmikmod_mingw = no && test $libmikmod_darwin = no
then
libmikmod_driver_nas=no
AC_PATH_X
AC_CHECK_HEADERS([audio/audiolib.h],[AC_CHECK_LIB([audio],[AuCreateFlow],[libmikmod_driver_nas=yes])])
if test $libmikmod_driver_nas = no; then
if test -n "$ac_x_includes" || test -n "$ac_x_libraries"; then
ac_save_CFLAGS=$CFLAGS
ac_save_LDFLAGS=$LDFLAGS
ac_save_LIBS=$LIBS
test -n "$ac_x_includes" && CFLAGS="$CFLAGS -I$ac_x_includes"
test -n "$ac_x_libraries" && LDFLAGS="$LDFLAGS -L$ac_x_libraries"
LIBS="$LIBS -laudio"
AC_MSG_CHECKING([X11 locations for NAS])
AC_TRY_LINK([#include <audio/audiolib.h>],
[AuFlowID f=AuCreateFlow(0,0);],
[libmikmod_driver_nas=yes])
CFLAGS=$ac_save_CFLAGS
LDFLAGS=$ac_save_LDFLAGS
LIBS=$ac_save_LIBS
AC_MSG_RESULT([$libmikmod_driver_nas])
if test $libmikmod_driver_nas = yes; then
test -n "$ac_x_includes" && CFLAGS="$CFLAGS -I$ac_x_includes"
test -n "$ac_x_libraries" && LIBRARY_LIB="$LIBRARY_LIB -L$ac_x_libraries"
fi
fi
fi
else
libmikmod_driver_nas=no
fi
# OpenAL - all supported platforms
# -----------------
if test $libmikmod_driver_openal = yes
then
libmikmod_driver_openal=no
if test $libmikmod_darwin = yes
then
# header-only test is good enough. need 10.4.
AC_CHECK_HEADERS([OpenAL/al.h OpenAL/alc.h],,,[
#if HAVE_OPENAL_AL_H
# include <OpenAL/al.h>
#endif
#if HAVE_OPENAL_ALC_H
# include <OpenAL/alc.h>
#endif
])
if test $ac_cv_header_OpenAL_al_h = yes && test $ac_cv_header_OpenAL_alc_h = yes; then
libmikmod_driver_openal=yes
fi
else
AC_CHECK_HEADERS([AL/al.h AL/alc.h AL/alext.h],,,[
#if HAVE_AL_AL_H
# include <AL/al.h>
#endif
#if HAVE_AL_ALC_H
# include <AL/alc.h>
#endif
])
if test $ac_cv_header_AL_al_h = yes && test $ac_cv_header_AL_alc_h = yes; then
AC_CHECK_LIB([openal],[alEnable],[libmikmod_driver_openal=yes])
fi
fi
else
libmikmod_driver_openal=no
fi
# SDL - all supported platforms
# -----------------
if test $libmikmod_driver_sdl = yes
then
libmikmod_driver_sdl=no
if test $try_sdl2 = yes; then
AM_PATH_SDL2("2.0.0",[libmikmod_driver_sdl=yes])
fi
if test $libmikmod_driver_sdl != yes; then
AM_PATH_SDL("1.2.0",[libmikmod_driver_sdl=yes])
fi
# we don't need linking to SDLmain, because we are a library.
# we also don't need -lmingw32 for MinGW, because gcc adds it automatically.
# -mwindows doesn't make sense for us, either, i.e. no need for extra gdi32
# and comdlg32 linkage, nor the extra "--subsystem windows" flag.
SDL_CFLAGS="`echo $SDL_CFLAGS|sed -e 's/-Dmain=SDL_main//'`"
SDL_LIBS="`echo $SDL_LIBS|sed -e 's/-lSDLmain//'|sed -e 's/-lmingw32//'|sed -e 's/-mwindows//'`"
else
libmikmod_driver_sdl=no
fi
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
# Windows audio
# ---------------------
case $host_os in
mingw*|cygwin*)
# do a windows.h check, just in case..
AC_CHECK_HEADERS([windows.h],,[AC_MSG_ERROR([Targeting windows, but windows.h not available])])
if test $libmikmod_driver_ds = yes; then
libmikmod_driver_ds=no
AC_CHECK_HEADERS([dsound.h],[libmikmod_driver_ds=yes])
fi
if test $libmikmod_driver_xaudio2 = yes; then
libmikmod_driver_xaudio2=no
ac_save_CPPFLAGS=$CPPFLAGS
if test $use_xaudio28 = yes; then
CPPFLAGS="$CPPLAGS -D_WIN32_WINNT=0x0602"
fi
AC_CHECK_HEADERS([xaudio2.h],[libmikmod_driver_xaudio2=yes])
if test $libmikmod_driver_xaudio2 = yes ; then
AC_CACHE_CHECK([if XAUDIO2_DEBUG_ENGINE is defined],[libmikmod_cv_xaudio2_7_header],
[AC_TRY_COMPILE([#include <xaudio2.h>],[int flag=XAUDIO2_DEBUG_ENGINE;],
[libmikmod_cv_xaudio2_7_header=yes],[libmikmod_cv_xaudio2_7_header=no])])
if test $libmikmod_cv_xaudio2_7_header = yes && test $use_xaudio28 = yes; then
AC_MSG_WARN([xaudio2.h <= 2.7 and xaudio2.8 enabled - build will likely fail.])
fi
if test $libmikmod_cv_xaudio2_7_header = no && test $use_xaudio28 != yes; then
AC_MSG_WARN([xaudio2.h >= 2.8 and xaudio2.8 disabled - build will likely fail.])
fi
fi
CPPFLAGS=$ac_save_CPPFLAGS
fi
;;
*) libmikmod_driver_win=no
libmikmod_driver_ds=no
libmikmod_driver_xaudio2=no
;;
esac
# OS/2 audio
# ---------------------
case $host_os in
emx*)
# do an os2.h check, just in case..
AC_CHECK_HEADERS([os2.h],,[AC_MSG_ERROR([Targeting OS/2, but os2.h not available])])
;;
*) libmikmod_driver_os2=no
libmikmod_driver_dart=no
;;
esac
# sgi audio - IRIX only
# ---------------------
case $host_os in
irix*)
AC_CHECK_HEADERS([dmedia/audio.h],[AC_CHECK_LIB([audio],[ALseterrorhandler],[libmikmod_driver_sgi=yes])])
;;
esac
# audiofile
# ---------
if test $libmikmod_driver_af = yes && test $libmikmod_mingw = no && test $libmikmod_darwin = no
then
libmikmod_driver_af=no
AC_CHECK_HEADERS([AF/AFlib.h],[AC_CHECK_LIB([AF],[AFOpenAudioConn],[libmikmod_driver_af=yes])])
else
libmikmod_driver_af=no
fi
# libgus - Linux only
# -------------------
if test $libmikmod_linux = yes && test $libmikmod_driver_ultra = yes
then
libmikmod_driver_ultra=no
AC_CHECK_HEADERS([libgus.h])
if test $ac_cv_header_libgus_h = yes
then
AC_CACHE_CHECK([if libgus is new enough],[libmikmod_cv_libgus_h_good],
[AC_TRY_COMPILE([#include <libgus.h>],
[gus_info_t *info;
int flg1=GUS_INSTR_SIMPLE;
int flg2=GUS_WAVE_BIDIR;],
[libmikmod_cv_libgus_h_good=yes],[libmikmod_cv_libgus_h_good=no])])
if test $libmikmod_cv_libgus_h_good = yes; then
AC_CHECK_LIB([gus],[gus_cards],[libmikmod_driver_ultra=yes])
fi
fi
else
libmikmod_driver_ultra=no
fi
# sam9407 - Linux only
# --------------------
if test $libmikmod_linux = yes && test $libmikmod_driver_sam9407 = yes
then
libmikmod_driver_sam9407=no
AC_CHECK_HEADERS([sys/sam9407.h],[libmikmod_driver_sam9407=yes])
else
libmikmod_driver_sam9407=no
fi
# ================
# Choose settings.
# ================
libmikmod_driverlist=nosound
if test $libmikmod_driver_raw = yes ; then
libmikmod_driverlist="raw $libmikmod_driverlist"
AC_DEFINE([DRV_RAW], 1, [Define if you want a raw pcm data file writer driver])
fi
if test $libmikmod_driver_wav = yes ; then
libmikmod_driverlist="wav $libmikmod_driverlist"
AC_DEFINE([DRV_WAV], 1, [Define if you want a .wav file writer driver])
fi
if test $libmikmod_driver_aiff = yes ; then
libmikmod_driverlist="aiff $libmikmod_driverlist"
AC_DEFINE([DRV_AIFF], 1, [Define if you want an .aiff file writer driver])
fi
if test $libmikmod_driver_pipe = yes ; then
libmikmod_driverlist="pipe $libmikmod_driverlist"
AC_DEFINE([DRV_PIPE], 1, [Define if your system supports binary pipes (i.e. Unix)])
fi
if test $libmikmod_driver_stdout = yes ; then
libmikmod_driverlist="stdout $libmikmod_driverlist"
AC_DEFINE([DRV_STDOUT], 1, [Define if you want support for output to stdout])
fi
# If we can guess the drivers needed from the system, no need to ask the user
# to specify it manually
case $host_os in
aix*)
AC_DEFINE([AIX], 1, [Define if your system is AIX 3.x - might be needed for 4.x too])
AC_CHECK_HEADERS([sys/audio.h sys/acpa.h])
if test $ac_cv_header_sys_audio_h = yes && test $ac_cv_header_sys_acpa_h = yes; then
libmikmod_driver_aix=yes
fi
;;
hpux*)
AC_CHECK_HEADERS([sys/audio.h])
if test $ac_cv_header_sys_audio_h = yes; then
libmikmod_driver_hp=yes
fi
;;
netbsd*|openbsd*)
AC_CHECK_HEADERS([sys/audioio.h])
if test $ac_cv_header_sys_audioio_h = yes; then
libmikmod_driver_sun=yes
if test $libmikmod_netbsd = yes; then
libmikmod_driverlist="netbsd $libmikmod_driverlist"
else
libmikmod_driverlist="openbsd $libmikmod_driverlist"
fi
fi
;;
sunos*|solaris*)
AC_CHECK_HEADERS([sun/audioio.h sys/audioio.h])
if test $ac_cv_header_sun_audioio_h = yes || test $ac_cv_header_sys_audioio_h = yes; then
libmikmod_driver_sun=yes
libmikmod_driverlist="sun $libmikmod_driverlist"
if test "$cross_compiling" != yes ; then
case `uname -r` in
4*) AC_DEFINE([SUNOS], 1, [Define if your system is SunOS 4.x]) ;;
esac
fi
fi
;;
esac
if test $libmikmod_driver_af = yes
then
libmikmod_driverlist="$libmikmod_driverlist audiofile"
AC_DEFINE([DRV_AF], 1, [Define if the DEC AudioFile server driver is compiled])
LIBRARY_LIB="-lAF $LIBRARY_LIB"
fi
if test $libmikmod_driver_win = yes
then
libmikmod_driverlist="win $libmikmod_driverlist"
AC_DEFINE([DRV_WIN], 1, [Define if the Windows MCI driver is compiled])
LIBRARY_LIB="-lwinmm $LIBRARY_LIB"
fi
if test $libmikmod_driver_ds = yes
then
libmikmod_driverlist="ds $libmikmod_driverlist"
AC_DEFINE([DRV_DS], 1, [Define if the Windows DirectSound driver is compiled])
LIBRARY_LIB="-ldsound $LIBRARY_LIB"
fi
if test $libmikmod_driver_xaudio2 = yes
then
libmikmod_driverlist="xaudio2 $libmikmod_driverlist"
AC_DEFINE([DRV_XAUDIO2], 1, [Define if the Windows XAudio2 driver is compiled])
LIBRARY_LIB="-lole32 $LIBRARY_LIB"
if test $use_xaudio28 = yes ; then
AC_DEFINE([DRV_XAUDIO28],1,[Define if using XAudio 2.8 for Windows8 with XAudio2 driver])
LIBRARY_LIB="-lxaudio2_8 $LIBRARY_LIB"
fi
fi
if test $libmikmod_driver_os2 = yes
then
libmikmod_driverlist="os2 $libmikmod_driverlist"
AC_DEFINE([DRV_OS2], 1, [Define if the OS/2 MCI driver is compiled])
# drv_os2 and drv_dart both link to mmpm2
if test $libmikmod_driver_dart = no ; then
LIBRARY_LIB="-lmmpm2 $LIBRARY_LIB"
fi
fi
if test $libmikmod_driver_dart = yes
then
libmikmod_driverlist="dart $libmikmod_driverlist"
AC_DEFINE([DRV_DART], 1, [Define if the OS/2 direct audio (DART) driver is compiled])
LIBRARY_LIB="-lmmpm2 $LIBRARY_LIB"
fi
if test $libmikmod_driver_aix = yes
then
libmikmod_driverlist="aix $libmikmod_driverlist"
AC_DEFINE([DRV_AIX], 1, [Define if the AIX audio driver is compiled])
fi
if test $libmikmod_driver_ahi = yes
then
libmikmod_driverlist="ahi $libmikmod_driverlist"
AC_DEFINE([DRV_AHI], 1, [Define if the Amiga AHI driver is compiled])
fi
if test $libmikmod_driver_alsa = yes
then
libmikmod_driverlist="alsa $libmikmod_driverlist"
AC_DEFINE([DRV_ALSA], 1, [Define if the Linux ALSA driver is compiled])
if test $libmikmod_dynload = no ; then
LIBRARY_LIB="-lasound $LIBRARY_LIB"
fi
fi
if test $libmikmod_driver_pulseaudio = yes
then
libmikmod_driverlist="pulseaudio $libmikmod_driverlist"
AC_DEFINE([DRV_PULSEAUDIO], 1, [Define if the PulseAudio driver is compiled])
LIBRARY_LIB="-lpulse-simple -lpulse $LIBRARY_LIB"
fi
if test $libmikmod_driver_esd = yes
then
libmikmod_driverlist="esd $libmikmod_driverlist"
AC_DEFINE([DRV_ESD], 1, [Define if the Enlightened Sound Daemon driver is compiled])
CFLAGS="$CFLAGS $ESD_CFLAGS"
# Under Solaris and perhaps other systems, we have to forward esd
# dependencies to libmikmod's dependency list.
# However, no need to keep libraries we won't require (libossaudio on BSD
# systems, libaudiofile, libasound on Linux)
if test $libmikmod_dynload != no ; then
ESD_LIBS="`echo $ESD_LIBS|sed -e 's/-lesd//'|sed -e 's/-lasound//'|sed -e 's/-laudiofile//'|sed -e 's/-lossaudio//'`"
fi
LIBRARY_LIB="$ESD_LIBS $LIBRARY_LIB"
fi
if test $libmikmod_driver_nas = yes
then
libmikmod_driverlist="nas $libmikmod_driverlist"
AC_DEFINE([DRV_NAS], 1, [Define if the Network Audio System driver is compiled])
LIBRARY_LIB="-laudio $LIBRARY_LIB"
fi
if test $libmikmod_driver_hp = yes
then
libmikmod_driverlist="hp $libmikmod_driverlist"
AC_DEFINE([DRV_HP], 1, [Define if the HP-UX audio driver is compiled])
fi
if test $libmikmod_driver_openal = yes
then
libmikmod_driverlist="openal $libmikmod_driverlist"
AC_DEFINE([DRV_OPENAL], 1, [Define if the OpenAL driver is compiled])
if test $libmikmod_darwin = yes; then
LIBRARY_LIB="-framework OpenAL $LIBRARY_LIB"
else
LIBRARY_LIB="-lopenal $LIBRARY_LIB"
fi
fi
if test $libmikmod_driver_sdl = yes
then
libmikmod_driverlist="sdl $libmikmod_driverlist"
AC_DEFINE([DRV_SDL], 1, [Define if the SDL audio driver is compiled])
CFLAGS="$SDL_CFLAGS $CFLAGS"
LIBRARY_LIB="$SDL_LIBS $LIBRARY_LIB"
fi
if test $libmikmod_driver_oss = yes && test $libmikmod_mingw = no && test $libmikmod_darwin = no
then
AC_CHECK_HEADERS([sys/soundcard.h machine/soundcard.h soundcard.h])
# NetBSD and OpenBSD use ossaudio emulation layer,
# otherwise no link library is needed.
oss_library=""
case $host_os in
netbsd*|openbsd*)
AC_CHECK_LIB([ossaudio],[_oss_ioctl],[oss_library="-lossaudio"])
;;
esac
AC_MSG_CHECKING([whether OSS code compiles])
AC_TRY_COMPILE([#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_SOUNDCARD_H
# include <sys/soundcard.h>
#elif defined(HAVE_MACHINE_SOUNDCARD_H)
# include <machine/soundcard.h>
#elif defined(HAVE_SOUNDCARD_H)
# include <soundcard.h>
#else
error No OSS header present.
#endif],
[int i=SNDCTL_DSP_RESET;],
[libmikmod_driver_oss=yes],
[libmikmod_driver_oss=no])
AC_MSG_RESULT([$libmikmod_driver_oss])
if test $libmikmod_driver_oss = yes; then
libmikmod_driverlist="oss $libmikmod_driverlist"
AC_DEFINE([DRV_OSS], 1, [Define if the Open Sound System driver is compiled])
if test -n "$oss_library"; then
LIBRARY_LIB="$oss_library $LIBRARY_LIB"
fi
fi
fi
if test $libmikmod_darwin = yes
then
if test $libmikmod_driver_osx = yes; then
libmikmod_driverlist="osx $libmikmod_driverlist"
AC_DEFINE([DRV_OSX], 1, [Define this if you want the MacOS X CoreAudio driver])
LIBRARY_LIB="-framework CoreAudio $LIBRARY_LIB"
fi
fi
#OpenSL ES driver (e.g. Android)
if test $libmikmod_driver_osles = yes
then
AC_DEFINE([DRV_OSLES], 1, [Define if the OpenSL ES driver is compiled])
LIBRARY_LIB="-lOpenSLES $LIBRARY_LIB"
fi
if test $libmikmod_darwin = yes
then
if test $libmikmod_driver_mac = yes; then
libmikmod_driverlist="mac $libmikmod_driverlist"
AC_DEFINE([DRV_MAC], 1, [Define this if you want the Carbon Mac Audio driver])
LIBRARY_LIB="-framework Carbon $LIBRARY_LIB"
fi
fi
if test $libmikmod_driver_sam9407 = yes
then
libmikmod_driverlist="sam9407 $libmikmod_driverlist"
AC_DEFINE([DRV_SAM9407], 1, [Define if the Linux SAM9407 driver is compiled])
fi
if test $libmikmod_driver_sgi = yes
then
libmikmod_driverlist="sgi $libmikmod_driverlist"
AC_DEFINE([DRV_SGI], 1, [Define if the SGI audio driver is compiled])
LIBRARY_LIB="-laudio $LIBRARY_LIB"
fi
if test $libmikmod_driver_sun = yes
then
AC_DEFINE([DRV_SUN], 1, [Define if the Sun audio driver or compatible (NetBSD, OpenBSD) is compiled])
fi
if test $libmikmod_driver_ultra = yes
then
libmikmod_driverlist="ultra $libmikmod_driverlist"
AC_DEFINE([DRV_ULTRA], 1, [Define if the Linux Ultra driver is compiled])
if test $libmikmod_dynload = no; then
LIBRARY_LIB="-lgus $LIBRARY_LIB"
fi
fi
if test $libmikmod_debug = yes
then
AC_DEFINE([MIKMOD_DEBUG], 1, [Define if you want a debug version of the library])
CC="$CC -g"
fi
if test $libmikmod_dynload != no
then
AC_DEFINE([MIKMOD_DYNAMIC], 1, [Define if you want runtime dynamic linking of ALSA and EsounD drivers])
LIBRARY_LIB="$libmikmod_dllib $LIBRARY_LIB"
if test $libmikmod_dynload = sun; then
# RTLD_GLOBAL is not defined under every system
AC_CACHE_CHECK([if RTLD_GLOBAL is defined],libmikmod_cv_decl_rtld_global,
[AC_TRY_COMPILE([#include <dlfcn.h>],[int flag=RTLD_GLOBAL;],
[libmikmod_cv_decl_rtld_global=yes],
[libmikmod_cv_decl_rtld_global=no])])
if test $libmikmod_cv_decl_rtld_global = yes; then
AC_DEFINE([HAVE_RTLD_GLOBAL], 1, [Define if your system has RTLD_GLOBAL defined in <dlfcn.h>])
fi
fi
fi
# If compiling with gcc, use adequate optimization flags
if test $ac_cv_prog_gcc = yes
then
# On at least x86 platforms, gcc 2.7.2.1 and earlier won't work if -O3 (or
# -finline-functions) are used. Versions 2.7.2.3, 2.8.x and egcs are ok
# (didn't test 2.7.2.2).
# Until there's an easy way to catch broken inlining, we choose flags known
# to work correctly depending of the compiler version.
AC_CACHE_CHECK([if inlining functions is safe],[libmikmod_cv_gcc_inline_safe],
[AC_TRY_COMPILE(,[
#if !(defined __GNUC__ && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ > 7))
#error inlining functions is not safe
#endif
],
[libmikmod_cv_gcc_inline_safe=yes],
[libmikmod_cv_gcc_inline_safe=no])])
if test $libmikmod_cv_gcc_inline_safe = no; then
CFLAGS="$CFLAGS -fno-strength-reduce"
fi
CFLAGS="$CFLAGS -ffast-math"
if test $libmikmod_darwin = yes; then
CFLAGS="$CFLAGS -fno-common"
fi
if test $libmikmod_debug = yes; then
CFLAGS="$CFLAGS -Wall -Werror"
else
CFLAGS="$CFLAGS -Wall"
fi
# pgcc 2.95.2 appears not to be able to compile libmikmod, although regular
# gcc works fine. Issue a warning if the compiler is pgcc, until a reliable
# way to detect flawed version (or, better, a reliable workaround) is
# found.
dnl do not cache this test - better rechecking every time
AC_MSG_CHECKING([if compiler is pgcc])
if ($CC -v 2>&1 | grep ^pgcc > /dev/null) 2>/dev/null ; then
libmikmod_gcc_is_pgcc=yes
else
libmikmod_gcc_is_pgcc=no
fi
AC_MSG_RESULT([$libmikmod_gcc_is_pgcc])
if test $libmikmod_gcc_is_pgcc = yes; then
echo "
*** Version 2.95.2 of this compiler, and perhaps others, are unable to
*** compile libmikmod. If compilation fails for playercode/virtch.c
*** around line 650, with the error ``internal error--insn does not
*** satisfy its constraints'', then you'll have to use another compiler.
" >&2
fi
fi
if test x$libmikmod_threads != xno
then
AC_DEFINE([HAVE_PTHREAD], 1, [Define if your system provides POSIX.4 threads])
CFLAGS="$CFLAGS -D_REENTRANT"
LIBRARY_LIB="$libmikmod_threads $LIBRARY_LIB"
REENTRANT="-D_REENTRANT"
if test $libmikmod_cv_gcc_pthread = yes
then
dnl There is no need for -pthread on darwin, and gcc
dnl complains about unrecognized option -pthread
if test $libmikmod_darwin = no; then
REENTRANT="-pthread $REENTRANT"
LIB_LDADD="-pthread"
fi
fi
fi
case $host_cpu in
ppc|ppc64|powerpc|powerpc64)
AC_MSG_CHECKING(whether to use altivec)
if test x$libmikmod_simd = xyes ; then
case $host_os in
darwin*)
dnl compile all Altivec functions, check at run-time
CFLAGS="$CFLAGS -faltivec -force_cpusubtype_ALL" ;;
*)
dnl -faltivec and -force_cpusubtype_ALL are Apple-only
dnl features. -maltivec compiles all code for AltiVec..
CFLAGS="$CFLAGS -maltivec" ;;
esac
libmikmod_altivec=yes
libmikmod_simd=altivec
fi
AC_MSG_RESULT([$libmikmod_altivec])
;;
i*86|x86_64)
AC_MSG_CHECKING(whether to use sse2)
if test x$libmikmod_simd = xyes ; then
dnl x86_64 already enables sse2
dnl add -msse2 for x86 to enable it
case `arch` in
i*86) CFLAGS="$CFLAGS -msse2" ;;
esac
libmikmod_sse2=yes
libmikmod_simd=sse2
fi
AC_MSG_RESULT([$libmikmod_sse2])
;;
esac
# see if we set libmikmod_simd properly
case $libmikmod_simd in
altivec|sse2)
AC_DEFINE([MIKMOD_SIMD], 1, [Define if you want to use SIMD (AltiVec or SSE2) optimizations (Unstable!)]) ;;
*) libmikmod_simd=no ;;
esac
# MIKMOD_UNIX override
if test "$libmikmod_unix" = "0" || test "$libmikmod_unix" = "1"
then
AC_DEFINE_UNQUOTED([MIKMOD_UNIX], $libmikmod_unix, [Define to 0 or 1 to override MIKMOD_UNIX in mikmod_internals.h.])
fi
# symbol visibility
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden -Werror"
AC_CACHE_CHECK([if compiler supports visibility attributes],[libmikmod_cv_gcc_visibility],
AC_LANG_SAVE
AC_LANG_C
AC_TRY_COMPILE([void foo(void);
__attribute__((visibility("default"))) void foo(void) {}],
[],
[libmikmod_cv_gcc_visibility=yes],
[libmikmod_cv_gcc_visibility=no])
AC_LANG_RESTORE)
# we want symbol -fvisibility for elf targets, however it works
# with darwin/macho too. other than that, windows, dos, os/2, amiga
# do not need it: for any such targets, the -Werror switch is
# supposed to fail the above check. (I'm adding the manual test
# below nonetheless, just in case.)
case $host_os in
mingw*|cygwin*|emx*|*djgpp|amigaos*|aros*|morphos*)
libmikmod_cv_gcc_visibility=no
;;
esac
CFLAGS="$ac_save_CFLAGS"
if test $libmikmod_cv_gcc_visibility = yes ;then
CFLAGS="$CFLAGS -DSYM_VISIBILITY -fvisibility=hidden"
fi
# =================
# Create Makefiles.
# =================
AM_CONDITIONAL([BUILD_DOCS], [test "$libmikmod_docs" = yes])
AC_SUBST(REENTRANT)
AC_SUBST(LIBRARY_LIB)
AC_SUBST(LIBMIKMOD_MAJOR_VERSION)
AC_SUBST(LIBMIKMOD_MINOR_VERSION)
AC_SUBST(LIBMIKMOD_MICRO_VERSION)
AC_SUBST(LIBMIKMOD_VERSION)
AC_SUBST(LIB_LDADD)
AC_CONFIG_FILES([
libmikmod-config
libmikmod.pc
libmikmod.spec
Makefile
docs/Makefile
docs/libmikmod-config.1
dlapi/Makefile
drivers/Makefile
drivers/dos/Makefile
include/Makefile
loaders/Makefile
mmio/Makefile
playercode/Makefile
posix/Makefile])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT
chmod +x libmikmod-config
# ====================
# Print configuration.
# ====================
if test $libmikmod_dynload != no; then
libmikmod_dynload="yes, ${libmikmod_dynload} style"
fi
echo "
Library configuration:
Source code location: $srcdir
Compiler: $CC
Compiler flags: $CFLAGS
Debug version: $libmikmod_debug
SIMD optimizations: $libmikmod_simd
Dynamically loaded drivers whenever possible: $libmikmod_dynload
Drivers to be compiled: $libmikmod_driverlist
Install path: $prefix/lib, $prefix/include
"
|