1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943
|
dnl C O N F I G U R E . A C
dnl BZFlag
dnl Copyright (c) 1993-2010 Tim Riker
dnl
dnl This package is free software; you can redistribute it and/or
dnl modify it under the terms of the license found in the file
dnl named COPYING that should have accompanied this file.
dnl
dnl THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
dnl
AC_INIT([BZFlag], [2.0.16], [http://BZFlag.org/], [bzflag])
AC_CONFIG_SRCDIR(src/bzflag/bzflag.cxx)
AC_REVISION($Revision $)
AC_CONFIG_AUX_DIR(misc)
# sed magic to get version numbers from src/date/buildDate.cxx
MAJOR_VERSION=`sed -e 's/#.*define.*BZ_MAJOR_VERSION[^0-9]*\(.*\)/\1/' -e t -e d < \$srcdir/src/date/buildDate.cxx`
MINOR_VERSION=`sed -e 's/#.*define.*BZ_MINOR_VERSION[^0-9]*\(.*\)/\1/' -e t -e d < \$srcdir/src/date/buildDate.cxx`
REV=`sed -e 's/#.*define.*BZ_REV[^0-9]*\(.*\)/\1/' -e t -e d < \$srcdir/src/date/buildDate.cxx`
CONF_DATE=`date -u +%Y%m%d`
BZFLAG_DATE=`date -u +%Y-%m-%d`
BZFLAG_VERSION="$MAJOR_VERSION.$MINOR_VERSION.$REV"
echo "BZFlag-$BZFLAG_VERSION.$CONF_DATE"
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.6])
# if this is not a checkout, disable dependency tracking for a faster
# build. it's not likely that the user is doing development from a
# source release. at least they really should not given the extra
# steps that are necessary for making a proper useful diff.
AC_MSG_CHECKING([whether dependency tracking should be enabled])
if test -d $srcdir/CVS -o -d $srcdir/.svn ; then
if test "x$enable_maintainer_mode" = "x" ; then
enable_maintainer_mode="yes"
fi
if test "x$enable_dependency_tracking" = "x" ; then
enable_dependency_tracking="yes"
fi
AC_MSG_RESULT([yes])
else
if test "x$enable_maintainer_mode" = "x" ; then
enable_maintainer_mode="no"
fi
if test "x$enable_dependency_tracking" = "x" ; then
enable_dependency_tracking="no"
fi
AC_MSG_RESULT([no])
fi
# disables the build system dependency tracking by default for the
# automake and autoconf template files, unless this is a checkout.
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(include/config.h)
AC_SUBST(MAJOR_VERSION)
AC_SUBST(MINOR_VERSION)
AC_SUBST(BZFLAG_VERSION)
AC_SUBST(BZFLAG_DATE)
# Let the C++ code know about OS
AC_DEFINE_UNQUOTED(BZ_BUILD_OS, "$host_os", [BZFlag System Environment])
# check for regex option (on means build our own)
AC_ARG_WITH(regex, [ --with-regex Use bzflag regex lib])
if test x$with_regex != xno ; then
AC_DEFINE(BUILD_REGEX, 1, [Building regex])
fi
AM_CONDITIONAL(BUILD_REGEX, test "x$with_regex" != "xno")
# check for SDL option (enabled by default now)
AC_ARG_WITH(SDL, [ --without-SDL do not use Simple DirectMedia Layer])
if test x$with_SDL != xno ; then
with_SDL=yes
fi
dnl FIXME: need to move the rest of the ARGs up here too
# cannot override LD directly, so warn (configure will override it)
if test "x$LD" != "x" ; then
AC_MSG_WARN([LD cannot be set directly yet it seems to be set ($LD)])
fi
#Do not play with CFLAGS and CXXFLAGS if they are set by user
bzflag_test_CFLAGS=${CFLAGS+set}
bzflag_test_CXXFLAGS=${CXXFLAGS+set}
#Checks for programs.
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CXX
AM_CONDITIONAL([GNU_GCC], [test "$GCC" = yes])
AC_ARG_ENABLE(ccachetest, [ --disable-ccachetest don't try to use ccache])
if test x$enable_ccachetest != xno ; then
AC_PATH_PROG(CCACHE, ccache)
fi
if test "$CCACHE"
then
CC="$CCACHE $CC"
CXX="$CCACHE $CXX"
fi
AC_CHECK_TOOL(WINDRES, windres, :)
dnl On SGI systems, figure out if we are using MIPSPro compiler
using_mipspro=no
if test "x$build_vendor" = "xsgi" ; then
AC_MSG_CHECKING([whether we are using the MIPSPro compiler])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
[[#if defined(sgi) && !defined(__GNUC__) && defined(_COMPILER_VERSION)
this line should cause a compile failure when building with the MIPSpro compiler;
#endif
int main() { return 0; }
]])],[using_mipspro=no],[using_mipspro=yes])
AC_MSG_RESULT([$using_mipspro])
fi
AC_PROG_LN_S
# disabled shared libraries in order to prevent double-compilation
# FIXME: necessary until the flags are used properly.
AC_DISABLE_SHARED
if test x$enable_shared != xno ; then
AC_DEFINE(_USE_BZ_API, 1, [Enable plugins])
# explicitly link with the dl library when available
AC_CHECK_LIB(dl, dlopen, [LIBDL=-ldl], [])
AC_SUBST(LIBDL)
fi
AM_CONDITIONAL(BUILD_PLUGINS, test "x$enable_shared" != "xno")
# libtool shouldn't be generated until after LD is set.
# AC_PROG_LIBTOOL goes poof in libtool 1.9, but that's not very
# widespread at all.
# LT_INIT
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_CHECK_PROG(HASPOD2MAN, pod2man, yes, no)
if test x$HASPOD2MAN = xno ; then
AC_MSG_WARN([some man pages will not be generated])
fi
AM_CONDITIONAL(HASPOD2MAN, test $HASPOD2MAN = yes)
AC_SUBST(AR)
AC_CHECK_PROG(AR, ar, ar)
AC_SUBST(AR_FLAGS)
AC_CHECK_LIB(z, compress, BUILDZLIB=no, BUILDZLIB=yes)
AM_CONDITIONAL(BUILDZLIB, test $BUILDZLIB = yes)
#checking for libcurl library
LIBCURL_CHECK_CONFIG(, , ,
[AC_MSG_ERROR([libcurl is required. You must install it. \
See http://curl.haxx.se/])])
# Just for kicks
AC_MSG_CHECKING([for artificial intelligence for bz's robots])
AC_MSG_RESULT([not found])
#Checks for headers
AC_HEADER_STDC
AC_LANG(C++)
AC_CHECK_HEADERS( \
cstdlib \
cstdio \
cstring \
)
AC_LANG(C)
AC_CHECK_HEADERS( \
GL/glx.h \
SDL/SDL.h \
X11/Xlib.h \
bstring.h \
arpa/nameser_compat.h \
linux/input.h \
stdint.h \
sys/param.h \
unistd.h \
values.h \
dsound.h \
)
# nameser_compat.h used by src/c-ares
#Checks for types
#AM_CHECK_TYPES(socklen_t)
#AC_CHECK_TYPES(socklen_t)
AC_C_BIGENDIAN
AC_C_CONST
AC_MSG_CHECKING([for socklen_t type])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>]],
[[socklen_t len = 42; return 0;]])],
[ac_cv_type_socklen_t=yes],[ac_cv_type_socklen_t=no])
if test x$ac_cv_type_socklen_t != xyes ; then
AC_DEFINE(socklen_t, int, [if socklen_t is not defined, provide something useful])
else
AC_DEFINE(HAVE_SOCKLEN_T, 1, [if socklen_t is defined, make note of it])
fi
AC_MSG_RESULT([$ac_cv_type_socklen_t])
# Check for working FF_RUMBLE support in linux/input.h
AC_MSG_CHECKING([for linux rumble joystick support])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <linux/input.h>]],
[[struct ff_effect x; x.u.rumble.weak_magnitude = 42; return 0;]])],
[ac_ff_effect_rumble=yes],[ac_ff_effect_rumble=no])
if test x$ac_ff_effect_rumble = xyes ; then
AC_DEFINE(HAVE_FF_EFFECT_RUMBLE, 1, [we appear to have working support for rumble force feedback effects])
fi
AC_MSG_RESULT([$ac_ff_effect_rumble])
# Check for working directional FF support in linux/input.h
AC_MSG_CHECKING([for linux force feedback joystick support])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <linux/input.h>]],
[[struct ff_effect x; x.direction = 0x4000; return 0;]])],
[ac_ff_effect_directional=yes],[ac_ff_effect_directional=no])
if test x$ac_ff_effect_directional = xyes ; then
AC_DEFINE(HAVE_FF_EFFECT_DIRECTIONAL, 1, [we appear to have working support for directional force feedback effects])
fi
AC_MSG_RESULT([$ac_ff_effect_directional])
case $host_os in
linux*|kfreebsd*|freebsd*|netbsd*|dragonfly*) linux=true;;
*) linux=false;;
esac
AM_CONDITIONAL(LINUX, $linux)
AM_CONDITIONAL(BEOS, test x$host_os = xbeos)
AM_CONDITIONAL(PC, test x$host_vendor = xpc)
AM_CONDITIONAL(PPC, test x$host_vendor = xppc)
case $host_os in
solaris*) solaris=true;;
*) solaris=false;;
esac
AM_CONDITIONAL(SOLARIS, $solaris)
# Write code to detect platform specialization
sun_wspro=false
sun_cc=false
sun_gcc=false
case $host_os in
irix*) irix=true;;
*) irix=false;;
esac
AM_CONDITIONAL(IRIX, $irix)
AM_CONDITIONAL(BUGGY_MIPSPRO, test "x$using_mipspro" = "xyes")
case $host_os in
cygwin|mingw32*|windows**) win32=true;;
*) win32=false;;
esac
AM_CONDITIONAL(WIN32, $win32)
case $host_os in
macos|darwin*) macos=true;;
*) macos=false;;
esac
AM_CONDITIONAL(MACOS, $macos)
#CONFIG is only used for irix packaging
case $host_os in
irix*)
CONFIG=irix-mips3
AC_SUBST(CONFIG)
;;
esac
AC_PATH_XTRA
case $host_os in
macos|darwin*)
;;
*)
LDFLAGS="$LDFLAGS $X_LIBS"
esac
case $host_os in
solaris*)
GLIBS="-lresolv -laudio $GLIBS"
LIBS="$LIBS -lsocket -lnsl -lresolv"
LDFLAGS="$LDFLAGS -L/usr/demo/SOUND/lib"
;;
irix*)
GLIBS="-lXsgivc -lX11 -laudio $GLIBS"
;;
beos)
GLIBS=" -lmedia -lgame $GLIBS"
LIBS="-lbe"
;;
macos|darwin*)
;;
*)
;;
esac
# Check for the math lib
AC_CHECK_LIB(m, sqrtf)
# for BeOS - old network stack don't have those libs ( move it in the case switch ?)
AC_CHECK_LIB([socket], [socket])
AC_CHECK_LIB([socket], [gethostent], [], AC_CHECK_LIB([bind], [gethostent]))
# check for various IEEE and c99 standard math functions in libm
AC_CHECK_LIB([m], [acosf], [AC_DEFINE([HAVE_ACOSF],[1],[libm includes acosf])])
AC_CHECK_LIB([m], [asinf], [AC_DEFINE([HAVE_ASINF],[1],[libm includes asinf])])
AC_CHECK_LIB([m], [atan2f], [AC_DEFINE([HAVE_ATAN2F],[1],[libm includes atan2f])])
AC_CHECK_LIB([m], [atanf], [AC_DEFINE([HAVE_ATANF],[1],[libm includes atanf])])
AC_CHECK_LIB([m], [cosf], [AC_DEFINE([HAVE_COSF],[1],[libm includes cosf])])
AC_CHECK_LIB([m], [expf], [AC_DEFINE([HAVE_EXPF],[1],[libm includes expf])])
AC_CHECK_LIB([m], [fabsf], [AC_DEFINE([HAVE_FABSF],[1],[libm includes fabsf])])
AC_CHECK_LIB([m], [floorf], [AC_DEFINE([HAVE_FLOORF],[1],[libm includes floorf])])
AC_CHECK_LIB([m], [fmodf], [AC_DEFINE([HAVE_FMODF],[1],[libm includes fmodf])])
AC_CHECK_LIB([m], [hypotf], [AC_DEFINE([HAVE_HYPOTF],[1],[libm includes hypotf])])
AC_CHECK_LIB([m], [logf], [AC_DEFINE([HAVE_LOGF],[1],[libm includes logf])])
AC_CHECK_LIB([m], [log10f], [AC_DEFINE([HAVE_LOG10F],[1],[libm includes log10f])])
AC_CHECK_LIB([m], [powf], [AC_DEFINE([HAVE_POWF],[1],[libm includes powf])])
AC_CHECK_LIB([m], [sinf], [AC_DEFINE([HAVE_SINF],[1],[libm includes sinf])])
AC_CHECK_LIB([m], [sqrtf], [AC_DEFINE([HAVE_SQRTF],[1],[libm includes sqrtf])])
AC_CHECK_LIB([m], [tanf], [AC_DEFINE([HAVE_TANF],[1],[libm includes tanf])])
# avoid using X11 in BeOS and Mac OS X
case $host_os in
macos|darwin*)
;;
beos*)
;;
*)
if test x$no_x = x ; then
GLIBS="$X_PRE_LIBS -lX11 $EXTRA_LIBS $GLIBS"
fi
AC_CHECK_LIB(Xext, XextAddDisplay, [GLIBS="-lXext $GLIBS"], [], $GLIBS)
if test x$host_os = xlinux-gnu -o x$host_os = xlinux ; then
AC_CHECK_LIB(Xxf86vm, XF86VidModeGetAllModeLines, [GLIBS="-lXxf86vm $GLIBS"], [], $GLIBS)
# FIXME see XIJoystick.cxx
# AC_CHECK_LIB(Xi, XListInputDevices, [GLIBS="-lXi $GLIBS"], [], $GLIBS)
fi
;;
esac
AC_LANG(C++)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <regex.h>
]], [[
regcomp(0, 0, 0);
regexec(0, 0, 0, 0, 0);
]])],[AC_DEFINE(HAVE_REGEX_H, 1,
[Define to 1 if you have regex stuff available])],[])
ac_cv_search_glBegin=no
ac_cv_search_gluScaleImage=no
ac_func_search_save_LIBS=$LIBS
LIBS="-framework OpenGL $GLIBS $ac_func_search_save_LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <OpenGL/gl.h>]],
[[glBegin(GL_POINTS)]])],
[ac_cv_search_glBegin="-framework OpenGL"],[])
for ac_lib in opengl32 GL GL2 ; do
LIBS="-l$ac_lib $GLIBS $ac_func_search_save_LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <GL/gl.h>]],
[[glBegin(GL_POINTS)]])],
[ac_cv_search_glBegin="-l$ac_lib"
break],[])
done
if test "x$ac_cv_search_glBegin" != "xno" ; then
GLIBS="$ac_cv_search_glBegin $GLIBS"
if test "$ac_cv_search_glBegin" = -lGL2 ; then
AC_DEFINE(BEOS_USE_GL2, 1, [Use new GL Kit for BeOS])
fi
LIBS="-framework OpenGL $ac_func_search_save_LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <OpenGL/glu.h>]],
[[gluScaleImage(GL_RED,0,0,GL_INT,0,0,0,GL_INT,0)]])],
[ac_cv_search_gluScaleImage="-framework OpenGL"],[])
for ac_lib in glu32 GL GLU ; do
LIBS="-l$ac_lib $GLIBS $ac_func_search_save_LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <GL/glu.h>]],
[[gluScaleImage(GL_RED,0,0,GL_INT,0,0,0,GL_INT,0)]])],
[ac_cv_search_gluScaleImage="-l$ac_lib"
break],[])
done
if test "x$ac_cv_search_gluScaleImage" != xno ; then
GLIBS="$ac_cv_search_gluScaleImage $GLIBS"
fi
fi
LIBS=$ac_func_search_save_LIBS
AC_SUBST(GLIBS)
# Check for the GLEW library (GL Extension Wrangler)
AC_ARG_WITH(glew, [ --with-glew use GL Extension Wrangler])
if test x$with_glew != xno ; then
AC_MSG_CHECKING([for GLEW library])
tmpLIBS=$LIBS
GLEW_LIBS="-lGLEW"
LIBS=$GLEW_LIBS
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <GL/glew.h>]],
[[glewInit()]])],
[glew_check="yes"], [glew_check="no"])
if test x$glew_check = xyes ; then
AC_DEFINE(HAVE_GLEW, 1, [GLEW library is available])
else
GLEW_LIBS=""
fi
AC_MSG_RESULT([$glew_check])
LIBS=$tmpLIBS
fi
AC_SUBST(GLEW_LIBS)
case $host_os in
mingw32*)
AC_CHECK_LIB(ws2_32, closesocket)
AC_CHECK_LIB(winmm, timeGetTime)
GLIBS="-mwindows -lgdi32 -ldxguid -ldsound -ldinput $GLIBS"
# MingW does some funny stuff with DirectX.
# Test for a working DirectInput.
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#define DIRECTINPUT_VERSION 0x0700
#include <dinput.h>
]], [[
IDirectInput7* directInput;
HINSTANCE hinst = GetModuleHandle(NULL);
HRESULT success = DirectInputCreateEx(hinst, DIRECTINPUT_VERSION,
IID_IDirectInput7, (void**)&directInput, NULL);
]])],[],[AC_DEFINE(BROKEN_DINPUT, 1, [Define to 1 if your DirectInput headers and libraries are broken or mismatched.])])
;;
esac
# Remove ogg/vorbis dependencies until we actually need them.
#
# AC_CHECK_LIB(ogg, ogg_stream_init, [ALIBS="-logg $ALIBS"], [], $ALIBS)
# AC_CHECK_LIB(vorbis, vorbis_info_init, [ALIBS="-lvorbis $ALIBS"], [], $ALIBS)
# AC_CHECK_LIB(vorbisfile, ov_open, [ALIBS="-lvorbisfile $ALIBS"], [], $ALIBS)
# AC_SUBST(ALIBS)
case $host_os in
macos|darwin*)
if test x$with_SDL = xyes ; then
LIBS="$LIBS -framework Carbon -framework Cocoa -framework OpenGL"
else
LIBS="$LIBS -framework Carbon -framework AGL"
fi
;;
irix)
if test x$host_cpu = xmips64 ; then
LDFLAGS="$LDFLAGS -L$(ROOT)/usr/lib32"
else
LDFLAGS="$LDFLAGS -L$(ROOT)/usr/lib"
fi
;;
esac
if test "x$prefix" = "xNONE" ; then
prefix=$ac_default_prefix
fi
AC_CHECK_LIB(cares, ares_init, BUILDCARES=no, BUILDCARES=yes)
AM_CONDITIONAL(BUILDCARES, test $BUILDCARES = yes)
if test "x$BUILDCARES" = "xyes" ; then
AC_MSG_WARN([using an internal c-ares lib.])
AC_MSG_WARN([Consider installing an updated library at system level])
AC_MSG_WARN([link is http://daniel.haxx.se/projects/c-ares/])
AC_DEFINE(LOCAL_CARES, [], [Using a local version of c-ares.])
fi
MP_WITH_CURSES
# do we want bzadmin?
AC_ARG_ENABLE(bzadmin, [ --disable-bzadmin do not build text client])
if test x$enable_bzadmin != xno ; then
if test "x$CURSES_LIB" = "x" ; then
AC_MSG_WARN([could not find a curses library, will build bzadmin without curses])
fi
AM_CONDITIONAL(BZADMIN_INCLUDED, true)
else
AM_CONDITIONAL(BZADMIN_INCLUDED, false)
fi
AM_CONDITIONAL(HAVE_CURSES, test "x$CURSES_LIB" != x)
AC_SUBST(CURSES_LIB)
AC_ARG_ENABLE(timebomb, [ --enable-timebomb build exp Date])
if test x$enable_timebomb = xyes ; then
AC_DEFINE(TIME_BOMB, "3/13/1998", [Time Bomb expiration])
fi
savedLIBS=$LIBS
LIBS="$GLIBS $LIBS"
AC_LANG(C)
if test x$with_SDL = xyes ; then
AC_MSG_CHECKING([for SDL framework])
savedLDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -framework SDL"
framework_SDL_flag_works=yes
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <SDL/SDL_version.h>]], [[]])],
[],[framework_SDL_flag_works=no ])
AC_MSG_RESULT([$framework_SDL_flag_works])
if test x$framework_SDL_flag_works = xno ; then
LDFLAGS="$savedLDFLAGS"
with_SDL=no
fi
if test x$with_SDL = xno ; then
AM_PATH_SDL(1.2.5, with_SDL=yes, with_SDL=no)
if test x$with_SDL = xno ; then
AC_MSG_WARN([could not find an appropriate SDL version. BZflag will build without SDL])
fi
fi
fi
AC_LANG(C++)
LIBS=$savedLIBS
if test x$with_SDL = xyes ; then
AC_DEFINE(HAVE_SDL, 1, [Using SDL])
fi
AM_CONDITIONAL(HAVE_SDL, test x$with_SDL = xyes)
# Check for the SDL_image library
AC_ARG_ENABLE([sdl_image],
[AC_HELP_STRING([--enable-sdl-image],
[use SDL_Image library if available (default is no)])],
[use_sdl_image=$enableval],
[use_sdl_image=no])
if test $use_sdl_image = "yes"; then
AC_MSG_CHECKING([for SDL_image library])
tmpLIBS=$LIBS
SDL_IMAGE_LIBS="-lSDL_image"
LIBS=$SDL_IMAGE_LIBS
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <SDL/SDL_image.h>]],
[[IMG_Load(NULL)]])],
[sdl_image_check="yes"], [sdl_image_check="no"])
if test "x$sdl_image_check" = "xyes" ; then
AC_DEFINE(HAVE_SDL_IMAGE, 1, [SDL_image library is available])
else
SDL_IMAGE_LIBS=""
fi
AC_MSG_RESULT([$sdl_image_check])
LIBS=$tmpLIBS
else
SDL_IMAGE_LIBS=""
fi
AC_SUBST(SDL_IMAGE_LIBS)
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging])
AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes)
if test x$enable_debug = xyes ; then
AC_DEFINE(DEBUG_RENDERING, 1, [Debug Rendering])
AC_ARG_ENABLE(profiling, [ --enable-profiling turn on profiling])
fi
case $host_os in
macos|darwin*)
AC_ARG_ENABLE(universal, [ --enable-universal create universal binaries for Mac OS X])
;;
esac
AC_ARG_ENABLE(client, [ --disable-client servers-only build])
if test x$enable_client != xno ; then
if test "x$ac_cv_search_gluScaleImage" = "xno" ; then
AC_MSG_WARN(
[Client build has been requested, but GL is not fully available (missing gl.h)
... disabling client generation])
AM_CONDITIONAL(CLIENT_INCLUDED, false)
enable_client=no
else
AM_CONDITIONAL(CLIENT_INCLUDED, true)
fi
else
AM_CONDITIONAL(CLIENT_INCLUDED, false)
fi
AC_ARG_ENABLE(robots, [ --disable-robots disable robots])
if test x$enable_robots != xno ; then
AC_DEFINE(ROBOT, 1, [Enabling Robots])
fi
AC_ARG_ENABLE(snapping, [ --disable-snapping disable snapping])
if test x$enable_snapping != xno ; then
AC_DEFINE(SNAPPING, 1, [Enabling Snapping])
fi
case $host_os in
linux*)
AC_DEFINE(HALF_RATE_AUDIO, 1, [Half rate Audio])
AC_DEFINE(XF86VIDMODE_EXT, 1, [XFree86 Video Mode Extension])
# FIXME see XIJoystick.cxx
#if test x$no_sdl = xyes ; then
#AC_DEFINE(XIJOYSTICK, 1, [XInput Joystick Handling])
#fi
#FLAGS="$FLAGS -Wall -W -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings -Wconversion -Wredundant-decls"
FLAGS="$FLAGS -Wall -W"
case $host_vendor in
pc)
if expr `$CC -dumpversion` \>= "3.4" > /dev/null ; then
FLAGS="$FLAGS -mtune"
else
FLAGS="$FLAGS -mcpu"
fi
# silly hack, should be a proper configure compiler option test
if test x$host_cpu = xx86_64 ; then
FLAGS="$FLAGS=k8"
else
FLAGS="$FLAGS=$host_cpu"
fi
;;
ppc)
FLAGS="$FLAGS -mcpu=$host_cpu"
;;
esac
;;
cygwin)
AC_DEFINE(HALF_RATE_AUDIO, 1, [Half rate Audio])
AC_DEFINE(XF86VIDMODE_EXT, 1, [XFree86 Video Mode Extension])
#if test x$no_sdl = xyes ; then
#AC_DEFINE(XIJOYSTICK, 1, [XInput Joystick Handling])
#fi
FLAGS="$FLAGS -Wall -W -mcpu=$host_cpu"
;;
mingw32*)
WINPORT=windows_port.o
AC_SUBST(WINPORT)
AC_DEFINE(HALF_RATE_AUDIO, 1, [Half rate Audio])
FLAGS="$FLAGS -Wall -W"
if expr `$CC -dumpversion` \>= "3.4" > /dev/null ; then
FLAGS="$FLAGS -mtune=$host_cpu"
else
FLAGS="$FLAGS -mcpu=$host_cpu"
fi
;;
solaris*)
AC_DEFINE(ETC_INET, [], [hosts is in /etc/inet/])
AC_DEFINE(SUN_OGL_NO_VERTEX_MACROS, [], [Sun OpenGL No Macro Vertex])
if $sun_wspro ; then
FLAGS="$FLAGS -KPIC"
elif $sun_cc ; then
FLAGS="$FLAGS -fast"
elif $sun_gcc ; then
FLAGS="$FLAGS -fpermissive"
fi
;;
macos|darwin*)
FLAGS="$FLAGS -pipe -pedantic -fno-exceptions -W -Wall -Wundef -Wno-import"
AC_MSG_CHECKING([whether to build universal binaries])
if test "x$enable_universal" = "xyes" ; then
if test ! -d "/Developer/SDKs/MacOSX10.4u.sdk" ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Unable to find the Universal SDK])
fi
FLAGS="$FLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"
LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
;;
irix)
FLAGS="$FLAGS -Wall"
if test x$host_cpu = xmips64 ; then
FLAGS="FLAGS -march=mips3"
else
FLAGS="FLAGS -march=mips2"
fi
;;
beos*)
AC_DEFINE(HAVE_DEFINED_TOLOWER, 1, [tolower and toupper are not functions])
;;
esac
# We use buildDate.cxx's compilation date instead
# CXXFLAGS="$CXXFLAGS -DBZ_BUILD_DATE=$CONF_DATE"
if test x$enable_debug = xyes ; then
FLAGS="$FLAGS -O0"
case $host_os in
linux*|cygwin|mingw32*)
FLAGS="$FLAGS -Werror -Wshadow"
if test x$enable_profiling = xyes ; then
FLAGS="$FLAGS -pg"
fi
;;
macos|darwin*)
if test x$enable_profiling = xyes ; then
FLAGS="$FLAGS -pg"
fi
;;
beos)
FLAGS="$FLAGS -Werror"
;;
esac
AC_DEFINE(DEBUG, 1, [Debugging enabled])
else
case $host_os in
linux*|cygwin|mingw32*)
FLAGS="$FLAGS -ffast-math -fno-exceptions"
;;
solaris*)
FLAGS="$FLAGS -O"
;;
macos|darwin*)
FLAGS="$FLAGS -O3 -ffast-math -fomit-frame-pointer"
FLAGS="$FLAGS -fexpensive-optimizations -fno-exceptions"
if test x$enable_profiling = xyes ; then
FLAGS="$FLAGS -pg"
fi
;;
irix)
if test x$host_cpu = xmips64 ; then
FLAGS="$FLAGS -O3 -ffast-math -fomit-frame-pointer"
FLAGS="$FLAGS -fexpensive-optimizations -fno-exceptions"
else
FLAGS="$FLAGS -O2"
fi
;;
beos)
FLAGS="$FLAGS -O2 -ffast-math -fomit-frame-pointer"
FLAGS="$FLAGS -fno-exceptions"
;;
esac
AC_DEFINE(NDEBUG, 1, [Debugging disabled])
fi
#Do not play with CFLAGS and CXXFLAGS if they are set by user
if test "x$bzflag_test_CFLAGS" != "xset" ; then
CFLAGS="$CFLAGS $FLAGS"
fi
if test "x$bzflag_test_CXXFLAGS" != "xset" ; then
CXXFLAGS="$CXXFLAGS $FLAGS"
fi
dnl check for -search_paths_first linker flag when making dynamic libraries
search_paths_first_flag="-Wl,-search_paths_first -mdynamic-no-pic"
AC_MSG_CHECKING([if the compiler understands $search_paths_first_flag])
search_paths_first_flag_works=yes
PRELDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $search_paths_first_flag"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],
[search_paths_first_flag_works=no])
AC_MSG_RESULT($search_paths_first_flag_works)
if test "x$search_paths_first_flag_works" = "xno" ; then
LDFLAGS="$PRELDFLAGS"
fi
# Check for functions
AC_CHECK_FUNCS(\
CGLGetCurrentContext \
Sleep \
WaitForSingleObject \
_stricmp \
_strnicmp \
_vsnprintf \
atexit \
getrlimit \
glXGetCurrentContext \
select \
snooze \
usleep \
vsnprintf \
wglGetCurrentContext \
)
dnl test for isnan() presence
BZ_FUNC_ISNAN
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <algorithm>
]], [[
int i = std::min(0, 1); i = i;
]])],[AC_DEFINE(HAVE_STD__MIN, 1, [Define to 1 if you have a conforming std::min])],[])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <algorithm>
]], [[
int i = std::max(0, 1); i = i;
]])],[AC_DEFINE(HAVE_STD__MAX, 1, [Define to 1 if you have a conforming std::max])],[])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <algorithm>
]], [[
char array[] = "test";
int i = std::count(array, array + 5, 't'); i = i;
]])],[AC_DEFINE(HAVE_STD__COUNT, 1, [Define to 1 if you have a conforming
std::count, otherwise old version of count template is assumed])],[])
LIBDIR="\$(top_srcdir)/lib"
AC_SUBST(LIBDIR)
AC_CONFIG_FILES(bzflag.info
BZFlag.xcodeproj/Makefile
Makefile
bzflag.lsm
bzflag.spec
data/Makefile
data/fonts/Makefile
data/l10n/Makefile
debian/Makefile
include/Makefile
m4/Makefile
man/Makefile
misc/Makefile
package/Makefile
package/irix/Makefile
package/linux/Makefile
package/rpm/Makefile
package/win32/Makefile
package/win32/nsis/Makefile
plugins/Makefile
plugins/plugin_utils/Makefile
plugins/plugin_utils/VC9/Makefile
plugins/HoldTheFlag/Makefile
plugins/Phoenix/Makefile
plugins/RogueGenocide/Makefile
plugins/SAMPLE_PLUGIN/Makefile
plugins/TimeLimit/Makefile
plugins/airspawn/Makefile
plugins/chathistory/Makefile
plugins/flagStay/Makefile
plugins/hiddenAdmin/Makefile
plugins/keepaway/Makefile
plugins/killall/Makefile
plugins/koth/Makefile
plugins/logDetail/Makefile
plugins/nagware/Makefile
plugins/playHistoryTracker/Makefile
plugins/pushstats/Makefile
plugins/python/Makefile
plugins/rabbitTimer/Makefile
plugins/rabidRabbit/Makefile
plugins/recordmatch/Makefile
plugins/regFlag/Makefile
plugins/serverControl/Makefile
plugins/shockwaveDeath/Makefile
plugins/teamflagreset/Makefile
plugins/timedctf/Makefile
plugins/wwzones/Makefile
plugins/vc9/Makefile
src/3D/Makefile
src/Makefile
src/bzadmin/Makefile
src/bzflag/Makefile
src/bzfs/Makefile
src/c-ares/Makefile
src/common/Makefile
src/date/Makefile
src/game/Makefile
src/geometry/Makefile
src/geometry/models/Makefile
src/geometry/models/tank/Makefile
src/mediafile/Makefile
src/net/Makefile
src/obstacle/Makefile
src/ogl/Makefile
src/platform/MacOSX/BZFlag-Info.plist
src/platform/MacOSX/Makefile
src/platform/Makefile
src/regex/Makefile
src/scene/Makefile
src/zlib/Makefile
tools/Makefile
tools/TextTool-W32/Makefile
tools/TextTool-W32/res/Makefile
tools/bzwtransform/Makefile
tools/modeltool/Makefile
tools/modeltool/vc9/Makefile
win32/Makefile
win32/VC71/Makefile
win32/VC9/Makefile)
AC_OUTPUT
#################
# patch libtool #
#################
case $host_os in
darwin*)
for script in $ac_top_builddir $ac_abs_builddir $ac_builddir . ; do
if test "x$script" = "x" ; then
libtoolscript="libtool"
else
libtoolscript="${script}/libtool"
fi
if test -f ${libtoolscript} ; then
if test -w ${libtoolscript} ; then
# remove any -all_load option.
# provokes libtool linker bug with noinst C++ libraries.
sed 's/-all_load.*convenience//g' < $libtoolscript > ${libtoolscript}.sed
if test ! "x`cat ${libtoolscript}`" = "x`cat ${libtoolscript}.sed`" ; then
AC_MSG_RESULT([Found -all_load in libtool script, removing])
cp ${libtoolscript}.sed ${libtoolscript}
fi
rm -f ${libtoolscript}.sed
else
AC_MSG_WARN([libtool script exists but is not writable so not attempting to edit])
fi
fi
done
;;
esac
# use AC_MSG_RESULT instead of AC_MSG_NOTIFY to support old autoconf
echo "CFLAGS are $CFLAGS"
echo "CXXFLAGS are $CXXFLAGS"
echo "LDFLAGS are $LDFLAGS"
echo "LIBS are $LIBS"
AC_MSG_RESULT([])
AC_MSG_RESULT([BZFlag-$BZFLAG_VERSION.$CONF_DATE with the following:])
if test "x$CURSES_LIB" = "x" ; then
AC_MSG_RESULT([ no curses!])
else
AC_MSG_RESULT([ curses: $CURSES_LIB])
fi
if test "x$with_SDL" = "xno" ; then
AC_MSG_RESULT([ no SDL!])
else
AC_MSG_RESULT([ SDL])
fi
if test "x$enable_bzadmin" = "xno" ; then
AC_MSG_RESULT([ no bzadmin client binary!])
else
AC_MSG_RESULT([ bzadmin])
fi
if test "x$enable_client" = "xno" ; then
AC_MSG_RESULT([ no bzflag client binary!])
else
AC_MSG_RESULT([ bzflag client])
fi
|