[2] | 1 | dnl Process this file with autoconf to produce a configure script. |
---|
[608] | 2 | AC_INIT(abuse, 0.8) |
---|
[32] | 3 | AC_CONFIG_AUX_DIR(.auto) |
---|
| 4 | AM_INIT_AUTOMAKE |
---|
[41] | 5 | AM_CONFIG_HEADER(config.h) |
---|
[2] | 6 | |
---|
| 7 | dnl Checks for programs. |
---|
| 8 | AC_PROG_LIBTOOL |
---|
| 9 | AC_ISC_POSIX |
---|
| 10 | AC_PROG_CC |
---|
| 11 | AC_PROG_CPP |
---|
| 12 | AC_PROG_CXX |
---|
| 13 | AC_PROG_INSTALL |
---|
| 14 | AC_C_BIGENDIAN |
---|
| 15 | |
---|
| 16 | dnl Check for X |
---|
| 17 | AC_PATH_X |
---|
[628] | 18 | if test "x${x_libraries}" != x; then |
---|
| 19 | X_LIBS="-L${x_libraries}" |
---|
[160] | 20 | fi |
---|
[2] | 21 | |
---|
[478] | 22 | AC_ARG_ENABLE(debug, |
---|
| 23 | [ --enable-debug build debug versions of the game (default no)]) |
---|
| 24 | AC_ARG_ENABLE(release, |
---|
| 25 | [ --enable-release build final release of the game (default no)]) |
---|
[609] | 26 | AC_ARG_ENABLE(nonfree, |
---|
| 27 | [ --disable-nonfree disable non-free data (default no)]) |
---|
[478] | 28 | |
---|
[623] | 29 | AC_ARG_WITH(assetdir, |
---|
| 30 | [ --with-assetdir=DIR override default game data directory]) |
---|
[614] | 31 | |
---|
| 32 | dnl Figure out where the datafiles will be |
---|
[623] | 33 | if test "x${with_assetdir}" = x; then |
---|
| 34 | with_assetdir='$(datadir)/games/abuse' |
---|
[614] | 35 | fi |
---|
[623] | 36 | AC_SUBST([assetdir], [$with_assetdir]) |
---|
[614] | 37 | |
---|
| 38 | dnl Checks for libraries |
---|
[2] | 39 | dnl Do we need to link against something for X shared memory support? |
---|
[614] | 40 | AC_CHECK_LIB(Xext, XShmAttach, :, |
---|
| 41 | [AC_CHECK_LIB(XextSam, XShmAttach, LIBS="$LIBS -lXextSam", :, |
---|
| 42 | $X_LIBS -lX11 -lXext)], |
---|
| 43 | $X_LIBS -lX11) |
---|
[2] | 44 | |
---|
| 45 | dnl Checks for Solaris compatibility |
---|
[614] | 46 | AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm") |
---|
| 47 | AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") |
---|
| 48 | AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl") |
---|
[2] | 49 | |
---|
| 50 | dnl Check for SDL |
---|
| 51 | SDL_VERSION=1.1.6 |
---|
| 52 | AM_PATH_SDL($SDL_VERSION, :, |
---|
[42] | 53 | AC_MSG_ERROR([*** SDL version $SDL_VERSION or above not found!])) |
---|
[2] | 54 | CFLAGS="$CFLAGS $SDL_CFLAGS" |
---|
[160] | 55 | LIBS="$LIBS $SDL_LIBS $X_LIBS" |
---|
[2] | 56 | |
---|
[537] | 57 | dnl Check for SDL mixer |
---|
| 58 | ac_cv_my_have_sdl_mixer="no" |
---|
| 59 | save_CPPFLAGS="${CPPFLAGS}" |
---|
| 60 | CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}" |
---|
[551] | 61 | AC_CHECK_HEADERS(SDL/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"]) |
---|
[537] | 62 | CPPFLAGS="${save_CPPFLAGS}" |
---|
[551] | 63 | if test "${ac_cv_my_have_sdl_mixer}" = "no"; then |
---|
| 64 | AC_MSG_ERROR([*** SDL_mixer not found!]) |
---|
[537] | 65 | fi |
---|
[551] | 66 | LIBS="$LIBS -lSDL_mixer" |
---|
[479] | 67 | |
---|
[478] | 68 | if test "${enable_debug}" = "yes"; then |
---|
| 69 | AC_DEFINE(HAVE_DEBUG, 1, Define to 1 to activate debug) |
---|
| 70 | OPT="-O0" |
---|
| 71 | else |
---|
| 72 | OPT="-O2 -fno-strength-reduce -fomit-frame-pointer" |
---|
| 73 | fi |
---|
| 74 | |
---|
| 75 | if test "${enable_release}" = "yes"; then |
---|
| 76 | AC_DEFINE(HAVE_RELEASE, 1, Define to 1 to activate final release) |
---|
| 77 | REL="" |
---|
| 78 | else |
---|
| 79 | REL="-g" |
---|
| 80 | fi |
---|
| 81 | |
---|
[609] | 82 | dnl Is our package stripped from its non-free data? Or did the user |
---|
| 83 | dnl maybe disable non-free data? |
---|
| 84 | ac_cv_have_nonfree="no" |
---|
| 85 | if test -f "${srcdir}/data/sfx/ambcave1.wav"; then |
---|
| 86 | ac_cv_have_nonfree="yes" |
---|
| 87 | fi |
---|
| 88 | if test "${enable_nonfree}" = "no"; then |
---|
| 89 | ac_cv_have_nonfree="no" |
---|
| 90 | fi |
---|
| 91 | AM_CONDITIONAL(HAVE_NONFREE, test "${ac_cv_have_nonfree}" = "yes") |
---|
| 92 | |
---|
[37] | 93 | # Optimizations |
---|
[478] | 94 | CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}" |
---|
[37] | 95 | # Code qui fait des warnings == code de porc == deux baffes dans ta gueule |
---|
[511] | 96 | CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wsign-compare" |
---|
[37] | 97 | |
---|
[2] | 98 | dnl Checks for header files |
---|
| 99 | AC_HEADER_DIRENT |
---|
| 100 | AC_HEADER_STDC |
---|
[556] | 101 | AC_CHECK_HEADERS(fcntl.h malloc.h string.h sys/ioctl.h sys/time.h unistd.h) |
---|
| 102 | AC_CHECK_HEADERS(netinet/in.h) |
---|
[2] | 103 | |
---|
| 104 | dnl Checks for functions |
---|
| 105 | AC_FUNC_MEMCMP |
---|
| 106 | AC_CHECK_FUNCS(atexit on_exit strstr gettimeofday) |
---|
| 107 | |
---|
| 108 | dnl Check for OpenGL |
---|
| 109 | dnl Should this be more thorough? |
---|
| 110 | dnl For OpenGL support on OSX it's better to use Project Builder as -lGL |
---|
| 111 | dnl doesn't seem to work this way. |
---|
| 112 | AC_MSG_CHECKING(for OpenGL support) |
---|
| 113 | have_opengl=no |
---|
| 114 | AC_TRY_COMPILE([ |
---|
[42] | 115 | #ifdef WIN32 |
---|
| 116 | #include <windows.h> |
---|
| 117 | #elif defined(__APPLE__) && defined(__MACH__) |
---|
| 118 | /* #include <OpenGL/gl.h>*/ |
---|
| 119 | #error /* Error so the compile fails on OSX */ |
---|
| 120 | #else |
---|
| 121 | #include <GL/gl.h> |
---|
[614] | 122 | #endif], |
---|
| 123 | [], |
---|
| 124 | [have_opengl=yes]) |
---|
[2] | 125 | AC_MSG_RESULT($have_opengl) |
---|
[614] | 126 | if test "x$have_opengl" = xyes; then |
---|
[42] | 127 | CFLAGS="$CFLAGS -DHAVE_OPENGL" |
---|
| 128 | CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL" |
---|
| 129 | LIBS="$LIBS -lGL -lpthread" |
---|
[2] | 130 | fi |
---|
| 131 | |
---|
[42] | 132 | AC_OUTPUT([ |
---|
| 133 | Makefile |
---|
| 134 | src/Makefile |
---|
[62] | 135 | src/lisp/Makefile |
---|
[42] | 136 | src/net/Makefile |
---|
| 137 | src/imlib/Makefile |
---|
[606] | 138 | src/sdlport/Makefile |
---|
[610] | 139 | data/Makefile |
---|
| 140 | doc/Makefile |
---|
| 141 | doc/abuse.6 |
---|
| 142 | doc/abuse-tool.6]) |
---|
[2] | 143 | |
---|
| 144 | echo " |
---|
| 145 | ------ Configuration for $PACKAGE $VERSION ------ |
---|
[614] | 146 | Compiler: ${CC} (`${CC} --version | head -n 1`) |
---|
| 147 | Install prefix: ${prefix} |
---|
[623] | 148 | Asset directory: ${with_assetdir} |
---|
[614] | 149 | SDL version: `sdl-config --version` |
---|
| 150 | OpenGL support: ${have_opengl} |
---|
[2] | 151 | |
---|
| 152 | Now type 'make' to build $PACKAGE. |
---|
| 153 | " |
---|