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