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