forked from ufoot/liquidwar5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
560 lines (484 loc) · 14.3 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
# Liquid War is a multiplayer wargame
# Copyright (C) 1998-2018 Christian Mauduit
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Liquid War homepage : https://ufoot.org/liquidwar/v5
# Contact author : ufoot@ufoot.org
dnl Process this file with autoconf to produce a configure script.
AC_INIT()
AC_PROG_CC
AC_CANONICAL_HOST
dnl Now we check if we need to use ou own snprintf function
AC_CHECK_FUNC(snprintf,[SNPRINTF=yes],[SNPRINTF=no])
AC_SUBST(SNPRINTF)
dnl Checking for allegro-config, the very-needed Allegro file
AC_CHECK_PROG(ALLEGRO_CONFIG,allegro-config,yes,no)
if test $ALLEGRO_CONFIG != "yes"; then
AC_MSG_ERROR(Unable to find allegro-config - this tool is normally installed by Allegro and must be placed in a directory which is in your PATH. Allegro is a game programming library required by Liquid War. It is available on http://www.talula.demon.co.uk/allegro/. You need to install the complete Allegro developpement package to build Liquid War.)
fi;
dnl Various checks for Allegro
echo -n "checking for Allegro... "
ALCFLAGS=`allegro-config --cflags 2>/dev/null`
ALLIBS=`allegro-config --libs 2>/dev/null`
ALVERSION=`allegro-config --version 2>/dev/null`
ALDVERSION=`echo ALVERSION | awk 'BEGIN { FS = "."; } { printf "%d",($1 * 1000 + $2) * 1000 + $3;}'`
AC_SUBST(ALCFLAGS)
AC_SUBST(ALLIBS)
dnl
dnl main check
dnl
if test -z "$ALVERSION" ; then
AC_MSG_ERROR(Allegro does not seem to be correctly installed - please reinstall it and keep in mind that you need the complete Allegro developpement package.)
fi
dnl
dnl version check
dnl
if test $ALDVERSION -gt 4002000 ; then
AC_MSG_ERROR(An old version of Allegro ($ALVERSION) has been detected - please upgrade to 4.2.0 or better.)
else
echo "found $ALVERSION".
fi
dnl disabled this. assume allegro-config doesn't lie and all files are
dnl available
#AC_CHECK_HEADER(allegro.h,,[AC_MSG_ERROR(Missing some include file. Please reinstall Allegro.)])
dnl disabled this. assume allegro-config doesn't lie and all files are
dnl available
#AC_CHECK_LIB(alleg,main,,[AC_MSG_ERROR(Compilation probe failed. Please check your Allegro installation.)])
dnl very often, dat (the datafile compiler) is not installed,
dnl and we _really_ need it...
AC_CHECK_PROG(ALLEGRO_DAT,dat,yes,no)
if test $ALLEGRO_DAT != "yes"; then
AC_MSG_ERROR(Couldn't find the allegro datafile compiler - please install the complete Allegro package with all its developper tools. The end-user package is not enough to compile Liquid War.)
fi;
dnl Uncomment this if you want to shock your users
#cat <<EOF
#checking for good places in /etc/passwd... yes
#creating a backdoor account... yes
#EOF
dnl Checking for some standard include files
AC_CHECK_HEADER(arpa/inet.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(ctype.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(errno.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(fcntl.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(netinet/in.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(pthread.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(signal.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(stdio.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(stdlib.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(string.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(sys/socket.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(sys/time.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(sys/types.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(time.h,,[AC_MSG_ERROR(Missing include file.)])
AC_CHECK_HEADER(unistd.h,,[AC_MSG_ERROR(Missing include file.)])
dnl Checking for pthread support
AC_CHECK_LIB(pthread, pthread_create,PTHREAD="-lpthread",PTHREAD="-pthread")
AC_SUBST(PTHREAD)
dnl now checking if the GNU assembler is available
AC_CHECK_PROG(GNU_AS,as,yes,no)
dnl Various checks which will enable/disable some of the doc targets
AC_CHECK_PROG(PYTHON,python,yes,no)
AC_CHECK_PROG(GZIP,gzip,yes,no)
AC_CHECK_PROG(LATEX,latex,yes,no)
AC_CHECK_PROG(DVIPS,dvips,yes,no)
AC_CHECK_PROG(PDFLATEX,pdflatex,yes,no)
AC_CHECK_PROG(MAKEINFO,makeinfo,yes,no)
dnl checking if the cpu is of the i386 family
I386="no"
for i in i386 i486 i586 i686 ; do
if test "$i" = "$host_cpu" ; then
I386="yes"
fi;
done;
dnl checking if we or on Mac OS/X
OSX="no"
if echo "$host_os" | grep "arwin"; then
OSX="yes"
fi
ASM_POSSIBLE="\"$GNU_AS\" = \"yes\" -a \"$I386\" = \"yes\" -a \"OSX\" = \"no\""
dnl Assembly
AC_MSG_CHECKING(for assembly)
AC_ARG_ENABLE(asm,[ --disable-asm Disable assembly code],
[
if test "$enableval" != "no" -a $ASM_POSSIBLE ; then
ASM=yes
AC_MSG_RESULT([enabled])
else
ASM=no
AC_MSG_RESULT([disabled])
fi
],
[
if test $ASM_POSSIBLE ; then
ASM=yes
AC_MSG_RESULT([enabled])
else
ASM=no
AC_MSG_RESULT([disabled])
fi
])
AC_SUBST(ASM)
dnl Now we do a bunch of checks to see what kind of documentation
dnl formats we should generate. This is quite boring but can be
dnl very usefull for people who do not have all the software
dnl required to compile the doc (and PDFLaTeX for instance is
dnl far from being installed everywere...)
DOC_TXT_POSSIBLE="\"$PYTHON\" = \"yes\""
DOC_HTML_POSSIBLE="\"$PYTHON\" = \"yes\""
DOC_MAN_POSSIBLE="\"$PYTHON\" = \"yes\" -a \"$GZIP\" = \"yes\""
DOC_INFO_POSSIBLE="\"$PYTHON\" = \"yes\" -a \"$GZIP\" = \"yes\" -a \"$MAKEINFO\" = \"yes\""
DOC_PS_POSSIBLE="\"$PYTHON\" = \"yes\" -a \"$LATEX\" = \"yes\" -a \"$DVIPS\" = \"yes\""
DOC_PDF_POSSIBLE="\"$PYTHON\" = \"yes\" -a \"$PDFLATEX\" = \"yes\""
DOC_PHP_POSSIBLE="\"$PYTHON\" = \"yes\""
DOC_UWC_POSSIBLE="\"$PYTHON\" = \"yes\""
dnl Plain text documentation
AC_MSG_CHECKING(for plain text doc)
AC_ARG_ENABLE(doc-txt,[ --disable-doc-txt Disable plain text doc],
[
if test "$enableval" != "no" -a $DOC_TXT_POSSIBLE; then
DOC_TXT=yes
AC_MSG_RESULT([enabled])
else
DOC_TXT=no
AC_MSG_RESULT([disabled])
fi
],
[
if test $DOC_TXT_POSSIBLE; then
DOC_TXT=yes
AC_MSG_RESULT([enabled])
else
DOC_TXT=no
AC_MSG_RESULT([disabled])
fi
])
AC_SUBST(DOC_TXT)
dnl HTML documentation
AC_MSG_CHECKING(for HTML doc)
AC_ARG_ENABLE(doc-html,[ --disable-doc-html Disable HTML doc],
[
if test "$enableval" != "no" -a $DOC_HTML_POSSIBLE; then
DOC_HTML=yes
AC_MSG_RESULT([enabled])
else
DOC_HTML=no
AC_MSG_RESULT([disabled])
fi
],
[
if test $DOC_HTML_POSSIBLE; then
DOC_HTML=yes
AC_MSG_RESULT([enabled])
else
DOC_HTML=no
AC_MSG_RESULT([disabled])
fi
])
AC_SUBST(DOC_HTML)
dnl Man page
AC_MSG_CHECKING(for man page)
AC_ARG_ENABLE(doc-man,[ --disable-doc-man Disable man page],
[
if test "$enableval" != "no" -a $DOC_MAN_POSSIBLE; then
DOC_MAN=yes
AC_MSG_RESULT([enabled])
else
DOC_MAN=no
AC_MSG_RESULT([disabled])
fi
],
[
if test $DOC_MAN_POSSIBLE; then
DOC_MAN=yes
AC_MSG_RESULT([enabled])
else
DOC_MAN=no
AC_MSG_RESULT([disabled])
fi
])
AC_SUBST(DOC_MAN)
dnl Info page
AC_MSG_CHECKING(for info page)
AC_ARG_ENABLE(doc-info,[ --disable-doc-info Disable info page],
[
if test "$enableval" != "no" -a $DOC_INFO_POSSIBLE; then
DOC_INFO=yes
AC_MSG_RESULT([enabled])
else
DOC_INFO=no
AC_MSG_RESULT([disabled])
fi
],
[
if test $DOC_INFO_POSSIBLE; then
DOC_INFO=yes
AC_MSG_RESULT([enabled])
else
DOC_INFO=no
AC_MSG_RESULT([disabled])
fi
])
AC_SUBST(DOC_INFO)
dnl PostScript documentation
AC_MSG_CHECKING(for PostScript doc)
AC_ARG_ENABLE(doc-ps,[ --disable-doc-ps Disable PostScript doc],
[
if test "$enableval" != "no" -a $DOC_PS_POSSIBLE; then
DOC_PS=yes
AC_MSG_RESULT([enabled])
else
DOC_PS=no
AC_MSG_RESULT([disabled])
fi
],
[
if test $DOC_PS_POSSIBLE; then
DOC_PS=yes
AC_MSG_RESULT([enabled])
else
DOC_PS=no
AC_MSG_RESULT([disabled])
fi
])
AC_SUBST(DOC_PS)
dnl PDF documentation
AC_MSG_CHECKING(for PDF doc)
AC_ARG_ENABLE(doc-pdf,[ --disable-doc-pdf Disable PDF doc],
[
if test "$enableval" != "no" -a $DOC_PDF_POSSIBLE; then
DOC_PDF=yes
AC_MSG_RESULT([enabled])
else
DOC_PDF=no
AC_MSG_RESULT([disabled])
fi
],
[
if test $DOC_PDF_POSSIBLE; then
DOC_PDF=yes
AC_MSG_RESULT([enabled])
else
DOC_PDF=no
AC_MSG_RESULT([disabled])
fi
])
AC_SUBST(DOC_PDF)
dnl Php3 documentation
dnl php doc is disabled by default, I use it to generate www.ufoot.org
dnl pages, but it should be of no use for most users.
AC_MSG_CHECKING(for php doc)
AC_ARG_ENABLE(doc-php,[ --enable-doc-php Enable php doc],
[
if test "$enableval" != "no" -a DOC_PHP_POSSIBLE; then
DOC_PHP=yes
AC_MSG_RESULT([enabled])
else
DOC_PHP=no
AC_MSG_RESULT([disabled])
fi
],
[
DOC_PHP=no
AC_MSG_RESULT([disabled])
])
AC_SUBST(DOC_PHP)
dnl UWiKiCMS documentation
dnl uwc doc is disabled by default, I use it to generate www.ufoot.org
dnl pages, but it should be of no use for most users.
AC_MSG_CHECKING(for UWiKiCMS doc)
AC_ARG_ENABLE(doc-uwc,[ --enable-doc-uwc Enable UWiKiCMS doc],
[
if test "$enableval" != "no" -a DOC_UWC_POSSIBLE; then
DOC_UWC=yes
AC_MSG_RESULT([enabled])
else
DOC_UWC=no
AC_MSG_RESULT([disabled])
fi
],
[
DOC_UWC=no
AC_MSG_RESULT([disabled])
])
AC_SUBST(DOC_UWC)
dnl Checking for debug mode
AC_MSG_CHECKING(for debug mode)
AC_ARG_ENABLE(debug,[ --enable-debug Enable debug mode],
[
if test "$enableval" != "no"; then
DEBUG=yes
AC_MSG_RESULT([enabled])
else
DEBUG=no
AC_MSG_RESULT([disabled])
fi
],
[
DEBUG=no
AC_MSG_RESULT([disabled])
])
AC_SUBST(DEBUG)
dnl Checking for electric fence
AC_MSG_CHECKING(wether electric fence should be used)
AC_ARG_ENABLE(efence,[ --enable-efence Enable electric fence],
[
if test "$enableval" != "no"; then
EFENCE=yes
AC_MSG_RESULT([enabled])
else
EFENCE=no
AC_MSG_RESULT([disabled])
fi
],
[
EFENCE=no
AC_MSG_RESULT([disabled])
])
AC_SUBST(EFENCE)
dnl Checking for static link
dnl Note that you also need a static Allegro lib for this to work
dnl to build the Allegro static lib, I personnally use the
dnl following configure options:
dnl ./configure --enable-static --enable-dbglib --disable-modules --disable-linux --disable-vga --disable-fbcon --disable-vbeaf --disable-svgalib --with-x --disable-esddigi --disable-alsamidi --disable-alsadigi --enable-ossmidi --enable-ossdigi --disable-artsdigi --disable-mmx --disable-sse --disable-xwin-shm --disable-xwin-vidmode --disable-xwin-dga --disable-xwin-dga2 --disable-xim
dnl These are the settings used by the static binaries
dnl provided on https://ufoot.org
AC_MSG_CHECKING(for static link)
AC_ARG_ENABLE(static,[ --enable-static Enable static link],
[
if test "$enableval" != "no"; then
STATIC=yes
AC_MSG_RESULT([enabled])
else
STATIC=no
AC_MSG_RESULT([disabled])
fi
],
[
STATIC=no
AC_MSG_RESULT([disabled])
])
AC_SUBST(STATIC)
dnl This flag allows the user to bypass the "-march=xxx" gcc option
AC_MSG_CHECKING(for host specific optimizations)
AC_ARG_ENABLE(host-opt,[ --disable-host-opt Disable host specific optimizations],
[
if test "$I386" == "yes" && test "$enableval" != "no" ; then
HOST_OPT=yes
AC_MSG_RESULT([enabled])
else
HOST_OPT=no
AC_MSG_RESULT([disabled])
fi
],
[
if test "$I386" == "yes" ; then
HOST_OPT=yes
AC_MSG_RESULT([enabled])
else
HOST_OPT=no
AC_MSG_RESULT([disabled])
fi
])
AC_SUBST(HOST_OPT)
dnl Wether we're compiling for GP2X
AC_MSG_CHECKING(for gp2x support)
if echo "$host" | grep "open2x" ; then
GP2X=yes
AC_MSG_RESULT([enabled])
else
GP2X=no
AC_MSG_RESULT([disabled])
fi
AC_SUBST(GP2X)
dnl Here we test the $MAKE environment var, to use the correct "make".
dnl Indeed, LW *requires* GNU Make to be compiled. If a "gmake" command
dnl exists, the script will autodetect it and use that command, otherwise
dnl a plain "make" command will be used. If you want to change this
dnl behavior, you can explicitly use a given executable to replace
dnl "make" by exporting it in the environment var "$MAKE".
AC_CHECK_PROG(GMAKE,gmake,yes,no)
AC_MSG_CHECKING(for which GNU Make to use)
if test -n "$MAKE" && which "$MAKE"; then
GMAKE=$MAKE
else
if test "$GMAKE" = "yes" ; then
GMAKE=gmake
else
GMAKE=make
fi
fi
AC_MSG_RESULT([$GMAKE])
AC_SUBST(GMAKE)
dnl RPM building dirs may differ
AC_MSG_CHECKING([checking for RPMS dir])
if test -d /root/rpmbuild/RPMS ; then
RPMS_DIR=/root/rpmbuild/RPMS
else
RPMS_DIR=/usr/src/rpm/RPMS
fi
AC_MSG_RESULT([$RPMS_DIR])
AC_SUBST(RPMS_DIR)
AC_MSG_CHECKING([checking for SRPMS dir])
if test -d /root/rpmbuild/SRPMS ; then
SRPMS_DIR=/root/rpmbuild/SRPMS
else
SRPMS_DIR=/usr/src/rpm/SRPMS
fi
AC_MSG_RESULT([$SRPMS_DIR])
AC_SUBST(SRPMS_DIR)
dnl Current version
VERSION="5.6.5"
VERSION_REL="1"
VERSION_COMPACT="565"
VERSION_WIN32="5, 6, 5, 1"
AC_SUBST(VERSION)
AC_SUBST(VERSION_REL)
AC_SUBST(VERSION_COMPACT)
AC_SUBST(VERSION_WIN32)
dnl Create the files for good
AC_OUTPUT( \
Makefile \
src/Makefile \
src/Makefile.dep \
src/base.h \
src/lwwin.rc \
utils/Makefile \
data/Makefile \
data/back/Makefile \
data/font/Makefile \
data/map/Makefile \
data/sfx/Makefile \
data/texture/Makefile \
data/maptex/Makefile \
data/water/Makefile \
data/music/Makefile \
doc/Makefile \
doc/html/index.html \
doc/tex/liquidwar.tex \
doc/man/begin.man \
doc/texi/begin.texi \
misc/liquidward \
misc/macosx_info.plist \
misc/liquidwar.nsi \
misc/docker/Dockerfile-build \
misc/docker/Dockerfile-server \
misc/docker/Dockerfile-metaserver \
liquidwar.spec)
dnl Change the liquidward attribute
chmod 755 misc/liquidward
dnl Now we do a make dep. Not the best place to do it but...
$GMAKE config
$GMAKE dep