-
Notifications
You must be signed in to change notification settings - Fork 19
/
configure.ac
1202 lines (1111 loc) · 49.7 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
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
m4_define([MAJOR_VERSION], [3])
m4_define([MINOR_VERSION], [0])
m4_define([PATCH_VERSION], [0])
AC_INIT([ocp],[MAJOR_VERSION.MINOR_VERSION.PATCH_VERSION],[[email protected]])
AC_DEFINE_UNQUOTED(DLLVERSION, `printf 0x%04x%02x%02x MAJOR_VERSION MINOR_VERSION PATCH_VERSION`)
AC_SUBST([MAJOR_VERSION], [MAJOR_VERSION])
AC_SUBST([MINOR_VERSION], [MINOR_VERSION])
AC_SUBST([PATCH_VERSION], [PATCH_VERSION])
AC_DEFINE([OCP_MAJOR_VERSION], [MAJOR_VERSION])
AC_DEFINE([OCP_MINOR_VERSION], [MINOR_VERSION])
AC_DEFINE([OCP_PATCH_VERSION], [PATCH_VERSION])
AC_CANONICAL_HOST
AC_MSG_CHECKING([GIT submodules are checked out])
AS_IF([test -f playtimidity/timidity-git/Makefile.am], [AC_MSG_RESULT([ok])],
[AC_MSG_ERROR([playtimidity/timidity-git is missing - please execute 'git submodule update --init --recursive'])]
)
AC_ARG_WITH([debug], [AS_HELP_STRING([--with-debug],[compile with debug-flags])])
AS_IF([test "x$with_debug" = "xyes"], [
for i in $CFLAGS
do
new_CFLAGS="$new_CFLAGS `echo $i|grep -- -L`";
new_CFLAGS="$new_CFLAGS `echo $i|grep -- -I`";
done;
CFLAGS="$new_CFLAGS -g"
for i in $CXXFLAGS
do
new_CXXFLAGS="$new_CFLAGS `echo $i|grep -- -L`";
new_CXXFLAGS="$new_CFLAGS `echo $i|grep -- -I`";
done;
CXXFLAGS="$new_CXXFLAGS -g -DDEBUG=1"
])
AC_CHECK_HEADERS_ONCE([sys/time.h])
# Timidity relies on this obsolete test
if test $ac_cv_header_sys_time_h = yes; then
AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both <sys/time.h>
and <time.h>. This macro is obsolete.])
fi
AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_CXXCPP
AC_PROG_MAKE_SET
AC_SUBST(UPDATE_MIME_DATABASE)
AC_SUBST(DESKTOP_FILE_INSTALL)
AC_SUBST(UPDATE_DESKTOP_DATABASE)
AC_C_BIGENDIAN
AC_SUBST(DIRSEPARATOR)
AC_SUBST(SHARED_FLAGS)
AC_SUBST(LIB_SUFFIX)
AC_SUBST(EXE_SUFFIX)
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(HAIKU)
AC_SUBST(WINDOWS)
AC_SUBST(WINDRES)
DIRSEPARATOR="/"
target=`$CC -dumpmachine`
AS_CASE([$target],
[*-darwin*],[
SHARED_FLAGS="-dynamiclib -undefined dynamic_lookup"
CFLAGS="$CFLAGS -fno-common"
CXXFLAGS="$CXXFLAGS -fno-common"
LIB_SUFFIX=.dylib
PTHREAD_LIBS=-pthread
],
[*-haiku*],[
SHARED_FLAGS=-shared
LIB_SUFFIX=.so
PTHREAD_LIBS=
with_desktop_file_install=no
with_update_desktop_database=no
HAIKU=1
],
[*-mingw*],[
WINDOWS=1
DIRSEPARATOR=\\
SHARED_FLAGS="-shared -pthread" # clock_gettime() is provided via -pthread when using mingw
LIB_SUFFIX=.dll
EXE_SUFFIX=.exe
PTHREAD_LIBS=-pthread
WINDRES="${WINDRES:-$host-windres}"
DATADIROCP=$prefix
ac_cv_env_DATADIROCP_set=set
LIBDIROCP=$prefix
ac_cv_env_LIBDIROCP_set=set
],[
SHARED_FLAGS=-shared
LIB_SUFFIX=.so
PTHREAD_LIBS=-pthread
]
)
AC_DEFINE_UNQUOTED(LIB_SUFFIX, "$LIB_SUFFIX")
AC_ARG_WITH([builtin], [AS_HELP_STRING([--with-builtin=core,auto,none], [force/disable builtin plugins support. For now playback plugins, audio mixers and audio drivers are always modules])],
[], [with_builtin=auto])
AC_ARG_WITH([x11], [AS_HELP_STRING([--with-x11], [force/disable x11 support])], [], [with_x11=auto])
#AC_ARG_WITH([adplug], [AS_HELP_STRING([--with-adplug], [force/disable adplug support])], [], [with_adplug=auto])
AC_ARG_WITH([mad], [AS_HELP_STRING([--with-mad], [force/disable mad mpeg audio support])], [], [with_mad=auto])
AC_ARG_WITH([libgme], [AS_HELP_STRING([--with-libgme], [force/disable libgme (Game Music Emulator support)])], [], [with_libgme=auto])
AC_ARG_WITH([alsa], [AS_HELP_STRING([--with-alsa], [force/disable alsa support])], [], [with_alsa=auto])
AC_ARG_WITH([oss], [AS_HELP_STRING([--with-oss], [force/disable oss support])], [], [with_oss=auto])
AC_ARG_WITH([lzw], [AS_HELP_STRING([--with-lzw], [force/disable lzw support (enabled by default)])], [], [with_lzw=yes])
AC_ARG_WITH([lzh], [AS_HELP_STRING([--with-lzh], [force/disable lzh support in .ym files(enabled by default)])], [], [with_lzh=yes])
AC_ARG_WITH([coreaudio], [AS_HELP_STRING([--with-coreaudio], [force/disable osx coreaudio support (autodetect by default)])], [], [with_coreaudio=auto])
AC_ARG_WITH([flac], [AS_HELP_STRING([--with-flac], [force/disable FLAC support (autodetect by default)])], [], [with_flac=auto])
AC_ARG_WITH([sdl], [AS_HELP_STRING([--with-sdl], [force/disable SDL video support (autodetect by default)])], [], [with_sdl=auto])
AC_ARG_WITH([sdl2], [AS_HELP_STRING([--with-sdl2], [force/disable SDL2 video support (autodetect by default)])], [], [with_sdl2=auto])
AC_ARG_WITH([info], [AS_HELP_STRING([--without-info], [Do not install info manual pages])], [], [with_info=auto])
AC_ARG_WITH([update_mime_database], [AS_HELP_STRING([--without-update-mime-database], [Do not update mime database after file copy (SDL and X11 normally does this)])],[], [with_update_mime_database=auto])
AC_ARG_WITH([desktop_file_install], [AS_HELP_STRING([--without-desktop_file_install], [Do not install .desktop file (SDL and X11 normally does this)])], [], [with_desktop_file_install=auto])
AC_ARG_WITH([update_desktop_database], [AS_HELP_STRING([--without-update-desktop-database],[Do not update desktop database (SDL and X11 normally does this)])], [], [with_update_desktop_database=auto])
AC_ARG_WITH([dumptools], [AS_HELP_STRING([--with-dumptools], [enable building the different fileformat dump utilities])], [], [with_dumptools=no])
AC_ARG_WITH([unifont-relative], [AS_HELP_STRING([--with-unifont-relative], [unifont files should be placed in datarootdir (same as ocp.hlp)])], [], [with_unifont_relative=no])
AC_ARG_WITH([unifontdir-ttf], [AS_HELP_STRING([--with-unifontdir-ttf=/path], [the path to where ttf-unifont is located (used by X11, SDL1.x and SDL2)])], [], [with_unifontdir_ttf='${datarootdir}/fonts/truetype/unifont'])
AC_ARG_WITH([unifont_ttf], [AS_HELP_STRING([--with-unifont-ttf=/path], [the full path to unifont.ttf (default is UNIFONTDIR/unifont.ttf); use this option if the unifont.ttf is named UniFont.ttf or similiar. If the filename contains version number it is recommended that this is fixed in unifont installation with non-version symlinks])],
[], [with_unifont_ttf='${with_unifontdir_ttf}/unifont.ttf'])
AC_ARG_WITH([unifont_csur_ttf], [AS_HELP_STRING([--with-unifont-csur-ttf=/path], [the full path to unifont_csur.ttf (default is UNIFONTDIR/unifont_csur.ttf) or disable by using --without-unifont-csur-ttf])],
[], [with_unifont_csur_ttf='${with_unifontdir_ttf}/unifont_csur.ttf'])
AC_ARG_WITH([unifont_upper_ttf], [AS_HELP_STRING([--with-unifont-upper-ttf=/path], [the full path to unifont_upper.ttf (default is UNIFONTDIR/unifont_upper.ttf)])],[], [with_unifont_upper_ttf='${with_unifontdir_ttf}/unifont_upper.ttf'])
AC_ARG_WITH([unifontdir-otf], [AS_HELP_STRING([--with-unifontdir-otf=/path], [the path to where otf-unifont is located (used by X11, SDL1.x and SDL2)])], [], [with_unifontdir_otf='${datarootdir}/fonts/opentype/unifont'])
AC_ARG_WITH([unifont_otf], [AS_HELP_STRING([--with-unifont-otf=/path], [the full path to unifont.otf (default is UNIFONTDIR/unifont.otf); use this option if the unifont.otf is named UniFont.otf or similiar. If the filename contains version number it is recommended that this is fixed in unifont installation with non-version symlinks])],
[], [with_unifont_otf='${with_unifontdir_otf}/unifont.otf'])
AC_ARG_WITH([unifont_csur_otf], [AS_HELP_STRING([--with-unifont-csur-otf=/path], [the full path to unifont_csur.otf (default is UNIFONTDIR/unifont_csur.otf) or disable by using --without-unifont-csur-otf])],
[], [with_unifont_csur_otf='${with_unifontdir_otf}/unifont_csur.otf'])
AC_ARG_WITH([unifont_upper_otf], [AS_HELP_STRING([--with-unifont-upper-otf=/path], [the full path to unifont_upper.otf (default is UNIFONTDIR/unifont_upper.otf)])],[], [with_unifont_upper_otf='${with_unifontdir_otf}/unifont_upper.otf'])
# normally, this is done automatically first when running AC_OUTPUT, but we need them expanded now
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
AC_DEFUN([AS_AC_EXPAND],
[
EXP_VAR=[$1]
FROM_VAR=[$2]
dnl first expand prefix and exec_prefix if necessary
prefix_save=$prefix
exec_prefix_save=$exec_prefix
dnl if no prefix given, then use /usr/local, the default prefix
full_var="$FROM_VAR"
dnl loop until it doesn"t change anymore
while true; do
new_full_var="`eval echo $full_var`"
AS_IF([test "x$new_full_var" = "x$full_var"],[break])
full_var=$new_full_var
done
dnl clean up
full_var=$new_full_var
AC_SUBST([$1], "$full_var")
dnl restore prefix and exec_prefix
prefix=$prefix_save
exec_prefix=$exec_prefix_save
])
AC_DEFUN([AS_AC_EXPAND_WITH_DEBUG],
[
EXP_VAR=[$1]
FROM_VAR=[$2]
[$3]=""
dnl first expand prefix and exec_prefix if necessary
prefix_save=$prefix
exec_prefix_save=$exec_prefix
dnl if no prefix given, then use /usr/local, the default prefix
full_var="$FROM_VAR"
dnl loop until it doesn"t change anymore
while true; do
[$3]="$[$3]""$full_var"
new_full_var="`eval echo $full_var`"
AS_IF([test "x$new_full_var" = "x$full_var"],[break])
full_var=$new_full_var
[$3]="$[$3] => "
done
dnl clean up
full_var=$new_full_var
AC_SUBST([$1], "$full_var")
dnl restore prefix and exec_prefix
prefix=$prefix_save
exec_prefix=$exec_prefix_save
])
AC_SUBST(STATIC_BUILD)
AC_SUBST(STATIC_CORE)
AS_CASE([$with_builtin],
['none'], [
builtin="none"
],
['auto'|'core'], [
builtin="core"
AC_DEFINE([SUPPORT_STATIC_PLUGINS],[1])
AC_DEFINE([STATIC_CORE],[1])
STATIC_BUILD=1
STATIC_CORE=1
],[
AC_MSG_ERROR([Unknown --with-builtin combination: $with_builtin])
]
);
AC_MSG_CHECKING([for known broken gcc versions])
AS_IF([$CC --version|head -n 1|grep '^gcc' > /dev/null], [
cc_version=`( $CC -dumpversion ) 2>&1`
AS_IF([test "$?" -gt 0 || test x$cc_version = x], [AC_MSG_ERROR([not found])], [
AS_CASE([$cc_version],
[''], [AC_MSG_ERROR([not found])],
# old GCC versions in the 2.95.xx family are known to produce bad crashing binaries (it is still out there on some old systems. In general the all versions before 3.0 is risky
[2.95.[[2-9]]|2.95.[[2-9]][[-]].*],[AC_MSG_ERROR([$cc_version, bad])],
[AC_MSG_RESULT([$cc_version, ok])]
)
])
],[
AC_MSG_RESULT([not gcc, ok])
])
AC_MSG_CHECKING([for broken signed char to signed int in loops (gcc version 4.1.1)])
AC_RUN_IFELSE(
[AC_LANG_SOURCE([
#include <stdio.h>
#include <unistd.h>
void failcheck(signed int source, signed int filter)
{
if ((source>128)&&(filter>0))
_exit(1);
}
int main(int arg, char *argv@<:@@:>@)
{
int j;
for (j=0; j<256; j++)
{
signed char j2=(signed char)j;
signed int j3=j2;
failcheck(j, j3);
}
return 0;
}
])],
AC_MSG_RESULT([ok]),
AC_MSG_ERROR([failed.
Try to remove any -O flag or to add -fwrapv to CFLAGS and CXXFLAGS]),
AC_DEFINE(GCC_411_RUNTIMECHECK, 1)
)
AC_MSG_CHECKING([for PIC])
org_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fPIC"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]],[[]])],
[AC_MSG_RESULT(-fPIC)
CXXFLAGS="$CXXFLAGS -fPIC"]
,
[CFLAGS="$org_cflags -fpic"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]],[[]])],
[AC_MSG_RESULT(-fpic)
CXXFLAGS="$CXXFLAGS -fpic"]
,
[CFLAGS="$org_cflags"
AC_MSG_RESULT(not supported)]
])
)
AC_CHECK_FUNCS([memmem])
AC_CHECK_FUNCS([getopt])
AC_CHECK_FUNCS([getpwuid])
AC_CHECK_FUNCS([popen])
AC_CHECK_FUNCS([qsort])
AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([sleep])
AC_CHECK_FUNCS([sysconf])
AC_CHECK_FUNCS([strerror])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([strupr])
AC_CHECK_FUNCS([getcwd])
AC_CHECK_FUNCS([snprintf])
AC_CHECK_FUNCS([usleep])
AC_CHECK_FUNCS([vsnprintf])
AC_CHECK_FUNCS([strncasecmp])
AC_CHECK_FUNCS([mkstemp])
AC_CHECK_FUNCS([strlcpy])
AC_CHECK_FUNCS([strlcat])
AC_SUBST(MATH_LIBS)
AC_CHECK_FUNCS([sqrt], [MATH_LIBS=], [
AC_CHECK_LIB([m], [sqrt], [MATH_LIBS=-lm], [AC_MSG_ERROR("libm not found")])
])
AC_STRUCT_DIRENT_D_TYPE
AC_CONFIG_HEADERS([config.h] [playsid/sidplayfp-config/config.h])
AC_SUBST(HAVE_GETOPT_H)
AC_SUBST(HAVE_SYS_IO_H)
AC_SUBST(HAVE_SYS_STAT_H)
AC_SUBST(HAVE_SYS_TYPES_H)
AC_CHECK_HEADER([dirent.h], [AC_DEFINE(HAVE_DIRENT_H, 1)], [])
AC_CHECK_HEADER([fcntl.h], [AC_DEFINE(HAVE_FCNTL_H, 1)], [])
AC_CHECK_HEADER([grp.h], [AC_DEFINE(HAVE_GRP_H, 1)], [])
AC_CHECK_HEADER([getopt.h], [AC_DEFINE(HAVE_GETOPT_H, 1)] HAVE_GETOPT_H=1, [])
AC_CHECK_HEADER([ndir.h], [AC_DEFINE(HAVE_NDIR_H, 1)], [])
AC_CHECK_HEADER([sys/io], HAVE_SYS_IO_H=1, [])
AC_CHECK_HEADER([sys/ndir.h], [AC_DEFINE(HAVE_SYS_NDIR_H, 1)], [])
AC_CHECK_HEADER([sys/dir.h], [AC_DEFINE(HAVE_SYS_DIR_H, 1)], [])
AC_CHECK_HEADER([stdint.h], [AC_DEFINE(HAVE_STDINT_H, 1)], [])
AC_CHECK_HEADER([inttypes.h], [AC_DEFINE(HAVE_INTTYPES_H, 1)], [])
AC_CHECK_HEADER([byteswap.h], [AC_DEFINE(HAVE_BYTESWAP_H, 1)], [])
AC_CHECK_HEADER([unistd.h], [AC_DEFINE(HAVE_UNISTD_H, 1)], [])
AC_CHECK_HEADER([limits.h], [AC_DEFINE(HAVE_LIMITS_H, 1)], [])
AC_CHECK_HEADER([string.h], [AC_DEFINE(HAVE_STRING_H, 1)], [AC_DEFINE(NO_STRING_H,1,"Define to 1 if you do not have <string.h>.")])
AC_CHECK_HEADER([strings.h], [AC_DEFINE(HAVE_STRINGS_H, 1)], [])
AC_CHECK_HEADER([errno.h], [AC_DEFINE(HAVE_ERRNO_H, 1)], [])
AC_CHECK_HEADER([sys/cdefs.h], [AC_DEFINE(HAVE_SYS_CDEFS_H, 1)], [])
AC_CHECK_HEADER([sys/stat.h], [AC_DEFINE(HAVE_SYS_STAT_H, 1) HAVE_SYS_STAT_H=1], [])
AC_CHECK_HEADER([sys/time.h], [AC_DEFINE(HAVE_SYS_TIME_H, 1)], [])
AC_CHECK_HEADER([sys/types.h], [AC_DEFINE(HAVE_SYS_TYPES_H, 1) HAVE_SYS_TYPES_H=1], [])
AC_CHECK_HEADER([sys/param.h], [AC_DEFINE(HAVE_SYS_PARAM_H, 1)], [])
AC_CHECK_HEADER([machine/endian.h],[AC_DEFINE(HAVE_MACHINE_ENDIAN_H, 1)], [])
AC_CHECK_HEADER([pwd.h], [AC_DEFINE(HAVE_PWD_H, 1)], [])
AC_CHECK_HEADER([Availability.h], [AC_DEFINE(HAVE_AVAILABILITY_H, 1)], [])
AC_CHECK_HEADER([AvailabilityMacros.h], [AC_DEFINE(HAVE_AVAILABILITYMACROS_H, 1)], [])
AC_CHECK_HEADER([AvailabilityVersions.h], [AC_DEFINE(HAVE_AVAILABILITYVERSIONS_H, 1)], [])
AC_CHECK_FUNC([getpwnam], [HAVE_GETPWNAM=1; AC_DEFINE(HAVE_GETPWNAM)])
dnl timidity patch dir
AC_ARG_WITH([timidity-default-path], [AS_HELP_STRING([--with-timidity-default-path=DIR], [Where timidity.cfg is (PREFIX/share/timidity)])],
[timiditypkgdatadir=$withval],
[
AS_IF([test "x$prefix" != "xNONE"], [timiditypkgdatadir='${prefix}/share/timidity'],
[timiditypkgdatadir='/usr/local/share/timidity'])
]
)
tmpdefpath="`eval \"echo ${timiditypkgdatadir}\"`"
AC_DEFINE_UNQUOTED(TIMIDITY_DEFAULT_PATH,"$tmpdefpath",place to install patches)
AC_DEFINE(TIMIDITYPKGDATADIR,TIMIDITY_DEFAULT_PATH,a compatibility matter. ignore it.)
dnl We first check for ncursesw, if that fails we revert back to ncurses
AC_SUBST(HAVE_CURSES)
AS_IF([test "x$WINDOWS" == x],
[
AX_WITH_CURSES
AS_IF([test "x$ax_cv_ncursesw" != xyes && test "x$ax_cv_ncurses" != xyes], [AC_MSG_ERROR([requires either NcursesW or Ncurses library])])
AS_IF([test "x$ax_cv_curses_color" != xyes], [AC_MSG_ERROR([requires an X/Open-compatible Curses library with color])])
HAVE_CURSES=1
push_LIBS=$LIBS
LIBS=$CURSES_LIBS
AC_CHECK_FUNCS([resize_term])
LIBS=$push_LIBS
]
)
AC_CHECK_LIB([z], [zlibVersion], [], [AC_MSG_ERROR("zlib not found")])
AC_CHECK_HEADER([zlib.h], [], [AC_MSG_ERROR("zlib header files was not found")])
AC_CHECK_LIB([bz2], [BZ2_bzDecompress], [], [AC_MSG_ERROR([bzip2 library not found (libbz2-dev)])])
AC_CHECK_HEADER([bzlib.h], [], [AC_MSG_ERROR("bzip2 header file not found (libbz2-dev)")])
AS_IF([test "x$WINDOWS" == x],
[
AC_SUBST(DL_LIBS)
dnl -lc is dirty hack here
push_LIBS=$LIBS
LIBS=
dnl refresh LIB list
AC_LANG_PUSH(C)
AC_CHECK_FUNC([dlopen], [DL_LIBS=""],[AC_CHECK_LIB([dl], [dlopen], [DL_LIBS="-ldl"], [AC_MSG_ERROR("dlopen not found")])])
LIBS=$push_LIBS
AC_LANG_POP
]
)
AC_SUBST(MAD_CFLAGS)
AC_SUBST(MAD_LIBS)
AC_SUBST(HAVE_MAD)
AS_IF([test "x$with_mad" != "xno"],[
PKG_CHECK_MODULES([MAD],[mad],[],[
dnl Fall back to non-pkg-config method
AC_CHECK_LIB([mad], [mad_stream_init], [], [
AS_IF([test "x$with_mad" = "xyes"], [AC_MSG_ERROR("libmad not found")],
[with_mad="no"])
])
AS_IF([test "x$with_mad" != "xno"], [
AC_CHECK_HEADER([mad.h], [], [
AS_IF([test "x$with_mad" = "xyes"], [AC_MSG_ERROR("libmad header files was not found")],
[with_mad="no"])
])
])
AS_IF([test "x$with_mad" != "xno"], [
MAD_LIBS="-lmad"
MAD_CFLAGS=""
LIBS=$push_LIBS
])
])
])
AS_IF([test "x$with_mad" = "xno"], [
HAVE_MAD=
],[
HAVE_MAD=1
AC_DEFINE(HAVE_MAD)
])
PKG_CHECK_MODULES([LIBJPEG],[libjpeg],[AS_ECHO("libjpeg flags ... $LIBJPEG_CFLAGS $LIBJPEG_LIBS")],[AC_MSG_ERROR([failed to find libjpeg])])
PKG_CHECK_MODULES([LIBPNG],[libpng],[],[AC_MSG_ERROR([failed to find libpng])])
AC_SUBST(OGG_CFLAGS)
AC_SUBST(OGG_LIBS)
PKG_CHECK_MODULES([OGG],[ogg],[],[
dnl Fall back to non-pkg-config method
AC_CHECK_LIB([ogg], [ogg_sync_init], [], [AC_MSG_ERROR("ogg libraries not found")])
OGG_LIBS="-logg"
OGG_CFLAGS=""
LIBS=$push_LIBS
])
AC_SUBST(VORBIS_CFLAGS)
AC_SUBST(VORBIS_LIBS)
PKG_CHECK_MODULES([VORBIS],[vorbis],[],[
dnl Fall back to non-pkg-config method
AC_CHECK_LIB([vorbis], [vorbis_bitrate_init], [], [AC_MSG_ERROR("vorbis libraries not found")], [$OGG_LIBS])
AC_CHECK_HEADER([vorbis/codec.h], [], [AC_MSG_ERROR("libvorbis header files was not found")])
VORBIS_LIBS="-lvorbis"
VORBIS_CFLAGS=""
LIBS=$push_LIBS
])
AC_SUBST(VORBISFILE_CFLAGS)
AC_SUBST(VORBISFILE_LIBS)
PKG_CHECK_MODULES([VORBISFILE],[vorbisfile],[],[
dnl Fall back to non-pkg-config method
AC_CHECK_LIB([vorbisfile], [ov_pcm_seek_lap], [AC_DEFINE(HAVE_OV_PCM_SEEK_LAP, 1)],
AC_CHECK_LIB([vorbisfile], [ov_pcm_seek], [AC_DEFINE(HAVE_OV_PCM_SEEK, 1)], [AC_MSG_ERROR("vorbis libraries not found")], [$OGG_LIBS $VORBIS_LIBS])
)
AC_CHECK_HEADER([vorbis/vorbisfile.h], [], [AC_MSG_ERROR("libvorbis header files were not found")])
VORBISFILE_LIBS="-lvorbisfile"
VORBISFILE_CFLAGS=""
LIBS=$push_LIBS
])
AC_SUBST(FLAC_CFLAGS)
AC_SUBST(FLAC_LIBS)
AC_SUBST(HAVE_FLAC)
AS_IF([test "x$with_flac" != "xno"],[
PKG_CHECK_MODULES([FLAC],[flac],[],[
AC_CHECK_LIB([FLAC], [FLAC__seekable_stream_decoder_process_until_end_of_metadata], [FLAC_LIBS="-lFLAC"],
AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_process_until_end_of_metadata], [FLAC_LIBS="-lFLAC"],
[AS_IF([test "x$with_flac" = "xyes"], [AC_MSG_ERROR("libFLAC not found")], [with_flac="no"])],
[-lz]),
[-lz])
AC_CHECK_HEADER([FLAC/all.h], [FLAC_CFLAGS=""],
[ AS_IF([test "x$with_flac" = "xyes"], [AC_MSG_ERROR("libFLAC header files were not found")], [with_flac="no"]) ])
LIBS=$push_LIBS
])
])
AC_SUBST(HAVE_FLAC)
AS_IF([test "x$with_flac" = "xno"], [HAVE_FLAC=], [HAVE_FLAC=1])
AS_IF([test "x$with_x11" != "xno"], [
AC_CHECK_HEADER([X11/extensions/xf86vmode.h], [], [ AS_IF([test "x$with_x11" = "xyes"], [AC_MSG_ERROR("xvidmode header files was not found")], [with_x11="no"]) ],
[#include <X11/Xlib.h>
])
])
AS_IF([test "x$with_x11" != "xno"], [
AC_CHECK_HEADER([X11/extensions/XShm.h], [], [ AS_IF([test "x$with_x11" = "xyes"], [AC_MSG_ERROR("XShm header files was not found")], [with_x11="no"]) ],
[#include <X11/Xlib.h>
])
])
AS_IF([test "x$with_x11" != "xno"], [
AC_CHECK_HEADER([X11/xpm.h], [], [ AS_IF([test "x$with_x11" = "xyes"], [AC_MSG_ERROR("xpm header files was not found")], [with_x11="no"]) ],
[#include <X11/Xlib.h>
])
])
AS_IF([test "x$with_x11" != "xno"], [
AC_CHECK_LIB([Xpm], [XpmCreatePixmapFromData], [X11_LIBS="-lXpm -lX11 -L/usr/X11R6/lib"], [ AS_IF([test "x$with_x11" = "xyes"], [AC_MSG_ERROR(["Xpm/X11 not found (expected to be found in /usr/X11R6/lib)"])], [with_x11="no"]) ], [-lXpm -lX11 -L/usr/X11R6/lib])
LIBS=$push_LIBS
])
AS_IF([test "x$with_x11" != "xno"], [
AC_CHECK_LIB([Xext], [XShmQueryExtension], [X11_LIBS="-lXext $X11_LIBS"], [ AS_IF([test "x$with_x11" = "xyes"], [AC_MSG_ERROR(["SHM/X11 not found (expected to be found in /usr/X11R6/lib)"])], [with_x11="no"]) ], [-lX11 -lXext -L/usr/X11R6/lib])
LIBS=$push_LIBS
])
AS_IF([test "x$with_x11" != "xno"], [
AC_CHECK_LIB([Xxf86vm], [XF86VidModeQueryExtension], [X11_LIBS="-lXxf86vm $X11_LIBS"], [ AS_IF([test "x$with_x11" = "xyes"], [AC_MSG_ERROR(["xvidmode was not found (expected to be found in /usr/X11R6/lib)"]) ], [with_x11="no"]) ], [-lX11 -lXext -L/usr/X11R6/lib])
LIBS=$push_LIBS
])
AC_SUBST(HAVE_X11)
AS_IF([test "x$with_x11" = "xno"], [
X11_LIBS=
HAVE_X11=
],[
HAVE_X11=1
AC_DEFINE(HAVE_X11)
])
AS_IF([test "x$with_sdl" = "xyes" && test "x$with_sdl2" = "xyes"], [AC_MSG_ERROR("Can not use both --with-sdl and --with-sdl2")])
AS_IF([test "x$with_sdl" = "xyes"], [with_sdl2="no"])
AS_IF([test "x$with_sdl2" = "xyes"], [with_sdl="no"])
AC_SUBST(SDL2_CFLAGS)
AC_SUBST(SDL2_LIBS)
AS_IF([test "x$with_sdl2" != "xno"], [
AM_PATH_SDL2(["2.0.0"], [with_sdl2=yes], AS_IF([test "x$with_sdl2" = "xyes"], [AC_MSG_ERROR("libSDL2 was not found")], [with_sdl2="no"]) )
])
SDL2_CFLAGS=$SDL_CFLAGS
SDL2_LIBS=$SDL_LIBS
SDL_CFLAGS=
SDL_LIBS=
AC_SUBST(HAVE_SDL2)
AS_IF([test "x$with_sdl2" = "xno"],
[
HAVE_SDL2=
],[
HAVE_SDL2=1
AC_DEFINE(HAVE_SDL2)
with_sdl="no"
])
org_cflags="$CFLAGS"
org_cppflags="$CPPFLAGS"
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
AS_IF([test "x$with_sdl" != "xno"],[
PKG_CHECK_MODULES([SDL],[sdl],[],[
dnl Fall back to non-pkg-config method
AC_CHECK_LIB([SDL], [SDL_Init], [SDL_LIBS="-lSDL"], [ AS_IF([test "x$with_sdl" = "xyes"],[AC_MSG_ERROR("libSDL was not found")],[with_sdl="no"]) ])
AS_IF([test "x$with_sdl" != "xno"],[
CFLAGS="$CFLAGS -I/usr/include/SDL"
CPPFLAGS="$CPPFLAGS -I/usr/include/SDL"
AC_CHECK_HEADER([SDL.h], [SDL_CFLAGS="-I/usr/include/SDL"], [ AS_IF([test "x$with_sdl" = "xyes"], [AC_MSG_ERROR("SDL header files not found")],[with_sdl="no"]) ])
])
])
])
AC_SUBST(HAVE_SDL)
AS_IF([test "x$with_sdl" = "xno"],[
HAVE_SDL=
],[
HAVE_SDL=1
AC_DEFINE(HAVE_SDL)
])
CFLAGS="$org_cflags"
CPPFLAGS="$org_cflags"
AC_SUBST(FREETYPE2_LIBS)
AC_SUBST(FREETYPE2_CFLAGS)
AS_IF([test "x$HAVE_SDL" = "x1" || test "x$HAVE_SDL2" = "x1" || test "x$HAVE_X11" = "x1"],[
PKG_CHECK_MODULES([FREETYPE2],[freetype2],[],[
dnl Fall back to non-pkg-config method
AC_CHECK_LIB([freetype], [FT_Init_FreeType], [],[AC_MSG_ERROR("libfreetype not found")])
AC_CHECK_HEADER([ft2built.h], [] , [AC_MSG_ERROR("libfreetype header files was not found")])
])
AS_IF([test "x$with_unifont_relative" != xyes],
[
AS_AC_EXPAND_WITH_DEBUG(UNIFONT_TTF, $with_unifont_ttf, UNIFONT_TTF_DEBUG)
AS_AC_EXPAND_WITH_DEBUG(UNIFONT_OTF, $with_unifont_otf, UNIFONT_OTF_DEBUG)
AS_AC_EXPAND_WITH_DEBUG(UNIFONT_UPPER_TTF, $with_unifont_upper_ttf, UNIFONT_UPPER_TTF_DEBUG)
AS_AC_EXPAND_WITH_DEBUG(UNIFONT_UPPER_OTF, $with_unifont_upper_otf, UNIFONT_UPPER_OTF_DEBUG)
dnl CSUR is optional, since some distributions skip this file due to the scripts not being part of unicode standard
AS_IF([test "x$with_unifont_csur_ttf" != "xno"],[
AS_AC_EXPAND_WITH_DEBUG(UNIFONT_CSUR_TTF, $with_unifont_csur_ttf, UNIFONT_CSUR_TTF_DEBUG)
])
AS_IF([test "x$with_unifont_csur_otf" != "xno"],[
AS_AC_EXPAND_WITH_DEBUG(UNIFONT_CSUR_OTF, $with_unifont_csur_otf, UNIFONT_CSUR_OTF_DEBUG)
])
dnl remove double slashes
UNIFONT_TTF=`echo "$UNIFONT_TTF" | sed 's/\(\)\/\/*/\1\//g'`
UNIFONT_OTF=`echo "$UNIFONT_OTF" | sed 's/\(\)\/\/*/\1\//g'`
UNIFONT_UPPER_TTF=`echo "$UNIFONT_UPPER_TTF" | sed 's/\(\)\/\/*/\1\//g'`
UNIFONT_UPPER_OTF=`echo "$UNIFONT_UPPER_OTF" | sed 's/\(\)\/\/*/\1\//g'`
AS_IF([test "x$with_unifont_csur_ttf" != "xno"],[
UNIFONT_CSUR_TTF=`echo "$UNIFONT_CSUR_TTF" | sed 's/\(\)\/\/*/\1\//g'`
])
AS_IF([test "x$with_unifont_csur_otf" != "xno"],[
UNIFONT_CSUR_OTF=`echo "$UNIFONT_CSUR_OTF" | sed 's/\(\)\/\/*/\1\//g'`
])
AS_IF([test "x$cross_compiling" = "xyes"],[AC_MSG_NOTICE([Unable to verify unifont files due to cross-compilation])],[
AC_CHECK_FILE([$UNIFONT_TTF], [got_unifont_ttf=yes], [got_unifont_ttf=no])
AC_CHECK_FILE([$UNIFONT_OTF], [got_unifont_otf=yes], [got_unifont_otf=no])
AC_CHECK_FILE([$UNIFONT_UPPER_TTF], [got_unifont_upper_ttf=yes], [got_unifont_upper_ttf=no])
AC_CHECK_FILE([$UNIFONT_UPPER_OTF], [got_unifont_upper_otf=yes], [got_unifont_upper_otf=no])
AS_IF([test "x$with_unifont_csur_ttf" != "xno"],[
AC_CHECK_FILE([$UNIFONT_CSUR_TTF], [got_unifont_csur_ttf=yes], [got_unifont_csur_ttf=no])
])
AS_IF([test "x$with_unifont_csur_otf" != "xno"],[
AC_CHECK_FILE([$UNIFONT_CSUR_OTF], [got_unifont_csur_otf=yes], [got_unifont_csur_otf=no])
])
])
AC_DEFINE_UNQUOTED([UNIFONT_TTF], "$UNIFONT_TTF")
AC_DEFINE_UNQUOTED([UNIFONT_OTF], "$UNIFONT_OTF")
AC_DEFINE_UNQUOTED([UNIFONT_UPPER_TTF], "$UNIFONT_UPPER_TTF")
AC_DEFINE_UNQUOTED([UNIFONT_UPPER_OTF], "$UNIFONT_UPPER_OTF")
AS_IF([test x$with_unifont_csur_ttf != "xno"],[
AC_DEFINE_UNQUOTED([UNIFONT_CSUR_TTF], "$UNIFONT_CSUR_TTF")
])
AS_IF([test x$with_unifont_csur_otf != "xno"],[
AC_DEFINE_UNQUOTED([UNIFONT_CSUR_OTF], "$UNIFONT_CSUR_OTF")
])
AS_IF([test "x$cross_compiling" != "xyes"],[
AS_IF([test "x$got_unifont_ttf" = "xno" &&
test "x$got_unifont_otf" = "xno"],[
AC_MSG_ERROR([Unable to locate unifont.ttf/unifont.otf (needed by X11, SDL1.x and SDL2). Following paths were tested:
$UNIFONT_TTF_DEBUG
$UNIFONT_OTF_DEBUG
Please use --with-unifontdir-ttf=/dir/ or
--with-unifontdir-otf=/dir/ or
--with-unifont-ttf=/dir/file or
--with-unifont-otf=/dir/file or
maybe adjust --prefix or --datarootdir])])
AS_IF([test "x$with_unifont_csur_ttf" != "xno" &&
test "x$with_unifont_csur_otf" != "xno" &&
test "x$got_unifont_csur_ttf" = "xno" &&
test "x$got_unifont_csur_otf" = "xno"],[AC_MSG_WARN([Unable to locate unifont_csur.ttf/unifont_csur.otf (optionally needed by X11, SDL1.x and SDL2). Following paths were tested:
$UNIFONT_CSUR_TTF_DEBUG
$UNIFONT_CSUR_OTF_DEBUG
Please use --with-unifontdir-ttf=/dir/ or
--with-unifontdir-otf=/dir/ or
--with-unifont-csur-ttf=/dir/file or
--with-unifont-csur-otf=/dir/file or
disable the optional CSUR by using --without-unifont-csur-ttf and --without-unifont-csur-otf])])
AS_IF([test "x$got_unifont_upper_ttf" = "xno" &&
test "x$got_unifont_upper_otf" = "xno"],[AC_MSG_ERROR([Unable to locate unifont_upper.ttf/unifont_upper.otf (needed by X11, SDL1.x and SDL2). Following paths were tested:
$UNIFONT_UPPER_TTF_DEBUG
$UNIFONT_UPPER_OTF_DEBUG
Please use --with-unifontdir-ttf=/dir/ or
--with-unifontdir-otf=/dir/ or
--with-unifont-upper-ttf=/dir/file or
--with-unifont-upper-otf=/dir/file or
maybe adjust --prefix or --datarootdir])])
])
], [
AC_DEFINE([UNIFONT_RELATIVE], [1])
UNIFONT_TTF="relative to ocp executable"
UNIFONT_CSUR_TTF="relative to ocp executable"
UNIFONT_UPPER_TTF="relative to ocp executable"
UNIFONT_OTF="relative to ocp executable"
UNIFONT_CSUR_OTF="relative to ocp executable"
UNIFONT_UPPER_OTF="relative to ocp executable"
])
])
dnl This is for external libbinio + adplug
dnl AC_LANG_PUSH(C++)
dnl org_cxxflags="$CXXFLAGS"
dnl org_cppflags="$CPPFLAGS"
dnl AC_SUBST(ADPLUG_CXXFLAGS)
dnl AC_SUBST(ADPLUG_LIBS)
dnl AS_IF([test "x$with_adplug" != "xno"],[
dnl PKG_CHECK_MODULES([ADPLUG],[adplug],[ADPLUG_CXXFLAGS=$ADPLUG_CFLAGS],[
dnl dnl Fall back to non-pkg-config method
dnl AC_CHECK_HEADER([adplug/adplug.h], [], [with_adplug_failed=yes])
dnl AS_IF([test "x$with_adplug_failed" = "xyes"],[
dnl CXXFLAGS="$CXXFLAGS -I/usr/include/libbinio"
dnl CPPFLAGS="$CPPFLAGS -I/usr/include/libbinio"
dnl unset ac_cv_header_adplug_adplug_h
dnl AC_MSG_NOTICE("Trying again with -I/usr/include/libbinio")
dnl AC_CHECK_HEADER([adplug/adplug.h],
dnl [ADPLUG_CXXFLAGS="-I/usr/include/libbinio"],
dnl [ AS_IF([test "x$with_adplug" = "xyes"], [AC_MSG_ERROR("Adplug header files was not found")], [with_adplug="no"]) ]
dnl )
dnl ])
dnl AS_IF([test "x$with_adplug" != "xno"],[
dnl AC_CHECK_LIB([adplug], [docell0], [ADPLUG_LIBS="-ladplug"], [ AS_IF([test "x$with_adplug" = "xyes"], [AC_MSG_ERROR("Adplug was not found")], [with_adplug="no"]) ])
dnl LIBS=$push_LIBS
dnl ])
dnl ])
dnl ])
dnl CXXFLAGS="$org_cxxflags"
dnl CPPFLAGS="$org_cppflags"
dnl AS_IF([test "x$with_adplug" != "xno"],[
dnl AC_MSG_CHECKING([If AdPlug was compiled with another C++ ABI])
dnl CXXFLAGS="$CXXFLAGS $ADPLUG_CXXFLAGS"
dnl LIBS="$LIBS $ADPLUG_LIBS"
dnl
dnl AC_LINK_IFELSE(
dnl [AC_LANG_PROGRAM([[#include <adplug/emuopl.h>]],[[CEmuopl opl = CEmuopl(48000, 1, 1);]])],
dnl [],
dnl [AC_MSG_ERROR("Adplug was compiled with a different c++ compiler")]
dnl )
dnl
dnl AC_RUN_IFELSE(
dnl [AC_LANG_PROGRAM([[
dnl #include <adplug/adplug.h>
dnl #include <adplug/players.h>
dnl #include <adplug/player.h>
dnl ]],[[
dnl int j;
dnl CPlayers::const_iterator i;
dnl
dnl for (i = CAdPlug::players.begin(); i != CAdPlug::players.end(); i++)
dnl {
dnl for (j = 0; (*i)->get_extension(j); j++)
dnl {
dnl if (CFileProvider::extension("OPL", (*i)->get_extension(j)))
dnl {
dnl return 0;
dnl }
dnl }
dnl }
dnl return 0;
dnl ]]
dnl )],
dnl [AC_MSG_RESULT([ok])],
dnl [AC_MSG_ERROR("Adplug was compiled with a different c++ compiler")],
dnl [AC_MSG_NOTICE("Unable to test due to cross-compilation")]
dnl )
dnl LIBS=$push_LIBS
dnl CXXFLAGS="$org_cxxflags"
dnl CPPFLAGS="$org_cppflags"
dnl ])
dnl
dnl AS_IF([test "x$with_adplug" != "xno"],[
dnl AC_MSG_CHECKING([If libbinio used by AdPlug contains bugs https://github.com/adplug/libbinio/issues/2])
dnl CXXFLAGS="$CXXFLAGS $ADPLUG_CXXFLAGS"
dnl LIBS="$LIBS $ADPLUG_LIBS"
dnl
dnl AC_RUN_IFELSE(
dnl [AC_LANG_PROGRAM([[
dnl #include <binio.h>
dnl #include <binstr.h>
dnl #include <cstdlib>
dnl #include <string.h>
dnl #include <string.h>
dnl ]],[[
dnl binisstream *f = new binisstream((void *)"foobar", 6);
dnl long size;
dnl char test[6] = {1,2,3,4,5,6};
dnl
dnl f->seek(0, binio::End);
dnl size = f->pos();
dnl f->seek(0);
dnl
dnl if (f->readString(test, size) != 6) return -1;
dnl
dnl /* test should contain "foobar" if all is correct */
dnl return memcmp(test, "foobar", 6);
dnl ]])],
dnl [AC_MSG_RESULT([ok])],
dnl [AC_MSG_ERROR("libbinio fails to use memoryobjects")],
dnl [AC_MSG_NOTICE("Unable to test due to cross-compilation")]
dnl )
dnl LIBS=$push_LIBS
dnl CXXFLAGS="$org_cxxflags"
dnl CPPFLAGS="$org_cppflags"
dnl ])
dnl
dnl AC_SUBST(HAVE_ADPLUG)
dnl AC_SUBST(ADPLUG_INI)
dnl AS_IF([test "x$with_adplug" = "xno"],[
dnl HAVE_ADPLUG=
dnl ADPLUG_INI=
dnl ],[
dnl HAVE_ADPLUG=1
dnl ADPLUG_INI=opltype
dnl ])
dnl AC_LANG_POP()
dnl This is for builtin libbinio + adplug
# Conditionally build iostream wrappers
AC_LANG_PUSH(C++)
origCXX="$CXX"
origCXXFLAGS="$CXXFLAGS"
AX_CXX_COMPILE_STDCXX_14([noext], [optional])
AS_IF([test $ax_cv_cxx_compile_cxx14__std_cpp14 != "yes"],
AX_CXX_COMPILE_STDCXX_11([noext], [optional]),
)
AC_SUBST(ADPLUG_CXX)
AC_SUBST(ADPLUG_CXXFLAGS)
ADPLUG_CXX="$CXX"
ADPLUG_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$origCXXFLAGS"
CXX="$origCXX"
AC_ARG_ENABLE([iostream], AS_HELP_STRING([--disable-iostream],[ADPLUG: Do not build iostream wrapper streams]))
AS_IF([test ${enable_iostream:=yes} = yes], [
AC_CHECK_LIB(stdc++,main, AC_SUBST(ENABLE_IOSTREAM,1),
AC_SUBST(ENABLE_IOSTREAM,0))
],[
AC_SUBST(ENABLE_IOSTREAM,0)
])
# Conditionally build std::string methods
AC_ARG_ENABLE([string], AS_HELP_STRING([--disable-string],[ADPLUG: Do not build std::string methods]))
AS_IF([test ${enable_string:=yes} = yes], [
AC_CHECK_LIB(stdc++, main, AC_SUBST(ENABLE_STRING,1),
AC_SUBST(ENABLE_STRING,0))
],[
AC_SUBST(ENABLE_STRING,0)
])
AS_IF([test x${with_iso} = xyes], [
AC_SUBST(ISO_STDLIB,1)
],[
AS_IF([test x${with_iso} = xno], [
AC_SUBST(ISO_STDLIB,0)
],[
AC_CHECK_TYPE([std::basic_istream<char>],
AC_SUBST(ISO_STDLIB,1),
AC_SUBST(ISO_STDLIB,0),
[
AC_LANG_SOURCE([
#include <iostream>
]) ] )
])
])
AC_ARG_WITH([math],AS_HELP_STRING([--without-math],[ADPLUG: Do not build routines depending on 'math.h']))
AS_IF([test ${with_math:=yes} = yes], [
AC_CHECK_FUNC(ldexp, AC_SUBST(WITH_MATH,1), AC_SUBST(WITH_MATH,0))
],[
AC_SUBST(WITH_MATH,0)
])
# Check if 'long long' or 'long double' are available and use them instead.
AC_CHECK_TYPE(long long, AC_SUBST(TYPE_INT,"long long"), AC_SUBST(TYPE_INT,long))
AC_CHECK_TYPE(long double, AC_SUBST(TYPE_FLOAT,"long double"), AC_SUBST(TYPE_FLOAT,double))
AC_SUBST(HAVE_ADPLUG)
AC_SUBST(ADPLUG_INI)
HAVE_ADPLUG=1
ADPLUG_INI=opltype
AC_SUBST(VERSION, "2.3.4-beta") dnl this name is risky!!
AC_LANG_POP()
dnl Adplug+libbinio complete
dnl SIDPLAY specifics
AC_MSG_CHECKING([GIT submodules are checked out])
AS_IF([test -f playsid/libsidplayfp-git/src/sidemu.cpp], [ AS_IF([test -f playsid/libsidplayfp-git/src/builders/resid-builder/resid/sid.h], [],
[AC_MSG_ERROR([playsid/libsidplayfp-git/src/builders/resid-builder/resid is missing - please execute 'git submodule update --init --recursive'])] )],
[AC_MSG_ERROR([playsid/libsidplayfp-git is missing - please execute 'git submodule update --init --recursive'])]
)
AC_MSG_RESULT([ok])
origCXX="$CXX"
origCXXFLAGS="$CXXFLAGS"
AC_LANG_PUSH([C++])
HAVE_SIDPLAYFP_BUILDERS_RESIDFP_H=1
HAVE_SIDPLAYFP_BUILDERS_RESID_H=1
RESID_INLINING=1
RESID_INLINE=inline
AX_CXX_COMPILE_STDCXX_17([noext], [optional])
AS_IF([test $ax_cv_cxx_compile_cxx17__std_cpp17 == "yes"],
[AC_DEFINE([HAVE_CXX17])],
[AX_CXX_COMPILE_STDCXX_14([noext], [optional])
AS_IF([test $ax_cv_cxx_compile_cxx14__std_cpp14 == "yes"],
[AC_DEFINE([HAVE_CXX14])],
[AX_CXX_COMPILE_STDCXX_11([noext], [optional])
AS_IF([test $ax_cv_cxx_compile_cxx11__std_cpp11 == "yes"],
[AC_DEFINE([HAVE_CXX11])])
])
])
AC_ARG_VAR([XA], [6502 assembler - must be full path])
AC_PATH_PROG([XA],[xa])
AS_IF([test -z "$XA"], [AC_MSG_ERROR([xa is needed for compiling 6502 assembler used by libsidplayfp])])
AC_PATH_PROG([HEXDUMP],[hexdump])
AS_IF([test -z "$HEXDUMP"], [AC_MSG_ERROR([hexdump is needed for compiling libsidplayfp])])
AC_PATH_PROG([PERL], [perl])
AS_IF([test -z "$PERL"], [AC_MSG_ERROR([perl is needed for compiling libsidplayfp])])
dnl TODO HAVE_VISIBILITY
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden -fvisibility-inlines-hidden], [HAVE_VISIBILITY=1;has_visibility=yes], [has_visibility=no])
AC_CHECK_SIZEOF([short])
AC_CHECK_SIZEOF([int])
AS_IF([test $ac_cv_sizeof_short -ne 2], [AC_MSG_ERROR([LIBSIDPLAYFP: size of short must be 16 bit])])
AS_IF([test $ac_cv_sizeof_int -lt 4], [AC_MSG_ERROR([LIBSIDPLAYFP: only 32 bit or better CPUs are supported])])
AS_IF([test "x${ac_cv_header_stdint_h}" != "xyes"], [AC_MSG_ERROR([Required header stdint.h not found])])
AC_CHECK_DECL(
[strcasecmp],
[AC_CHECK_FUNCS([strcasecmp])],
[AC_CHECK_DECL(
[stricmp],
[AC_CHECK_FUNCS([stricmp])]
)]
)
AC_CHECK_DECL(
[strncasecmp],
[AC_CHECK_FUNCS([strncasecmp])],
[AC_CHECK_DECL(
[strnicmp],
[AC_CHECK_FUNCS([strnicmp])]
)]
)
AC_CACHE_CHECK([for working bool], ac_cv_cxx_bool,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],
[[bool flag;]])],
[ac_cv_cxx_bool=yes],
[ac_cv_cxx_bool=no])]
)
AS_IF([test "x$ac_cv_cxx_bool" = "xno"], [HAVE_BOOL=0], [HAVE_BOOL=1])
dnl TODO RESID_BRANCH_HINTS
dnl Enable branch prediction hints.
AC_ARG_ENABLE([branch-hints],
[AS_HELP_STRING([--enable-branch-hints],
[enable static branch prediction hints [default=yes]])],
[],
[enable_branch_hints=yes]
)
AS_IF([test "$enable_branch_hints" != no], [RESID_BRANCH_HINTS=1], [RESID_BRANCH_HINTS=0])
AC_CACHE_CHECK([for log1p], [resid_cv_log1p],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[ log1p(1); ]])],[resid_cv_log1p=yes],[resid_cv_log1p=no])])
AS_IF([test "$resid_cv_log1p" = no], [HAVE_LOG1P=0], [HAVE_LOG1P=1])
AC_CACHE_CHECK([for __builtin_expect], [resid_cv_builtin_expect],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() { __builtin_expect(0, 0); }])],
[resid_cv_builtin_expect=yes], [resid_cv_builtin_expect=no])]
)
AS_IF([test "$resid_cv_builtin_expect" = no], [HAVE_BUILTIN_EXPECT=0], [HAVE_BUILTIN_EXPECT=1])
LIBSIDPLAYCXX="$CXX -DHAVE_CONFIG_H=1 -DSIDTUNE_NO_STDIN_LOADER=1 -DPACKAGE_NAME=\\\"sidplayfp\\\" -DVERSION=\\\"2.5.10\\\" -DPACKAGE_VERSION=\\\"2.5.10-1\\\" -DPACKAGE_URL=\\\"\\\""
LIBSIDPLAYCXXFLAGS="$CXXFLAGS"
AC_SUBST(LIBSIDPLAYCXX)
AC_SUBST(LIBSIDPLAYCXXFLAGS)
AC_LANG_POP
CXX=$origCXX
CXXFLAGS=$origCXXFLAGS
NEW_8580_FILTER=0
AC_SUBST(HAVE_BOOL)
AC_SUBST(HAVE_LOG1P)
AC_SUBST(HAVE_BUILTIN_EXPECT)
AC_SUBST(RESID_INLINING)
AC_SUBST(RESID_INLINE)
AC_SUBST(RESID_BRANCH_HINTS)
AC_SUBST(NEW_8580_FILTER)
AC_SUBST(HAVE_SIDPLAYFP_BUILDERS_RESIDFP_H)
AC_SUBST(HAVE_SIDPLAYFP_BUILDERS_RESID_H)
PKG_CHECK_MODULES([LIBDISCID],[libdiscid],[],[AC_MSG_ERROR([libdiscid not found])])
PKG_CHECK_MODULES([LIBCJSON],[libcjson],[],[AC_MSG_ERROR([libcjson not found])])
AS_IF([test "x$with_alsa" != "xno"],[
PKG_CHECK_MODULES([ALSA],[alsa],[],[
AS_IF([test "x$with_alsa" = "xyes"], [AC_MSG_ERROR([pkg-config failed])], [with_alsa="no"])
])
])
PKG_CHECK_MODULES([LIBANCIENT],[libancient],[],[AC_MSG_ERROR([libancient not found])])
origCXX="$CXX"
AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])
AC_SUBST(LIBANCIENT_CXX)
LIBANCIENT_CXX="$CXX"
CXX="$origCXX"
AC_SUBST(HAVE_ALSA)
AS_IF([test "x$with_alsa" = "xno"],[HAVE_ALSA=],[HAVE_ALSA=1])
AC_SUBST(LINUX)
AC_SUBST(CDROM_SUPPORT)
AC_SUBST(X11_LIBS)
AC_SUBST(CDROM_INI)
AC_SUBST(HAVE_FRAMEBUFFER)
HAVE_FRAMEBUFFER=1
LINUX=1
AC_CHECK_HEADER([linux/limits.h], [], [AC_MSG_RESULT([linux kernel header files was not found]);LINUX=])
AS_IF([test "$LINUX+set" != "+set"], [ AC_CHECK_HEADER([linux/major.h], [], [AC_MSG_RESULT([linux kernel header files was not found]);LINUX=]) ])
AS_IF([test "$LINUX+set" != "+set"], [ AC_CHECK_HEADER([linux/fb.h], [AC_DEFINE(HAVE_FRAMEBUFFER)], [AC_MSG_RESULT([linux kernel header files was not found]);LINUX=;HAVE_FRAMEBUFFER=]) ])
AS_IF([test "$LINUX+set" != "+set"], [ AC_CHECK_HEADER([linux/cdrom.h], [CDROM_SUPPORT=1;CDROM_INI="cdrom"], [AC_MSG_RESULT([linux cdrom kernel header files was not found])]) ])
AC_SUBST(HAVE_OSS)
AC_SUBST(OSS_LIBS)
AC_SUBST(OSS_CFLAGS)
AS_IF([test "x$with_oss" != "xno"], [
PKG_CHECK_MODULES([OSS],[oss],[HAVE_OSS=1],[
dnl Fall back to non-pkg-config method (Normal for Linux systems)
AC_CHECK_HEADER([sys/soundcard.h],
[HAVE_OSS=1;AC_DEFINE(HAVE_SYS_SOUNDCARD_H)],
[ AS_IF([test "x$with_oss" = "xyes"], [AC_MSG_ERROR([kernel OSS header file was not found], 1)],[with_oss="no";HAVE_OSS=]) ]
)
])
])
AC_SUBST(HAVE_COREAUDIO)
AC_SUBST(COREAUDIO_CFLAGS)
AC_SUBST(COREAUDIO_LIBS)
AS_IF([test "x$with_coreaudio" != "xno"],[
AC_CHECK_HEADER([CoreServices/CoreServices.h], [HAVE_COREAUDIO=1], [ AS_IF([test "x$with_coreaudio" = "xyes"], [AC_MSG_ERROR([CoreAudio not found], 1)], [with_coreaudio="no"; HAVE_COREAUDIO=]) ])
])
AS_IF([test "x$with_coreaudio" != "xno"],[
AC_CHECK_HEADER([AudioUnit/AudioUnit.h], [HAVE_COREAUDIO=1], [ AS_IF([test "x$with_coreaudio" = "xyes"], [AC_MSG_ERROR([CoreAudio not found], 1)], [with_coreaudio="no"; HAVE_COREAUDIO=]) ])
])
AS_IF([test "x$with_coreaudio" != "xno"],[
AC_CHECK_HEADER([AudioToolbox/AudioToolbox.h], [HAVE_COREAUDIO=1], [ AS_IF([test "x$with_coreaudio" = "xyes"], [AC_MSG_ERROR([CoreAudio not found], 1)], [with_coreaudio="no"; HAVE_COREAUDIO=]) ])
])
AS_IF([test "x$with_coreaudio" != "xno"],[
AC_CHECK_HEADER([CoreAudio/CoreAudio.h], [HAVE_COREAUDIO=1], [ AS_IF([test "x$with_coreaudio" = "xyes"], [AC_MSG_ERROR([CoreAudio not found], 1)], [with_coreaudio="no"; HAVE_COREAUDIO=]) ])
])
AS_IF([test "x$with_coreaudio" != "xno"],[
COREAUDIO_CFLAGS=""
COREAUDIO_LIBS="-framework CoreAudio -framework Carbon -framework AudioUnit"