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
|
# Process this file with autoconf to produce a configure script.
#######################################################################
# Initial configuration #
#######################################################################
AC_PREREQ([2.57])
define([WESNOTH_VERSION],[1.1.8+svn])
dnl define([DEFAULT_SERVER],[server.wesnoth.org])
define([DEFAULT_SERVER],[devsrv.wesnoth.org:14999])
AC_INIT([Battle for Wesnoth], WESNOTH_VERSION, [isaac@warp.es], [wesnoth])
AC_DEFINE([WESNOTH_DEFAULT_SERVER], ["]DEFAULT_SERVER["], [The default server for this version])
dnl
dnl Generate wesconfig.h from the information above
dnl
AC_CONFIG_COMMANDS([src/wesconfig.h],
[cat > src/wesconfig.h <<EOF
#ifndef WESCONFIG_H_INCLUDED
#define WESCONFIG_H_INCLUDED
#ifdef HAVE_CONFIG_H
# include "config.h"
#else
# define VERSION "]WESNOTH_VERSION["
# define WESNOTH_DEFAULT_SERVER "]DEFAULT_SERVER["
# define PACKAGE "wesnoth"
# ifndef LOCALEDIR
# define LOCALEDIR "translations"
# endif
#endif
#endif
EOF
])
AC_REVISION([$Revision: 1.1 $])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_SRCDIR([src/actions.cpp])
AC_CONFIG_HEADER([config.h])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.9 tar-ustar foreign])
AM_GNU_GETTEXT([external])
AC_PROG_RANLIB
#######################################################################
# Configuration options #
#######################################################################
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug], [enable debug in wesnoth]),
[debug=$enableval],
[debug=no])
if test "x$debug" = "xyes"
then
CXXFLAGS="$CXXFLAGS -DDEBUG -O0 -ggdb3 -W -Wall -ansi "
else
CXXFLAGS="$CXXFLAGS -W -Wall -ansi "
fi
AC_ARG_ENABLE([static],
AS_HELP_STRING([--enable-static], [enable static building of wesnoth]),
[static=$enableval],
[static=no])
AC_ARG_ENABLE([python],
AS_HELP_STRING([--enable-python], [enable Python support]),
[python=$enableval],
[python=no])
AC_ARG_ENABLE([lite],
AS_HELP_STRING([--enable-lite], [enable lite version of wesnoth (without music or large images)]),
[lite=$enableval],
[lite=no])
AC_ARG_ENABLE([tinygui],
AS_HELP_STRING([--enable-tinygui], [enable GUI reductions for resolutions down to 320x240 (PDAs)]),
[tinygui=$enableval],
[tinygui=no])
if test "x$tinygui" = "xyes"
then
CPPFLAGS="$CPPFLAGS -DUSE_TINY_GUI"
fi
AM_CONDITIONAL([TINYGUI], [test "x$tinygui" = "xyes"])
DATADIR=$PACKAGE
AC_ARG_WITH([datadir-name],
AS_HELP_STRING([--with-datadir-name@<:@=DIR@:>@], [change name of data directory @<:@wesnoth@:>@]),
[case "${withval}" in
yes)
DATADIR="wesnoth"
;;
no)
;;
*)
DATADIR="${withval}"
;;
esac])
AC_SUBST([DATADIR])
#LOCALEDIR="$datadir/locale"
LOCALEDIR=translations
AC_ARG_WITH([localedir],
AS_HELP_STRING([--with-localedir@<:@=DIR@:>@], [install locale data under dir @<:@translations@:>@]),
[case "${withval}" in
yes)
LOCALEDIR="translations"
;;
no)
;;
*)
LOCALEDIR="${withval}"
;;
esac])
AC_SUBST([LOCALEDIR])
case "`eval echo \"$LOCALEDIR\"`" in
/*) FULLLOCALEDIR="$LOCALEDIR"; HAS_RELATIVE_LOCALEDIR=0 ;;
*) FULLLOCALEDIR='${datadir}/${DATADIR}/${LOCALEDIR}'; HAS_RELATIVE_LOCALEDIR=1 ;;
esac
AC_SUBST([FULLLOCALEDIR])
AC_SUBST([HAS_RELATIVE_LOCALEDIR])
# icondir and desktopdir may differ from datadir (suggested by Gentoo)
AC_ARG_WITH([icondir],
AS_HELP_STRING([--with-icondir@<:@=DIR@:>@], [change icon directory under gnome or kde, needs --with-gnome or --with-kde option]),
[case "${withval}" in
yes)
ICONDIR="${datadir}/icons"
;;
no)
;;
*)
ICONDIR="${withval}"
;;
esac])
AC_SUBST([ICONDIR])
if test "x$icondir" = "xnone"; then
icondirset=no
else
icondirset=yes
fi
AM_CONDITIONAL([HAS_ICONDIR], [test "x$icondirset" = "xyes"])
AC_ARG_WITH([desktopdir],
AS_HELP_STRING([--with-desktopdir@<:@=DIR@:>@], [change desktop directory under gnome or kde, needs --with-gnome or --with-kde option]),
[case "${withval}" in
yes)
DESKTOPDIR="${datadir}/applications"
;;
no)
;;
*)
DESKTOPDIR="${withval}"
;;
esac])
AC_SUBST([DESKTOPDIR])
if test "x$desktopdir" = "xnone"; then
desktopdirset=no
else
desktopdirset=yes
fi
AM_CONDITIONAL([HAS_DESKTOPDIR], [test "x$desktopdirset" = "xyes"])
AC_ARG_ENABLE([game],
AS_HELP_STRING([--disable-game], [disable compilation of game]),
[game=$enableval],
[game=yes])
AC_ARG_ENABLE([server],
AS_HELP_STRING([--enable-server], [enable compilation of server]),
[server=$enableval],
[server=no])
AC_ARG_WITH([fifodir],
AS_HELP_STRING([--with-fifodir], [directory for the wesnothd fifo socket file]),
[fifodir=$withval],
[fifodir=$localstatedir/run/wesnothd])
AC_SUBST([fifodir])
AC_ARG_WITH([server-uid],
AS_HELP_STRING([--with-server-uid], [user id of the user who runs wesnothd]),
[serveruid=$withval],
[serveruid=0])
AC_SUBST([serveruid])
AC_ARG_WITH([server-gid],
AS_HELP_STRING([--with-server-gid], [group id of the user who runs wesnothd]),
[servergid=$withval],
[servergid=0])
AC_SUBST([servergid])
AC_ARG_ENABLE([campaign_server],
AS_HELP_STRING([--enable-campaign-server], [enable compilation of campaign server]),
[campaignserver=$enableval],
[campaignserver=no])
AC_ARG_ENABLE([editor],
AS_HELP_STRING([--enable-editor], [enable compilation of map editor]),
[editor=$enableval],
[editor=no])
AC_ARG_ENABLE([tools],
AS_HELP_STRING([--enable-tools], [enable compilation of tools for translators and artists]),
[tools=$enableval],
[tools=no])
AC_ARG_WITH([fribidi],
AS_HELP_STRING([--without-fribidi], [disable Bidirectional language support]),
[fribidi=$withval],
[fribidi=yes])
AC_ARG_WITH([kde],
AS_HELP_STRING([--with-kde], [enable installation of icon and KDE menu entry]),
[kde=$withval],
[kde=no])
AC_ARG_WITH([gnome],
AS_HELP_STRING([--with-gnome], [enable installation of icon and GNOME menu entry]),
[gnome=$withval],
[gnome=no])
AC_ARG_ENABLE([gnome1],
AS_HELP_STRING([--disable-gnome1], [disable installation of icon and menu entry in GNOME1]),
[gnome1=$enableval],
[gnome1=yes])
AC_ARG_ENABLE([gnome2],
AS_HELP_STRING([--disable-gnome2], [disable installation of icon and menu entry in GNOME2]),
[gnome2=$enableval],
[gnome2=yes])
AC_ARG_ENABLE([dummy-locales],
AS_HELP_STRING([--enable-dummy-locales], [enable installation of Wesnoth own private locales]),
[dummylocales=$enableval],
[dummylocales=no])
AC_ARG_WITH([preferences-dir],
AS_HELP_STRING([--with-preferences-dir], [use a non-default preferences directory (.wesnoth on unix)]),
[prefsdir=$withval
AC_SUBST([prefsdir])])
AM_CONDITIONAL([PREFSDIR], [test x$prefsdir != x])
AC_ARG_ENABLE([internal-data],
AS_HELP_STRING([--enable-internal-data],
[put data inside application: Mac OS X only]),
[internaldata=$enableval],
[internaldata=no])
AM_CONDITIONAL([STATIC], [test x$static = xyes])
AM_CONDITIONAL([GAME], [test x$game = xyes])
AM_CONDITIONAL([SERVER], [test x$server = xyes])
AM_CONDITIONAL([CAMPAIGNSERVER], [test x$campaignserver = xyes])
AM_CONDITIONAL([EDITOR], [test x$editor = xyes])
AM_CONDITIONAL([TOOLS], [test x$tools = xyes])
AM_CONDITIONAL([GCC], [test x$GXX = xyes])
AM_CONDITIONAL([INCLUDEDINTL], [test x$nls_cv_use_gnu_gettext = xyes])
AM_CONDITIONAL([INSTALLDATA], [test x$game = xyes || x$editor = xyes])
AM_CONDITIONAL([DUMMYLOCALES], [test x$dummylocales = xyes])
if test x$dummylocales = xyes; then
AC_DEFINE([USE_DUMMYLOCALES],,[Define if the game should not use system locales])
fi
if test x$internaldata = xyes; then
AC_DEFINE([USE_INTERNAL_DATA],[],[Define if translations should be placed inside app, for Mac OS X])
fi
#######################################################################
# Checks for programs. #
#######################################################################
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AM_PROG_CC_C_O
have_libx11='no'
if test "$with_x" != 'no'; then
dnl Locate X include files and libraries
AC_PATH_XTRA
NEW_LIBS="$X_LIBS -lX11"
AC_CHECK_LIB(X11, XOpenDisplay, have_libx11='yes',have_libx11='no',$X_LIBS)
if test "$have_libx11" != 'no'; then
AC_DEFINE([HAVE_LIBX11],,[Define if you have X11 libraries])
X_LIBS="$NEW_LIBS"
CPPFLAGS="$X_CFLAGS $CPPFLAGS"
LIBS="$X_LIBS $LIBS"
fi
fi
AM_CONDITIONAL([X11], [test "$have_libx11" = 'yes'])
# SDL_CONFIG
AC_PATH_PROGS([SDL_CONFIG], [sdl-config sdl11-config], [none])
if test "x$SDL_CONFIG" = "xnone"; then
AC_MSG_ERROR([*** SDL not found! Get SDL from www.libsdl.org.
If you already installed it, check it's in the path. If problem remains,
please send a mail to the address that appears in ./configure --version
indicating your platform, the version of configure script and the problem.])
fi
# fribidi-config
AC_PATH_PROGS([FRIBIDI_CONFIG], [fribidi-config], [none])
if test "x$FRIBIDI_CONFIG" = "xnone"; then
fribidifound=no
AC_MSG_WARN([*** FRIBIDI not found.])
else
fribidifound=yes
FRIBIDI_CFLAGS=`$FRIBIDI_CONFIG --cflags`
FRIBIDI_LIBS=`$FRIBIDI_CONFIG --libs`
fi
AC_SUBST([FRIBIDI_CFLAGS])
AC_SUBST([FRIBIDI_LIBS])
AM_CONDITIONAL([FRIBIDI], [test "x$fribidifound" = xyes -a "x$fribidi" = xyes ])
# python
if test "x$python" = "xyes"; then
if test "x$PYTHON" = "x"; then
AC_PATH_PROG(PYTHON, python, none)
fi
if test "x$PYTHON" = "xnone"; then
AC_ERROR(Python interpreter required)
fi
AC_MSG_CHECKING(Python version and location)
PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
PYTHON_VERSION_MAJOR=[`$PYTHON -c "import sys; print '%d' % (sys.version_info[0]);"`]
PYTHON_VERSION_MINOR=[`$PYTHON -c "import sys; print '%d' % (sys.version_info[1]);"`]
PYTHON_VERSION="${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}"
AC_MSG_RESULT([$PYTHON, $PYTHON_VERSION, $PYTHON_PREFIX])
AC_MSG_CHECKING(whether Python is at least 2.3)
if test $PYTHON_VERSION_MAJOR -lt 2 -o $PYTHON_VERSION_MAJOR -eq 2 -a $PYTHON_VERSION_MINOR -lt 3; then
AC_MSG_RESULT(no)
AC_ERROR(Wesnoth requires at least Python 2.3)
fi
AC_MSG_RESULT(yes)
PYTHON_CFLAGS="-DHAVE_PYTHON -I$PYTHON_PREFIX/include/python$PYTHON_VERSION"
OLD_CPPFLAGS="$CPPFLAGS"
OLD_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
CXXFLAGS="$CXXFLAGS $PYTHON_CFLAGS"
AC_CHECK_HEADER([Python.h],
[],
[AC_MSG_ERROR([*** Python include files not found!
You should install Python development package.])])
CPPFLAGS="$OLD_CPPFLAGS"
CXXFLAGS="$OLD_CXXFLAGS"
AC_SUBST([PYTHON_CFLAGS])
found=no
for pylibpath in '/usr/lib' $PYTHON_PREFIX/lib $PYTHON_PREFIX/lib/python$PYTHON_VERSION/config; do
eval `echo unset ac_cv_lib_python$PYTHON_VERSION'_'Py_Finalize | tr '.' '_'`
save_LIBS=$LIBS
LIBS="$LIBS -L$pylibpath"
AC_CHECK_LIB(python$PYTHON_VERSION, Py_Finalize, PYTHON_LIBS="-L$pylibpath -lpython$PYTHON_VERSION $PYTHON_DEPS"; found=yes,,$PYTHON_DEPS)
LIBS=$save_LIBS
if test "x$found" = "xyes"; then
break
fi
done
if test "x$found" != "xyes"; then
AC_ERROR(Python development libraries required)
fi
AC_SUBST([PYTHON_LIBS])
fi
AM_CONDITIONAL([PYTHON], [test "x$python" = "xyes"])
# libpng-config
AC_PATH_PROGS([PNG_CONFIG], [libpng-config libpng12-config], [none])
if test "x$PNG_CONFIG" = "xnone"; then
AC_PATH_PROG([PNG_CONFIG], [pkg-config], [none])
if test "x$PNG_CONFIG" = "xnone"; then
pngfound=no
AC_MSG_WARN([*** LIBPNG not found.])
else
pngfound=yes
PNG_CFLAGS=`$PNG_CONFIG --cflags libpng12`
PNG_LIBS=`$PNG_CONFIG --libs libpng12`
fi
else
pngfound=yes
PNG_CFLAGS=`$PNG_CONFIG --cflags`
PNG_LIBS=`$PNG_CONFIG --libs`
fi
AC_SUBST([PNG_CFLAGS])
AC_SUBST([PNG_LIBS])
AM_CONDITIONAL([LIBPNG], [test x$pngfound = xyes])
# Check for SDL version. Taken from sdl.m4
AC_ARG_ENABLE([sdltest],
AS_HELP_STRING([--disable-sdltest], [do not try to compile and run a test SDL program]),
,
[enable_sdltest=yes])
min_sdl_version=1.2.7
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
SDL_CFLAGS=`$SDL_CONFIG --cflags`
SDL_LIBS=`$SDL_CONFIG --libs`
sdl_major_version=`$SDL_CONFIG --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
sdl_minor_version=`$SDL_CONFIG --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
sdl_micro_version=`$SDL_CONFIG --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_sdltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
# Now check if the installed SDL is sufficiently new. (Also sanity
# checks the results of sdl-config to some extent
rm -f conf.sdltest
AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main (int argc, char **argv)
{
int major, minor, micro;
char *tmp_version;
/* This hangs on some systems (?)
system ("touch conf.sdltest");
*/
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_sdl_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
printf("%s, bad version string\n", "$min_sdl_version");
exit(1);
}
if (($sdl_major_version > major) ||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
])],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)]
[AC_MSG_ERROR([*** Please upgrade your SDL version])],
[AC_MSG_RESULT([not tested in cross-compiling])])
rm -f conf.sdltest
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
# GNOME_CONFIG
AC_PATH_PROGS([GNOME_CONFIG], [gnome-config], [none])
if test "x$GNOME_CONFIG" = "xnone"; then
gnome1found=no
else
GNOME1_DESKTOP=`$GNOME_CONFIG --datadir`/gnome/apps/Games
gnome1found=yes
fi
AC_SUBST([GNOME1_DESKTOP])
# KDE_CONFIG
AC_PATH_PROGS([KDE_CONFIG], [kde-config], [none])
if test "x$KDE_CONFIG" = "xnone"; then
kdefound=no
else
KDE_DESKTOP=`$KDE_CONFIG --install apps`/Games/TacticStrategy
KDE_ICON=`$KDE_CONFIG --install icon`
kdefound=yes
fi
AC_SUBST([KDE_DESKTOP])
AC_SUBST([KDE_ICON])
AM_CONDITIONAL([KDE], [test x$kde = xyes && test x$kdefound = xyes])
AM_CONDITIONAL([GNOME1], [test x$gnome = xyes && test x$gnome1found = xyes && test x$gnome1 = xyes])
AM_CONDITIONAL([GNOME2], [test x$gnome = xyes && test x$gnome2 = xyes])
#######################################################################
# Checks for libraries. #
#######################################################################
# Use a modified version of ac_link so that libtool gets called
# this seems pretty broken on most systems
AC_PATH_PROG([LTOOL], [libtool], [])
if test "$static" = "yes" -a -n "$LTOOL"
then
LDPREFIX="$LTOOL --mode=link --tag=CXX"
else
LDPREFIX=""
fi
AC_SUBST([LDPREFIX])
#
if test -n "$LDPREFIX" -a -r `$SDL_CONFIG --prefix`/lib/libSDL.la
then SDL_LIBS=`$SDL_CONFIG --prefix`/lib/libSDL.la
else SDL_LIBS=`$SDL_CONFIG --libs`
fi
case $host_os in
darwin*)
SDL_LIBS="-framework Carbon $SDL_LIBS"
esac
case $host_os in
mingw32*)
SDL_LIBS="-lunicows $SDL_LIBS"
esac
OLD_LIBS=$LIBS
LIBS="$LIBS $SDL_LIBS"
# There's no need for this, $SDL_CONFIG comes with libsdl and
# it doesn't find it in FreeBSD
# AC_CHECK_LIB([SDL], [SDL_Init])
# unfortunately, sdl_config is not shipped with the Mac OS X packages...
# so recommend using fink sdl packages as a workaround
ac_link="$LDPREFIX $ac_link"
AC_CHECK_LIB([SDL_image],
[IMG_Load],
[if test -n "$LDPREFIX" -a -r `$SDL_CONFIG --prefix`/lib/libSDL_image.la
then SDL_IMAGE_LIBS=`$SDL_CONFIG --prefix`/lib/libSDL_image.la
else SDL_IMAGE_LIBS=-lSDL_image
fi],
[AC_MSG_ERROR([*** SDL_image lib not found! Get SDL_image from
http://www.libsdl.org/projects/SDL_image/index.html])])
AC_CHECK_LIB([SDL_mixer],
[Mix_OpenAudio],
[if test -n "$LDPREFIX" -a -r `$SDL_CONFIG --prefix`/lib/libSDL_mixer.la
then SDL_MIXER_LIBS=`$SDL_CONFIG --prefix`/lib/libSDL_mixer.la
else SDL_MIXER_LIBS=-lSDL_mixer
fi],
[AC_MSG_ERROR([*** SDL_mixer lib not found! Get SDL_mixer from
http://www.libsdl.org/projects/SDL_mixer/index.html])])
AC_CHECK_LIB([SDL_net],
[SDLNet_Init],
[if test -n "$LDPREFIX" -a -r `$SDL_CONFIG --prefix`/lib/libSDL_net.la
then SDL_NET_LIBS=`$SDL_CONFIG --prefix`/lib/libSDL_net.la
else SDL_NET_LIBS=-lSDL_net
fi],
[AC_MSG_ERROR([*** SDL_net lib not found! Get SDL_net from
http://www.libsdl.org/projects/SDL_net/index.html])])
LIBS=$OLD_LIBS
AC_SUBST([SDL_LIBS])
AC_SUBST([SDL_IMAGE_LIBS])
AC_SUBST([SDL_MIXER_LIBS])
AC_SUBST([SDL_NET_LIBS])
# Checking for the freetype library. This was copied from the
# config script of SDL_ttf, modified for CPPFLAGS
dnl Get the cflags and libraries from the freetype-config script
AC_ARG_WITH([freetype-prefix],
AS_HELP_STRING([--with-freetype-prefix=PFX], [Prefix where FREETYPE is installed (optional)]),
[freetype_prefix="$withval"],
[freetype_prefix=""])
AC_ARG_WITH([freetype-exec-prefix],
AS_HELP_STRING([--with-freetype-exec-prefix=PFX], [Exec prefix where FREETYPE is installed (optional)]),
[freetype_exec_prefix="$withval"],
[freetype_exec_prefix=""])
if test x$freetype_exec_prefix != x ; then
freetype_args="$freetype_args --exec-prefix=$freetype_exec_prefix"
if test x${FREETYPE_CONFIG+set} != xset ; then
FREETYPE_CONFIG=$freetype_exec_prefix/bin/freetype-config
fi
fi
if test x$freetype_prefix != x ; then
freetype_args="$freetype_args --prefix=$freetype_prefix"
if test x${FREETYPE_CONFIG+set} != xset ; then
FREETYPE_CONFIG=$freetype_prefix/bin/freetype-config
fi
fi
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
no_freetype=""
if test "$FREETYPE_CONFIG" = "no" ; then
AC_MSG_ERROR([
*** Unable to find FreeType2 library (http://www.freetype.org/)
])
else
CPPFLAGS="$CPPFLAGS `$FREETYPE_CONFIG $freetypeconf_args --cflags`"
FREETYPE_LIBS=`$FREETYPE_CONFIG $freetypeconf_args --libs`
fi
AC_SUBST([FREETYPE_LIBS])
AC_ARG_WITH([zipios],
AS_HELP_STRING([--without-zipios], [Do not use zipios++ even if installed]),
[checkzipios="$withval"],
[checkzipios="yes"])
AC_LANG(C++)
LIBZIPIOS=
if test $checkzipios = yes; then
AC_MSG_CHECKING([for libzipios++])
OLD_LIBS="$LIBS"
LIBS="-lzipios -lz"
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <zipios++/dircoll.h>
int main(int argc, char **argv)
{
zipios::DirectoryCollection z("src");
}
])],
[AC_MSG_RESULT(yes)
LIBZIPIOS="-lzipios -lz"
AC_DEFINE([USE_ZIPIOS],[1],[Make use of the zipios++ library to read data in zip files])],
[AC_MSG_RESULT(no)
AC_MSG_WARN([*** libzipios++ not found - support for ZIP files is disabled])])
LIBS="$OLD_LIBS"
else
AC_MSG_NOTICE([skipping check for libzipios++])
fi
AC_SUBST([LIBZIPIOS])
#######################################################################
# Checks for header files. #
#######################################################################
AC_HEADER_DIRENT
AC_HEADER_STDC
OLD_CPPFLAGS=$CPPFLAGS
OLD_CXXFLAGS=$CXXFLAGS
SDL_CFLAGS=`$SDL_CONFIG --cflags`
SDL_CFLAGS="$SDL_CFLAGS"
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
AC_CHECK_HEADER([SDL.h],
[],
[AC_MSG_ERROR([*** SDL include files not found!
You should install SDL development package.])])
AC_CHECK_HEADER([SDL_image.h],
[],
[AC_MSG_ERROR([*** SDL_image include files not found!
You should install development package.])])
AC_CHECK_HEADER([SDL_mixer.h],
[],
[AC_MSG_ERROR([*** SDL_mixer include files not found!
You should install development package.])])
AC_CHECK_HEADER([SDL_net.h],
[],
[AC_MSG_ERROR([*** SDL_net include files not found!
You should install development package.])])
CPPFLAGS=$OLD_CPPFLAGS
CXXFLAGS=$OLD_CXXFLAGS
AC_SUBST([SDL_CFLAGS])
AC_CHECK_HEADERS([stdlib.h unistd.h poll.h sys/poll.h sys/select.h])
#######################################################################
# Checks for typedefs, structures, and compiler characteristics. #
#######################################################################
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([floor socket strtoul])
#######################################################################
# Check for PNG support in SDL_image #
#######################################################################
AC_LANG([C])
AC_MSG_CHECKING([for PNG support in SDL_image])
OLD_CPPFLAGS=$CPPFLAGS
OLD_CFLAGS=$CFLAGS
OLD_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS $SDL_IMAGE_LIBS"
ac_link="$LDPREFIX $ac_link"
AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <SDL_image.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
SDL_RWops *src;
src = SDL_RWFromFile("images/units/human-magi/mage.png", "rb");
if (src == NULL)
exit(0);
exit(!IMG_isPNG(src));
}
])],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)]
[AC_MSG_ERROR([*** SDL_image has no PNG support! You need SDL_image with PNG support])],
[AC_MSG_RESULT([not tested in cross-compiling])])
CPPFLAGS=$OLD_CPPFLAGS
CFLAGS=$OLD_CFLAGS
LIBS=$OLD_LIBS
#######################################################################
# Check for OGG support in SDL_mixer #
#######################################################################
if test "x$lite" = "xno"; then
if test -e "music/main_menu.ogg" ; then
AC_LANG([C])
AC_MSG_CHECKING([for OGG support in SDL_mixer])
OLD_CPPFLAGS=$CPPFLAGS
OLD_CFLAGS=$CFLAGS
OLD_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS $SDL_MIXER_LIBS"
ac_link="$LDPREFIX $ac_link"
AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <SDL_mixer.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
Mix_Music* music = Mix_LoadMUS("music/main_menu.ogg");
if (music == NULL)
exit(1);
exit(0);
}
])],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)]
[AC_MSG_ERROR([*** SDL_mixer has no OGG support! You need SDL_mixer with OGG support])],
[AC_MSG_RESULT([not tested in cross-compiling])])
CPPFLAGS=$OLD_CPPFLAGS
CFLAGS=$OLD_CFLAGS
LIBS=$OLD_LIBS
fi
fi
#######################################################################
# Tune gettext stuff for our needs #
#######################################################################
case $srcdir in
/*) topdir=$srcdir ;;
*) topdir=`pwd`/$srcdir ;;
esac
for domain in `grep ^SUBDIRS $srcdir/po/Makefile.am | cut -d= -f2`
do
# Symlinks to the single copy of Makefile.in.in
echo "creating po/$domain/Makefile.in.in"
mkdir -p po/$domain
rm -f po/$domain/Makefile.in.in
ln -s "$topdir/po/Makefile.in.in" "po/$domain/Makefile.in.in"
done
AC_CONFIG_COMMANDS([translations],
[rm -rf translations
case $srcdir in
/*) topdir=$srcdir ;;
*) topdir=`pwd`/$srcdir ;;
esac
for domain in `grep ^SUBDIRS $srcdir/po/Makefile.am | cut -d= -f2`
do
# Symlinks that allow message catalogs to be used from build tree
if test -w $srcdir; then
for lang in `cat $srcdir/po/$domain/LINGUAS`
do
mkdir -p $srcdir/translations/$lang/LC_MESSAGES
rm -f $srcdir/translations/$lang/LC_MESSAGES/$domain.mo
ln -s $topdir/po/$domain/$lang.gmo $srcdir/translations/$lang/LC_MESSAGES/$domain.mo
done
fi
done])
#######################################################################
# Data file substitution. #
#######################################################################
AM_CONDITIONAL([LITE], [test "x$lite" = "xyes"])
if test "x$lite" = "xyes"; then
PACKAGE=$PACKAGE-lite
fi
AC_SUBST([DATA_FILES])
AC_SUBST([FONT_FILES])
AC_SUBST([IMAGE_FILES])
AC_SUBST([MUSIC_FILES])
AC_SUBST([SOUND_FILES])
AC_CONFIG_FILES([Makefile
po/Makefile
po/wesnoth/Makefile.in
po/wesnoth-editor/Makefile.in
po/wesnoth-lib/Makefile.in
po/wesnoth-tutorial/Makefile.in
po/wesnoth-httt/Makefile.in
po/wesnoth-ei/Makefile.in
po/wesnoth-trow/Makefile.in
po/wesnoth-tb/Makefile.in
po/wesnoth-tsg/Makefile.in
po/wesnoth-utbs/Makefile.in
m4/Makefile
icons/Makefile
src/Makefile
doc/Makefile
doc/man/Makefile])
AC_OUTPUT
|