-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
899 lines (760 loc) · 30.2 KB
/
configure.ac
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
AC_INIT([src/mednafen.cpp])
AC_GNU_SOURCE
AC_USE_SYSTEM_EXTENSIONS
AC_CONFIG_MACRO_DIR([m4])
#
# Avoid trailing and leading zeroes in the decimal version components to avoid confusing not-so-learned people.
#
MEDNAFEN_VERSION='1.24.3'
MEDNAFEN_VERSION_NUMERIC=0x00102403
# 0xJJJnnnRR
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([mednafen], $MEDNAFEN_VERSION)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_HEADERS([include/config.h:include/config.h.in])
AC_PROG_CC
AC_PROG_CPP
AM_PROG_AS
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CXXCPP
AC_LANG_CPLUSPLUS
CXX="$CXX -std=gnu++11"
CXXCPP="$CXXCPP -std=gnu++11"
CC="$CC -std=gnu99"
CPP="$CPP -std=gnu99"
AX_CFLAGS_GCC_OPTION([-fsigned-char], CC)
AX_CXXFLAGS_GCC_OPTION([-fsigned-char], CXX)
AC_PROG_INSTALL
gl_VISIBILITY
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
AC_DEFINE(_LARGEFILE64_SOURCE, [1], [Define for largefile support through extra functions.])
AC_DEFINE(_LARGEFILE_SOURCE, [1], [Define for fseeko and ftello on some hosts.])
# sizeof tests need to come after largefile support macros
AC_CHECK_TYPE(ptrdiff_t,long)
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(__int64)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(ptrdiff_t)
AC_CHECK_SIZEOF(off_t)
AC_C_CONST
AC_CHECK_FUNCS(memcmp memcpy memmove memset mmap munmap madvise signal sigaction fork pipe dup2 fcntl getenv putenv setenv gettimeofday getpwuid getuid strerror strerror_r ftello fopen64 fseeko64 ftello64 fstat64 ftruncate64 __mingw_get_crt_info)
AC_SEARCH_LIBS(fmodl, [m])
#
# Check for any libraries that need to be linked against for clock_gettime().
#
# (posix4 is apparently used by much older versions of Solaris according to tar, pre-7, so maybe it's not necessary
# for Mednafen?)
AC_SEARCH_LIBS(clock_gettime, [rt posix4])
AC_CHECK_FUNCS(clock_gettime nanosleep usleep localtime_r gmtime_r)
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(stdint.h inttypes.h)
AC_FUNC_MKDIR
PKG_PROG_PKG_CONFIG
AC_CHECK_FUNCS(round nearbyint nearbyintf rint rintf)
AC_CHECK_HEADERS(fenv.h)
AC_DEFINE(MINILZO_HAVE_CONFIG_H, [1], [Define if config.h is present])
AM_ICONV
AM_GNU_GETTEXT
AC_SUBST(LIBICONV)
AC_SUBST(LIBINTL)
dnl Check for zlib
AC_CHECK_LIB([z], [zlibVersion], ZLIB_LIBS="-lz", AC_MSG_ERROR([*** zlib not found!]))
AC_SUBST([ZLIB_LIBS])
ENABLE_LIBXXX_MODE=false
AC_ARG_ENABLE(libxxx-mode, AC_HELP_STRING([--enable-libxxx-mode], [dev use only]))
if test x$enable_libxxx_mode = xyes; then
ENABLE_LIBXXX_MODE=true
fi
AC_ARG_ENABLE(dev-build,
AC_HELP_STRING([--enable-dev-build], [enable expensive Mednafen developer features [[default=no]]]),
, enable_dev_build=no)
if test x$enable_dev_build = xyes; then
AC_DEFINE([MDFN_ENABLE_DEV_BUILD], [1], [Define if we are compiling with expensive Mednafen developer features enabled.])
fi
dnl -fno-fast-math and -fno-unsafe-math-optimizations to make sure it's disabled, as the fast-math feature on certain older
dnl versions of gcc produces horribly broken code(and even when it's working correctly, it can have somewhat unpredictable effects).
dnl
dnl -fno-aggressive-loop-optimizations because I don't trust gcc's aggressive loop optimizations, and there miiight be old code
dnl in Mednafen that would cause problems.
dnl
dnl -fomit-frame-pointer is required for some x86 inline assembly to compile.
dnl
dnl -fstrict-aliasing for OpenBSD
dnl
OPTIMIZER_FLAGS=""
AX_CFLAGS_GCC_OPTION([-fno-fast-math], OPTIMIZER_FLAGS)
AX_CFLAGS_GCC_OPTION([-fno-unsafe-math-optimizations], OPTIMIZER_FLAGS)
AX_CFLAGS_GCC_OPTION([-fno-aggressive-loop-optimizations], OPTIMIZER_FLAGS)
AX_CFLAGS_GCC_OPTION([-fno-ipa-icf], OPTIMIZER_FLAGS)
AX_CFLAGS_GCC_OPTION([-fno-printf-return-value], OPTIMIZER_FLAGS)
AX_CFLAGS_GCC_OPTION([-fomit-frame-pointer], OPTIMIZER_FLAGS)
AX_CFLAGS_GCC_OPTION([-fstrict-aliasing], OPTIMIZER_FLAGS)
dnl
dnl Aggressively try to disable PIC and PIE, as it has a significant performance overhead and will
dnl break some code(with compile-time failures or run-time assert()s triggering).
dnl
dnl Use -fwrapv instead of -fno-strict-overflow; -fno-strict-overflow is buggy on gcc and does not work as documented/implied.
dnl
dnl -mfunction-return=keep, -mindirect-branch=keep, -mno-indirect-branch-register to disable performance-murdering Spectre mitigations.
dnl
CODEGEN_FLAGS=""
AX_CFLAGS_GCC_OPTION([-fno-pic], CODEGEN_FLAGS)
AX_CFLAGS_GCC_OPTION([-fno-pie], CODEGEN_FLAGS)
AX_CFLAGS_GCC_OPTION([-fno-PIC], CODEGEN_FLAGS)
AX_CFLAGS_GCC_OPTION([-fno-PIE], CODEGEN_FLAGS)
AX_CFLAGS_GCC_OPTION([-nopie], CODEGEN_FLAGS)
AX_CFLAGS_GCC_OPTION([-no-pie], CODEGEN_FLAGS)
AX_CFLAGS_GCC_OPTION([-fwrapv], CODEGEN_FLAGS)
AX_CFLAGS_GCC_OPTION([-fjump-tables], CODEGEN_FLAGS)
AX_CFLAGS_GCC_OPTION([-mfunction-return=keep], CODEGEN_FLAGS)
AX_CFLAGS_GCC_OPTION([-mindirect-branch=keep], CODEGEN_FLAGS)
AX_CFLAGS_GCC_OPTION([-mno-indirect-branch-register], CODEGEN_FLAGS)
AX_CFLAGS_GCC_OPTION([-mno-retpoline], CODEGEN_FLAGS)
CODEGEN_CFLAGS=""
CODEGEN_CXXFLAGS=""
AX_CXXFLAGS_GCC_OPTION([-fexceptions], CODEGEN_CXXFLAGS)
WARNING_FLAGS=""
AX_CFLAGS_GCC_OPTION([-Wall], WARNING_FLAGS)
AX_CFLAGS_GCC_OPTION([-Wshadow], WARNING_FLAGS)
AX_CFLAGS_GCC_OPTION([-Wempty-body], WARNING_FLAGS)
AX_CFLAGS_GCC_OPTION([-Wignored-qualifiers], WARNING_FLAGS)
AX_CFLAGS_GCC_OPTION([-Wvla], WARNING_FLAGS)
AX_CFLAGS_GCC_OPTION([-Wvariadic-macros], WARNING_FLAGS)
AX_CFLAGS_GCC_OPTION([-Wdisabled-optimization], WARNING_FLAGS)
AX_CFLAGS_GCC_OPTION([-Werror=write-strings], WARNING_FLAGS)
AC_SUBST(WARNING_FLAGS)
#################################
#
# Used as needed in Makefile.am:
#
NO_STACK_PROTECTOR_FLAGS=""
AX_CFLAGS_GCC_OPTION([-fno-stack-protector], NO_STACK_PROTECTOR_FLAGS)
AX_CFLAGS_GCC_OPTION([-fno-stack-protector-all], NO_STACK_PROTECTOR_FLAGS)
AX_CFLAGS_GCC_OPTION([-fno-stack-protector-strong], NO_STACK_PROTECTOR_FLAGS)
AC_SUBST(NO_STACK_PROTECTOR_FLAGS)
# Used for ngp and quicklz
NO_STRICT_ALIASING_FLAGS=""
AX_CFLAGS_GCC_OPTION([-fno-strict-aliasing], NO_STRICT_ALIASING_FLAGS)
AC_SUBST(NO_STRICT_ALIASING_FLAGS)
# -----------------------------------
# Begin snes flags
#
SNES_EXTRA_FLAGS=""
SNES_EXTRA_CXXFLAGS=""
AX_CFLAGS_GCC_OPTION([-Wno-unused], SNES_EXTRA_FLAGS)
AX_CFLAGS_GCC_OPTION([-Wno-shadow], SNES_EXTRA_FLAGS)
AX_CFLAGS_GCC_OPTION([-Wno-sign-compare], SNES_EXTRA_FLAGS)
AX_CFLAGS_GCC_OPTION([-Wno-uninitialized], SNES_EXTRA_FLAGS)
AX_CFLAGS_GCC_OPTION([-Wno-parentheses], SNES_EXTRA_FLAGS)
AX_CFLAGS_GCC_OPTION([-Wno-switch], SNES_EXTRA_FLAGS)
AC_SUBST(SNES_EXTRA_FLAGS)
AC_SUBST(SNES_EXTRA_CXXFLAGS)
#
# End snes flags
# -----------------------------------
# -----------------------------------
# Begin ss flags
#
SS_EXTRA_FLAGS=""
AX_CFLAGS_GCC_OPTION([-mtune=haswell], SS_EXTRA_FLAGS)
AC_SUBST(SS_EXTRA_FLAGS)
#
# End ss flags
# -----------------------------------
#
# End used-as-needed flags
########################################
AM_CONDITIONAL(WANT_DEBUGGER, false)
AM_CONDITIONAL(WANT_FANCY_SCALERS, false)
AC_ARG_ENABLE(debugger,
AC_HELP_STRING([--enable-debugger], [build with internal debugger [[default=yes]]]),
, enable_debugger=yes)
if test x$enable_debugger = xyes; then
AC_DEFINE([WANT_DEBUGGER], [1], [Define if we are compiling with debugger.])
AM_CONDITIONAL(WANT_DEBUGGER, true)
fi
AC_ARG_ENABLE(cjk-fonts,
AC_HELP_STRING([--enable-cjk-fonts], [build with internal CJK(Chinese, Japanese, Korean) fonts [[default=yes]]]),
, enable_cjk_fonts=yes)
if test x$enable_cjk_fonts = xyes; then
AC_DEFINE([WANT_INTERNAL_CJK], [1], [Define if we are compiling with internal CJK fonts.])
fi
AC_ARG_ENABLE(fancy-scalers,
AC_HELP_STRING([--enable-fancy-scalers], [build with fancy(2xsai, hq2x, etc.) CPU-intensive software video scalers [[default=yes]]]),
, enable_fancy_scalers=yes)
if test x$enable_fancy_scalers = xyes; then
AC_DEFINE([WANT_FANCY_SCALERS], [1], [Define if we are compiling with with fancy CPU-intensive software video scalers.])
AM_CONDITIONAL(WANT_FANCY_SCALERS, true)
fi
dnl
dnl The code that uses $enable_altivec is lower, in the CPU architecture section.
dnl
AC_ARG_ENABLE(altivec,
AC_HELP_STRING([--enable-altivec], [use AltiVec extensions on PowerPC/POWER ISA processors [[default=yes]]]),
, enable_altivec=yes)
AM_CONDITIONAL(WANT_APPLE2_EMU, false)
AM_CONDITIONAL(WANT_GB_EMU, false)
AM_CONDITIONAL(WANT_GBA_EMU, false)
AM_CONDITIONAL(WANT_LYNX_EMU, false)
AM_CONDITIONAL(WANT_MD_EMU, false)
AM_CONDITIONAL(WANT_SMS_EMU, false)
AM_CONDITIONAL(WANT_NES_EMU, false)
AM_CONDITIONAL(WANT_NES_NEW_EMU, false)
AM_CONDITIONAL(WANT_NGP_EMU, false)
AM_CONDITIONAL(WANT_PCE_EMU, false)
AM_CONDITIONAL(WANT_PCE_FAST_EMU, false)
AM_CONDITIONAL(WANT_PCFX_EMU, false)
AM_CONDITIONAL(WANT_PSX_EMU, false)
AM_CONDITIONAL(WANT_SMS_EMU, false)
AM_CONDITIONAL(WANT_SNES_EMU, false)
AM_CONDITIONAL(WANT_SNES_FAUST_EMU, false)
AM_CONDITIONAL(WANT_SS_EMU, false)
AM_CONDITIONAL(WANT_SSFPLAY_EMU, false)
AM_CONDITIONAL(WANT_VB_EMU, false)
AM_CONDITIONAL(WANT_WSWAN_EMU, false)
AM_CONDITIONAL(NEED_BLIP_BUFFER, false)
AM_CONDITIONAL(NEED_GB_APU_EMU, false)
AM_CONDITIONAL(NEED_YM2413_EMU, false)
AM_CONDITIONAL(NEED_YM2612_EMU, false)
AM_CONDITIONAL(NEED_PCE_PSG_EMU, false)
AM_CONDITIONAL(NEED_SMS_APU_EMU, false)
AM_CONDITIONAL(NEED_68K_EMU, false)
AM_CONDITIONAL(NEED_Z80_EMU, false)
AM_CONDITIONAL(NEED_V810_EMU, false)
AM_CONDITIONAL(NEED_HUC6270_EMU, false)
AM_CONDITIONAL(NEED_ARCADE_CARD_EMU, false)
AC_ARG_ENABLE(apple2,
AC_HELP_STRING([--enable-apple2], [build with Apple II+ emulation [[default=yes]]]),
, enable_apple2=yes)
if test x$enable_apple2 = xyes; then
AC_DEFINE([WANT_APPLE2_EMU], [1], [Define if we are compiling with Apple II+ emulation.])
AM_CONDITIONAL(WANT_APPLE2_EMU, true)
fi
AC_ARG_ENABLE(gb,
AC_HELP_STRING([--enable-gb], [build with GameBoy emulation [[default=yes]]]),
, enable_gb=yes)
if test x$enable_gb = xyes; then
AC_DEFINE([WANT_GB_EMU], [1], [Define if we are compiling with GB emulation.])
AM_CONDITIONAL(WANT_GB_EMU, true)
AM_CONDITIONAL(NEED_GB_APU_EMU, true)
AM_CONDITIONAL(NEED_BLIP_BUFFER, true)
fi
AC_ARG_ENABLE(gba,
AC_HELP_STRING([--enable-gba], [build with GameBoy Advance emulation [[default=yes]]]),
, enable_gba=yes)
if test x$enable_gba = xyes; then
AC_DEFINE([WANT_GBA_EMU], [1], [Define if we are compiling with GBA emulation.])
AM_CONDITIONAL(WANT_GBA_EMU, true)
AM_CONDITIONAL(NEED_GB_APU_EMU, true)
AM_CONDITIONAL(NEED_BLIP_BUFFER, true)
fi
AC_ARG_ENABLE(lynx,
AC_HELP_STRING([--enable-lynx], [build with Atari Lynx emulation [[default=yes]]]),
, enable_lynx=yes)
if test x$enable_lynx = xyes; then
AC_DEFINE([WANT_LYNX_EMU], [1], [Define if we are compiling with Lynx emulation.])
AM_CONDITIONAL(WANT_LYNX_EMU, true)
AM_CONDITIONAL(NEED_BLIP_BUFFER, true)
fi
AC_ARG_ENABLE(md,
AC_HELP_STRING([--enable-md], [build with Sega Genesis/MegaDrive emulation [[default=yes]]]),
, enable_md=yes)
if test x$enable_md = xyes; then
AC_DEFINE([WANT_MD_EMU], [1], [Define if we are compiling with Sega Genesis/MegaDrive emulation.])
AM_CONDITIONAL(WANT_MD_EMU, true)
AM_CONDITIONAL(NEED_68K_EMU, true)
AM_CONDITIONAL(NEED_Z80_EMU, true)
AM_CONDITIONAL(NEED_YM2612_EMU, true)
AM_CONDITIONAL(NEED_SMS_APU_EMU, true)
AM_CONDITIONAL(NEED_BLIP_BUFFER, true)
fi
AC_ARG_ENABLE(nes,
AC_HELP_STRING([--enable-nes], [build with Nintendo Entertainment System emulation [[default=yes]]]),
, enable_nes=yes)
if test x$enable_nes = xyes; then
AC_DEFINE([WANT_NES_EMU], [1], [Define if we are compiling with NES emulation.])
AM_CONDITIONAL(WANT_NES_EMU, true)
fi
#AC_ARG_ENABLE(nes_new,
# AC_HELP_STRING([--enable-nes-new], [build with experimental, alternate new(ish) NES emulation [[default=yes]]]),
# , enable_nes_new=yes)
#
#if test x$enable_nes_new = xyes; then
# AC_DEFINE([WANT_NES_NEW_EMU], [1], [Define if we are compiling with experimental, alternate new(ish) NES emulation.])
# AM_CONDITIONAL(WANT_NES_NEW_EMU, true)
#fi
AC_ARG_ENABLE(ngp,
AC_HELP_STRING([--enable-ngp], [build with Neo Geo Pocket emulation [[default=yes]]]),
, enable_ngp=yes)
if test x$enable_ngp = xyes; then
AC_DEFINE([WANT_NGP_EMU], [1], [Define if we are compiling with NGP emulation.])
AM_CONDITIONAL(WANT_NGP_EMU, true)
AM_CONDITIONAL(NEED_Z80_EMU, true)
AM_CONDITIONAL(NEED_BLIP_BUFFER, true)
fi
AC_ARG_ENABLE(pce,
AC_HELP_STRING([--enable-pce], [build with PC Engine(TurboGrafx 16) emulation [[default=yes]]]),
, enable_pce=yes)
if test x$enable_pce = xyes; then
AC_DEFINE([WANT_PCE_EMU], [1], [Define if we are compiling with PCE emulation.])
AM_CONDITIONAL(WANT_PCE_EMU, true)
AM_CONDITIONAL(NEED_PCE_PSG_EMU, true)
AM_CONDITIONAL(NEED_HUC6270_EMU, true)
AM_CONDITIONAL(NEED_ARCADE_CARD_EMU, true)
fi
AC_ARG_ENABLE(pce-fast,
AC_HELP_STRING([--enable-pce-fast], [build the separate, fast PC Engine(TurboGrafx 16) emulation [[default=yes]]]),
, enable_pce_fast=yes)
if test x$enable_pce_fast = xyes; then
AC_DEFINE([WANT_PCE_FAST_EMU], [1], [Define if we are compiling with separate fast PCE emulation.])
AM_CONDITIONAL(WANT_PCE_FAST_EMU, true)
AM_CONDITIONAL(NEED_ARCADE_CARD_EMU, true)
AM_CONDITIONAL(NEED_BLIP_BUFFER, true)
fi
AC_ARG_ENABLE(pcfx,
AC_HELP_STRING([--enable-pcfx], [build with PC-FX emulation [[default=yes]]]),
, enable_pcfx=yes)
if test x$enable_pcfx = xyes; then
AC_DEFINE([WANT_PCFX_EMU], [1], [Define if we are compiling with PC-FX emulation.])
AM_CONDITIONAL(WANT_PCFX_EMU, true)
AM_CONDITIONAL(NEED_V810_EMU, true)
AM_CONDITIONAL(NEED_PCE_PSG_EMU, true)
AM_CONDITIONAL(NEED_HUC6270_EMU, true)
fi
AC_ARG_ENABLE(psx,
AC_HELP_STRING([--enable-psx], [build with PlayStation emulation [[default=yes]]]),
, enable_psx=yes)
if test x$enable_psx = xyes; then
AC_DEFINE([WANT_PSX_EMU], [1], [Define if we are compiling with PlayStation emulation.])
AM_CONDITIONAL(WANT_PSX_EMU, true)
fi
AC_ARG_ENABLE(sms,
AC_HELP_STRING([--enable-sms], [build with SMS+GG emulation [[default=yes]]]),
, enable_sms=yes)
if test x$enable_sms = xyes; then
AC_DEFINE([WANT_SMS_EMU], [1], [Define if we are compiling with SMS+GG emulation.])
AM_CONDITIONAL(WANT_SMS_EMU, true)
AM_CONDITIONAL(NEED_Z80_EMU, true)
AM_CONDITIONAL(NEED_SMS_APU_EMU, true)
AM_CONDITIONAL(NEED_YM2413_EMU, true)
AM_CONDITIONAL(NEED_BLIP_BUFFER, true)
fi
AC_ARG_ENABLE(snes,
AC_HELP_STRING([--enable-snes], [build with SNES emulation [[default=yes]]]),
, enable_snes=yes)
if test x$enable_snes = xyes; then
AC_DEFINE([WANT_SNES_EMU], [1], [Define if we are compiling with SNES emulation.])
AM_CONDITIONAL(WANT_SNES_EMU, true)
fi
AC_ARG_ENABLE(snes-faust,
AC_HELP_STRING([--enable-snes-faust], [build with experimental fast SNES emulation [[default=yes]]]),
, enable_snes_faust=yes)
if test x$enable_snes_faust = xyes; then
AC_DEFINE([WANT_SNES_FAUST_EMU], [1], [Define if we are compiling with experimental fast SNES emulation.])
AM_CONDITIONAL(WANT_SNES_FAUST_EMU, true)
fi
AC_ARG_ENABLE(ss,
AC_HELP_STRING([--enable-ss], [build with Sega Saturn emulation [[default=x86_64 amd64 aarch64* arm64* ppc64* powerpc64*]]]),
, [enable_ss="x86_64 amd64 aarch64* arm64* ppc64* powerpc64*"])
for i in $enable_ss; do case $host_cpu in $i) enable_ss=yes ;; esac; done
if test "x$enable_ss" = "xyes"; then
AC_DEFINE([WANT_SS_EMU], [1], [Define if we are compiling with Sega Saturn emulation.])
AM_CONDITIONAL(WANT_SS_EMU, true)
AM_CONDITIONAL(NEED_68K_EMU, true)
fi
AC_ARG_ENABLE(ssfplay,
AC_HELP_STRING([--enable-ssfplay], [build with SSF playback support [[default=yes]]]),
, enable_ssfplay=yes)
if test x$enable_ssfplay = xyes; then
AC_DEFINE([WANT_SSFPLAY_EMU], [1], [Define if we are compiling with SSF playback support.])
AM_CONDITIONAL(WANT_SSFPLAY_EMU, true)
AM_CONDITIONAL(NEED_68K_EMU, true)
fi
AC_ARG_ENABLE(vb,
AC_HELP_STRING([--enable-vb], [build with Virtual Boy emulation [[default=yes]]]),
, enable_vb=yes)
if test x$enable_vb = xyes; then
AC_DEFINE([WANT_VB_EMU], [1], [Define if we are compiling with Virtual Boy emulation.])
AM_CONDITIONAL(WANT_VB_EMU, true)
AM_CONDITIONAL(NEED_V810_EMU, true)
AM_CONDITIONAL(NEED_BLIP_BUFFER, true)
fi
AC_ARG_ENABLE(wswan,
AC_HELP_STRING([--enable-wswan], [build with WonderSwan emulation [[default=yes]]]),
, enable_wswan=yes)
if test x$enable_wswan = xyes; then
AC_DEFINE([WANT_WSWAN_EMU], [1], [Define if we are compiling with WonderSwan emulation.])
AM_CONDITIONAL(WANT_WSWAN_EMU, true)
AM_CONDITIONAL(NEED_BLIP_BUFFER, true)
fi
##
## ALSA and JACK checking code ripped from SDL's autoconf file, with heavy modifications
##
#
# ALSA
#
AM_CONDITIONAL(HAVE_ALSA, false)
AC_ARG_ENABLE(alsa, AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
[],
[enable_alsa=yes])
if test x$enable_alsa = xyes; then
AM_PATH_ALSA(1.0.0, have_alsa=yes, have_alsa=no)
# Restore all flags from before the ALSA detection runs
CFLAGS="$alsa_save_CFLAGS"
LDFLAGS="$alsa_save_LDFLAGS"
LIBS="$alsa_save_LIBS"
if test x$have_alsa = xyes; then
AM_CONDITIONAL(HAVE_ALSA, true)
AC_DEFINE([HAVE_ALSA], [1], [Define if we are compiling with ALSA support.])
fi
fi
AC_SUBST([ALSA_LIBS])
AC_SUBST([ALSA_CFLAGS])
#
# JACK
#
AM_CONDITIONAL(HAVE_JACK, false)
AC_ARG_ENABLE(jack, AC_HELP_STRING([--enable-jack], [support the JACK audio API [[default=yes]]]),
[],
[enable_jack=yes])
if test x$enable_jack = xyes; then
PKG_CHECK_MODULES(JACK, jack, [have_jack=yes], [have_jack=no])
if test x$have_jack = xyes; then
AM_CONDITIONAL(HAVE_JACK, true)
AC_DEFINE([HAVE_JACK], [1], [Define if we are compiling with JACK support.])
fi
fi
AC_SUBST([JACK_LIBS])
AC_SUBST([JACK_CFLAGS])
#
# OpenBSD Audio
#
AM_CONDITIONAL(HAVE_OPENBSD_AUDIO, false)
AC_MSG_CHECKING([for OpenBSD audio])
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/audioio.h>
#include <string.h>
],
[
struct audio_swpar par;
struct audio_pos pos;
struct audio_status status;
AUDIO_INITPAR(&par);
],
[AC_MSG_RESULT([yes])
AM_CONDITIONAL(HAVE_OPENBSD_AUDIO, true)
AC_DEFINE([HAVE_OPENBSD_AUDIO], [1], [Define if we are compiling with OpenBSD audio support.])],
[AC_MSG_RESULT([no])])
#
# mpcdec
#
AM_CONDITIONAL(HAVE_EXTERNAL_MPCDEC, false)
AC_ARG_WITH([external-mpcdec], [AS_HELP_STRING([--with-external-mpcdec], [compile and link with external mpcdec @<:@default=no@:>@])],
[],
[with_external_mpcdec=no])
if test x$with_external_mpcdec = xyes; then
AC_CHECK_LIB([mpcdec], [mpc_demux_init], [], AC_MSG_ERROR([*** mpcdec not found!]))
AC_CHECK_HEADER([mpc/mpcdec.h], [], AC_MSG_ERROR([*** mpcdec not found!]))
AC_DEFINE([HAVE_EXTERNAL_MPCDEC], [1], [Define if we are compiling and linking with external mpcdec.])
AM_CONDITIONAL(HAVE_EXTERNAL_MPCDEC, true)
AC_SUBST([MPCDEC_LIBS], ["-lmpcdec"])
else
AC_DEFINE([MPC_FIXED_POINT], [1], [Define to use fixed-point MPC decoder.])
fi
#
# tremor
#
AM_CONDITIONAL(HAVE_EXTERNAL_TREMOR, false)
AC_ARG_WITH([external-tremor], [AS_HELP_STRING([--with-external-tremor], [compile and link with external tremor @<:@default=no@:>@])],
[],
[with_external_tremor=no])
if test x$with_external_tremor = xyes; then
AC_CHECK_LIB([vorbisidec], [ov_read], [], AC_MSG_ERROR([*** libvorbisidec not found!]))
AC_CHECK_HEADER([tremor/ivorbisfile.h], [], AC_MSG_ERROR([*** libvorbisidec not found!]))
AC_DEFINE([HAVE_EXTERNAL_TREMOR], [1], [Define if we are compiling and linking with external tremor.])
AM_CONDITIONAL(HAVE_EXTERNAL_TREMOR, true)
AC_SUBST([TREMOR_LIBS], ["-lvorbisidec"])
fi
#
# trio
#
AM_CONDITIONAL(HAVE_EXTERNAL_TRIO, false)
AC_ARG_WITH([external-trio], [AS_HELP_STRING([--with-external-trio], [compile and link with external trio @<:@default=no@:>@])],
[],
[with_external_trio=no])
if test x$with_external_trio = xyes; then
AC_CHECK_LIB([trio], [trio_printf], [], AC_MSG_ERROR([*** libtrio not found!]))
AC_CHECK_HEADER([trio.h], [], AC_MSG_ERROR([*** libtrio not found!]))
AC_DEFINE([HAVE_EXTERNAL_TRIO], [1], [Define if we are compiling and linking with external trio.])
AM_CONDITIONAL(HAVE_EXTERNAL_TRIO, true)
AC_SUBST([TRIO_LIBS], ["-ltrio"])
trio_include_symsrc="include/trio_external"
else
trio_include_symsrc="src/trio"
fi
AC_CONFIG_LINKS([include/trio/triodef.h:$trio_include_symsrc/triodef.h])
AC_CONFIG_LINKS([include/trio/trio.h:$trio_include_symsrc/trio.h])
AC_CONFIG_LINKS([include/trio/trionan.h:$trio_include_symsrc/trionan.h])
AC_CONFIG_LINKS([include/trio/triop.h:$trio_include_symsrc/triop.h])
AC_CONFIG_LINKS([include/trio/triostr.h:$trio_include_symsrc/triostr.h])
#
# minilzo/lzo
#
AM_CONDITIONAL(HAVE_EXTERNAL_LZO2, false)
AC_ARG_WITH([external-lzo], [AS_HELP_STRING([--with-external-lzo], [compile and link with external LZO @<:@default=no@:>@])],
[],
[with_external_lzo=no])
if test x$with_external_lzo = xyes; then
PKG_CHECK_MODULES(LZO2, lzo2 >= 2.0.9, [], AC_MSG_ERROR([*** lzo2 >= 2.0.9 not found!]))
AC_SUBST([LZO2_LIBS])
AC_SUBST([LZO2_CFLAGS])
AC_DEFINE([HAVE_EXTERNAL_LZO2], [1], [Define if we are compiling and linking with external LZO.])
AM_CONDITIONAL(HAVE_EXTERNAL_LZO2, true)
minilzo_include_symsrc="include/minilzo_external"
else
minilzo_include_symsrc="include/minilzo_internal"
fi
AC_CONFIG_LINKS([include/minilzo/minilzo.h:$minilzo_include_symsrc/minilzo.h])
#
# libsndfile
#
AM_CONDITIONAL(HAVE_LIBSNDFILE, false)
AC_ARG_WITH([libsndfile],
[AS_HELP_STRING([--with-libsndfile],
[support various sound file formats in ripped CD images @<:@default=yes@:>@])],
[],
[with_libsndfile=yes])
if test x$with_libsndfile = xyes; then
PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.2, [], AC_MSG_ERROR([*** libsndfile >= 1.0.2 not found!]))
AC_DEFINE([HAVE_LIBSNDFILE], [1], [Define if we are compiling with libsndfile support.])
AM_CONDITIONAL(HAVE_LIBSNDFILE, true)
fi
AC_SUBST([SNDFILE_LIBS])
AC_SUBST([SNDFILE_CFLAGS])
AM_CONDITIONAL(HAVE_OSSDSP, false)
AM_CONDITIONAL(HAVE_DIRECTSOUND, false)
AM_CONDITIONAL(HAVE_WASAPI, false)
AM_CONDITIONAL(HAVE_SDL, false)
AM_CONDITIONAL(DOS, false)
AM_CONDITIONAL(WIN32, false)
AM_CONDITIONAL(UNIX, false)
AM_CONDITIONAL(HAVE_LINUX_JOYSTICK, false)
AM_CONDITIONAL(ENABLE_LIBXXX_MODE, false)
NEED_SDL=true
if $ENABLE_LIBXXX_MODE; then
NEED_SDL=false
AC_DEFINE([ENABLE_LIBXXX_MODE], [1], [Define if we are compiling in libxxx mode.])
AM_CONDITIONAL(ENABLE_LIBXXX_MODE, true)
fi
if expr x"$host" : 'x.*-mingw*' > /dev/null; then
AC_CHECK_TOOL([WINDRES], [windres])
if test x$host_cpu != xx86_64; then
# Enable larger address space support(for the 32-bit build).
LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
AX_CFLAGS_GCC_OPTION([-march=i686], OPTIMIZER_FLAGS)
AX_CFLAGS_GCC_OPTION([-mtune=pentium3], OPTIMIZER_FLAGS)
else
AX_CFLAGS_GCC_OPTION([-mtune=amdfam10], OPTIMIZER_FLAGS)
fi
# Always build with DirectSound support.
AM_CONDITIONAL(HAVE_DIRECTSOUND,true)
AC_DEFINE([HAVE_DIRECTSOUND], [1], [Define if we are compiling with DirectSound support.])
LIBS="-ldxguid -lwinmm -ldsound $LIBS"
# Always build with WASAPI support.
AM_CONDITIONAL(HAVE_WASAPI,true)
AC_DEFINE([HAVE_WASAPI], [1], [Define if we are compiling with WASAPI support.])
LIBS="-lole32 $LIBS"
AC_DEFINE([PSS_STYLE],[2], [Defines the filesystem path-separator type.])
AC_DEFINE([WIN32], [1], [Define if we are compiling for Win32.])
AM_CONDITIONAL(WIN32, true)
LIBS="-mconsole -lws2_32 -ldxguid -lwinmm -ldinput $LIBS -lwinmm"
CPPFLAGS="-D_LFS64_LARGEFILE=1 $CPPFLAGS"
elif expr x"$host" : 'x.*djgpp' > /dev/null; then
AC_DEFINE([PSS_STYLE],[2], [Defines the filesystem path-separator type.])
AC_DEFINE([DOS], [1], [Define if we are compiling for DOS.])
AM_CONDITIONAL(DOS, true)
NEED_SDL=false
else
AC_DEFINE([PSS_STYLE],[1], [Defines the filesystem path-separator type.])
#
# POSIX threads
#
AC_SEARCH_LIBS(pthread_create, [pthread])
AC_CHECK_FUNCS(pthread_create sem_init, [], AC_MSG_ERROR([*** pthreads not found!]))
AC_CHECK_FUNCS(sem_timedwait sem_timedwait_monotonic sem_clockwait sem_clockwait_np pthread_condattr_setclock pthread_setname_np pthread_set_name_np pthread_getaffinity_np pthread_setaffinity_np pthread_cond_timedwait_relative_np)
AC_CHECK_HEADERS(pthread.h sched.h)
AC_CHECK_HEADERS(pthread_np.h, [], [], [
#include <pthread.h>
])
AC_MSG_CHECKING([type for pthread affinity setting])
AC_TRY_COMPILE(
[
#include <pthread.h>
#if defined HAVE_SCHED_H
#include <sched.h>
#endif
#if defined(HAVE_PTHREAD_NP_H)
#include <pthread_np.h>
#endif
],
[
cpu_set_t c;
int result;
CPU_ZERO(&c);
result = pthread_setaffinity_np(pthread_self(), sizeof(c), &c);
result = pthread_getaffinity_np(pthread_self(), sizeof(c), &c);
],
[
AC_MSG_RESULT([cpu_set_t])
AC_DEFINE([PTHREAD_AFFINITY_NP], [cpu_set_t], [Define to CPU set type if we are compiling with pthreads affinity setting support.])
],
AC_TRY_COMPILE(
[
#include <pthread.h>
#if defined HAVE_SCHED_H
#include <sched.h>
#endif
#if defined(HAVE_PTHREAD_NP_H)
#include <pthread_np.h>
#endif
],
[
cpuset_t c;
int result;
CPU_ZERO(&c);
result = pthread_setaffinity_np(pthread_self(), sizeof(c), &c);
result = pthread_getaffinity_np(pthread_self(), sizeof(c), &c);
],
[
AC_MSG_RESULT([cpuset_t])
AC_DEFINE([PTHREAD_AFFINITY_NP], [cpuset_t], [Define to CPU set type if we are compiling with pthreads affinity setting support.])
],
[
AC_MSG_RESULT([unknown])
]))
AC_CHECK_HEADER([sys/soundcard.h],[AM_CONDITIONAL(HAVE_OSSDSP,true) AC_DEFINE([HAVE_OSSDSP], [1], [Define if we are compiling with OSS support.])])
#
# Linux joystick
#
AC_MSG_CHECKING([for Linux joystick APIs])
AC_TRY_COMPILE([],
[
#ifndef __linux__
#error "error"
#endif
],
[
AC_TRY_COMPILE([
#include <linux/joystick.h>
#include <linux/input.h>
],
[
struct js_event dummy0;
struct ff_effect dummy1;
],
[
AC_MSG_RESULT([yes])
AM_CONDITIONAL(HAVE_LINUX_JOYSTICK, true)
AC_DEFINE([HAVE_LINUX_JOYSTICK], [1], [Define if we are compiling with Linux joystick support.])
],
AC_MSG_ERROR([*** Linux joystick APIs not found!]))
],
[AC_MSG_RESULT([no])])
fi
if $NEED_SDL
then
SDL_VERSION=2.0.5
AM_PATH_SDL2($SDL_VERSION, HAVE_SDL=true, HAVE_SDL=false)
if $HAVE_SDL
then
AM_CONDITIONAL(HAVE_SDL, true)
AC_DEFINE([HAVE_SDL], [1], [Define if we are compiling with SDL.])
AC_SUBST(SDL_LIBS)
AC_SUBST(SDL_CFLAGS)
else
AC_MSG_ERROR([*** SDL >= 2.0.5 not found!])
fi
fi
dnl
dnl FIXME: Make sure POSIX/BSD sockets API detection doesn't have any false positives(like when targeting Windows).
dnl
AM_CONDITIONAL(HAVE_POSIX_SOCKETS, false)
dnl
dnl
HAVE_POSIX_SOCKETS=yes
dnl
dnl Solaris may require "nsl" and "socket" libraries.
dnl
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([socket], [socket network])
AC_CHECK_FUNCS(socket bind listen connect accept send recv close gethostbyname gethostbyaddr getaddrinfo freeaddrinfo gai_strerror select poll getsockopt setsockopt, [],
[HAVE_POSIX_SOCKETS=no])
if test x$HAVE_POSIX_SOCKETS = xyes; then
AM_CONDITIONAL(HAVE_POSIX_SOCKETS, true)
AC_DEFINE([HAVE_POSIX_SOCKETS], [1], [Define if we are compiling with POSIX sockets support.])
fi
AM_CONDITIONAL(ARCH_X86, false)
AM_CONDITIONAL(ARCH_X86_32, false)
AM_CONDITIONAL(ARCH_X86_64, false)
AM_CONDITIONAL(ARCH_POWERPC, false)
TRIO_CFLAGS=""
dnl OpenBSD...
AC_TRY_COMPILE([], [asm volatile("vcvtss2si %xmm6,%ecx\n\tvhaddps %ymm7,%ymm7,%ymm7\n\tvzeroupper\n\t");],
AC_DEFINE([HAVE_INLINEASM_AVX], [1], [Define if GNU-style AVX inline assembly is supported.]),
[])
case "$host_cpu" in
x86_64|amd64)
AC_DEFINE([ARCH_X86], [1], [Define if we are compiling for 32-bit or 64-bit x86 architectures.])
AM_CONDITIONAL(ARCH_X86, true)
AC_DEFINE([ARCH_X86_64], [1], [Define if we are compiling for 64-bit x86 architectures.])
AM_CONDITIONAL(ARCH_X86_64, true)
AX_CFLAGS_GCC_OPTION([-mcmodel=small], CODEGEN_FLAGS)
;;
i*86)
AC_DEFINE([ARCH_X86], [1], [Define if we are compiling for 32-bit or 64-bit x86 architectures.])
AM_CONDITIONAL(ARCH_X86, true)
AC_DEFINE([ARCH_X86_32], [1], [Define if we are compiling for 32-bit x86 architectures.])
AM_CONDITIONAL(ARCH_X86_32, true)
;;
powerpc*)
AC_DEFINE([ARCH_POWERPC], [1], [Define if we are compiling for PPC architectures.])
AM_CONDITIONAL(ARCH_POWERPC, true)
if test x$enable_altivec = xyes; then
ALTIVEC_FLAGS=""
AX_CFLAGS_GCC_OPTION([-faltivec], ALTIVEC_FLAGS)
AX_CFLAGS_GCC_OPTION([-maltivec], ALTIVEC_FLAGS)
if test "x$ALTIVEC_FLAGS" != "x"; then
altivec_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $ALTIVEC_FLAGS"
AC_CHECK_HEADER([altivec.h],
AC_DEFINE([HAVE_ALTIVEC_H], [1], [Define if altivec.h is present and usable.]),
[] )
CPPFLAGS="$altivec_save_CPPFLAGS"
fi
fi
;;
alpha*)
AX_CFLAGS_GCC_OPTION([-mieee], TRIO_CFLAGS)
;;
esac
AC_SUBST(TRIO_CFLAGS)
AC_C_BIGENDIAN([AC_DEFINE([MSB_FIRST],[1],[Define on big-endian platforms.])],
[
AC_DEFINE([LSB_FIRST],[1],[Define on little-endian platforms.])
])
AC_DEFINE_UNQUOTED([MEDNAFEN_VERSION],"$MEDNAFEN_VERSION", [Mednafen version definition.])
AC_DEFINE_UNQUOTED([MEDNAFEN_VERSION_NUMERIC],$MEDNAFEN_VERSION_NUMERIC, [Mednafen version numeric.])
AC_SUBST([AM_CFLAGS], "$ALTIVEC_FLAGS $OPTIMIZER_FLAGS $WARNING_FLAGS $CODEGEN_FLAGS $CODEGEN_CFLAGS")
AC_SUBST([AM_CXXFLAGS], "$ALTIVEC_FLAGS $OPTIMIZER_FLAGS $WARNING_FLAGS $CODEGEN_FLAGS $CODEGEN_CXXFLAGS")
dnl Output Makefiles
AC_OUTPUT([Makefile po/Makefile.in intl/Makefile src/Makefile src/drivers/Makefile src/drivers_libxxx/Makefile src/drivers_dos/Makefile src/sexyal/Makefile src/ss/Makefile])