-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure.ac
1142 lines (1011 loc) · 36.4 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
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([Exult], [1.5.0git], ,[exult], [http://exult.sourceforge.net/])
AC_CONFIG_SRCDIR([exult.cc])
# ---------------------------------------------------------------------
# System/version info
# ---------------------------------------------------------------------
# check host/target systems
# (build = system we're building on, host = system we're building for,
# target = system the program we're building will build for)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package Name])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package Version])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
AH_BOTTOM([
#define USE_FMOPL_MIDI
])
# ---------------------------------------------------------------------
# Host system settings
# ---------------------------------------------------------------------
AC_EXEEXT
SYSLIBS=""
ICON_FILE=""
EXE_TARGET="exult$EXEEXT"
EXULT_DATADIR="$datadir/exult"
ARCH=""
# Default C anc C++ compiler set
cxx_compilers="g++ clang++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC"
# determine windowing system from 'host'
AC_MSG_CHECKING([windowing system])
case "$host_os" in
linux*)
WINDOWING_SYSTEM="-DXWIN"
AC_MSG_RESULT([X11 (GNU/Linux)])
;;
mingw32* )
WINDOWING_SYSTEM="-DWIN32"
AC_MSG_RESULT([Win32 (mingw32)])
SYSLIBS="-lwinmm -lstdc++"
ICON_FILE="win32/exultico.o"
enable_timidity="no"
;;
cygwin* )
WINDOWING_SYSTEM="-DWIN32"
AC_DEFINE(CYGWIN, 1, [Using Cygwin])
AC_MSG_RESULT([Win32 (cygwin)])
CXXFLAGS="$CXXFLAGS -mno-cygwin"
SYSLIBS="-lwinmm"
ICON_FILE="win32/exultico.o"
enable_timidity="no"
;;
openbsd* )
WINDOWING_SYSTEM="-DXWIN"
AC_DEFINE(OPENBSD, 1, [Using OpenBSD])
AC_MSG_RESULT([X11 (OpenBSD)])
SYSLIBS="-L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXxf86dga"
;;
freebsd* )
WINDOWING_SYSTEM="-DXWIN"
AC_DEFINE(NETBSD, 1, [Using NetBSD])
AC_MSG_RESULT([X11 (FreeBSD)])
CXXFLAGS="$CXXFLAGS -I/usr/local/include"
;;
netbsd* )
WINDOWING_SYSTEM="-DXWIN"
AC_MSG_RESULT([X11 (NetBSD)])
CXXFLAGS="$CXXFLAGS -I/usr/X11R6/include"
;;
solaris* )
WINDOWING_SYSTEM="-DXWIN"
AC_MSG_RESULT([X11 (Solaris)])
SYSLIBS="-lsocket -lX11"
;;
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. Plain Darwin will propably
dnl use X-Windows; and it is of course lacking Cocoa. For
dnl now I am lazy and do not add proper detection code.
WINDOWING_SYSTEM="-DMACOSX"
AC_DEFINE(MACOSX, 1, [Using MacOSX])
AC_MSG_RESULT([Mac OS X])
SYSLIBS="-framework CoreFoundation -framework AudioUnit -framework AudioToolbox -framework CoreMIDI"
CXXFLAGS="$CXXFLAGS"
EXULT_DATADIR="/Library/Application\ Support/Exult/data"
ARCH=macosx
dnl swap around clang for OSX
cxx_compilers="clang++ g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC"
;;
*)
WINDOWING_SYSTEM="-DXWIN"
AC_MSG_RESULT([not sure... guessing X11])
;;
esac
AM_CONDITIONAL(MACOSX, test x$ARCH = xmacosx)
# ---------------------------------------------------------------------
# Compilers and other tools
# ---------------------------------------------------------------------
AC_PROG_AWK
AC_ARG_WITH(cxx, AS_HELP_STRING([--with-cxx=COMMAND], [Explicitly specify the C++ compiler to use]),[WITHCXX="$withval"],[WITHCXX="$CXX"])
if test "x$WITHCXX" != "x"; then
cxx_compilers="$WITHCXX"
fi
AC_PROG_CXX([$cxx_compilers])
AC_LANG([C++])
# TODO: Maybe making a function to do these.
# Lets clean up CFLAGS of -O[0-3gs]? and -g[0-3]?
for ccflag in $CFLAGS; do
AS_CASE([$ccflag],
[-O|-O0|-O1|-O2|-O3|-Os|-Og|-g|-g1|-g2|-g3], [],
[NEWCFLAGS="$NEWCFLAGS $ccflag"])
done
CFLAGS="$NEWCFLAGS"
# Lets clean up CXXFLAGS of -O[0-3gs]? and -g[0-3]?
for cxxflag in $CXXFLAGS; do
AS_CASE([$cxxflag],
[-O|-O0|-O1|-O2|-O3|-Os|-Og|-g|-g1|-g2|-g3], [],
[NEWCXXFLAGS="$NEWCXXFLAGS $cxxflag"])
done
CXXFLAGS="$NEWCXXFLAGS"
AX_CXX_COMPILE_STDCXX_17([noext],[optional])
if test "$HAVE_CXX17" = "0"; then
AX_CXX_COMPILE_STDCXX_14([noext],[mandatory])
fi
AC_PROG_CXXCPP
AC_PROG_INSTALL
AM_PROG_LEX
AC_PROG_YACC
AM_CONDITIONAL(LEXYACC, test -n "$YACC")
AM_DISABLE_SHARED
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
# ---------------------------------------------------------------------
# Checks for integer types with specific sizes.
# ---------------------------------------------------------------------
AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t])
AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t])
# ---------------------------------------------------------------------
# Check sizes of integer types, in case the above fail.
# ---------------------------------------------------------------------
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(int*)
# ---------------------------------------------------------------------
# Checks for header files.
# ---------------------------------------------------------------------
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h sys/time.h unistd.h)
AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
AC_CHECK_HEADERS(sys/wait.h signal.h)
AC_CHECK_HEADERS(png.h, AM_CONDITIONAL(HAVE_PNG,true), AM_CONDITIONAL(HAVE_PNG, false))
AC_CHECK_HEADERS(sstream)
AC_CHECK_HEADERS(unordered_map, [], AC_DEFINE(DONT_HAVE_HASH_MAP, 1, [Doesn't have hash map]))
AC_CHECK_HEADERS(unordered_set, [], AC_DEFINE(DONT_HAVE_HASH_SET, 1, [Doesn't have hash set]))
# ---------------------------------------------------------------------
# Checks for typedefs, structures, and compiler characteristics.
# ---------------------------------------------------------------------
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
# ---------------------------------------------------------------------
# Checks for library functions
# ---------------------------------------------------------------------
dnl Disabled this for now (undefined in autoconf < 2.5)
dnl AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_CHECK_FUNCS([atexit dup2 getcwd isascii memchr memmove memset mkdir pow select socket strcasecmp strchr strstr strtol strtoul])
AC_MSG_CHECKING([for getaddrinfo()])
AC_TRY_COMPILE([
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_NETDB_H
#include <netdb.h>
#endif
],
[
struct addrinfo a;
//getaddrinfo(0, 0, 0, 0);
],
ac_cv_func_getaddrinfo=yes,
ac_cv_func_getaddrinfo=no)
AC_MSG_RESULT($ac_cv_func_getaddrinfo)
if test x$ac_cv_func_getaddrinfo = xyes ; then
AC_DEFINE(HAVE_GETADDRINFO, 1, [Have addrinfo/getaddrinfo])
fi
AC_MSG_CHECKING([for mkstemp()])
AC_TRY_LINK([
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
],
[
mkstemp(0);
],
ac_cv_func_mkstemp=yes,
ac_cv_func_mkstemp=no)
AC_MSG_RESULT($ac_cv_func_mkstemp)
if test x$ac_cv_func_mkstemp = xyes ; then
AC_DEFINE(HAVE_MKSTEMP, 1, [Have mkstemp])
fi
AC_MSG_CHECKING([for snprintf()])
AC_TRY_LINK([
#include <stdio.h>
],
[
snprintf(0,0,0,0);
],
ac_cv_func_snprintf=yes,
ac_cv_func_snprintf=no)
AC_MSG_RESULT($ac_cv_func_snprintf)
if test x$ac_cv_func_snprintf = xyes ; then
AC_DEFINE(HAVE_SNPRINTF, 1, [Have snprintf])
AM_CONDITIONAL(HAVE_SNPRINTF,true)
else
AM_CONDITIONAL(HAVE_SNPRINTF,false)
fi
# do we need special X11 libraries?
AC_MSG_CHECKING([for special X11 libraries])
if test x$x_libraries = xNONE; then
AC_MSG_RESULT(no)
unset x_libraries
else
x_libraries="-L$x_libraries -lX11 -lXext"
AC_MSG_RESULT($x_libraries)
AC_SUBST(x_libraries)
fi
# ---------------------------------------------------------------------
# Statically link libraries?
# ---------------------------------------------------------------------
AC_ARG_ENABLE(static-libraries, AS_HELP_STRING([--enable-static-libraries], [Enable static linking of libraries]),,enable_static_libs=no)
AC_MSG_CHECKING([if we want to statically compile libraries])
if test x$enable_static_libs != xno; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
# ---------------------------------------------------------------------
# Check for pkg-config
# ---------------------------------------------------------------------
PKG_PROG_PKG_CONFIG
# ---------------------------------------------------------------------
# SDL
# ---------------------------------------------------------------------
EXULT_CHECK_SDL(:,AC_MSG_ERROR([[*** SDL not found!]]))
# ---------------------------------------------------------------------
# libogg, libvorbis, libvorbisfile
# ---------------------------------------------------------------------
if test "x$PKG_CONFIG" != "x"; then
PKG_CHECK_MODULES(OGG, ogg >= 1.0 vorbis >= 1.0.1 vorbisfile, , AC_MSG_ERROR([*** must have Ogg/Vorbis installed!]))
else
dnl old school test
m4_ifdef([XIPH_PATH_OGG], [
XIPH_PATH_OGG(, AC_MSG_ERROR([*** must have Ogg installed!]))
], AC_MSG_ERROR([*** must have Ogg installed!]))
m4_ifdef([XIPH_PATH_VORBIS], [
XIPH_PATH_VORBIS(, AC_MSG_ERROR([*** must have Vorbis installed!]))
], AC_MSG_ERROR([*** must have Vorbis installed!]))
fi
# ---------------------------------------------------------------------
# libglade (for ES)
# ---------------------------------------------------------------------
if test "x$PKG_CONFIG" != "x"; then
PKG_CHECK_MODULES(GLADE, libglade-2.0 >= 2.0, have_glade=yes, have_glade=no)
else
have_glade=no
fi
# ---------------------------------------------------------------------
# libgnomeui (for Gnome shp thumbnailer)
# ---------------------------------------------------------------------
if test "x$PKG_CONFIG" != "x"; then
PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0 >= 2.16, have_gnomeui=yes, have_gnomeui=no)
else
have_gnomeui=no
fi
# ---------------------------------------------------------------------
# Black magic for static linking.
# ---------------------------------------------------------------------
if test x$ARCH = xmacosx; then
AC_ARG_WITH(macosx-static-lib-path,
AS_HELP_STRING([--with-macosx-static-lib-path=path], [path to location of static library files (Mac OS X bundles only)]),
[with_macosx_static_lib_path="$withval"],
[with_macosx_static_lib_path=""])
if test x$with_macosx_static_lib_path != x; then
if test ! -d $with_macosx_static_lib_path; then
AC_MSG_ERROR([*** a directory is expected for --macosx-static-lib-path!])
fi
with_macosx_static_lib_path=`echo "$with_macosx_static_lib_path" | sed 's/\/*$//'`
else
enable_static_libs=no
fi
fi
if test x$enable_static_libs != xno; then
if test x$ARCH != xmacosx; then
# Assuming GCC. This is probably not portable.
STATIC_LD="-static"
LDFLAGS="$LDFLAGS -static"
else
# Apple has done its best to prevent the above from working, so we
# need this stuff here.
# Using -static doesn't work because of system libraries that cannot be
# linked statically; using the usual -Wl,-static -lvorbis -Wl,-dynamic
# also fails if there is a non-static version of libvorbis in the lib
# search path before or at the same location as the static lib because
# the linker tries to use these even with the flags. The only way to get
# reliable static compiles in Mac OS X is to hard-code the path to the
# static library and link to *that*.
# Damn you, Apple!
# SDL Mac OS X readme lists this as needed.
# We should have sdl-config by this point, or we would have
# died in EXULT_CHECK_SDL.
SDL_LIBS=`$SDL_CONFIG $sdl_config_args --static-libs`
OGG_LIBS="$with_macosx_static_lib_path/libogg.a"
VORBISFILE_LIBS="$with_macosx_static_lib_path/libvorbisfile.a"
VORBIS_LIBS="$with_macosx_static_lib_path/libvorbis.a -lm"
ZLIB_LIBS="$with_macosx_static_lib_path/libz.a"
fi
fi
# ---------------------------------------------------------------------
# Mac OS X code signing
# ---------------------------------------------------------------------
AM_CONDITIONAL(WITH_OSX_CODE_SIGNATURE, false)
AC_ARG_WITH(macosx-code-signature,
AS_HELP_STRING([--with-macosx-code-signature=identity], [identity for code signing (Mac OS X bundles only) @<:@default "Developer ID Application"@:>@]),
[with_macosx_code_signature="$withval"],
[with_macosx_code_signature=""])
if test x$ARCH = xmacosx; then
if test x"$with_macosx_code_signature" != x; then
if test x"$with_macosx_code_signature" = xyes; then
with_macosx_code_signature="Developer ID Application"
fi
AM_CONDITIONAL(WITH_OSX_CODE_SIGNATURE, true)
OSX_CODE_SIGNATURE="$with_macosx_code_signature"
AC_SUBST(OSX_CODE_SIGNATURE)
fi
fi
# ---------------------------------------------------------------------
# Optional components
# ---------------------------------------------------------------------
# Timidity midi driver
AC_ARG_ENABLE(timidity_midi, AS_HELP_STRING([--disable-timidity-midi], [Disable built-in timidity midi]),,enable_timidity_midi=yes)
AC_ARG_WITH(timidity, AS_HELP_STRING([--with-timidity=path], [path to timidity.cfg (optional)]),,)
AC_MSG_CHECKING([if we want to use timidity midi])
if test x$enable_timidity_midi = xyes; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_TIMIDITY_MIDI, 1, [Enable timidity midi])
if test x$with_timidity != x; then
if test ! -d $with_timidity; then
with_timidity=`echo "$with_timidity" | sed 's/timidity.cfg//'`
fi
AC_DEFINE_UNQUOTED(DEFAULT_TIMIDITY_PATH, "$with_timidity", [Default timidity path])
fi
else
AC_MSG_RESULT(no)
fi
# ALSA midi driver
AC_CHECK_HEADER(alsa/asoundlib.h, HAVEALSA=yes, HAVEALSA=no)
AC_ARG_ENABLE(alsa, AS_HELP_STRING([--disable-alsa], [Disable ALSA midi support]),,enable_alsa=yes)
AC_MSG_CHECKING([if we want to use ALSA midi])
if test x$HAVEALSA = xyes; then
if test x$enable_alsa = xyes; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_ALSA_MIDI, 1, [Enable ALSA midi])
LIBS="$LIBS -lasound"
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT([no; libasound not found])
fi
# fluidsynth midi driver
AC_CHECK_HEADER(fluidsynth.h, HAVEFLUIDSYNTH=yes, HAVEFLUIDSYNTH=no)
AC_ARG_ENABLE(fluidsynth, AS_HELP_STRING([--disable-fluidsynth], [Disable fluidsynth midi support]),,enable_fluidsynth=yes)
AC_MSG_CHECKING([if we want to use fluidsynth midi])
if test x$HAVEFLUIDSYNTH = xyes; then
if test x$enable_fluidsynth = xyes; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_FLUIDSYNTH_MIDI, 1, [Enable fluidsynth midi])
LIBS="$LIBS -lfluidsynth"
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT([no; fluidsynth.h not found])
fi
# mt32emu midi driver
AC_ARG_ENABLE(mt32emu, AS_HELP_STRING([--enable-mt32emu], [Enable built-in mt32emu support]),,enable_mt32emu=no)
AC_MSG_CHECKING([if we should build mt32emu])
if test x$enable_mt32emu = xyes; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_MT32EMU_MIDI, 1, [Enable mt32emu])
AM_CONDITIONAL(BUILD_MT32EMU, true)
else
AC_MSG_RESULT(no)
AM_CONDITIONAL(BUILD_MT32EMU, false)
fi
# zipped savegame support
AC_ARG_ENABLE(zip-support, AS_HELP_STRING([--enable-zip-support], [Enable zipped savegame support @<:@default yes@:>@]),,enable_zip_support=yes)
if test x$enable_zip_support = xyes ; then
AC_CHECK_HEADER(zlib.h,,enable_zip_support=no)
fi
AC_MSG_CHECKING([for zipped savegame support])
if test x$enable_zip_support = xyes ; then
# disabled for now (non-portable):
# link statically against zlib if using gcc
# if test x$GCC = xyes ; then
# ZLIB_LIBS="-Wl,-Bstatic -lz -Wl,-Bdynamic"
# else
if test x$enable_static_libs = xno -o x$ARCH != xmacosx; then
ZLIB_LIBS="-lz"
fi
# fi
AC_DEFINE(HAVE_ZIP_SUPPORT, 1, [Have zip support])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
# HQnX scaler
AC_ARG_ENABLE(all_hq_scalers, AS_HELP_STRING([--enable-all-hq-scalers], [Enable hq2x, hq3x, hq4x scaler support @<:@default yes@:>@]),,enable_all_hq_scalers=yes)
AC_MSG_CHECKING([if we should build all hq scaler])
if test x$enable_all_hq_scalers = xyes; then
enable_hq2x=yes
enable_hq3x=yes
enable_hq4x=yes
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
# HQ2X scaler
AC_ARG_ENABLE(hq2x, AS_HELP_STRING([--enable-hq2x],[Enable hq2x scaler support @<:@default no@:>@]),,enable_hq2x=no)
AC_MSG_CHECKING(if we should build the hq2x scaler)
if test x$enable_hq2x = xyes; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_HQ2X_SCALER, 1, [Build hq2x scaler])
else
AC_MSG_RESULT(no)
fi
# HQ3X scaler
AC_ARG_ENABLE(hq3x, AS_HELP_STRING([--enable-hq3x],[Enable hq3x scaler support @<:@default no@:>@]),,enable_hq3x=no)
AC_MSG_CHECKING(if we should build the hq3x scaler)
if test x$enable_hq3x = xyes; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_HQ3X_SCALER, 1, [Build hq3x scaler])
else
AC_MSG_RESULT(no)
fi
# HQ4X scaler
AC_ARG_ENABLE(hq4x, AS_HELP_STRING([--enable-hq4x],[Enable hq4x scaler support @<:@default no@:>@]),,enable_hq4x=no)
AC_MSG_CHECKING(if we should build the hq4x scaler)
if test x$enable_hq4x = xyes; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_HQ4X_SCALER, 1, [Build hq4x scaler])
else
AC_MSG_RESULT(no)
fi
# NxBR scalers
AC_ARG_ENABLE(nxbr, AS_HELP_STRING([--enable-nxbr],[Enable 2xBR, 3xBR and 4xBR scaler support @<:@default yes@:>@]),,enable_nxbr=yes)
AC_MSG_CHECKING([if we should build the 2xBR, 3xBR and 4xBR scalers])
if test x$enable_nxbr = xyes; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_XBR_SCALER, 1, [Build NxBR scalers])
else
AC_MSG_RESULT(no)
fi
# OpenGL rendering
AC_ARG_ENABLE(opengl, AS_HELP_STRING([--enable-opengl], [Enable OpenGL rendering support @<:@EXPERIMENTAL@:>@]),,enable_opengl=no)
if test x$enable_opengl = xyes; then
# Check for header presence. Damn you, Apple!
if test x$ARCH != xmacosx; then
AC_CHECK_HEADER(GL/gl.h,,enable_opengl=no)
else
AC_CHECK_HEADER(OpenGL/gl.h,,enable_opengl=no)
fi
# OpenGL scaler is broken with SDL2
if test x$sdl_ver = xsdl2; then
enable_opengl=no
fi
fi
AC_MSG_CHECKING([for OpenGL rendering support])
if test x$enable_opengl = xyes ; then
AC_DEFINE(HAVE_OPENGL, 1, [Have OpenGL])
# Mac OS X gets OpenGL through a framework.
if test x$ARCH != xmacosx; then
OPENGL_LIBS="-lGL"
else
OPENGL_LIBS="-framework OpenGL"
fi
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
# Midi Sfx
AC_ARG_ENABLE(midi-sfx, AS_HELP_STRING([--enable-midi-sfx], [Support for Midi Sfx (sounds horrible) @<:@default no@:>@]),,enable_midi_sfx=no)
AC_MSG_CHECKING([whether to enable midi sfx])
if test x$enable_midi_sfx = xyes; then
AC_DEFINE(ENABLE_MIDISFX, 1, [Enable Midi Sfx])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
# ---------------------------------------------------------------------
# support for Exult Studio
# ---------------------------------------------------------------------
AC_MSG_CHECKING([whether to enable support for Exult Studio])
AC_ARG_ENABLE(exult-studio-support, AS_HELP_STRING([--enable-exult-studio-support], [Enable ExultStudio support @<:@default no@:>@]),,enable_exult_studio_support=no)
if test "$WINDOWING_SYSTEM" != -DXWIN ; then
enable_exult_studio_support=no
fi
AC_ARG_ENABLE(macosx-studio-support, AS_HELP_STRING([--enable-macosx-studio-support], [Force ExultStudio support in Mac OS X @<:@EXPERIMENTAL@:>@ @<:@default no@:>@]),,enable_macosx_studio_support=no)
if test "$WINDOWING_SYSTEM" != -DMACOSX; then
enable_macosx_studio_support=no
fi
if test x$enable_macosx_studio_support = xyes ; then
enable_exult_studio_support=yes
SYSLIBS="$SYSLIBS -L/usr/X11R6/lib -lX11"
AC_DEFINE(XWIN, 1, [X11 (needed by Exult Studio support in Mac OS X)])
fi
if test x$enable_exult_studio_support = xyes ; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_EXULTSTUDIO, 1, [Use Exult Studio])
# due to bug 2129731 and 3139441 some Linux distributions need -lX11 explicitly set
# when enabling Exult Studio support or linking fails
if test "$WINDOWING_SYSTEM" = -DXWIN ; then
SYSLIBS="$SYSLIBS -lX11"
fi
else
AC_MSG_RESULT(no)
fi
# ---------------------------------------------------------------------
# Alternative directories
# ---------------------------------------------------------------------
DESKTOPDIR="${datadir}/applications"
AC_ARG_WITH([desktopdir],
AS_HELP_STRING([--with-desktopdir=DIR],[change desktop directory]),
[case "${withval}" in
yes)
;;
no)
;;
*)
DESKTOPDIR="${withval}"
;;
esac])
AC_SUBST([DESKTOPDIR])
ICONDIR="${datadir}/icons"
AC_ARG_WITH([icondir],
AS_HELP_STRING([--with-icondir=DIR],[change icon directory]),
[case "${withval}" in
yes)
;;
no)
;;
*)
ICONDIR="${withval}"
;;
esac])
AC_SUBST([ICONDIR])
# ---------------------------------------------------------------------
# Workaround for 'ar' warning in libtool
# ---------------------------------------------------------------------
if test "x$AR_FLAGS" = "xcru" ; then
AR_FLAGS="cr"
fi
# ---------------------------------------------------------------------
# Optimization options
# ---------------------------------------------------------------------
AC_ARG_WITH([optimization],
AS_HELP_STRING([--with-optimization=none|size|debug|light|normal|heavy],
[Select optimization level @<:@default normal@:>@]),
[opt_level="$withval"], [opt_level="normal"])
AC_MSG_CHECKING([desired optimization level])
if test x$opt_level = xnone; then
AC_MSG_RESULT(none)
DEBUG_FLAGS="$DEBUG_FLAGS -O0"
elif test x$opt_level = xsize; then
AC_MSG_RESULT(size)
AX_CHECK_COMPILE_FLAG([-Os], [have_os_opt=yes], [have_os_opt=no], [$DEBUG_FLAGS -Werror])
if test x$have_os_opt = xyes; then
DEBUG_FLAGS="$DEBUG_FLAGS -Os"
else
# Sane default if compiler does not support -Os
DEBUG_FLAGS="$DEBUG_FLAGS -O2"
for opt_flag in -falign-functions -falign-jumps -falign-loops -falign-labels -freorder-blocks -freorder-blocks-and-partition -fprefetch-loop-arrays -ftree-vect-loop-version
do
AX_CHECK_COMPILE_FLAG([$opt_flag], [DEBUG_FLAGS="$DEBUG_FLAGS $opt_flag"], [], [$DEBUG_FLAGS -Werror])
done
fi
elif test x$opt_level = xdebug; then
AC_MSG_RESULT(debug)
AX_CHECK_COMPILE_FLAG([-Og], [have_og_opt=yes], [have_og_opt=no], [$DEBUG_FLAGS -Werror])
if test x$have_og_opt = xyes; then
DEBUG_FLAGS="$DEBUG_FLAGS -Og"
else
# Sane default if compiler does not support -Og
DEBUG_FLAGS="$DEBUG_FLAGS -O1"
for opt_flag in -fno-branch-count-reg -fno-if-conversion -fno-if-conversion2 -fno-inline-functions-called-once -fno-move-loop-invariants -fno-ssa-phiopt -fno-tree-bit-ccp -fno-tree-pta -fno-tree-sra
do
AX_CHECK_COMPILE_FLAG([$opt_flag], [DEBUG_FLAGS="$DEBUG_FLAGS $opt_flag"], [], [$DEBUG_FLAGS -Werror])
done
fi
elif test x$opt_level = xlight; then
AC_MSG_RESULT(light)
DEBUG_FLAGS="$DEBUG_FLAGS -O1"
elif test x$opt_level = xnormal; then
AC_MSG_RESULT(normal)
DEBUG_FLAGS="$DEBUG_FLAGS -O2"
elif test x$opt_level = xheavy; then
AC_MSG_RESULT(heavy)
DEBUG_FLAGS="$DEBUG_FLAGS -O3"
else
AC_MSG_RESULT(invalid)
echo "Invalid option given for --with-optimization: $opt_level."
echo "Expected one of 'none', 'size', 'debug', 'light', 'normal', 'heavy'."
exit 1
fi
# link-time optimization
GB_ENABLE_LTO
DEBUG_FLAGS="$DEBUG_FLAGS $LTO_CFLAGS"
# ---------------------------------------------------------------------
# Debugging options
# ---------------------------------------------------------------------
AC_ARG_WITH([debug],
AS_HELP_STRING([--with-debug=no|messages|symbols|full|extreme],
[Enable debug mode @<:@default no@:>@]),
[dbg_level="$withval"], [dbg_level="no"])
AC_MSG_CHECKING([whether to enable debugging mode])
if test x$dbg_level = xno; then
AC_MSG_RESULT(no)
elif test x$dbg_level = xmessages; then
AC_MSG_RESULT(messages only)
AC_DEFINE(DEBUG, 1, [Enable debug mode])
elif test x$dbg_level = xsymbols -o x$dbg_level = xfull -o x$dbg_level = xextreme; then
AC_MSG_RESULT($dbg_level)
if test x$dbg_level != xsymbols; then
AC_DEFINE(DEBUG, 1, [Enable debug mode])
fi
if test x$dbg_level = xextreme; then
DEBUG_FLAGS="$DEBUG_FLAGS -g3"
else
DEBUG_FLAGS="$DEBUG_FLAGS -g"
fi
# TODO: Maybe add warning that -O0 and -Og work better for debug symbols?
else
AC_MSG_RESULT(invalid)
echo "Invalid option given for --with-debug: $dbg_level."
echo "Expected one of 'no', 'messages', 'symbols', 'full', 'extreme'."
exit 1
fi
# SDL parachute?
AC_ARG_ENABLE(sdl-parachute, AS_HELP_STRING([--enable-sdl-parachute], [Use SDL parachute @<:@default yes@:>@]),,enable_sdl_parachute=yes)
AC_MSG_CHECKING([if we should disable the SDL parachute])
if test x$enable_sdl_parachute = xno; then
AC_MSG_RESULT(yes)
AC_DEFINE(NO_SDL_PARACHUTE, 1, [Disable SDL parachute])
else
AC_MSG_RESULT(no)
fi
# ---------------------------------------------------------------------
# Warning level
# ---------------------------------------------------------------------
CHK_WARN="-Wall -Wextra -pedantic"
CHK_WARN="$CHK_WARN -Walloc-zero -Walloca"
CHK_WARN="$CHK_WARN -Wc++14-compat -Wc++17-compat"
CHK_WARN="$CHK_WARN -Wcatch-value=3 -Wcast-align -Wcast-qual"
CHK_WARN="$CHK_WARN -Wconditionally-supported -Wctor-dtor-privacy -Wdisabled-optimization"
CHK_WARN="$CHK_WARN -Wduplicated-branches -Wduplicated-cond -Wextra-semi"
CHK_WARN="$CHK_WARN -Wformat-nonliteral -Wformat-security"
CHK_WARN="$CHK_WARN -Wlogical-not-parentheses -Wlogical-op"
CHK_WARN="$CHK_WARN -Wmissing-include-dirs -Wnon-virtual-dtor -Wnull-dereference"
CHK_WARN="$CHK_WARN -Wold-style-cast -Woverloaded-virtual -Wplacement-new"
CHK_WARN="$CHK_WARN -Wredundant-decls -Wshift-negative-value -Wshift-overflow"
CHK_WARN="$CHK_WARN -Wtrigraphs -Wundef -Wuninitialized -Wuseless-cast -Wwrite-strings"
# Warnings that give lots of warnings
#CHK_WARN="$CHK_WARN -Wformat-signedness -Wcast-align=strict -Weffc++ -Wpadded -Wshadow -Wsign-conversion"
# GCC attributes
#CHK_WARN="$CHK_WARN -Wsuggest-attribute=cold -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=malloc -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure"
# C++11 and newer
#CHK_WARN="$CHK_WARN -Wsuggest-final-methods -Wsuggest-final-types -Wsuggest-override -Wzero-as-null-pointer-constant"
# Clang warnings
CHK_WARN="$CHK_WARN -Wunused-const-variables -Wabsolute-value -Wdeprecated-register -Wmismatched-tags -Wunused-private-field"
# Eliminate some spurious warnings due to low optimization level.
if test x$opt_level = xnone -o x$opt_level = xdebug; then
CHK_WARN="$CHK_WARN -Wno-maybe-uninitialized"
fi
# Warnings give errors
AC_ARG_ENABLE(warning-errors, AS_HELP_STRING([--enable-warning-errors], [Turn all warnings into errors @<:@default no@:>@]),,enable_warning_errors=no)
if test x$enable_warning_errors = xyes; then
CHK_WARN="-Werror $CHK_WARN"
fi
# Pedantic warnings give errors
AC_ARG_ENABLE(pedantic-errors, AS_HELP_STRING([--enable-pedantic-errors], [Turn all pedantic warnings into errors @<:@default no@:>@]),,enable_pedantic_errors=no)
if test x$enable_pedantic_errors = xyes; then
CHK_WARN="-pedantic-errors $CHK_WARN"
fi
# Ignore long-long warnings (for SDL header files...)
AC_ARG_ENABLE(long-long-warnings, AS_HELP_STRING([--enable-long-long-warnings], [Enable long long warnings (for Compaq cxx with GNU ld) @<:@default no@:>@]),,enable_long_long_warnings=no)
AC_MSG_CHECKING([if we should disable long-long warnings])
if test x$enable_long_long_warnings = xyes; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
CHK_WARN="$CHK_WARN -Wno-long-long"
fi
WARNINGS=""
for cxx_flag in $CHK_WARN
do
AX_CHECK_COMPILE_FLAG([$cxx_flag], [WARNINGS="$WARNINGS $cxx_flag"], [], [$DEBUG_FLAGS -Werror])
done
DEBUG_FLAGS="$DEBUG_FLAGS $WARNINGS"
# --------------------
# External features
# --------------------
# Build any external programs?
AC_ARG_ENABLE(tools, AS_HELP_STRING([--disable-tools], [Only build the main program]),,enable_tools=yes)
AC_MSG_CHECKING([whether to build only the main program])
if test x$enable_tools = xno; then
AC_MSG_RESULT(yes)
AM_CONDITIONAL(BUILD_TOOLS, false)
enable_gtk_interface=no
enable_gimp_plugin=no
enable_compiler=no
else
AM_CONDITIONAL(BUILD_TOOLS, true)
AC_MSG_RESULT(no)
fi
# Build compiler?
AC_ARG_ENABLE(compiler, AS_HELP_STRING([--enable-compiler], [Build the usecode compiler @<:@default no@:>@]),,enable_compiler=no)
AC_MSG_CHECKING([whether to build the usecode compiler])
if test x$enable_compiler = xno; then
AC_MSG_RESULT(no)
AM_CONDITIONAL(BUILD_COMPILER, false)
else
AC_MSG_RESULT(yes)
AM_CONDITIONAL(BUILD_COMPILER, true)
fi
# Build data files?
AC_ARG_ENABLE(data, AS_HELP_STRING([--enable-data], [Create the data files @<:@default yes@:>@]),,enable_data=yes)
AC_MSG_CHECKING([whether to build the data files])
if test x$enable_data = xno; then
AC_MSG_RESULT(no)
AM_CONDITIONAL(DATA_FILES, false)
else
AM_CONDITIONAL(DATA_FILES, true)
AC_MSG_RESULT(yes)
fi
# Build mods?
AC_ARG_ENABLE(mods, AS_HELP_STRING([--enable-mods], [Build the Exult mods (requires usecode compiler) @<:@default no@:>@]),,enable_mods=no)
AC_MSG_CHECKING([whether to build the Exult mods])
if test x$enable_mods = xno -o x$enable_compiler = xno; then
AC_MSG_RESULT(no)
AM_CONDITIONAL(BUILD_MODS, false)
else
AM_CONDITIONAL(BUILD_MODS, true)
AC_MSG_RESULT(yes)
fi
# Freetype2 (optional, used in ExultStudio, shapes/fontgen.cc)
AC_PATH_PROG(FT2CONFIG, freetype-config)
if test -n "$FT2CONFIG"; then
AC_DEFINE(HAVE_FREETYPE2, 1, [Have freetype2])
FREETYPE2_LIBS=`$FT2CONFIG --libs`
AC_SUBST(FREETYPE2_LIBS)
FREETYPE2_INCLUDES=`$FT2CONFIG --cflags`
AC_SUBST(FREETYPE2_INCLUDES)
fi
# exult-studio
AC_ARG_ENABLE(exult-studio, AS_HELP_STRING([--enable-exult-studio], [Build Exult Studio @<:@default no@:>@]),,enable_exult_studio=no)
AC_MSG_CHECKING([whether to build Exult Studio])
if test x$enable_exult_studio = xyes; then
AC_MSG_RESULT(yes)
if test x$have_glade = xno; then
echo "Umm, but we don't have any libglade stuff."
echo "Try again, either with libglade, or with --disable-exult-studio"
exit 1
fi
AM_CONDITIONAL(BUILD_STUDIO, true)
else
AM_CONDITIONAL(BUILD_STUDIO, false)
AC_MSG_RESULT(no)
fi
# Usecode debugger
AC_ARG_WITH([usecode-debugger],
AS_HELP_STRING([--with-usecode-debugger=no|console|yes],
[Experimental and buggy support for usecode debugging @<:@default no@:>@]),
[enable_usecode_debugger="$withval"], [enable_usecode_debugger="no"])
AC_MSG_CHECKING([whether to enable the usecode debugger])
if test x$enable_usecode_debugger = xconsole -o x$enable_usecode_debugger = xyes; then
AC_MSG_RESULT(yes)
if test x$enable_usecode_debugger = xconsole; then
AC_DEFINE(USECODE_CONSOLE_DEBUGGER, 1, [Enable Usecode debugging on console])
elif test x$enable_exult_studio != xyes; then
echo "But we are not building Exult Studio."
echo "Try again, either with --enable-exult-studio, or without the usecode debugger"
exit 1
elif test x$enable_exult_studio_support != xyes; then
echo "But we are not building Exult with Exult Studio support."
echo "Try again, either with --enable-exult-studio-support, or without the usecode debugger"
exit 1
fi
AC_DEFINE(USECODE_DEBUGGER, 1, [Enable Usecode debugging])
else
AC_MSG_RESULT(no)
fi
# gnome-shp-thumbnailer
AC_ARG_ENABLE(gnome-shp-thumbnailer, AS_HELP_STRING([--enable-gnome-shp-thumbnailer], [Build Gnome SHP Thumbnailer @<:@default no@:>@]),,enable_gnome_shp_thumbnailer=no)
AC_MSG_CHECKING([whether to build the Gnome SHP Thumbnailer])
if test x$enable_gnome_shp_thumbnailer = xyes; then
AC_MSG_RESULT(yes)
if test x$have_gnomeui = xno; then
echo "Umm, but we don't have any libgnomeui stuff."
echo "Try again, either with libgnomeui, or with --disable-gnome-shp-thumbnailer"
exit 1
fi
AM_CONDITIONAL(BUILD_GTHUMB, true)
else
AM_CONDITIONAL(BUILD_GTHUMB, false)
AC_MSG_RESULT(no)
fi
# GIMP plugin
AM_CONDITIONAL(GIMP_PLUGIN, false)
AC_ARG_ENABLE(gimp-plugin, AS_HELP_STRING([--enable-gimp-plugin], [Build the GIMP plugin @<:@default no@:>@]),,enable_gimp_plugin=no)
AC_MSG_CHECKING([whether to build the GIMP plugin])
if test x$enable_gimp_plugin = xyes; then
AC_MSG_RESULT(yes)
AC_MSG_CHECKING([for gimptool])
AC_CHECK_PROGS(GIMPTOOL, gimptool-2.0 gimptool-1.3 gimptool-1.2 gimptool)
if test -z "$GIMPTOOL"; then
AC_MSG_RESULT([no, not building GIMP plugin])
else
AC_MSG_CHECKING([for GIMP version])
gimp_version=`$GIMPTOOL --version | awk 'BEGIN { FS = "."; } { print $1 * 1000 + $2*100+$3;}'`
if test "$gimp_version" -ge 1312; then
AC_MSG_RESULT([found >= 1.3.12])
AC_SUBST(GIMPTOOL)
AM_CONDITIONAL(GIMP_PLUGIN, true)
GIMP_PLUGIN_PREFIX=`$GIMPTOOL --gimpplugindir`
GIMP_PLUGIN_PREFIX="$GIMP_PLUGIN_PREFIX/plug-ins"
AC_SUBST(GIMP_PLUGIN_PREFIX)
AC_DEFINE(HAVE_GIMP, 1, [Have GIMP])
GIMP_INCLUDES=`$GIMPTOOL --cflags`
GIMP_LIBS=`$GIMPTOOL --libs`
AC_SUBST(GIMP_INCLUDES)
AC_SUBST(GIMP_LIBS)
elif test "$gimp_version" -ge 1200 -a \
"$gimp_version" -lt 1300; then
AC_MSG_RESULT([found 1.2.x])
AC_SUBST(GIMPTOOL)
AM_CONDITIONAL(GIMP_PLUGIN, true)
GIMP_PLUGIN_PREFIX=`$GIMPTOOL --gimpplugindir`
GIMP_PLUGIN_PREFIX="$GIMP_PLUGIN_PREFIX/plug-ins"
AC_SUBST(GIMP_PLUGIN_PREFIX)
AC_DEFINE(HAVE_GIMP, 1, [Have GIMP])
AC_DEFINE(HAVE_GIMP_1_2, 1, [Have GIMP 1.2.x])
GIMP_INCLUDES=`$GIMPTOOL --cflags`
GIMP_LIBS=`$GIMPTOOL --libs`
AC_SUBST(GIMP_INCLUDES)
AC_SUBST(GIMP_LIBS)
else
AC_MSG_RESULT([found < 1.2.00 - disabling plugin])
fi
fi
else
AC_MSG_RESULT(no)
fi
# ----------------------------------------------------------------
# If we are cross-compiling, look for expack and head2data in PATH
# ----------------------------------------------------------------