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 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382
|
dnl Init.
AC_INIT(dosbox-x,2025.12.01,[https://github.com/joncampbell123/dosbox-x/issues],[],[https://dosbox-x.com])
COPYRIGHT_YEAR=`echo $PACKAGE_VERSION | cut -c1-4`
AC_SUBST([COPYRIGHT_YEAR])
AC_PREREQ(2.60)
AC_CONFIG_SRCDIR(README.md)
dnl Utility function ============================
# AC_CHECK_CPPFLAGS(ADDITIONAL-CPPFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
#
# checks whether the $(C) compiler accepts the ADDITIONAL-CPPFLAGS
# if so, they are added to the CPPFLAGS
AC_DEFUN([AC_CHECK_CPPFLAGS],
[
AC_MSG_CHECKING([whether $CPP accepts "$1"])
temp_check_cppflags="${CPPFLAGS}"
CPPFLAGS="$1 ${CPPFLAGS}"
AC_PREPROC_IFELSE(
[AC_LANG_SOURCE([[int main(void){return 0;}]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no]); CPPFLAGS="${temp_check_cppflags}"])
])# AC_CHECK_CPPFLAGS
dnl LIBRARY TEST: OpenGL support
AC_CHECK_LIB(GL, main, have_gl_lib=yes, have_gl_lib=no , )
AC_CHECK_LIB(opengl32, main, have_opengl32_lib=yes,have_opengl32_lib=no , )
AC_CHECK_HEADER(GL/gl.h, have_gl_h=yes , have_gl_h=no , )
dnl LIBRARY TEST: Direct3D 9 header support
AC_CHECK_HEADER(d3d9.h, have_d3d9_h=yes , have_d3d9_h=no , )
AC_CHECK_HEADER(d3dx9math.h, have_d3dx9math_h=yes , have_d3dx9math_h=no , )
dnl Utility function ============================
# AC_CHECK_CXXFLAGS(ADDITIONAL-CXXFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
#
# checks whether the $(CXX) (c++) compiler accepts the ADDITIONAL-CXXFLAGS
# if so, they are added to the CXXFLAGS
AC_DEFUN([AC_CHECK_CXXFLAGS],
[
AC_MSG_CHECKING([whether $CXX accepts "$1"])
cat > conftest.c++ << EOF
int main(){
return 0;
}
EOF
if $CXX $CPPFLAGS $CXXFLAGS -Werror -c -o conftest.o conftest.c++ [$1] > /dev/null 2>&1
then
AC_MSG_RESULT([yes])
CXXFLAGS="${CXXFLAGS} [$1]"
AC_CHECK_CPPFLAGS([$1])
[$2]
else
AC_MSG_RESULT([no])
[$3]
fi
])# AC_CHECK_CXXFLAGS
dnl End Utility function ============================
dnl Detect the canonical host and target build environment
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
MACOSX_DEPLOYMENT_TARGET="10.15"
MACOSX_ARCH="ARM"
case "$host_os" in
darwin*)
HOST_VERSION=`sw_vers -productVersion | cut -d. -f1,2`
major=`echo $HOST_VERSION | cut -d. -f1`
minor=`echo $HOST_VERSION | cut -d. -f2`
version_num=`expr $major \* 100 + $minor`
if test "$version_num" -lt 1015; then
MACOSX_DEPLOYMENT_TARGET="$HOST_VERSION"
else
MACOSX_DEPLOYMENT_TARGET="10.15"
fi
case "$host_cpu" in
x86_64)
MACOSX_ARCH="Intel"
;;
arm64|aarch64)
MACOSX_ARCH="ARM"
;;
*)
MACOSX_ARCH="Unknown"
;;
esac
;;
*)
echo "Not macOS, skipping version check"
;;
esac
AC_SUBST([MACOSX_DEPLOYMENT_TARGET])
AC_SUBST([MACOSX_ARCH])
AC_MSG_CHECKING([for Git commit hash])
COMMIT_HASH=`git rev-parse --short=7 HEAD 2>/dev/null || echo "unknown"`
AC_SUBST([COMMIT_HASH])
AC_MSG_RESULT([$COMMIT_HASH])
dnl Setup for automake
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_HEADER(config.h)
AH_BOTTOM([/*
Define HAS_CDIRECTLPT as 1 if C_DIRECTLPT is defined (as 1) *and* parallel
pass-through is available on the current platform. It is only available on
x86{_64} with Windows or BSD, and on Linux.
We cannot override the value of C_DIRECTLPT, because configure will replace
"#undef C_DIRECTLPT" or "#define C_DIRECTLPT 0" with "#define C_DIRECTLPT 1".
*/
#ifdef C_DIRECTLPT
#if ((defined __i386__ || defined __x86_64__ || defined _M_IX86 || defined _M_X64) && \
(defined WIN32 || defined BSD || defined __CYGWIN__)) || \
/* WIN32 is not defined by default on Cygwin */ \
defined LINUX /* Linux, including non-x86 (e.g. Raspberry Pi) */
#define HAS_CDIRECTLPT 1
#endif
#endif // C_DIRECTLPT
#ifndef HAS_CDIRECTLPT
#define HAS_CDIRECTLPT 0
#endif])
dnl Checks for programs.
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_OBJCXX
AC_PROG_INSTALL
AC_CHECK_TOOL(AR, ar)
AC_PROG_RANLIB
AC_PREFIX_DEFAULT([/usr/local])
dnl this code needs large file support on 32-bit systems
AC_SYS_LARGEFILE
#Check for big endian machine, should #define WORDS_BIGENDIAN if so
AC_C_BIGENDIAN
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_TM
dnl some semi complex check for sys/socket so it works on darwin as well
AC_CHECK_HEADERS([stdlib.h sys/types.h])
AC_CHECK_HEADERS([sys/socket.h netinet/in.h pwd.h], [], [],
[#include <stdio.h>
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
])
dnl Allow the SDL drawn menu to be enabled on Windows or macOS instead of their native menu system.
AH_TEMPLATE(C_FORCE_MENU_SDLDRAW,[Define to 1 to force SDL-drawn menus])
AC_ARG_ENABLE(force-menu-sdldraw,AC_HELP_STRING([--enable-force-menu-sdldraw],[Force SDL drawn menus]),enable_force_menu_sdldraw=yes)
dnl This is how the build script can specify a HX DOS extender target
AH_TEMPLATE(C_HX_DOS,[Define to 1 to target HX DOS])
AC_ARG_ENABLE(hx-dos,AC_HELP_STRING([--enable-hx-dos],[Enable HX target]),enable_hx=yes)
dnl This is how the build script can use libopencow for win9x unicode
# AH_TEMPLATE(C_OPENCOW,[Define to 1 to enable opencow])
AC_ARG_ENABLE(opencow,AC_HELP_STRING([--enable-opencow],[Enable OpenCOW]),enable_opencow=yes)
dnl Disable SDLnet for win9x builds
AC_ARG_ENABLE(sdlnet,AC_HELP_STRING([--disable-sdlnet],[Disable SDLNet]),disable_sdl_net=yes)
dnl Let me know if you're targeting Emscripten
AH_TEMPLATE(C_EMSCRIPTEN,[Define to 1 to target Emscripten])
AC_ARG_ENABLE(emscripten,AC_HELP_STRING([--enable-emscripten],[Enable Emscripten target]),enable_emscripten=$enableval,enable_emscripten=no)
dnl Allow disabling X11 integration if your platform doesn't support it
AC_ARG_ENABLE(x11,AC_HELP_STRING([--disable-x11],[Don't enable X11 integration]))
dnl Optimize for speed by default
AC_ARG_ENABLE(optimize,AC_HELP_STRING([--disable-optimize],[Don't enable compiler optimizations]))
dnl FIXME: Remove default "-O2" set by some autotools versions. TODO: check availability of sed.
CFLAGS=["`echo $CFLAGS' ' | sed -e 's/-O[^ ]* //g'`"]
CXXFLAGS=["`echo $CXXFLAGS' ' | sed -e 's/-O[^ ]* //g'`"]
if test x$enable_optimize != xno; then
if test x$enable_emscripten = xyes; then
CFLAGS="$CFLAGS -Os"
CXXFLAGS="$CXXFLAGS -Os"
else
CFLAGS="$CFLAGS -O2"
CXXFLAGS="$CXXFLAGS -O2"
fi
fi
if test x$enable_emscripten = xyes; then
AC_DEFINE(C_EMSCRIPTEN,1,[Targeting Emscripten])
AC_DEFINE(C_DIRECTSERIAL, 0, [ Define to 1 if you want serial pass-through support (Win32, Posix and OS/2).])
fi
dnl Some stuff for the icon.
case "$host" in
*-*-cygwin* | *-*-mingw32*)
if test x$enable_hx = xyes; then
CXXFLAGS="$CXXFLAGS -DHX_DOS"
AC_DEFINE(C_HX_DOS,1,[Targeting HX DOS extender])
fi
;;
esac
if test x$enable_force_menu_sdldraw = xyes; then
CXXFLAGS="$CXXFLAGS -DFORCE_SDLDRAW"
AC_DEFINE(C_FORCE_MENU_SDLDRAW,1,[Force SDL drawn menus])
fi
dnl TEST: Environ can be included
AC_MSG_CHECKING(if environ can be included)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <unistd.h>
#include <stdlib.h>]],[[*environ;]])],
[AC_MSG_RESULT(yes);AC_DEFINE(ENVIRON_INCLUDED,1,[environ can be included])],AC_MSG_RESULT(no))
dnl TEST: Environ can be linked
AC_MSG_CHECKING(if environ can be linked)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char ** environ;]],[[*environ;]])],
[AC_MSG_RESULT(yes);AC_DEFINE(ENVIRON_LINKED,1,[environ can be linked])],AC_MSG_RESULT(no))
dnl TEST: dirent includes d_type
AC_MSG_CHECKING([if dirent includes d_type])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <sys/types.h>
#include <dirent.h>
void blah(){
struct dirent d_test;
d_test.d_type = 0;
}])],[AC_MSG_RESULT(yes);AC_DEFINE(DIRENT_HAS_D_TYPE,1,[struct dirent has d_type])],AC_MSG_RESULT(no))
dnl TEST: Check for powf
AC_MSG_CHECKING(for powf in libm);
LIBS_BACKUP=$LIBS;
LIBS="$LIBS -lm";
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],[[
powf(1.0f, 1.0f);
]])], [AC_MSG_RESULT(yes)], [AC_DEFINE([DB_HAVE_NO_POWF],[1],[libm does not include powf])])
LIBS=$LIBS_BACKUP
dnl Look for clock_gettime, a DB_HAVE_CLOCK_GETTIME is set when present
AH_TEMPLATE([DB_HAVE_CLOCK_GETTIME],[Determines if the function clock_gettime is available.])
AC_SEARCH_LIBS([clock_gettime], [rt] , [found_clock_gettime=yes], [found_clock_gettime=no])
if test x$found_clock_gettime = xyes; then
AC_DEFINE(DB_HAVE_CLOCK_GETTIME)
fi
dnl TEST: Check if the compiler support attributes
AH_TEMPLATE([C_HAS_ATTRIBUTE],[Determines if the compilers supports attributes for structures.])
AC_MSG_CHECKING(if compiler allows __attribute__)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
typedef struct { } __attribute__((packed)) junk;]],
[[ ]])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_ATTRIBUTE)],AC_MSG_RESULT(no))
dnl TEST: Check if the compiler supports certain attributes
OLDCFLAGS="$CFLAGS"
CFLAGS="-Werror"
AH_TEMPLATE([C_ATTRIBUTE_ALWAYS_INLINE],[Determines if the compilers supports always_inline attribute.])
AC_MSG_CHECKING(if compiler allows __attribute__((always_inline)) )
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ inline void __attribute__((always_inline)) test(){}
])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_ALWAYS_INLINE)],AC_MSG_RESULT(no))
AH_TEMPLATE([C_ATTRIBUTE_FASTCALL],[Determines if the compilers supports fastcall attribute.])
AC_MSG_CHECKING(if compiler allows __attribute__((fastcall)) )
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ void __attribute__((fastcall)) test(){}
])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_FASTCALL)],AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
dnl TEST: Check if the compiler supports __builtin_expect
#Switch language to c++
AC_LANG_PUSH(C++)
AH_TEMPLATE([C_HAS_BUILTIN_EXPECT],[Determines if the compilers supports __builtin_expect for branch prediction.])
AC_MSG_CHECKING(if compiler allows __builtin_expect)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[
int x=10;if( __builtin_expect ((x==1),0) ) ;
]])], [ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_BUILTIN_EXPECT)],AC_MSG_RESULT(no))
#switch language back
AC_LANG_POP(C++)
dnl Check for linux/kvm.h
AH_TEMPLATE(C_HAVE_LINUX_KVM,[Define to 1 if you have linux/kvm.h and KVM virtualization])
AC_CHECK_HEADER([linux/kvm.h], [AC_DEFINE(C_HAVE_LINUX_KVM,1)])
dnl Check for mach_vm_remap (Darwin)
AH_TEMPLATE(C_HAVE_MACH_VM_REMAP,[Define to 1 if you have the mach_vm_remap function])
AC_CHECK_HEADER([mach/mach.h], [
AC_CHECK_FUNC([mach_vm_remap],[AC_DEFINE(C_HAVE_MACH_VM_REMAP,1)])
])
dnl Check for mprotect. Needed for 64 bits linux
AH_TEMPLATE(C_HAVE_MPROTECT,[Define to 1 if you have the mprotect function])
AC_CHECK_HEADER([sys/mman.h], [
AC_CHECK_FUNC([mprotect],[AC_DEFINE(C_HAVE_MPROTECT,1)])
])
dnl Check for memfd_create, for dynamic core. You need the glibc version, not just the syscall.
AH_TEMPLATE(C_HAVE_MEMFD_CREATE,[Define to 1 if you have the memfd_create function])
AC_CHECK_HEADER([sys/mman.h], [
AC_CHECK_FUNC([memfd_create],[AC_DEFINE(C_HAVE_MEMFD_CREATE,1)])
])
dnl Check for posix_memalign
AH_TEMPLATE(C_HAVE_POSIX_MEMALIGN,[Define to 1 if you have the posix_memalign function])
AC_CHECK_HEADER([stdlib.h], [
AC_CHECK_FUNC([posix_memalign],[AC_DEFINE(C_HAVE_POSIX_MEMALIGN,1)])
])
dnl Check for mmap
AH_TEMPLATE(C_HAVE_MMAP,[Define to 1 if you have the mmap function])
AC_CHECK_HEADER([sys/mman.h], [
AC_CHECK_FUNC([mmap],[AC_DEFINE(C_HAVE_MMAP,1)])
])
dnl Check for realpath. Used on Linux
AC_CHECK_FUNCS([realpath])
dnl Setpriority
AH_TEMPLATE(C_SET_PRIORITY,[Define to 1 if you have setpriority support])
AC_MSG_CHECKING(for setpriority support)
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <sys/resource.h>
int main(int argc,char **argv) {
return setpriority (PRIO_PROCESS, 0,PRIO_MIN+PRIO_MAX);
};
])],AC_MSG_RESULT(yes);AC_DEFINE(C_SET_PRIORITY,1),AC_MSG_RESULT(no))
dnl Some target detection and actions for them
case "$host" in
*-*-darwin* | *-*-openbsd*)
dnl El Capitan's refusal to allow sudo make install to /usr/include, and the failure of most open source to
dnl include from /usr/local/include is irritating and tiresome...
CFLAGS="$CFLAGS -I/usr/local/include"
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
;;
esac
if test x$enable_emscripten = xyes; then
CXXFLAGS="$CXXFLAGS"
else
dnl Some default CPU flags
case "$host_cpu" in
x86_64 | amd64)
# SSE is part of the x86_64 ABI
CXXFLAGS="$CXXFLAGS -msse"
;;
esac
fi
dnl Some needed libraries for OS2
dnl perhaps join this with the other target depended checks. move them upwards
AM_CONDITIONAL(OS2, test x$host = xi386-pc-os2-emx)
if test x$host = xi386-pc-os2-emx ; then
CXXFLAGS="$CXXFLAGS -DOS2 -march=pentium4 -idirafter /@unixroot/usr/include/os2tk45"
CFLAGS="$CFLAGS -DOS2 -march=pentium4 -idirafter /@unixroot/usr/include/os2tk45"
LDFLAGS="$LDFLAGS -Zomf -Zhigh-mem -lcx"
fi
dnl I would like to know of any concerns given by the C++ compiler.
dnl Clang/LLVM already does this to some degree, let's get GCC to do it too.
AC_CHECK_CXXFLAGS([ -Wall ])
AC_CHECK_CXXFLAGS([ -Wextra ])
AC_CHECK_CXXFLAGS([ -Wunused ])
AC_CHECK_CXXFLAGS([ -pedantic ])
AC_CHECK_CXXFLAGS([ -Wno-error=format-security ]) # imfc.cpp and later versions of GCC, see https://github.com/joncampbell123/dosbox-x/issues/4436
AC_CHECK_CXXFLAGS([ -Wno-error=incompatible-pointer-types ]) # required to compile speexdsp/fftwrap.c with GCC 14
#AC_CHECK_CXXFLAGS([ -Wconversion ]) DO NOT ENABLE. THIS WARNING IS WAY TOO PEDANTIC TO BE USEFUL, EXCEPT FOR SPECIFIC CASES
#AC_CHECK_CXXFLAGS([ -Wsign-conversion ])
AC_CHECK_CXXFLAGS([ -Wlogical-op ])
AC_CHECK_CXXFLAGS([ -Wsign-promo ])
AC_CHECK_CXXFLAGS([ -Wconversion-null ])
#AC_CHECK_CXXFLAGS([ -Woverloaded-virtual ]) NOT TOO USEFUL
AC_CHECK_CXXFLAGS([ -Wsuggest-override ])
AC_CHECK_CXXFLAGS([ -Wnon-virtual-dtor ])
AC_CHECK_CXXFLAGS([ -Wno-deprecated-declarations ])
dnl Let GCC 7.3.x know that the "fall through" switch cases in this codebase
dnl are often intentional.
AC_CHECK_CXXFLAGS([ -Wno-implicit-fallthrough ])
dnl Stop reporting "type punning" warnings, I'm sick of hearing about it.
AC_CHECK_CXXFLAGS([ -Wno-strict-aliasing ])
dnl other
AC_CHECK_CXXFLAGS([ -Wno-missing-field-initializers ])
AC_CHECK_CXXFLAGS([ -Wno-format-zero-length ])
dnl Clang/LLVM warning: don't care the address of a member may be unaligned, unless targeting ARM!
AC_CHECK_CXXFLAGS([ -Wno-address-of-packed-member ])
dnl Clang/LLVM warning: don't care about int to void*, since void* is either same size or larger
AC_CHECK_CXXFLAGS([ -Wno-int-to-void-pointer-cast ])
dnl Some stuff for the icon and other makefile platform stuff.
dnl Slightly double with the above, but that deals more with compiled features.
case "$host" in
*-*-cygwin* | *-*-mingw32*)
dnl Some stuff for the ico
AC_CHECK_TOOL(WINDRES, windres, :)
LDFLAGS="-static -static-libgcc -static-libstdc++ $LDFLAGS"
DBPLATFORM="win"
;;
*-*-darwin*)
WINDRES=":"
DBPLATFORM="mac"
;;
*)
WINDRES=":"
DBPLATFORM="other"
;;
esac
AM_CONDITIONAL(HAVE_WINDRES, test "x$WINDRES" != "x:")
AM_CONDITIONAL(MACOSX, test "x$DBPLATFORM" = "xmac")
AC_SUBST(WINDRES)
dnl LIBRARY TEST: SDL 2.x
SDL2_VERSION=2.0.5
AM_PATH_SDL2($SDL2_VERSION)
dnl LIBRARY TEST: SDL 1.x
SDL_VERSION=1.2.0
AM_PATH_SDL($SDL_VERSION)
dnl LIBRARY USE: SDL selection
if test -n "$SDL2_LIBS"; then
LIBS="$LIBS $SDL2_LIBS"
CPPFLAGS="$CPPFLAGS $SDL2_CFLAGS"
SDL_STRING="SDL2"
else
if test -n "$SDL_LIBS"; then
LIBS="$LIBS $SDL_LIBS"
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
SDL_STRING="SDL1"
else
AC_MSG_ERROR([SDL 1.x or SDL 2.x is required to compile this program])
fi
fi
AC_SUBST([SDL_STRING])
AH_TEMPLATE(C_GAMELINK,[Define to 1 to enable game link headless mode])
AC_CHECK_LIB(rt, main, have_rt_lib=yes, have_rt_lib=no , )
AC_ARG_ENABLE(gamelink,AC_HELP_STRING([--disable-gamelink],[Disable headless game link output mode (only for SDL2)]),,enable_gamelink=yes)
AC_MSG_CHECKING(whether gamelink is enabled)
if test x$enable_gamelink = xyes; then
if test "x$SDL2_LIBS" = "x"; then
AC_MSG_RESULT(no (SDL2 missing))
else
AC_MSG_RESULT(yes)
C_GAMELINK=1
AC_DEFINE(C_GAMELINK,1)
fi
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL([C_GAMELINK], [test "x$C_GAMELINK" = x1])
dnl FEATURE: Whether to use OpenGL
AH_TEMPLATE(C_OPENGL,[Define to 1 to use opengl display output support])
AC_ARG_ENABLE(opengl,AC_HELP_STRING([--disable-opengl],[Disable opengl support]),enable_opengl=$enableval,enable_opengl=yes)
AC_MSG_CHECKING(whether opengl display output will be enabled)
# We need to do this before any other AC_CHECK_LIB runs just to make sure
# linking doesn't fail if SDL is using OpenGL
if test x$enable_opengl = xyes; then
case "$host" in
*-*-darwin*)
AC_MSG_RESULT(yes)
LIBS="$LIBS -framework OpenGL"
AC_DEFINE(C_OPENGL,1)
;;
*)
pkg-config --exists gl; RES=$?
if test x$RES = x0; then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS "`pkg-config gl --cflags`
CPPFLAGS="$CPPFLAGS "`pkg-config gl --cflags`
LIBS="$LIBS "`pkg-config gl --libs`
AC_DEFINE(C_OPENGL,1)
elif test x$have_gl_h = xyes -a x$have_gl_lib = xyes ; then
AC_MSG_RESULT(yes)
LIBS="$LIBS -lGL"
AC_DEFINE(C_OPENGL,1)
elif test x$have_gl_h = xyes -a x$have_opengl32_lib = xyes ; then
AC_MSG_RESULT(yes)
LIBS="$LIBS -lopengl32"
AC_DEFINE(C_OPENGL,1)
else
AC_MSG_RESULT(no)
fi
;;
esac
fi
# FIXME: Arrggh we need the WHOLE PATH
pwd=`realpath $srcdir`
if [[ -z "$pwd" ]]; then pwd=`pwd`; fi
CFLAGS="$CFLAGS -I$pwd -I$pwd/vs/sdlnet/linux-host/include -I$pwd/vs/sdlnet/linux-host/include/SDL"
LDFLAGS="$LDFLAGS -L$pwd/vs/sdlnet/linux-host/lib"
CPPFLAGS="$CPPFLAGS -I$pwd -I$pwd/vs/sdlnet/linux-host/include -I$pwd/vs/sdlnet/linux-host/include/SDL"
CXXFLAGS="$CXXFLAGS -I$pwd -I$pwd/vs/sdlnet/linux-host/include -I$pwd/vs/sdlnet/linux-host/include/SDL"
if test x$enable_emscripten != xyes; then
dnl Some target detection and actions for them
case "$host" in
*-*-cygwin* | *-*-mingw32*)
LIBS="$LIBS -lwinmm -ldsound -limm32 -lole32 -loleaut32 -lversion -lsetupapi"
CXXFLAGS="$CXXFLAGS -mno-ms-bitfields"
dnl FEATURE: Whether to support direct parallel port pass-through
AC_DEFINE(C_DIRECTLPT, 1, [ Define to 1 if you want parallel pass-through support (Win32, Linux and BSD).])
dnl FEATURE: Whether to support direct serial port pass-through
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial pass-through support (Win32, Posix and OS/2).])
;;
*-*-darwin*)
dnl We have a problem here: both Mac OS X and Darwin report
dnl the same signature "powerpc-apple-darwin*" - so we have
dnl to do more to distinguish them.
dnl For now I am lazy and do not add proper detection code.
macosx=1
if test x$warn_cpp11 = x1; then
OBJCXXFLAGS="$OBJCXXFLAGS -std=gnu++14";
else
OBJCXXFLAGS="$OBJCXXFLAGS -std=gnu++11";
fi
AC_DEFINE(MACOSX, 1, [Compiling on Mac OS X])
LIBS="$LIBS -framework Carbon -framework CoreFoundation -framework CoreMIDI -framework AudioUnit -framework AudioToolbox -framework ApplicationServices -framework AppKit -framework IOKit"
dnl FEATURE: Whether to support direct serial port pass-through
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial pass-through support (Win32, Posix and OS/2).])
;;
*-*-linux*)
AC_DEFINE(LINUX, 1, [Compiling on GNU/Linux])
CXXFLAGS="$CXXFLAGS -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L"
LIBS="$LIBS -lrt" # uses shm_* functions which requires librt on Linux
dnl FEATURE: Whether to support direct parallel port pass-through
AC_DEFINE(C_DIRECTLPT, 1, [ Define to 1 if you want parallel pass-through support (Win32, Linux and BSD).])
dnl FEATURE: Whether to support direct serial port pass-through
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial pass-through support (Win32, Posix and OS/2).])
;;
*-*-haiku*)
AC_DEFINE(HAIKU, 1, [Compiling on Haiku])
dnl FEATURE: Whether to support direct serial port pass-through
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial pass-through support (Win32, Posix and OS/2).])
LIBS="$LIBS -lnetwork -lbsd -lbe"
;;
*-*-freebsd* | *-*-dragonfly* | *-*-netbsd* | *-*-openbsd*)
dnl FEATURE: Whether to support direct parallel port pass-through
AC_DEFINE(C_DIRECTLPT, 1, [ Define to 1 if you want parallel pass-through support (Win32, Linux and BSD).])
dnl Disabled directserial for now. It doesn't do anything without
dnl specifying an extra ifdef in directserial_posix.*
dnl directserial detection should be rewritten to test for the needed
dnl functions and headers. I currently do not know
dnl which ones are needed for BSD
AC_DEFINE(BSD, 1, [Compiling on BSD])
dnl FEATURE: Whether to support direct serial port pass-through
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial pass-through support (Win32, Posix and OS/2).])
;;
*-*-os2-emx*)
AC_DEFINE(OS2, 1, [Compiling on OS/2 EMX])
dnl FEATURE: Whether to support direct serial port pass-through
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial pass-through support (Win32, Posix and OS/2).])
dnl If we have SDL2, we need to link the multimedia extensions.
if test "x$SDL2_LIBS" != "x"; then
LIBS="$LIBS -lmmpm2"
fi
;;
*-*-riscos*)
AC_DEFINE(RISCOS, 1, [Compiling on RISC OS])
dnl The following line is required in order to use std::to_string()
CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_C99=1"
;;
esac
dnl Fix for FreeBSD not automatically linking to pthread for std::thread
case "$host" in
*-*-freebsd*)
LIBS="$LIBS -lpthread"
;;
esac
dnl OpenBSD/i386 and NetBSD/i386 require linking to libi386.a for i386_iopl() (for initPassthroughIO()).
dnl OpenBSD/x86_64 requires linking to libamd64.a for amd64_iopl(). NetBSD/x86_64 requires linking to libx86_64.a for x86_64_iopl().
case "$host" in
i*86-*-openbsd* | i*86-*-netbsd*)
LIBS="$LIBS -li386"
;;
x86_64-*-openbsd*)
LIBS="$LIBS -lamd64"
;;
x86_64-*-netbsd*)
LIBS="$LIBS -lx86_64"
;;
esac
fi
AM_CONDITIONAL(MACOSX, test x"$macosx" = x"1")
AM_CONDITIONAL(EMSCRIPTEN, test x"$enable_emscripten" = x"yes")
dnl The target cpu checks for dynamic cores
AH_TEMPLATE(C_TARGETCPU,[The type of cpu this target has])
AC_MSG_CHECKING(for target cpu type)
case "$host_cpu" in
x86_64 | amd64)
AC_DEFINE(C_TARGETCPU,X86_64)
AC_MSG_RESULT(x86-64 bit compatible)
c_targetcpu="x86_64"
c_unalignedmemory=yes
;;
i?86)
AC_DEFINE(C_TARGETCPU,X86)
AC_MSG_RESULT(x86 compatible)
c_targetcpu="x86"
c_unalignedmemory=yes
;;
powerpc*)
AC_DEFINE(C_TARGETCPU,POWERPC)
AC_MSG_RESULT(Power PC)
c_targetcpu="powerpc"
c_unalignedmemory=yes
;;
m68k*)
AC_DEFINE(C_TARGETCPU,M68K)
AC_MSG_RESULT(Motorola 68000)
c_targetcpu="m68k"
c_unalignedmemory=yes
;;
loongarch64*)
AC_DEFINE(C_TARGETCPU,LOONGARCH64)
AC_MSG_RESULT(LoongArch)
c_targetcpu="loongarch64"
c_unalignedmemory=yes
;;
armv7*)
AC_DEFINE(C_TARGETCPU,ARMV7LE)
AC_MSG_RESULT(ARMv7 Little Endian)
c_targetcpu="arm"
c_unalignedmemory=yes
;;
armv6*)
AC_DEFINE(C_TARGETCPU,ARMV4LE)
AC_MSG_RESULT(ARMv6 Little Endian)
c_targetcpu="arm"
dnl c_unalignedmemory=yes
;;
aarch64)
AC_DEFINE(C_TARGETCPU,ARMV8LE)
AC_MSG_RESULT(ARMv8 Little Endian 64-bit)
c_targetcpu="arm"
c_unalignedmemory=yes
;;
arm) # Mac OS X uname -m says "arm64", for some reason it becomes "arm" ?
AC_DEFINE(C_TARGETCPU,ARMV8LE)
AC_MSG_RESULT(ARMv8 Little Endian 64-bit)
c_targetcpu="arm"
c_unalignedmemory=yes
;;
*)
AC_DEFINE(C_TARGETCPU,UNKNOWN)
AC_MSG_RESULT(unknown)
c_unalignedmemory=no
;;
esac
dnl TODO: Need GCC to know this code is using C++ lambda functions
dnl LIBRARY TEST: ALSA
AM_PATH_ALSA(0.9.0, AC_DEFINE(HAVE_ALSA,1,[Define to 1 to use ALSA for MIDI]) , : )
dnl Some stuff for the icon.
case "$host" in
*-*-cygwin* | *-*-mingw32*)
dnl MinGW puts ncurses headers in a subdir
ncursescfg=`ncursesw6-config --cflags`
CXXFLAGS="$CXXFLAGS $ncursescfg"
CPPFLAGS="$CPPFLAGS $ncursescfg"
CFLAGS="$CFLAGS $ncursescfg"
;;
*)
WINDRES=":"
;;
esac
dnl LIBRARY TEST: curses
AC_CHECK_HEADER(curses.h,have_curses_h=yes,)
AC_CHECK_LIB(curses, initscr, curses_lib=curses, , )
AC_CHECK_LIB(ncurses, initscr, curses_lib=ncurses, , )
AC_CHECK_LIB(pdcurses, initscr, curses_lib=pdcurses, , )
# Check if this system's ncurses uses a separate tinfo library
AC_CHECK_LIB(tinfo, nodelay,
if test x$curses_lib = xncurses ; then
LIBS="$LIBS -ltinfo";
fi)
dnl LIBRARY TEST: libzlib
AC_CHECK_HEADER(zlib.h,have_zlib_h=yes,)
AC_CHECK_LIB(z, inflateEnd, have_zlib_lib=yes, ,)
dnl LIBRARY TEST: libpng
AC_CHECK_HEADER(png.h,have_png_h=yes,)
AC_CHECK_LIB(png, png_get_io_ptr, have_png_lib=yes, ,-lz)
dnl LIBRARY TEST: libpcap
AC_CHECK_HEADER(pcap.h,have_pcap_h=yes,)
AC_CHECK_LIB(pcap, pcap_open_live, have_pcap_lib=yes, ,-lz)
dnl LIBRARY TEST: libslirp
AC_CHECK_HEADER(slirp/libslirp.h,have_slirp_h=yes,)
AC_CHECK_LIB(slirp, slirp_input, have_slirp_lib=yes, ,-lz)
dnl LIBRARY TEST: libiconv
AC_CHECK_HEADER(iconv.h,have_iconv_h=yes,)
dnl TEST: check if iconv uses const char
AC_MSG_CHECKING([whether iconv uses const char**])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <iconv.h>
size_t iconv(iconv_t, const char **restrict, size_t *restrict, char **restrict, size_t *restrict);
])], AC_DEFINE(ICONV_CONST_CHAR, 1) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AH_TEMPLATE(ICONV_CONST_CHAR,[Whether iconv uses const char**])
dnl LIBRARY TEST: SDLnet
AC_CHECK_HEADER(SDL_net.h,have_sdl_net_h=yes,)
AC_CHECK_LIB(SDL2_net, SDLNet_Init, have_sdl2_net_lib=yes, , )
AC_CHECK_LIB(SDL_net, SDLNet_Init, have_sdl_net_lib=yes, , )
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <SDL_config.h>
#ifndef SDL_VIDEO_DRIVER_X11
#error SDL_VIDEO_DRIVER_X11
#endif
void test(){}
])], , enable_x11=no)
if test x$enable_x11 != xno; then
dnl LIBRARY TEST: X11 Xlib support
AC_CHECK_LIB(X11, main, have_x11_lib=yes, have_x11_lib=no, )
AC_CHECK_LIB(Xrandr, XRRGetCrtcInfo, have_xrandr_lib=yes, have_xrandr_lib=no, )
AC_CHECK_HEADER(X11/XKBlib.h, have_x11_h=yes, have_x11_h=no, )
dnl Compile test will fail for XKBrules.h if we do not also include XKBlib.h
dnl Hope your compiler supports the GCC style -include option!
if test x$have_x11_h = xyes; then
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -include X11/XKBlib.h"
AC_CHECK_HEADER(X11/extensions/XKBrules.h, have_x11_ext_xkbrules_h=yes, have_x11_ext_xkbrules_h=no, )
AC_CHECK_HEADER(X11/extensions/XKBfile.h, have_xkbfile_h=yes, have_xkbfile_h=no, )
CPPFLAGS=$save_CPPFLAGS
fi
fi
dnl LIBRARY TEST: Fluidsynth support
AC_CHECK_HEADER(fluidsynth.h,have_fluidsynth_h=yes,)
AC_CHECK_LIB(fluidsynth, fluid_synth_sysex, have_fluidsynth_lib=yes,,)
dnl LIBRARY TEST: FreeType2
AH_TEMPLATE(C_FREETYPE,[Define to 1 to enable freetype support])
AC_ARG_ENABLE(freetype,AC_HELP_STRING([--disable-freetype],[Disable freetype support]),enable_freetype=$enableval,enable_freetype=yes)
AM_CONDITIONAL(C_FREETYPE, test "x$enable_freetype" = "xyes")
if test x$enable_freetype = xyes; then
AC_MSG_CHECKING(for freetype)
if test x$INTERNAL_FREETYPE = x1; then
# CFLAGS and LDFLAGS were already updated by build-macos
AC_DEFINE(C_FREETYPE,1)
AC_MSG_RESULT(yes)
else
pkg-config --exists freetype2; RES=$?
if test x$RES = x0; then
CFLAGS="$CFLAGS "`pkg-config freetype2 --cflags`
CPPFLAGS="$CPPFLAGS "`pkg-config freetype2 --cflags`
LIBS="$LIBS "`pkg-config freetype2 --libs`
AC_DEFINE(C_FREETYPE,1)
AC_MSG_RESULT(yes)
else
enable_freetype=no
AC_MSG_RESULT(no)
fi
fi
fi
dnl LIBRARY TEST: FFMPEG support
pkg-config --exists libavcodec; RES=$?
if test x$RES = x0; then
have_avcodec_h=yes
have_ffmpeg=yes
else
have_avcodec_h=no
have_ffmpeg=no
fi
dnl LIBRARY TEST: OpenGL support
AC_CHECK_LIB(GL, main, have_gl_lib=yes, have_gl_lib=no , )
AC_CHECK_LIB(opengl32, main, have_opengl32_lib=yes,have_opengl32_lib=no , )
AC_CHECK_HEADER(GL/gl.h, have_gl_h=yes , have_gl_h=no , )
dnl LIBRARY TEST: Direct3D 9 header support
AC_CHECK_HEADER(d3d9.h, have_d3d9_h=yes , have_d3d9_h=no , )
AC_CHECK_HEADER(d3dx9math.h, have_d3dx9math_h=yes , have_d3dx9math_h=no , )
dnl ================== SDL net special test for OS/2
if test x$host = xi386-pc-os2-emx ; then
LIBS_BACKUP=$LIBS;
LIBS="$LIBS -lSDL_Net";
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <SDL_Net.h>]],[[
SDLNet_Init ();
]])], [AC_MSG_RESULT(yes); have_sdl_net_lib=yes], AC_MSG_RESULT(no))
LIBS=$LIBS_BACKUP
fi
dnl FEATURE: PRINTER (requires FreeType2)
AH_TEMPLATE(C_PRINTER,[Define to 1 to enable printer emulation])
AC_ARG_ENABLE(printer,AC_HELP_STRING([--disable-printer],[disable printer emulation]),enable_printer=$enableval,enable_printer=yes)
AM_CONDITIONAL(C_PRINTER, test "x$enable_printer" = "xyes")
if test x$enable_freetype = xyes; then
if test x$enable_printer = xyes; then
AC_DEFINE(C_PRINTER,1)
fi
fi
dnl FEATURE: xBRZ
AH_TEMPLATE(C_XBRZ,[Define to 1 to enable XBRZ scaler])
AC_ARG_ENABLE(xbrz,AC_HELP_STRING([--enable-xbrz],[compile with xBRZ scaler (default yes)]),enable_xbrz=$enableval,enable_xbrz=yes)
AM_CONDITIONAL(C_XBRZ, test "x$enable_xbrz" = "xyes")
if test x$enable_emscripten != xyes; then
if test x$enable_xbrz = xyes; then
AC_DEFINE(C_XBRZ,1)
fi
fi
dnl FEATURE: xBRZ
AH_TEMPLATE(C_SCALER_FULL_LINE,[Define to 1 to alter the simpler render scalers to operate only on the full scanline instead of detecting differences. This is a performance adjustment for slow or embedded systems])
AC_ARG_ENABLE(scaler-full-line,AC_HELP_STRING([--enable-scaler-full-line],[scaler render full line instead of detecting changes, for slower systems]),enable_scaler_full_line=$enableval,enable_scaler_full_line=no)
AM_CONDITIONAL(C_SCALER_FULL_LINE, test "x$enable_scaler_full_line" = "xyes")
if test x$enable_scaler_full_line = xyes; then
AC_DEFINE(C_SCALER_FULL_LINE,1)
fi
dnl FEATURE: MIDI through ALSA
AC_ARG_ENABLE(alsa-midi,
AC_HELP_STRING([--enable-alsa-midi],[compile with alsa midi support (default yes)]),
[ case "${enableval}" in
yes) alsa_midi=true;;
no) alsa_midi=false;;
esac],
[alsa_midi=true])
if test x$alsa_midi = xtrue ; then
CXXFLAGS="$CXXFLAGS $ALSA_CFLAGS"
fi
dnl FEATURE: MT32 (MUNT) emulation
AH_TEMPLATE(C_MT32,[Define to 1 to enable MT32 emulation])
AC_ARG_ENABLE(mt32,AC_HELP_STRING([--disable-mt32],[Disable MT32 emulation]),,enable_mt32=yes)
AC_MSG_CHECKING(whether MT32 emulation will be enabled)
# test
if test x$enable_mt32 = xyes ; then
case "$host_cpu" in
x86_64 | amd64)
AC_MSG_RESULT(yes)
AC_DEFINE(C_MT32,1)
;;
i?86)
AC_MSG_RESULT(yes)
AC_DEFINE(C_MT32,1)
;;
arm)
AC_MSG_RESULT(yes)
AC_DEFINE(C_MT32,1)
;;
aarch64)
AC_MSG_RESULT(yes)
AC_DEFINE(C_MT32,1)
;;
loongarch64)
AC_MSG_RESULT(yes)
AC_DEFINE(C_MT32,1)
;;
*)
enable_mt32=no
AC_MSG_RESULT(no)
;;
esac
else
enable_mt32=no
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(C_MT32, test "x$enable_mt32" = "xyes")
dnl On some Linux platforms, std::atomic needs a helper library
case "$host" in
*-*-linux*)
case "$host_cpu" in
x86_64 | amd64)
;;
i?86)
;;
*)
AC_MSG_CHECKING(whether -latomic is needed)
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <atomic>
#include <cstdint>
std::atomic<std::int64_t> v;
int main() {
return v;
}
])],STD_ATOMIC_NEED_LIBATOMIC=no,STD_ATOMIC_NEED_LIBATOMIC=yes)
AC_MSG_RESULT($STD_ATOMIC_NEED_LIBATOMIC)
if test "x$STD_ATOMIC_NEED_LIBATOMIC" = xyes; then
LIBS="$LIBS -latomic"
fi
;;
esac
;;
esac
dnl NASM (Netwide Assembler)
AC_PATH_PROG([NASM], [nasm])
if test -z "$ac_cv_path_NASM"; then
AC_MSG_WARN([NASM (netwide assembler) not found, you will not be able to compile the external x86 .asm files if they are modified])
fi
dnl FEATURE: DEBUG and HEAVY DEBUG options (debugger)
AH_TEMPLATE(C_DEBUG,[Define to 1 to enable internal debugger, requires libcurses])
AH_TEMPLATE(C_HEAVY_DEBUG,[Define to 1 to enable heavy debugging, also have to enable C_DEBUG])
AC_ARG_ENABLE(debug,AC_HELP_STRING([--enable-debug],[Enable debug mode]),[
if test x$enable_debug = xno; then
AC_MSG_RESULT([Debugger not enabled])
elif test x$curses_lib != x -a x$have_curses_h = xyes; then
LIBS="$LIBS -l$curses_lib"
AC_DEFINE(C_DEBUG,1)
if test x$enable_debug = xheavy ; then
AC_DEFINE(C_HEAVY_DEBUG,1)
LIBS="$LIBS -lgmock -lgtest"
fi
else
AC_MSG_ERROR([Can't find curses, which is required for debug mode])
fi
],)
AM_CONDITIONAL(C_DEBUG, test "x$enable_debug" = "xyes" || test "x$enable_debug" = "xheavy")
dnl automake 1.14 and upwards rewrite the host to have always 64 bit unless i386 as host is passed
dnl this can make building a 32 bit executable a bit tricky, as dosbox relies on the host to select the
dnl dynamic/dynrec core
AC_MSG_CHECKING([whether Apple user wants to override the build process to produce a 32 bit binary])
case "$host" in
*-*-darwin*)
if test x$c_targetcpu = xx86_64 -a x$c_sizep = x4 ; then
AC_MSG_RESULT(yes)
AC_DEFINE(C_TARGETCPU,X86)
c_targetcpu="x86"
else
AC_MSG_RESULT(no)
fi
;;
*)
AC_MSG_RESULT([no, not on Apple])
;;
esac
dnl FEATURE: Whether to enable dynamic core
AC_ARG_ENABLE(dynamic-core,AC_HELP_STRING([--disable-dynamic-core],[Disable all dynamic cores]),,enable_dynamic_core=yes)
dnl FEATURE: Whether to enable x86 dynamic core
AH_TEMPLATE(C_DYNAMIC_X86,[Define to 1 to use x86/x64 dynamic cpu core])
AC_ARG_ENABLE(dynamic-x86,AC_HELP_STRING([--disable-dynamic-x86],[Disable x86/x64 dynamic cpu core]),,enable_dynamic_x86=yes)
AC_MSG_CHECKING(whether x86 dynamic cpu core will be enabled)
if test x$enable_dynamic_x86 = xno -o x$enable_dynamic_core = xno; then
AC_MSG_RESULT(no)
elif test x$c_targetcpu = xx86 -o x$c_targetcpu = xx86_64; then
AC_DEFINE(C_DYNAMIC_X86,1)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl FEATURE: Whether to enable recompiling dynamic core
AH_TEMPLATE(C_DYNREC,[Define to 1 to use recompiling cpu core])
AC_ARG_ENABLE(dynrec,AC_HELP_STRING([--disable-dynrec],[Disable recompiling cpu core]),,enable_dynrec=yes)
AC_MSG_CHECKING(whether recompiling cpu core will be enabled)
if test x$enable_dynrec = xno -o x$enable_dynamic_core = xno; then
AC_MSG_RESULT(no)
# test for MIPS32 is missing from this Dynamic Recompiler whitelist
elif test x$c_targetcpu = xx86 -o x$c_targetcpu = xx86_64 -o x$c_targetcpu = xarm; then
AC_DEFINE(C_DYNREC,1)
AC_MSG_RESULT(yes)
case "$host" in
*-*-openbsd*)
AC_MSG_WARN([DOSBox-X will be linked with "wxneeded" to support dynrec core on OpenBSD])
LDFLAGS="-Wl,-z,wxneeded $LDFLAGS"
;;
esac
else
AC_MSG_RESULT(no)
fi
dnl FEATURE: Whether to emulate the floating point unit
AH_TEMPLATE(C_FPU,[Define to 1 to enable floating point emulation])
AC_ARG_ENABLE(fpu,AC_HELP_STRING([--disable-fpu],[Disable fpu support]),,enable_fpu=yes)
AC_MSG_CHECKING(whether fpu emulation will be enabled)
if test x$enable_fpu = xyes ; then
AC_MSG_RESULT(yes)
AC_DEFINE(C_FPU,1)
else
AC_MSG_RESULT(no)
fi
AH_TEMPLATE(C_FPU_X86,[Define to 1 to use a x86/x64 assembly fpu core])
AC_ARG_ENABLE(fpu-x86,AC_HELP_STRING([--disable-fpu-x86],[Disable x86 assembly fpu core]),,enable_fpu_x86=yes)
AC_ARG_ENABLE(fpu-x64,AC_HELP_STRING([--disable-fpu-x64],[Disable x64 assembly fpu core]),,enable_fpu_x64=yes)
AC_MSG_CHECKING(whether the x86/x64 assembly fpu core will be enabled)
if test x$enable_fpu_x86 = xno -o x$enable_fpu_x64 = xno; then
AC_MSG_RESULT(no)
else
if test x$enable_fpu = xyes; then
if test x$c_targetcpu = xx86 -o x$c_targetcpu = xx86_64; then
AC_DEFINE(C_FPU_X86,1)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(no)
fi
fi
dnl FEATURE: Whether to enable unaligned memory access
AH_TEMPLATE(C_UNALIGNED_MEMORY,[Define to 1 to use a unaligned memory access])
AC_ARG_ENABLE(unaligned_memory,AC_HELP_STRING([--disable-unaligned-memory],[Disable unaligned memory access]),,enable_unaligned_memory=yes)
AC_MSG_CHECKING(whether to enable unaligned memory access)
if test x$enable_unaligned_memory = xyes -a x$c_unalignedmemory = xyes; then
AC_DEFINE(C_UNALIGNED_MEMORY,1)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl FEATURE: Whether to support SDL net, and emulate modem and IPX connections
AH_TEMPLATE(C_SDL_NET,[Indicate whether SDL_net is present])
AH_TEMPLATE(C_MODEM,[Define to 1 to enable internal modem support, requires SDL_net])
AH_TEMPLATE(C_IPX,[Define to 1 to enable IPX over Internet networking, requires SDL_net])
case "$host" in
*-*-cygwin* | *-*-mingw32*)
if test x$have_sdl_net_h = xyes; then
have_sdl_net_lib=yes
fi
;;
esac
dnl enable SDL2 net if SDL2
if test -n "$SDL2_LIBS"; then
if test x$disable_sdl_net = xyes ; then
AC_MSG_WARN([SDL_net is disabled in parameters])
elif test x$have_sdl2_net_lib = xyes -a x$have_sdl_net_h = xyes ; then
LIBS="$LIBS -lSDL2_net"
AC_DEFINE(C_SDL_NET,1)
AC_DEFINE(C_MODEM,1)
AC_DEFINE(C_IPX,1)
have_sdl_net=yes
elif test x$have_sdl_net_lib = xyes -a x$have_sdl_net_h = xyes ; then
LIBS="$LIBS -lSDL_net"
AC_DEFINE(C_SDL_NET,1)
AC_DEFINE(C_MODEM,1)
AC_DEFINE(C_IPX,1)
have_sdl_net=yes
else
AC_MSG_WARN([Can't find SDL_net, internal modem and ipx disabled])
fi
else
if test x$disable_sdl_net = xyes ; then
AC_MSG_WARN([SDL_net is disabled in parameters])
elif test x$have_sdl_net_lib = xyes -a x$have_sdl_net_h = xyes ; then
LIBS="$LIBS -lSDL_net"
AC_DEFINE(C_SDL_NET,1)
AC_DEFINE(C_MODEM,1)
AC_DEFINE(C_IPX,1)
have_sdl_net=yes
else
AC_MSG_WARN([Can't find SDL_net, internal modem and ipx disabled])
fi
fi
dnl FEATURE: Whether to support libz, and enable snapshots
AH_TEMPLATE(C_LIBZ,[Define to 1 if you have libz])
if test x$have_zlib_lib = xyes -a x$have_zlib_h = xyes ; then
LIBS="$LIBS -lz"
AC_DEFINE(C_LIBZ,1)
fi
dnl FEATURE: Whether to support libpng, and enable snapshots
AH_TEMPLATE(C_LIBPNG,[Define to 1 if you have libpng])
AH_TEMPLATE(C_SSHOT,[Define to 1 to enable screenshots, requires libpng])
AC_ARG_ENABLE(screenshots,AC_HELP_STRING([--disable-screenshots],[Disable screenshots and movie recording]),,enable_screenshots=yes)
AC_MSG_CHECKING([whether screenshots will be enabled])
if test x$have_png_lib = xyes -a x$have_png_h = xyes ; then
LIBS="$LIBS -lpng -lz"
AC_DEFINE(C_LIBPNG,1)
if test x$enable_screenshots = xyes; then
AC_DEFINE(C_SSHOT,1)
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
else
AC_MSG_ERROR([Can't find libpng, install or try building the in-tree code])
fi
dnl FEATURE: Whether to use libpcap, and enable ethernet pass-through
AH_TEMPLATE(C_PCAP,[Define to 1 to enable ethernet pass-through, requires libpcap])
case "$host" in
*-*-cygwin* | *-*-mingw32*)
CFLAGS="$CFLAGS -I$pwd/vs/pcap"
CXXFLAGS="$CXXFLAGS -I$pwd/vs/pcap"
AC_DEFINE(C_PCAP,1)
;;
*)
if test x$have_pcap_lib = xyes -a x$have_pcap_h = xyes ; then
LIBS="$LIBS -lpcap";
AC_DEFINE(C_PCAP,1)
else
AC_MSG_WARN([Can't find libpcap, ethernet pass-through disabled])
fi
;;
esac
dnl FEATURE: Whether to use libslirp, and enable userspace TCP/IP emulation
AH_TEMPLATE(C_SLIRP, [Define to 1 to enable userspace TCP/IP emulation, requires libslirp])
AC_ARG_ENABLE(libslirp,AC_HELP_STRING([--disable-libslirp],[Disable libslirp support]),enable_libslirp=$enableval,enable_libslirp=yes)
if test x$enable_libslirp = xyes ; then
case "$host" in
*-*-cygwin* | *-*-mingw32*)
if test x$have_slirp_h = xyes; then
have_slirp_lib=yes
fi
;;
esac
if test x$have_slirp_lib = xyes -a x$have_slirp_h = xyes ; then
have_slirp=yes
AC_DEFINE(C_SLIRP,1)
LIBS="$LIBS "`pkg-config slirp --libs`
CFLAGS="$CFLAGS -DLIBSLIRP_STATIC "`pkg-config slirp --cflags`
CPPFLAGS="$CPPFLAGS -DLIBSLIRP_STATIC "`pkg-config slirp --cflags`
case "$host" in
*-*-cygwin* | *-*-mingw32*)
LIBS="$LIBS -lintl"
;;
esac
else
have_slirp=no
AC_MSG_WARN([Can't find libslirp, userspace TCP/IP emulation disabled])
fi
fi
if test x$enable_x11 != xno; then
dnl FEATURE: Whether to use X11 XKBlib
AH_TEMPLATE(C_X11_XKB,[define to 1 if you have XKBlib.h and X11 lib])
AC_MSG_CHECKING(for XKBlib support)
if test x$have_x11_lib = xyes -a x$have_x11_h = xyes ; then
LIBS="$LIBS -lX11"
AC_DEFINE(C_X11_XKB,1)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl FEATURE: Whether to use X11 XRandR
AH_TEMPLATE(C_X11_XRANDR,[define to 1 if you have XRandr.h and X11 lib])
AC_MSG_CHECKING(for XRandR support)
if test x$have_xrandr_lib = xyes -a x$have_x11_h = xyes ; then
LIBS="$LIBS -lXrandr"
AC_DEFINE(C_X11_XRANDR,1)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl Having XKBlib doesn't mean XKBrules.h is around
if test x$have_x11_ext_xkbrules_h = xyes ; then
AH_TEMPLATE(C_X11_EXT_XKBRULES,[define to 1 if XKBrules.h is present])
AC_DEFINE(C_X11_EXT_XKBRULES,1)
fi
if test x$have_xkbfile_h = xyes ; then
AH_TEMPLATE(C_X11_XKBFILE,[define to 1 if XKBfile.h is present])
AC_DEFINE(C_X11_XKBFILE,1)
LIBS="$LIBS -lxkbfile"
fi
if test x$have_x11_h = xyes ; then
AH_TEMPLATE(C_X11,[define to 1 to enable X11 support])
AC_DEFINE(C_X11,1)
fi
fi
dnl FEATURE: Whether to use Fluidsynth
AH_TEMPLATE(C_FLUIDSYNTH,[Define to 1 to enable libfluidsynth MIDI synthesis])
AC_ARG_ENABLE(libfluidsynth,AC_HELP_STRING([--disable-libfluidsynth],[Disable libfluidsynth support]),enable_libfluidsynth=$enableval,enable_libfluidsynth=yes)
if test x$enable_libfluidsynth = xyes; then
case "$host" in
*-*-linux*)
if test x$have_fluidsynth_h = xyes; then
have_fluidsynth_lib=yes
fi
;;
esac
if test x$have_fluidsynth_lib = xyes -a x$have_fluidsynth_h = xyes ; then
LIBS="$LIBS -lfluidsynth"
AC_DEFINE(C_FLUIDSYNTH,1)
else
AC_MSG_WARN([libfluidsynth MIDI synthesis not available])
fi
fi
dnl FEATURE: FFMPEG output support
AH_TEMPLATE(C_AVCODEC,[Define to 1 to use FFMPEG libavcodec for video capture])
AC_ARG_ENABLE(avcodec,AC_HELP_STRING([--enable-avcodec],[Enable FFMPEG avcodec support]),enable_ffmpeg=$enableval,enable_ffmpeg=yes)
if test x$enable_ffmpeg = xyes; then
if test x$have_ffmpeg = xyes; then
if test x$have_avcodec_h = xyes; then
PKGS="libavcodec libavformat libavutil libswscale libswresample"
CFLAGS="$CFLAGS "`pkg-config $PKGS --cflags`
CPPFLAGS="$CPPFLAGS "`pkg-config $PKGS --cflags`
LIBS=`pkg-config $PKGS --libs`" $LIBS"
AC_MSG_RESULT(yes)
AC_DEFINE(C_AVCODEC,1)
fi
fi
fi
dnl FEATURE: Whether to use Direct3D 9 output
AH_TEMPLATE(HAVE_D3D9_H,[Define to 1 to use Direct3D 9 display output support])
AC_ARG_ENABLE(d3d9,AC_HELP_STRING([--enable-d3d9],[Enable Direct3D 9 support]),enable_d3d9=$enableval,enable_d3d9=no)
AC_MSG_CHECKING(whether Direct3D 9 display output will be enabled)
dnl FEATURE: Direct3D9 shaders
AH_TEMPLATE(C_D3DSHADERS,[Define to 1 to use Direct3D shaders])
AC_ARG_ENABLE(d3d-shaders,AC_HELP_STRING([--enable-d3d-shaders],[Enable Direct3D shaders]),enable_d3d_shaders=$enableval,enable_d3d_shaders=no)
if test x$enable_d3d9 = xyes; then
case "$host" in
*-*-cygwin* | *-*-mingw32*)
if test x$have_d3d9_h = xyes -a x$have_d3dx9math_h = xyes ; then
do_d3d=1
AC_MSG_RESULT(yes)
AH_TEMPLATE(C_DIRECT3D,[Define to 1 to enable Direct3D 9 display output support])
AC_DEFINE(HAVE_D3D9_H,1)
AC_DEFINE(C_DIRECT3D,1)
if test x$enable_d3d_shaders = xyes; then
AC_DEFINE(C_D3DSHADERS,1)
fi
else
AC_MSG_RESULT(no)
fi
;;
*)
AC_MSG_RESULT(no)
;;
esac
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(C_DIRECT3D, test x"$do_d3d" = x"1")
AH_TEMPLATE(C_ICONV,[Define to 1 to use iconv])
if test x$have_iconv_h = xyes; then
AC_DEFINE(C_ICONV,1)
AC_MSG_CHECKING([whether we must link against -liconv])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <iconv.h>
iconv_t wrap_open(const char *tocode, const char *fromcode) {
return iconv_open(tocode, fromcode);
}]])],
AC_MSG_RESULT(no), [AC_MSG_RESULT(yes);LIBS="$LIBS -liconv"])
fi
dnl placeholder
AH_TEMPLATE(C_ICONV_WIN32,[Define to 1 to use Win32 functions in iconv backend])
dnl If networking is used, add networking libraries last on Windows
dnl so SDL_net, fluidsynth and libslirp successfully link to them
if test x$enable_emscripten != xyes; then
case "$host" in
*-*-cygwin* | *-*-mingw32*)
if test x$have_slirp = xyes; then
LIBS="$LIBS -luuid -lole32"
fi
LIBS="$LIBS -lwsock32 -lws2_32 -liphlpapi -lshlwapi"
if test x$enable_freetype = xyes; then
LIBS="$LIBS -lfreetype -lwinspool"
fi
;;
esac
fi
dnl LIBRARY USE: opencow
case "$host" in
*-*-cygwin* | *-*-mingw32*)
if test x$enable_opencow = xyes; then
LIBS="-lopencow $LIBS -lstdc++ -lopencow" #need to put at the first, also better at the last too.
LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition "
if test -n "$SDL_LIBS"; then
LIBS="${LIBS//-luser32/-lopencow -luser32}"
#SDL_LIBS="${SDL_LIBS//-luser32/\-lopencow -luser32}"
fi
fi
;;
esac
dnl BUILD: whether to enable universal binary support
if test x"$macosx" = x"1" && test x"$host_cpu" = x"arm"; then
AC_ARG_ENABLE(universal,AC_HELP_STRING([--enable-universal],[Enable macOS universal binary support]),
[enable_universal=$enableval],
[enable_universal=no])
else
enable_universal=no
fi
AM_CONDITIONAL(MACOS_UNIVERSAL, [ test x$enable_universal = xyes ])
LIBS="$LIBS -lopusfile -lspeexdsp"
LIBS="$LIBS -lminizip"
LIBS="$LIBS -lphysfs"
LIBS="$LIBS -lzstd"
AC_CONFIG_FILES([
Makefile
src/Makefile
src/cpu/Makefile
src/cpu/core_full/Makefile
src/cpu/core_normal/Makefile
src/debug/Makefile
src/dos/Makefile
src/fpu/Makefile
src/gamelink/Makefile
src/gui/Makefile
src/hardware/Makefile
src/hardware/mame/Makefile
src/hardware/serialport/Makefile
src/hardware/reSID/Makefile
src/hardware/parport/Makefile
src/aviwriter/Makefile
src/ints/Makefile
src/libs/Makefile
src/libs/zmbv/Makefile
src/libs/gui_tk/Makefile
src/libs/passthroughio/Makefile
src/libs/mt32/Makefile
src/libs/xBRZ/Makefile
src/output/Makefile
src/output/direct3d/Makefile
src/builtin/Makefile
src/misc/Makefile
src/shell/Makefile
src/platform/Makefile
include/Makefile
contrib/macos/dosbox-x.plist
contrib/linux/dosbox-x.spec
contrib/linux/com.dosbox_x.DOSBox-X.metainfo.xml
make-rpm.sh
])
AC_OUTPUT
# HACK: it's a script...
chmod +x make-rpm.sh
|