[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 |
---|
[731] | 53 | SDL2_VERSION=2.0.0 |
---|
| 54 | SDL2_FOUND="no" |
---|
| 55 | SDLPORT_DIR=sdl2port |
---|
| 56 | AM_PATH_SDL2($SDL2_VERSION, SDL2_FOUND="yes", |
---|
| 57 | AC_MSG_ERROR([*** SDL2 version $SDL2_VERSION or above not found!])) |
---|
| 58 | |
---|
| 59 | if test $SDL2_FOUND = "no"; then |
---|
| 60 | SDL_VERSION=1.1.6 |
---|
| 61 | SDLPORT_DIR=sdlport |
---|
| 62 | AM_PATH_SDL($SDL_VERSION, :, |
---|
| 63 | AC_MSG_ERROR([*** SDL version $SDL_VERSION or above not found!])) |
---|
| 64 | fi |
---|
| 65 | |
---|
[2] | 66 | CFLAGS="$CFLAGS $SDL_CFLAGS" |
---|
[160] | 67 | LIBS="$LIBS $SDL_LIBS $X_LIBS" |
---|
[731] | 68 | AC_SUBST(SDLPORT_DIR) |
---|
[2] | 69 | |
---|
[537] | 70 | dnl Check for SDL mixer |
---|
[731] | 71 | if test $SDL2_FOUND = "yes"; then |
---|
| 72 | ac_cv_my_have_sdl_mixer="no" |
---|
| 73 | save_CPPFLAGS="${CPPFLAGS}" |
---|
| 74 | CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}" |
---|
| 75 | AC_CHECK_HEADERS(SDL2/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"]) |
---|
| 76 | CPPFLAGS="${save_CPPFLAGS}" |
---|
| 77 | if test "${ac_cv_my_have_sdl_mixer}" = "no"; then |
---|
| 78 | AC_MSG_ERROR([*** SDL_mixer not found!]) |
---|
| 79 | fi |
---|
| 80 | LIBS="$LIBS -lSDL2_mixer" |
---|
| 81 | else |
---|
| 82 | ac_cv_my_have_sdl_mixer="no" |
---|
| 83 | save_CPPFLAGS="${CPPFLAGS}" |
---|
| 84 | CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}" |
---|
| 85 | AC_CHECK_HEADERS(SDL/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"]) |
---|
| 86 | CPPFLAGS="${save_CPPFLAGS}" |
---|
| 87 | if test "${ac_cv_my_have_sdl_mixer}" = "no"; then |
---|
| 88 | AC_MSG_ERROR([*** SDL_mixer not found!]) |
---|
| 89 | fi |
---|
| 90 | LIBS="$LIBS -lSDL_mixer" |
---|
[537] | 91 | fi |
---|
[479] | 92 | |
---|
[478] | 93 | if test "${enable_debug}" = "yes"; then |
---|
| 94 | AC_DEFINE(HAVE_DEBUG, 1, Define to 1 to activate debug) |
---|
| 95 | OPT="-O0" |
---|
| 96 | else |
---|
| 97 | OPT="-O2 -fno-strength-reduce -fomit-frame-pointer" |
---|
| 98 | fi |
---|
| 99 | |
---|
| 100 | if test "${enable_release}" = "yes"; then |
---|
| 101 | AC_DEFINE(HAVE_RELEASE, 1, Define to 1 to activate final release) |
---|
| 102 | REL="" |
---|
| 103 | else |
---|
| 104 | REL="-g" |
---|
| 105 | fi |
---|
| 106 | |
---|
[609] | 107 | dnl Is our package stripped from its non-free data? Or did the user |
---|
| 108 | dnl maybe disable non-free data? |
---|
| 109 | ac_cv_have_nonfree="no" |
---|
| 110 | if test -f "${srcdir}/data/sfx/ambcave1.wav"; then |
---|
| 111 | ac_cv_have_nonfree="yes" |
---|
| 112 | fi |
---|
[651] | 113 | if test "x${enable_nonfree}" = xno; then |
---|
[609] | 114 | ac_cv_have_nonfree="no" |
---|
| 115 | fi |
---|
[640] | 116 | if test "x${ac_cv_have_nonfree}" = xno; then |
---|
| 117 | distdir="\$(PACKAGE)-free-\$(VERSION)" |
---|
| 118 | else |
---|
| 119 | distdir="\$(PACKAGE)-\$(VERSION)" |
---|
| 120 | fi |
---|
| 121 | AC_SUBST(distdir) |
---|
[651] | 122 | AM_CONDITIONAL(HAVE_NONFREE, test "x${ac_cv_have_nonfree}" = xyes) |
---|
[609] | 123 | |
---|
[651] | 124 | dnl Is networking enabled? |
---|
| 125 | if test "x${enable_network}" != xno; then |
---|
| 126 | AC_DEFINE(HAVE_NETWORK, 1, Define to 1 to enable networking) |
---|
| 127 | fi |
---|
| 128 | AM_CONDITIONAL(HAVE_NETWORK, test "x${enable_network}" != xno) |
---|
| 129 | |
---|
[37] | 130 | # Optimizations |
---|
[478] | 131 | CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}" |
---|
[37] | 132 | # Code qui fait des warnings == code de porc == deux baffes dans ta gueule |
---|
[511] | 133 | CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wsign-compare" |
---|
[37] | 134 | |
---|
[2] | 135 | dnl Checks for header files |
---|
| 136 | AC_HEADER_DIRENT |
---|
| 137 | AC_HEADER_STDC |
---|
[556] | 138 | AC_CHECK_HEADERS(fcntl.h malloc.h string.h sys/ioctl.h sys/time.h unistd.h) |
---|
| 139 | AC_CHECK_HEADERS(netinet/in.h) |
---|
[2] | 140 | |
---|
| 141 | dnl Checks for functions |
---|
| 142 | AC_FUNC_MEMCMP |
---|
| 143 | AC_CHECK_FUNCS(atexit on_exit strstr gettimeofday) |
---|
| 144 | |
---|
| 145 | dnl Check for OpenGL |
---|
| 146 | dnl Should this be more thorough? |
---|
| 147 | dnl For OpenGL support on OSX it's better to use Project Builder as -lGL |
---|
| 148 | dnl doesn't seem to work this way. |
---|
| 149 | AC_MSG_CHECKING(for OpenGL support) |
---|
| 150 | have_opengl=no |
---|
| 151 | AC_TRY_COMPILE([ |
---|
[42] | 152 | #ifdef WIN32 |
---|
| 153 | #include <windows.h> |
---|
| 154 | #elif defined(__APPLE__) && defined(__MACH__) |
---|
| 155 | /* #include <OpenGL/gl.h>*/ |
---|
| 156 | #error /* Error so the compile fails on OSX */ |
---|
| 157 | #else |
---|
| 158 | #include <GL/gl.h> |
---|
[614] | 159 | #endif], |
---|
| 160 | [], |
---|
| 161 | [have_opengl=yes]) |
---|
[2] | 162 | AC_MSG_RESULT($have_opengl) |
---|
[614] | 163 | if test "x$have_opengl" = xyes; then |
---|
[42] | 164 | CFLAGS="$CFLAGS -DHAVE_OPENGL" |
---|
| 165 | CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL" |
---|
| 166 | LIBS="$LIBS -lGL -lpthread" |
---|
[2] | 167 | fi |
---|
| 168 | |
---|
[42] | 169 | AC_OUTPUT([ |
---|
| 170 | Makefile |
---|
| 171 | src/Makefile |
---|
[62] | 172 | src/lisp/Makefile |
---|
[42] | 173 | src/net/Makefile |
---|
| 174 | src/imlib/Makefile |
---|
[610] | 175 | data/Makefile |
---|
| 176 | doc/Makefile |
---|
| 177 | doc/abuse.6 |
---|
| 178 | doc/abuse-tool.6]) |
---|
[2] | 179 | |
---|
[731] | 180 | if test $SDL2_FOUND = "yes"; then |
---|
| 181 | AC_OUTPUT([src/sdl2port/Makefile]) |
---|
| 182 | else |
---|
| 183 | AC_OUTPUT([src/sdlport/Makefile]) |
---|
| 184 | fi |
---|
| 185 | |
---|
| 186 | if test $SDL2_FOUND = "yes"; then |
---|
[2] | 187 | echo " |
---|
| 188 | ------ Configuration for $PACKAGE $VERSION ------ |
---|
[614] | 189 | Compiler: ${CC} (`${CC} --version | head -n 1`) |
---|
| 190 | Install prefix: ${prefix} |
---|
[623] | 191 | Asset directory: ${with_assetdir} |
---|
[731] | 192 | SDL version: `sdl2-config --version` |
---|
| 193 | |
---|
| 194 | Now type 'make' to build $PACKAGE. |
---|
| 195 | " |
---|
| 196 | else |
---|
| 197 | echo " |
---|
| 198 | ------ Configuration for $PACKAGE $VERSION ------ |
---|
| 199 | Compiler: ${CC} (`${CC} --version | head -n 1`) |
---|
| 200 | Install prefix: ${prefix} |
---|
| 201 | Asset directory: ${with_assetdir} |
---|
[614] | 202 | SDL version: `sdl-config --version` |
---|
| 203 | OpenGL support: ${have_opengl} |
---|
[2] | 204 | |
---|
| 205 | Now type 'make' to build $PACKAGE. |
---|
| 206 | " |
---|
[731] | 207 | fi |
---|