1 | dnl Process this file with autoconf to produce a configure script. |
---|
2 | AC_INIT(abuse, 0.8) |
---|
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 | 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)]) |
---|
26 | AC_ARG_ENABLE(nonfree, |
---|
27 | [ --disable-nonfree disable non-free data (default no)]) |
---|
28 | |
---|
29 | AC_ARG_WITH(assetsdir, |
---|
30 | [ --with-assetsdir=DIR override default game data directory]) |
---|
31 | |
---|
32 | dnl Figure out where the datafiles will be |
---|
33 | if test "x${with_assetsdir}" = x; then |
---|
34 | with_assetsdir='$(datadir)/games/abuse' |
---|
35 | fi |
---|
36 | AC_SUBST([assetsdir], [$with_assetsdir]) |
---|
37 | |
---|
38 | dnl Checks for libraries |
---|
39 | dnl Do we need to link against something for X shared memory support? |
---|
40 | AC_CHECK_LIB(Xext, XShmAttach, :, |
---|
41 | [AC_CHECK_LIB(XextSam, XShmAttach, LIBS="$LIBS -lXextSam", :, |
---|
42 | $X_LIBS -lX11 -lXext)], |
---|
43 | $X_LIBS -lX11) |
---|
44 | |
---|
45 | dnl Checks for Solaris compatibility |
---|
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") |
---|
49 | |
---|
50 | dnl Check for SDL |
---|
51 | SDL_VERSION=1.1.6 |
---|
52 | AM_PATH_SDL($SDL_VERSION, :, |
---|
53 | AC_MSG_ERROR([*** SDL version $SDL_VERSION or above not found!])) |
---|
54 | CFLAGS="$CFLAGS $SDL_CFLAGS" |
---|
55 | LIBS="$LIBS $SDL_LIBS $X_LIBS" |
---|
56 | |
---|
57 | dnl Check for SDL mixer |
---|
58 | ac_cv_my_have_sdl_mixer="no" |
---|
59 | save_CPPFLAGS="${CPPFLAGS}" |
---|
60 | CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}" |
---|
61 | AC_CHECK_HEADERS(SDL/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"]) |
---|
62 | CPPFLAGS="${save_CPPFLAGS}" |
---|
63 | if test "${ac_cv_my_have_sdl_mixer}" = "no"; then |
---|
64 | AC_MSG_ERROR([*** SDL_mixer not found!]) |
---|
65 | fi |
---|
66 | LIBS="$LIBS -lSDL_mixer" |
---|
67 | |
---|
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 | |
---|
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 | |
---|
93 | # Optimizations |
---|
94 | CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}" |
---|
95 | # Code qui fait des warnings == code de porc == deux baffes dans ta gueule |
---|
96 | CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wsign-compare" |
---|
97 | |
---|
98 | dnl Checks for header files |
---|
99 | AC_HEADER_DIRENT |
---|
100 | AC_HEADER_STDC |
---|
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) |
---|
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([ |
---|
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> |
---|
122 | #endif], |
---|
123 | [], |
---|
124 | [have_opengl=yes]) |
---|
125 | AC_MSG_RESULT($have_opengl) |
---|
126 | if test "x$have_opengl" = xyes; then |
---|
127 | CFLAGS="$CFLAGS -DHAVE_OPENGL" |
---|
128 | CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL" |
---|
129 | LIBS="$LIBS -lGL -lpthread" |
---|
130 | fi |
---|
131 | |
---|
132 | AC_OUTPUT([ |
---|
133 | Makefile |
---|
134 | src/Makefile |
---|
135 | src/lisp/Makefile |
---|
136 | src/net/Makefile |
---|
137 | src/imlib/Makefile |
---|
138 | src/sdlport/Makefile |
---|
139 | data/Makefile |
---|
140 | doc/Makefile |
---|
141 | doc/abuse.6 |
---|
142 | doc/abuse-tool.6]) |
---|
143 | |
---|
144 | echo " |
---|
145 | ------ Configuration for $PACKAGE $VERSION ------ |
---|
146 | Compiler: ${CC} (`${CC} --version | head -n 1`) |
---|
147 | Install prefix: ${prefix} |
---|
148 | Assets directory: ${with_assetsdir} |
---|
149 | SDL version: `sdl-config --version` |
---|
150 | OpenGL support: ${have_opengl} |
---|
151 | |
---|
152 | Now type 'make' to build $PACKAGE. |
---|
153 | " |
---|