[2] | 1 | dnl Process this file with autoconf to produce a configure script. |
---|
[68] | 2 | AC_INIT(abuse, 0.7.1) |
---|
[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 |
---|
[160] | 18 | if [ "x$x_libraries" != "x" ]; then |
---|
| 19 | X_LIBS="-L$x_libraries" |
---|
| 20 | fi |
---|
[2] | 21 | |
---|
| 22 | dnl Figure out where the datafiles will be |
---|
| 23 | EXPDATADIR="-DEXPDATADIR=\\\"$datadir/games/abuse\\\"" |
---|
| 24 | AC_SUBST(EXPDATADIR) |
---|
| 25 | |
---|
[478] | 26 | AC_ARG_ENABLE(debug, |
---|
| 27 | [ --enable-debug build debug versions of the game (default no)]) |
---|
| 28 | AC_ARG_ENABLE(release, |
---|
| 29 | [ --enable-release build final release of the game (default no)]) |
---|
| 30 | |
---|
[2] | 31 | dnl Checks for libraries |
---|
| 32 | dnl Do we need to link against something for X shared memory support? |
---|
| 33 | AC_CHECK_LIB(Xext,XShmAttach,:,[ |
---|
| 34 | AC_CHECK_LIB(XextSam,XShmAttach,LIBS="$LIBS -lXextSam",,$X_LIBS -lX11 -lXext) |
---|
| 35 | ],$X_LIBS -lX11) |
---|
| 36 | |
---|
| 37 | dnl Checks for Solaris compatibility |
---|
| 38 | AC_CHECK_LIB(m,pow,LIBS="$LIBS -lm") |
---|
| 39 | AC_CHECK_LIB(socket,socket,LIBS="$LIBS -lsocket") |
---|
| 40 | AC_CHECK_LIB(nsl,gethostbyname,LIBS="$LIBS -lnsl") |
---|
| 41 | |
---|
| 42 | dnl Check for SDL |
---|
| 43 | SDL_VERSION=1.1.6 |
---|
| 44 | AM_PATH_SDL($SDL_VERSION, :, |
---|
[42] | 45 | AC_MSG_ERROR([*** SDL version $SDL_VERSION or above not found!])) |
---|
[2] | 46 | CFLAGS="$CFLAGS $SDL_CFLAGS" |
---|
[160] | 47 | LIBS="$LIBS $SDL_LIBS $X_LIBS" |
---|
[2] | 48 | |
---|
[478] | 49 | if test "${enable_debug}" = "yes"; then |
---|
| 50 | AC_DEFINE(HAVE_DEBUG, 1, Define to 1 to activate debug) |
---|
| 51 | OPT="-O0" |
---|
| 52 | else |
---|
| 53 | OPT="-O2 -fno-strength-reduce -fomit-frame-pointer" |
---|
| 54 | fi |
---|
| 55 | |
---|
| 56 | if test "${enable_release}" = "yes"; then |
---|
| 57 | AC_DEFINE(HAVE_RELEASE, 1, Define to 1 to activate final release) |
---|
| 58 | REL="" |
---|
| 59 | else |
---|
| 60 | REL="-g" |
---|
| 61 | fi |
---|
| 62 | |
---|
[37] | 63 | # Optimizations |
---|
[478] | 64 | CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}" |
---|
[37] | 65 | # Code qui fait des warnings == code de porc == deux baffes dans ta gueule |
---|
[478] | 66 | CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Waggregate-return -Wsign-compare" |
---|
[37] | 67 | |
---|
[2] | 68 | dnl Checks for header files |
---|
| 69 | AC_HEADER_DIRENT |
---|
| 70 | AC_HEADER_STDC |
---|
| 71 | AC_CHECK_HEADERS(fcntl.h malloc.h string.h sys/ioctl.h sys/time.h unistd.h) |
---|
| 72 | |
---|
| 73 | dnl Checks for functions |
---|
| 74 | AC_FUNC_MEMCMP |
---|
| 75 | AC_CHECK_FUNCS(atexit on_exit strstr gettimeofday) |
---|
| 76 | |
---|
| 77 | dnl Check for OpenGL |
---|
| 78 | dnl Should this be more thorough? |
---|
| 79 | dnl For OpenGL support on OSX it's better to use Project Builder as -lGL |
---|
| 80 | dnl doesn't seem to work this way. |
---|
| 81 | AC_MSG_CHECKING(for OpenGL support) |
---|
| 82 | have_opengl=no |
---|
| 83 | AC_TRY_COMPILE([ |
---|
[42] | 84 | #ifdef WIN32 |
---|
| 85 | #include <windows.h> |
---|
| 86 | #elif defined(__APPLE__) && defined(__MACH__) |
---|
| 87 | /* #include <OpenGL/gl.h>*/ |
---|
| 88 | #error /* Error so the compile fails on OSX */ |
---|
| 89 | #else |
---|
| 90 | #include <GL/gl.h> |
---|
| 91 | #endif |
---|
[2] | 92 | ],[ |
---|
| 93 | ],[ |
---|
| 94 | have_opengl=yes |
---|
| 95 | ]) |
---|
| 96 | AC_MSG_RESULT($have_opengl) |
---|
| 97 | if test x$have_opengl = xyes; then |
---|
[42] | 98 | CFLAGS="$CFLAGS -DHAVE_OPENGL" |
---|
| 99 | CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL" |
---|
| 100 | LIBS="$LIBS -lGL -lpthread" |
---|
[2] | 101 | fi |
---|
| 102 | |
---|
[42] | 103 | AC_OUTPUT([ |
---|
| 104 | Makefile |
---|
| 105 | abuse.6 |
---|
| 106 | src/Makefile |
---|
[62] | 107 | src/lisp/Makefile |
---|
[42] | 108 | src/net/Makefile |
---|
| 109 | src/imlib/Makefile |
---|
| 110 | src/sdlport/Makefile]) |
---|
[2] | 111 | |
---|
| 112 | echo " |
---|
| 113 | ------ Configuration for $PACKAGE $VERSION ------ |
---|
| 114 | Compiler: ${CC} (version `${CC} --version`) |
---|
| 115 | Install prefix: $prefix |
---|
| 116 | SDL version: `sdl-config --version` |
---|
| 117 | OpenGL support: $have_opengl |
---|
| 118 | |
---|
| 119 | Now type 'make' to build $PACKAGE. |
---|
| 120 | " |
---|