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