~swag/armagetronad/0.2.9-sty+ct+ap-fork

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: luke-jr
  • Date: 2006-05-29 01:55:42 UTC
  • Revision ID: svn-v3-list-QlpoOTFBWSZTWZvbKhsAAAdRgAAQABK6798QIABURMgAAaeoNT1TxT1DQbKaeobXKiyAmlWT7Y5MkdJOtXDtB7w7DOGFBHiOBxaUIu7HQyyQSvxdyRThQkJvbKhs:7d95bf1e-0414-0410-9756-b78462a59f44:armagetronad%2Fbranches%2F0.2.8%2Farmagetronad:4612
Unify tags/branches of modules released together

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl I would like to do this to generate the version number...
 
2
dnl AC_DEFUN([AUTOMATIC_VERSION],syscmd([sh batch/make/version .]))
 
3
 
 
4
dnl but have to do this with version generated in bootstrap.sh instead for some reason
 
5
m4_include(version)
 
6
 
 
7
dnl Comment this out to disable autoconf custom directories: 
 
8
m4_include(accustomdir.m4)
 
9
 
 
10
dnl Process this file with autoconf to produce a configure script.
 
11
AC_INIT(Armagetronad,AUTOMATIC_VERSION)
 
12
 
 
13
dnl flag telling the status message whether some files will be installed outside of prefix
 
14
OUTSIDE_OF_PREFIX=no
 
15
 
 
16
dnl system type
 
17
AC_CANONICAL_TARGET
 
18
 
 
19
dnl those two are apparently included in AC_CANONICAL_TARGET
 
20
dnl AC_CANONICAL_BUILD
 
21
dnl AC_CANONICAL_HOST
 
22
 
 
23
AC_PROG_RANLIB
 
24
AM_INIT_AUTOMAKE
 
25
 
 
26
dnl detect which link commant to use
 
27
AC_PROG_LN_S
 
28
 
 
29
dnl check whether m4 is available for documentation processing
 
30
AC_CHECK_PROG(HAVE_M4,m4,true,false)
 
31
AM_CONDITIONAL(HAVE_M4, test $HAVE_M4 = true)
 
32
 
 
33
dnl check whether date accepts -r to refer to a file
 
34
AM_CONDITIONAL(DATE_R, date +"%Y" -r $0 > /dev/null 2>&1)
 
35
 
 
36
dnl export version
 
37
version=$VERSION
 
38
AC_SUBST(version)
 
39
 
 
40
AC_ARG_VAR(XML2_CONFIG,[Configuration script of libxml2 to use, defaults to xml2-config])
 
41
AC_ARG_VAR(CXXFLAGS,Flags passed to the C++ compiler)
 
42
AC_ARG_VAR(DEBUGLEVEL,[Debug level for developers, normal users can safely ignore it. Accepted values go from 0 to 5. See README-DEVELOPER for details.])
 
43
AC_ARG_VAR(CODELEVEL,[Code checking strictness level for developers, normal users can safely ignore it. Accepted values go from 0 to 4. See README-DEVELOPER for details.])
 
44
AC_ARG_VAR(docstyle,[Documentation style for cross-building of documentation. Possible values: unix, web and windows.])
 
45
 
 
46
dnl a modern autoconf is required to process this
 
47
AC_PREREQ(2.50)
 
48
 
 
49
build_regular=true
 
50
 
 
51
AC_ARG_ENABLE(glout,
 
52
     AC_HELP_STRING([--enable-glout],
 
53
                [enable graphical output; otherwise, compile a dedicated server (default=enabled)]),
 
54
     [case "${enableval}" in
 
55
       yes) build_dedicated=false
 
56
                        build_regular=true
 
57
                ;;
 
58
       no)  build_dedicated=true
 
59
                        build_regular=false
 
60
            ;;
 
61
       *) AC_MSG_ERROR(bad value ${enableval} for --enable-glout) ;;
 
62
     esac],[build_dedicated=false])
 
63
 
 
64
# flag to set when mockup versions of the executables should be built to save
 
65
# compile time when testing the release process
 
66
AM_CONDITIONAL(BUILDFAKERELEASE, test "$ARMAGETRONAD_FAKERELEASE" != "")
 
67
 
 
68
# set replacement variables for dedicated server
 
69
progtitle_serverorclient=" Client"
 
70
progtitle_server=""
 
71
if test x$build_dedicated = xtrue; then
 
72
   progtitle_serverorclient=" Server"
 
73
   progtitle_server=" Server"
 
74
fi
 
75
AC_SUBST(progtitle_serverorclient)
 
76
AC_SUBST(progtitle_server)
 
77
AC_SUBST(build_dedicated)
 
78
AC_SUBST(build_regular)
 
79
 
 
80
dnl AC_ARG_ENABLE(glout,
 
81
dnl [  --enable-glout          enable graphical output; otherwise, compile
 
82
dnl                          a dedicated server (default=enabled)],,
 
83
dnl enable_glout=yes)
 
84
 
 
85
AC_ARG_ENABLE(master,
 
86
     AC_HELP_STRING([--enable-master],
 
87
                [Build the master server]),
 
88
     [case "${enableval}" in
 
89
       yes) armamaster=true ;;
 
90
       no)  armamaster=false ;;
 
91
       *) AC_MSG_ERROR(bad value ${enableval} for --enable-master) ;;
 
92
     esac],[armamaster=false])
 
93
         
 
94
AM_CONDITIONAL(BUILDMASTER, test x$armamaster = xtrue)
 
95
 
 
96
AC_ARG_ENABLE(main,
 
97
     AC_HELP_STRING([--enable-main],
 
98
                [Build the main program]),
 
99
     [case "${enableval}" in
 
100
       yes) armamain=true ;;
 
101
       no)  armamain=false ;;
 
102
       *) AC_MSG_ERROR(bad value ${enableval} for --enable-main) ;;
 
103
     esac],[armamain=true])
 
104
 
 
105
# consistency check of the three build flags     
 
106
test x$armamain = xfalse && build_dedicated=false build_regular=false
 
107
test x$build_dedicated = xfalse && test x$build_regular = xfalse && buildmain=false
 
108
 
 
109
AM_CONDITIONAL(BUILDDEDICATED, test x$build_dedicated = xtrue)
 
110
AM_CONDITIONAL(BUILDREGULAR, test x$build_regular = xfalse)
 
111
AM_CONDITIONAL(BUILDMAIN, test x$armamain = xtrue)
 
112
 
 
113
AC_ARG_ENABLE(memmanager,
 
114
        AC_HELP_STRING([--enable-memmanager],
 
115
                [enable custom memory manager on systems that allow it (default=disabled)]),,
 
116
enable_memmanager=no)
 
117
 
 
118
AC_ARG_ENABLE(music,
 
119
        AC_HELP_STRING([--enable-music],
 
120
                [compile in support for background music (default=disabled)]),,
 
121
enable_music=no)
 
122
 
 
123
AC_ARG_ENABLE(krawall,
 
124
        AC_HELP_STRING([--enable-krawall],
 
125
                [enable special code for the krawall gaming network (user authentification...) (default=disabled)]),,
 
126
enable_krawall=no)
 
127
 
 
128
AC_ARG_ENABLE(krawallserver,
 
129
        AC_HELP_STRING([--enable-krawallserver],
 
130
                [enable special code for the krawall gaming network SERVER (user database query...). dont't touch this! (default=disabled)]),,
 
131
enable_krawallserver=no)
 
132
 
 
133
AC_ARG_ENABLE(automakedefaults,
 
134
        AC_HELP_STRING([--enable-automakedefaults],
 
135
                [enforce the default installation directories as set by automake. localstatedir=prefix/var violates the FHS, so this is off by default.]),,
 
136
enable_automakedefaults=no enable_automakedefaults_default=yes)
 
137
 
 
138
AC_ARG_ENABLE(dirty,
 
139
        AC_HELP_STRING([--enable-dirty],
 
140
                [allow dirty GL initialisation (like used with SDL 1.0) even if you have SDL 1.1 or up (default=disabled)]),,
 
141
enable_dirty=no)
 
142
 
 
143
AC_ARG_ENABLE(sysinstall,
 
144
        AC_HELP_STRING([--enable-sysinstall],
 
145
                [will install configuration files to /etc/armagetron and create a user if possible (default=enabled)]),,
 
146
enable_sysinstall=yes)
 
147
 
 
148
AC_ARG_ENABLE(useradd,
 
149
        AC_HELP_STRING([--enable-useradd],
 
150
                [will create a user during installation (default=enabled; requires --enable-sysinstall or a manual call of the sysinstall script)]),,
 
151
enable_useradd=yes enable_useradd_default=yes)
 
152
AC_SUBST(enable_useradd)
 
153
 
 
154
AC_ARG_ENABLE(etc,
 
155
        AC_HELP_STRING([--enable-etc],
 
156
                [will create links in /etc to the configuration files (default=enabled; requires --enable-sysinstall or a manual call of the sysinstall script)]),,
 
157
enable_etc=yes enable_etc_default=yes)
 
158
AC_SUBST(enable_etc)
 
159
 
 
160
AC_ARG_ENABLE(desktop,
 
161
        AC_HELP_STRING([--enable-desktop],
 
162
                [will try to integrate into your desktop environment via menu entries (default=enabled; requires --enable-sysinstall or a manual call of the sysinstall script)]),,
 
163
enable_desktop=yes)
 
164
AC_SUBST(enable_desktop)
 
165
 
 
166
initdir=location
 
167
AC_ARG_ENABLE(initscripts,
 
168
        AC_HELP_STRING([--enable-initscripts=location],
 
169
                [will install init scripts for the servers into <location>(default=enabled; requires --enable-sysinstall; <location> defaults to /etc/init.d or /etc/rc.d)]),
 
170
test "x${enableval}" = "xyes" || initdir=${enableval}
 
171
test "x${enableval}" = "xno" || enable_initscripts=yes,
 
172
enable_initscripts=yes enable_initscripts_default=yes
 
173
# disable initscripts if no server is beeing built
 
174
test x$build_dedicated = xfalse && test x$armamaster = xfalse && enable_initscripts=no
 
175
initdir=location)
 
176
AC_SUBST(enable_initscripts)
 
177
 
 
178
AC_ARG_ENABLE(restoreold,
 
179
        AC_HELP_STRING([--enable-restoreold],
 
180
                [will try to install links to previous installation on uninstallation in multiver mode (default=enabled; requires --enable-sysinstall or a manual call of the sysinstall script)]),,
 
181
enable_restoreold=yes)
 
182
AC_SUBST(enable_restoreold)
 
183
 
 
184
AC_ARG_ENABLE(uninstall,
 
185
        AC_HELP_STRING([--enable-uninstall@<:@=cmd@:>@],
 
186
                [will install an uninstaller script (default=enabled)]),
 
187
if test "$enableval" = "no"; then
 
188
        enable_uninstall=no
 
189
else
 
190
        enable_uninstall=yes
 
191
        external_uninstall_cmd=$enableval
 
192
fi,
 
193
enable_uninstall=yes)
 
194
AC_SUBST(external_uninstall_cmd)
 
195
 
 
196
AC_ARG_ENABLE(multiver,
 
197
        AC_HELP_STRING([--enable-multiver@<:@=slot@:>@],
 
198
                [allow multiple versions to coexist by storing them in different directories (default=disabled)]),
 
199
if test "$enableval" = "no"; then
 
200
        enable_multiver=no
 
201
else
 
202
        enable_multiver=yes
 
203
        multiver_slot="$enableval"
 
204
fi,
 
205
enable_multiver=no)
 
206
 
 
207
AC_ARG_ENABLE(games,
 
208
        AC_HELP_STRING([--enable-games],
 
209
                [decorates all installation paths with "games" (default=enabled)]),,
 
210
enable_games=yes)
 
211
 
 
212
if test x$enable_krawall = xyes; then
 
213
AC_DEFINE(KRAWALL,,enables krawall)
 
214
fi
 
215
 
 
216
if test x$enable_krawallserver = xyes; then
 
217
AC_DEFINE(KRAWALL_SERVER,,enables krawall server)
 
218
fi
 
219
 
 
220
dnl developer CXXFLAGS
 
221
test -z "$DEBUGLEVEL" && DEBUGLEVEL=0
 
222
test -z "$CODELEVEL" && CODELEVEL=0
 
223
 
 
224
test $DEBUGLEVEL -ge 1 && CXXFLAGS="$CXXFLAGS -O0 -g"
 
225
test $DEBUGLEVEL -ge 2 && CXXFLAGS="$CXXFLAGS -DDEBUG"
 
226
test $DEBUGLEVEL -ge 3 && enable_memmanager=yes
 
227
test $DEBUGLEVEL -ge 4 && CXXFLAGS="$CXXFLAGS -DDEBUG_EXPENSIVE"
 
228
test $DEBUGLEVEL -ge 5 && CXXFLAGS="$CXXFLAGS -DMEM_DEB"
 
229
 
 
230
dnl default CXX flags: optimize for size if no optimization optimization has been selected yet
 
231
test -z "`echo $CXXFLAGS | grep "\-O"`" && CXXFLAGS="$CXXFLAGS -O2"
 
232
 
 
233
test $CODELEVEL -ge 1 && CXXFLAGS="$CXXFLAGS -Wall"
 
234
dnl test $CODELEVEL -ge 2 && CXXFLAGS="$CXXFLAGS -Wshadow -Wpointer-arith -Wfloat-equal -W -Wcast-qual -Wcast-align -Wconversion -Wunreachable-code --pedantic -Winline"
 
235
test $CODELEVEL -ge 2 && CXXFLAGS="$CXXFLAGS -Wpointer-arith -W -Wcast-qual -Wcast-align -Wconversion --pedantic -Wno-unused-parameter"
 
236
test $CODELEVEL -ge 3 && CXXFLAGS="$CXXFLAGS -Weffc++ -Wshadow -Winline -Wfloat-equal"
 
237
test $CODELEVEL -ge 4 && CXXFLAGS="$CXXFLAGS -Werror"
 
238
 
 
239
# work arond known cause of warnings in SDL headers
 
240
test $CODELEVEL -ge 2 && test x$build_dedicated = xtrue || CXXFLAGS="$CXXFLAGS -Wno-long-long"
 
241
 
 
242
dnl determine whether "games" should be put into paths: not if it was
 
243
dnl requested with --disable-games or if "games" is already included
 
244
dnl in the data path
 
245
games_suffix_data=/
 
246
games_suffix_doc=/
 
247
games_suffix_config=/
 
248
games_suffix_var=/
 
249
if test "${enable_games}" = "yes"; then
 
250
      test -z "`echo ${datadir}       | grep games`" && games_suffix_data=/games/
 
251
      test -z "`echo ${prefix}        | grep games`" && games_suffix_doc=/games/
 
252
      test -z "`echo ${sysconfdir}    | grep games`" && games_suffix_config=/games/
 
253
      test -z "`echo ${localstatedir} | grep games`" && games_suffix_var=/games/
 
254
fi
 
255
AC_SUBST(games_suffix_data)
 
256
AC_SUBST(games_suffix_config)
 
257
AC_SUBST(games_suffix_doc)
 
258
AC_SUBST(games_suffix_var)
 
259
 
 
260
dnl determine memmanager state
 
261
if test x$enable_memmanager != xyes ; then
 
262
  AC_DEFINE(DONTUSEMEMMANAGER)
 
263
fi
 
264
 
 
265
dnl LibTool configuration
 
266
dnl AC_LIBTOOL_DLOPEN
 
267
dnl AM_PROG_LIBTOOL
 
268
 
 
269
dnl Header file
 
270
AC_CONFIG_HEADER(config.h)
 
271
 
 
272
 
 
273
dnl Checks for programs.
 
274
 
 
275
dnl C Compiler:
 
276
dnl AC_PROG_CC
 
277
AC_PROG_CPP
 
278
 
 
279
dnl C++ Compiler:
 
280
AC_PROG_CXX
 
281
AC_PROG_CXXCPP
 
282
dnl AC_OBJEXT
 
283
 
 
284
dnl Make:
 
285
dnl AC_PROG_MAKE_SET
 
286
 
 
287
AC_CHECK_PROG(HAVE_GMAKE, gmake, yes, no)
 
288
if test ${HAVE_GMAKE} = no && make --version | head -n 1 | grep -v "GNU make" 2>&1 /dev/null; then
 
289
   AC_MSG_ERROR([GNU make (gmake) is currently required for compilation.])
 
290
fi
 
291
 
 
292
AC_CHECK_PROG(HAVE_BASH, bash, yes, no)
 
293
if test ${HAVE_BASH} = no; then
 
294
   AC_MSG_ERROR([GNU Bourne-Again SHell (bash) is currently required for compilation.])
 
295
fi
 
296
 
 
297
dnl testing a nifty make feature: silent inclu[]des
 
298
AC_SINCLUDE
 
299
 
 
300
dnl determine the program name and title
 
301
if test "x$progtitle" = "x" ; then
 
302
  progtitle="Armagetron Advanced"
 
303
fi
 
304
 
 
305
if test "x$progname" = "x" ; then
 
306
  progname=armagetronad
 
307
fi
 
308
 
 
309
prognamebase=$progname
 
310
AC_SUBST(progtitle)
 
311
AC_SUBST(progname)
 
312
AC_SUBST(prognamebase)
 
313
 
 
314
AM_CONDITIONAL(USE_SYSINSTALL, test "$enable_sysinstall" = "yes")
 
315
AM_CONDITIONAL(USE_UNINSTALL, test "$enable_uninstall" = "yes")
 
316
 
 
317
AM_CONDITIONAL(ALLOW_MULTIPLE_VERSIONS, test "$enable_multiver" = "yes")
 
318
AC_SUBST(enable_multiver)
 
319
if test "$enable_multiver" = "yes"; then
 
320
  if test "$multiver_slot" = "yes"; then
 
321
    multiver_slot="$PACKAGE_VERSION"
 
322
  fi
 
323
   progdir_suffix="-$multiver_slot"
 
324
   executable_suffix="-$multiver_slot"
 
325
else
 
326
   progdir_suffix=""
 
327
   executable_suffix=""
 
328
fi
 
329
AC_SUBST(progdir_suffix)
 
330
AC_SUBST(executable_suffix)
 
331
 
 
332
dnl AC_DEFINE(PROGDIR_SUFFIX,\"$progdir_suffix\",[Define to the suffix of all installation folders])
 
333
AC_DEFINE_UNQUOTED(PROGDIR_SUFFIX,"${progdir_suffix}",[Define to the suffix of all installation folders])
 
334
 
 
335
dnl type checks
 
336
AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define if you have the type socklen_t.]),,[#include <sys/types.h>
 
337
#include <sys/socket.h>])
 
338
 
 
339
# tells the makefile if the data files need to be installed
 
340
needdata=yes
 
341
AC_SUBST(needdata)
 
342
 
 
343
test "$docstyle" = "" && docstyle=unix
 
344
 
 
345
# find good default of init script directory
 
346
initdirdefault=/etc/init.d
 
347
for candidate in /etc/rc.d /etc/init.d; do
 
348
    test -d ${candidate} && initdirdefault=${candidate}
 
349
done
 
350
 
 
351
# configuration for various unix flavours
 
352
define(GENERICUNIX,[
 
353
        MATHLIB="m"
 
354
        AC_PATH_X
 
355
        AC_PATH_XTRA
 
356
        if test x$have_x = xyes; then
 
357
            CFLAGS="$CFLAGS $X_CFLAGS"
 
358
            CXXFLAGS="$CXXFLAGS $X_CFLAGS"
 
359
            LIBS="$X_LIBS $LIBS"
 
360
            SYS_GL_LIB="GL"
 
361
            SYS_GLU_LIB="GLU"
 
362
        else
 
363
            SYS_GL_LIB="GL"
 
364
            SYS_GLU_LIB="GLU"
 
365
        fi
 
366
]
 
367
)
 
368
 
 
369
define(SAFEUNIX,[
 
370
        AC_DEFINE(DONTUSEMEMMANAGER, 1, [Define if you dont want to use a custom memory manager.])
 
371
GENERICUNIX
 
372
]
 
373
)
 
374
 
 
375
SDL_CONFIG=sdl-config
 
376
 
 
377
dnl *************************************************
 
378
dnl GL AND  MATHLIB SELECTION ( SYSTEM DEPENDANT)
 
379
dnl *************************************************
 
380
case "$target" in
 
381
    *-*-cygwin* | *-*-mingw32*)
 
382
        AC_DEFINE(WIN32, 1, [Windows 9x/NT/2k/XP])
 
383
        MATHLIB=""
 
384
        SYS_GL_LIB="opengl32"
 
385
        SYS_GLU_LIB="glu32"
 
386
        ;;
 
387
    *-*-beos*)
 
388
        AC_DEFINE(BEOS, 1, [BeOS])
 
389
        MATHLIB=""
 
390
        SYS_GL_LIB="GL"
 
391
        SYS_GLU_LIB="GLU"
 
392
        ;;
 
393
    *-*-darwin*)
 
394
        AC_DEFINE(MACOSX, 1, [Mac OS X])
 
395
        MATHLIB=""
 
396
        SYS_GL_LIB=""
 
397
        SYS_GLU_LIB=""
 
398
        #LIBS="$LIBS -framework GLU -framework Quicktime -lsmpeg"
 
399
        ;;
 
400
    *-*-aix*)
 
401
        AC_DEFINE(AIX, 1, [AIX])
 
402
        MATHLIB=""
 
403
        if test x$ac_cv_prog_gcc = xyes; then
 
404
            CXXFLAGS="$CXXFLAGS -mthreads"
 
405
        fi
 
406
        SYS_GL_LIB=""
 
407
        SYS_GLU_LIB=""
 
408
        ;;
 
409
    *-*-solaris*)
 
410
        AC_DEFINE(SOLARIS, 1, [Solaris])
 
411
        AC_DEFINE(CAUTION_WALL, 1, [Define if your system deos not like the pointer tricks in eWall.h.])
 
412
        LIBS="$LIBS -lnsl -lsocket"
 
413
SAFEUNIX
 
414
        ;;
 
415
    *-*-linux* )
 
416
        AC_DEFINE(LINUX, 1, [GNU/Linux])
 
417
GENERICUNIX
 
418
                ;;
 
419
    *-*-openbsd* )
 
420
        # OpenBSD, almost like generic Unix, but needs different init script handling
 
421
        initdirdefault=OpenBSD
 
422
SAFEUNIX
 
423
        ;;
 
424
    *-*-freebsd* )
 
425
        # FreeBSD, sdl-config is specialized to sdl11-config there
 
426
        SDL_CONFIG=sdl11-config
 
427
SAFEUNIX
 
428
        ;;
 
429
    *)
 
430
        # generic unix
 
431
SAFEUNIX
 
432
        ;;
 
433
esac
 
434
 
 
435
AC_SUBST(docstyle)
 
436
 
 
437
#processor specific setup
 
438
case "$target" in
 
439
    i*86-*-*)
 
440
        ;;
 
441
        x86_64-*-*)
 
442
        ;;
 
443
    sparc-*-*)
 
444
        ;;
 
445
    *)
 
446
                #disable memory manager; it may depend on processor features
 
447
                AC_DEFINE(DONTUSEMEMMANAGER)
 
448
        ;;
 
449
esac
 
450
 
 
451
AC_CACHE_SAVE
 
452
 
 
453
dnl *************************************************
 
454
dnl         libxml2
 
455
dnl *************************************************
 
456
 
 
457
test -z "$XML2_CONFIG" && XML2_CONFIG=xml2-config
 
458
 
 
459
# if test x$armamain = xtrue; then
 
460
AC_CHECK_LIB(xml2,xmlParseMemory,
 
461
#export CXXFLAGS="$CXXFLAGS `$XML2_CONFIG --cflags`"
 
462
export CPPFLAGS="$CPPFLAGS `$XML2_CONFIG --cflags`"
 
463
export LIBS="`$XML2_CONFIG --libs` $LIBS"
 
464
AC_DEFINE(HAVE_LIBXML2, 1, [Define if you have the xml2 library (-lxml2).]),
 
465
AC_MSG_ERROR([You need the library xml2 to compile Armagetron. Read the file doc/install_linux.html.])
 
466
,`$XML2_CONFIG --libs`)
 
467
 
 
468
AC_CHECK_FUNC(xmlParserInputBufferCreateFilenameDefault,
 
469
,
 
470
AC_DEFINE(HAVE_LIBXML2_WO_PIBCREATE, 1, [Define if your xml2 library is obsolete (lacks xmlParserInputBufferCreateFilenameDefault).])
 
471
AC_MSG_WARN([
 
472
        Your xml2 library is obsolete!
 
473
        Map validation will be insecure and may fail!
 
474
])
 
475
)
 
476
# fi
 
477
 
 
478
if test x$build_regular = xfalse; then
 
479
 AC_MSG_RESULT([
 
480
 
 
481
 Configuring dedicated server, skipping libraries...
 
482
 ])
 
483
 AC_DEFINE(DEDICATED,,[Define if you wish to compile a dedicated server])
 
484
 
 
485
 progname=${prognamebase}-dedicated
 
486
 AC_SUBST(progname)
 
487
 
 
488
 needdata=no
 
489
 AC_SUBST(needdata)
 
490
else
 
491
 
 
492
 
 
493
if test x$enable_dirty = xyes; then
 
494
  AC_DEFINE(DIRTY,,[Define if you wish to use the old and dirty OpenGL
 
495
  initialization method])
 
496
fi
 
497
 
 
498
 
 
499
 
 
500
dnl *************************************************
 
501
dnl         math
 
502
dnl *************************************************
 
503
 
 
504
if test $MATHLIB ; then
 
505
AC_CHECK_LIB($MATHLIB, exp,,
 
506
        AC_MSG_WARN([
 
507
        You do not have the standard math library libm. Check
 
508
        config.log for error messages and fix that.]
 
509
        )
 
510
)
 
511
fi
 
512
 
 
513
dnl *************************************************
 
514
dnl         SDL
 
515
dnl *************************************************
 
516
 
 
517
AC_MSG_CHECKING(whether SDL is installed)
 
518
if SDLLIBS=`${SDL_CONFIG} --libs`; then
 
519
    AC_MSG_RESULT([yes, '${SDL_CONFIG} --libs' gave ${SDLLIBS}])
 
520
    AC_MSG_CHECKING(what name the SDL library is know under)
 
521
    SDLLIB=SDL`echo ${SDLLIBS} | sed -e "s,.*-lSDL,," -e "s, .*$,,"`
 
522
    if test -z ${SDLLIB}; then
 
523
        SDLLIB=`${SDLLIBS} | sed -e "s,.*-l,," -e "s, .*$,,"`
 
524
        if test -z ${SDLLIB}; then
 
525
            AC_MSG_RESULT([failed, taking default: SDL])
 
526
            SDLLIB=SDL
 
527
        else
 
528
            AC_MSG_RESULT([failed, taking anything from ${SDL_CONFIG} output: ${SDLLIB}])
 
529
        fi
 
530
    else
 
531
        AC_MSG_RESULT(${SDLLIB})
 
532
    fi
 
533
else
 
534
    AC_MSG_RESULT(no, trying default name)
 
535
    SDLLIBS=''
 
536
    SDLLIB=SDL
 
537
fi
 
538
 
 
539
AC_CHECK_LIB($SDLLIB,SDL_Init,
 
540
CXXFLAGS="$CXXFLAGS `${SDL_CONFIG} --cflags`"
 
541
CPPFLAGS="$CPPFLAGS `${SDL_CONFIG} --cflags`"
 
542
export CPPFLAGS
 
543
export CXXFLAGS
 
544
LIBS="${SDLLIBS} $LIBS"
 
545
export LIBS
 
546
AC_DEFINE(HAVE_LIBSDL,,[Define if you have the library SDL]),
 
547
AC_MSG_ERROR([You need the library SDL to compile Armagetron. Read the file doc/install_linux.html.])
 
548
,${SDLLIBS})
 
549
 
 
550
dnl *************************************************
 
551
dnl         SDL_Mixer
 
552
dnl *************************************************
 
553
 
 
554
if test x$enable_music = xyes; then
 
555
 AC_CHECK_LIB(SDL_mixer,Mix_OpenAudio,
 
556
 AC_DEFINE(HAVE_LIBSDL_MIXER, 1, [Define if you have the SDL_mixer library (-lSDL_mixer).])
 
557
 LIBS="-lSDL_mixer $LIBS",
 
558
 AC_MSG_WARN([
 
559
 SDL_mixer library not found. You will not hear music.])
 
560
 enable_music=no
 
561
 ,)
 
562
fi
 
563
 
 
564
dnl *************************************************
 
565
dnl  Winsock on windows cross-compile
 
566
dnl *************************************************
 
567
 
 
568
if test "`${SDL_CONFIG} --libs | grep windows`" ; then
 
569
        AC_CHECK_LIB(wsock32, main)
 
570
fi
 
571
 
 
572
dnl *************************************************
 
573
dnl         GL
 
574
dnl *************************************************
 
575
 
 
576
if test $SYS_GL_LIB && echo $LIBS | grep -v "\-lGL" > /dev/null; then
 
577
 
 
578
dnl AC_CHECK_LIB($SYS_GL_LIB, glEnd,,
 
579
 
 
580
AC_CHECK_LIB($SYS_GL_LIB, glVertex3f,,
 
581
 AC_MSG_RESULT([OpenGL not found. Maybe it needs X11 to compile? Checking that...])
 
582
 AC_CHECK_LIB(X11,main,
 
583
  LIBS="-lX11 -L/usr/X11R6/lib $LIBS"
 
584
  export LIBS
 
585
  AC_DEFINE(HAVE_LIBX11, 1, [Define if you have the X11 library (-lX11).])
 
586
  ,
 
587
  AC_MSG_WARN([
 
588
  Standard X11 library needed by OpenGL not found.
 
589
  ]),-L/usr/X11R6/lib)
 
590
 AC_CHECK_LIB(Xext,main,-L/usr/X11R6/lib)
 
591
 AC_CHECK_LIB(Xt,main,-L/usr/X11R6/lib)
 
592
 AC_CHECK_LIB(Xi,main,-L/usr/X11R6/lib)
 
593
 AC_CHECK_LIB(Xmu,main,-L/usr/X11R6/lib)
 
594
AC_CHECK_LIB($SYS_GL_LIB, glBegin,,AC_MSG_ERROR([
 
595
  You need Mesa or an OpenGL-System to compile Armagetron.
 
596
  Maybe your libGL needs the X libraries and your system does not
 
597
  find them? Read the file doc/install_linux.html.]),-L/usr/X11R6/lib)
 
598
)
 
599
 
 
600
dnl check for 3DFX-MESA
 
601
dnl AC_CHECK_LIB(GL,XMesaSetFXmode,AC_DEFINE(HAVE_FXMESA),,)
 
602
 
 
603
fi
 
604
 
 
605
dnl *************************************************
 
606
dnl         GLU
 
607
dnl *************************************************
 
608
 
 
609
 
 
610
if test $SYS_GLU_LIB && echo $LIBS | grep -v "\-lGLU" > /dev/null; then
 
611
 
 
612
dnl AC_CHECK_LIB($SYS_GLU_LIB, gluBuild2DMipmaps,,
 
613
AC_CHECK_LIB($SYS_GLU_LIB, gluBuild3DMipmaps,,
 
614
AC_MSG_ERROR([
 
615
You need GLU to compile Armagetron; it SHOULD have come with OpenGL.
 
616
Read the file doc/install_linux.html.]))
 
617
 
 
618
fi
 
619
 
 
620
dnl *************************************************
 
621
dnl         Other Stuff
 
622
dnl *************************************************
 
623
 
 
624
dnl AC_CHECK_LIB(g++, main,,
 
625
dnl AC_MSG_WARN([C++ standard library not found. You can ignore this warning on non-GNU-systems.]))
 
626
 
 
627
AC_CHECK_LIB(z, main,,
 
628
AC_MSG_ERROR([You need libz to compile Armagetron.]))
 
629
 
 
630
AC_CHECK_LIB(png, main,,
 
631
AC_MSG_ERROR([You need libpng to compile Armagetron.]))
 
632
 
 
633
AC_CHECK_LIB(jpeg, main,,
 
634
        AC_MSG_WARN([
 
635
        libjpeg not found. Expect small graphical errors ( missing moviepack title screen ).]
 
636
        )
 
637
)
 
638
 
 
639
AC_CHECK_LIB(SDL_image, IMG_Load,,
 
640
dnl AC_CHECK_LIB(IMG, main,,
 
641
AC_MSG_ERROR([You need libIMG/SDL_image to compile Armagetron.]
 
642
dnl )
 
643
))
 
644
 
 
645
dnl look for the right header for SDL_image
 
646
AC_CHECK_HEADERS(SDL_image.h,,
 
647
[
 
648
AC_MSG_WARN([SDL_image header not found where it should be ( the SDL include directory ).
 
649
Trying fallback.])
 
650
AC_CHECK_HEADERS(SDL/SDL_image.h,,
 
651
[AC_MSG_WARN([
 
652
SDL_image header not found. The library is there, so something must be unusual
 
653
in your setup: SDL_image.h does not reside in the same folder as the rest of the SDL
 
654
inlcudes and not in any SDL subdirectory in the inclue path. If you know the
 
655
correct path to it, edit src/render/rTexture.cpp and enter it there.])]
 
656
)
 
657
]
 
658
)
 
659
 
 
660
ifelse(,,,
 
661
[
 
662
dnl look for the right way to include the opengl headers
 
663
AC_CHECK_HEADERS( SDL_opengl.h,,
 
664
AC_CHECK_HEADERS( SDL/SDL_opengl.h,,
 
665
AC_CHECK_HEADERS( GL/gl.h,,
 
666
AC_CHECK_HEADERS( OpenGL/gl.h,,
 
667
AC_MSG_ERROR([OpenGL header not found.])
 
668
)
 
669
)
 
670
)
 
671
)
 
672
])
 
673
 
 
674
fi dnl (dedicated server)
 
675
 
 
676
if test "`$CXX -v 2>&1 | grep -v executing | grep pgcc`"  ; then
 
677
AC_MSG_WARN(
 
678
[
 
679
 
 
680
 
 
681
You are using PGCC to compile Armagetron. Due to a bug in PGCC,
 
682
exception handling needs to be disabled. This makes the server
 
683
mode vulnerable to an attack that causes the server to block or
 
684
crash. (The attack is still detected, but nothing can be done 
 
685
about it. You will get the message \"I told you not to use PGCC!\")
 
686
 
 
687
 
 
688
])
 
689
CXXFLAGS="$CXXFLAGS -fno-exceptions -DNOEXCEPT"
 
690
export CXXFLAGS
 
691
fi
 
692
 
 
693
 
 
694
dnl Replace `main' with a function in -lpthread:
 
695
 
 
696
dnl Checks for header files.
 
697
AC_HEADER_STDC
 
698
AC_CHECK_HEADERS(unistd.h)
 
699
 
 
700
dnl Checks for typedefs, structures, and compiler characteristics.
 
701
AC_C_CONST
 
702
 
 
703
dnl Checks for library functions.
 
704
AC_CHECK_FUNCS(select)
 
705
AC_CHECK_FUNCS(atan2f sinf cosf tanf sqrtf logf expf fabsf floorf)
 
706
AC_CHECK_FUNCS(wmemset)
 
707
 
 
708
# if the compiler is GCC -Os produces faulty code (exceptions cause crashes), at least on AMD64. Replace it with -O2.
 
709
test -z "`$CXX --version | grep '(GCC)'`" || CXXFLAGS="`echo $CXXFLAGS | sed -e 's,-Os,-O2,g' `" CFLAGS="`echo $CFLAGS | sed -e 's,-Os,-O2,g' `"
 
710
 
 
711
dnl add current directories to include search path
 
712
CXXFLAGS="-I. -I.. $CXXFLAGS"
 
713
export CXXFLAGS
 
714
 
 
715
# define
 
716
AC_DEFINE_UNQUOTED(TOP_SOURCE_DIR,"${srcdir}", [Define the top source directory])
 
717
AC_DEFINE_UNQUOTED(PROGNAME,"${progname}", [Define the short progam name (with possible -dedicated suffix)])
 
718
AC_DEFINE_UNQUOTED(PROGNAMEBASE,"${prognamebase}", [Define the short progam name])
 
719
 
 
720
realprefix=${prefix}
 
721
test x${realprefix} = xNONE && realprefix=${ac_default_prefix}
 
722
AC_DEFINE_UNQUOTED(PREFIX,"${realprefix}",[Define to the compiled in prefix where most game directories will be children of])
 
723
realexecprefix=${exec_prefix}
 
724
test x${realexecprefix} = xNONE && realexecprefix=${realprefix}
 
725
 
 
726
AM_CONDITIONAL(NEEDDATA, test "$needdata" = "yes" )
 
727
 
 
728
#test universal variables
 
729
dnl univar1=\${prefix}/foo
 
730
dnl univar2=bar
 
731
dnl AC_SUBST_UNIVERSAL(univar1)
 
732
dnl AC_SUBST_UNIVERSAL(univar2)
 
733
dnl AC_AA_PATH(tridir,${prefix}/tri,[trinary data],[PREFIX/tri])
 
734
 
 
735
# set and export init directory
 
736
test "x$initdir" = "xlocation" && initdir=${initdirdefault}
 
737
AC_SUBST(initdir)
 
738
AC_AA_PATH_NOSUFFIX_RAW(initdir)
 
739
 
 
740
if test "x$enable_automakedefaults" = "xno"; then
 
741
    # DEVIATION FROM AUTOMAKE DEFAULT for better FHS compatibility:
 
742
    # automake puts localstatedir to ${prefix}/var. This violates
 
743
    # the FHS condition that /usr needs to be mountable read-only
 
744
    # (except for installing/uninstalling software), so we put it 
 
745
    # by default to /var. Relocation does not suffer as no files
 
746
    # are installed there initially.
 
747
    if test "x$build_dedicated" = "xtrue" || test "x$armamaster" = "xtrue"; then
 
748
        AC_MSG_CHECKING(whether to bend localstatedir to /var)
 
749
        if test "x${localstatedir}" = "x\${prefix}/var"; then
 
750
            if test -d `eval echo ${localstatedir}`; then
 
751
                AC_MSG_RESULT([no, the automake default exists])
 
752
            else
 
753
                AC_MSG_RESULT(yes)
 
754
                localstatedir=/var
 
755
                test "x$enable_automakedefaults_default" = "xyes" && OUTSIDE_OF_PREFIX=yes
 
756
            fi
 
757
        else
 
758
            AC_MSG_RESULT([no, it has been overridden by the user])
 
759
        fi
 
760
    fi
 
761
    # this is not the best way to do it as the user has to set
 
762
    # --localstatedir=/usr/local/var and not --localstatedir=\${prefix}/var
 
763
    # to override it, but I could not find anything better.
 
764
 
 
765
    # ANOTHER DEVIATION: if --enable-games is set and the bindir
 
766
    # is the default, try to find an alternative binary directory
 
767
    # that also lies in the path, but has /games in it.
 
768
    if test "x${bindir}" = "x\${exec_prefix}/bin" && test "x$enable_games" = "xyes"; then
 
769
        for alt in bin/games games games/bin; do
 
770
            AC_MSG_CHECKING([alternative binary path ${realexecprefix}/${alt}])
 
771
            if test -d ${realexecprefix}/${alt} && echo ${PATH} | grep ${realexecprefix}/${alt} > /dev/null; then
 
772
                bindir=\${exec_prefix}/${alt}
 
773
                AC_MSG_RESULT(possible)
 
774
            else
 
775
                AC_MSG_RESULT(no)
 
776
            fi
 
777
        done
 
778
        # echo binary path : ${bindir}
 
779
    fi
 
780
fi
 
781
 
 
782
# paths given by autoconf relevant to us
 
783
# raw paths. No suffix, nothing to do but make them known
 
784
AC_AA_PATH_NOSUFFIX_RAW(prefix)
 
785
AC_AA_PATH_NOSUFFIX_RAW(exec_prefix)
 
786
 
 
787
# check whether those are part of suffix and disable relocability if not
 
788
AC_AA_PATH_PREPARE_BINRELOC(bindir,\${exec_prefix})
 
789
AC_AA_PATH_NOSUFFIX_RAW(bindir)
 
790
AC_AA_PATH_PREPARE_BINRELOC(sbindir,\${exec_prefix})
 
791
AC_AA_PATH_NOSUFFIX_RAW(sbindir)
 
792
 
 
793
# the full program on those: add (/games)/armagetronad(-dedicated) suffix,
 
794
# check relocability. The suffix can be overridden any time, before or after
 
795
# this block.
 
796
AC_AA_PATH_PREPARE_BINRELOC(datadir,\${prefix})
 
797
AC_AA_PATH_RAW(datadir)
 
798
AC_AA_PATH_PREPARE_BINRELOC(sysconfdir,\${prefix})
 
799
AC_AA_PATH_RAW(sysconfdir)
 
800
AC_AA_PATH_PREPARE(localstatedir)
 
801
AC_AA_PATH_RAW(localstatedir)
 
802
AC_AA_PATH_PREPARE(infodir)
 
803
AC_AA_PATH_RAW(infodir)
 
804
AC_AA_PATH_PREPARE(mandir)
 
805
AC_AA_PATH_RAW(mandir)
 
806
 
 
807
# additional paths:
 
808
# scripts
 
809
AC_AA_PATH(scriptdir,${aa_datadir}/scripts,[shell scripts],[DATADIR/scripts])
 
810
 
 
811
# documentation
 
812
AC_AA_PATH_PREPARE(docdir)
 
813
AC_AA_PATH(docdir,${datadir}/doc,[documentation],[DATADIR/doc])
 
814
 
 
815
# PID files
 
816
AC_AA_PATH_PREPARE(rundir)
 
817
rundir_suffix=""
 
818
AC_AA_PATH(rundir,${localstatedir}/run,[PID files],[LOCALSTATEDIR/run])
 
819
 
 
820
# log files
 
821
AC_AA_PATH_PREPARE(logdir)
 
822
logdir_suffix=""
 
823
AC_AA_PATH(logdir,${localstatedir}/log,[server logs],[LOCALSTATEDIR/log])
 
824
 
 
825
# state files of previous version to move to new location
 
826
oldvardirdefault=/var/${progname}/var
 
827
test "x$enable_games" = "xyes" && oldvardirdefault=/var/games/${progname}/var
 
828
AC_AA_PATH_WITH(oldvardir,\${prefix}${oldvardirdefault},[directory where the state files of a previous version may be kept; they'll be moved to their new place on installation.],[oldvardir])
 
829
AC_ARG_ENABLE(migratestate,AC_HELP_STRING([--enable-migratestate],
 
830
        [tries to move old server state data to its new location (default=enabled)]),,
 
831
        enable_migratestate=yes)
 
832
AC_SUBST_UNIVERSAL(enable_migratestate)
 
833
 
 
834
# determine whether binreloc should be used
 
835
# this needs to come after all AC_AA_PATH_PREPARE_BINRELOC macros.
 
836
AM_BINRELOC
 
837
 
 
838
# disable user addition for client
 
839
test x$build_dedicated = xtrue -o x$armamaster = xtrue || enable_useradd=no enable_useradd_default=no
 
840
 
 
841
# export relocatability to all systems (doesn't strictly have to
 
842
# go through the 'determine at build time' mechanism, but it doesn't hurt.
 
843
relocatable=${br_cv_binreloc}
 
844
AC_SUBST_UNIVERSAL(relocatable)
 
845
 
 
846
AC_USE_SUBST_UNIVERSAL
 
847
AC_AA_REPLACEPATHS
 
848
 
 
849
AC_OUTPUT(src/Makefile
 
850
src/first/Makefile
 
851
Makefile
 
852
batch/Makefile
 
853
language/languages.txt
 
854
config/rc.config config/aiplayers.cfg
 
855
src/doc/Makefile src/doc/net/Makefile src/doc/Doxyfile
 
856
src/doc/html.m4
 
857
src/thirdparty/Makefile
 
858
src/thirdparty/particles/Makefile
 
859
resource/Makefile
 
860
config/Makefile
 
861
desktop/Makefile
 
862
desktop/armagetronad.desktop
 
863
)
 
864
 
 
865
# m4_define(FULLEVAL,stage1=`eval echo $1`; stage2 
 
866
 
 
867
echo "Configuration complete!"
 
868
echo ""
 
869
echo "Options selected are:"
 
870
echo "     Build Regular Game Client: $build_regular"
 
871
echo "     Build Dedicated Server: $build_dedicated"
 
872
echo "     Build Master Server: $armamaster"
 
873
echo ""
 
874
echo "Installation options:"
 
875
echo "     Prefix: $prefix"
 
876
echo ""
 
877
if test x$build_dedicated = xtrue -o x$armamaster = xtrue ;
 
878
then
 
879
echo "     Build with Krawall authentication support (server): $enable_krawallserver"
 
880
echo "     Init scripts will be installed in  : $initdir"
 
881
echo "     Dynamic data will be kept in       : `eval echo ${aa_localstatedir}`"
 
882
echo "     PID files will be kept in          : `eval echo ${rundir}`"
 
883
echo "     Log files will be kept in          : `eval echo ${logdir}`"
 
884
echo "     Add user to run server             : $enable_useradd"
 
885
echo ""
 
886
fi
 
887
echo "     Binaries will be installed in      : `eval echo ${bindir}`"
 
888
echo "     Static data will be installed in   : `eval echo ${aa_datadir}`"
 
889
echo "     Configuration will be installed in : `eval echo ${aa_sysconfdir}`"
 
890
echo "     Documentation will be installed in : `eval echo ${aa_docdir}`"
 
891
test "x$enable_etc" = "xyes" && echo "     Link to configuration will go to   : /etc/${progname}"
 
892
echo "     Music support: $enable_music"
 
893
echo "     Build with Krawall authentication support: $enable_krawall"
 
894
echo "     Use dirty SDL initialization: $enable_dirty"
 
895
echo "     Call sysinstall: $enable_sysinstall"
 
896
if test "$enable_uninstall" = "yes" &&
 
897
   test "$external_uninstall_cmd" != ""; then
 
898
        uninstall_info=" (external: \"$external_uninstall_cmd\")"
 
899
else
 
900
        uninstall_info=""
 
901
fi
 
902
echo "     Generate uninstall: $enable_uninstall$uninstall_info"
 
903
if test "$enable_multiver" = "yes"; then
 
904
        multiver_info=" (slot \"$multiver_slot\")"
 
905
else
 
906
        multiver_info=""
 
907
fi
 
908
echo "     Allow multiple versions: $enable_multiver$multiver_info"
 
909
echo "     Use custom memory manager: $enable_memmanager"
 
910
echo "     Debug level: $DEBUGLEVEL"
 
911
echo "     Code level: $CODELEVEL"
 
912
 
 
913
# print warning about behavior deviating from automake's defaults
 
914
SWITCHES=""
 
915
test "x$OUTSIDE_OF_PREFIX" = "xyes" && SWITCHES=" --enable-automakedefaults"
 
916
test "x$enable_useradd_default" = "xyes" && OUTSIDE_OF_PREFIX=yes SWITCHES="${SWITCHES} --disable-useradd"
 
917
test "x$enable_etc_default" = "xyes" && OUTSIDE_OF_PREFIX=yes SWITCHES="${SWITCHES} --disable-etc"
 
918
test x$build_dedicated = xtrue -o x$armamaster = xtrue && test "x$enable_initscripts_default" = "xyes" && echo "${initdir}" | grep '^/etc/' > /dev/null && OUTSIDE_OF_PREFIX=yes SWITCHES="${SWITCHES} --disable-initscripts"
 
919
if test "x$OUTSIDE_OF_PREFIX" = "xyes"; then
 
920
    echo ""
 
921
    echo "Warning: The configure script decided that, to better work on your system,"
 
922
    echo "  it would be a good idea to modify files outside of ${prefix}"
 
923
    echo "   during installation or while running. If you disagree, rerun configure with"
 
924
    echo "   ${SWITCHES}"
 
925
    echo "  after consulting \"configure --help\" for the effects; if you want to get rid"
 
926
    echo "  of this warning, pass the corresponding opposite switches."
 
927
    echo ""
 
928
fi
 
929