source: abuse/trunk/configure.ac

Last change on this file was 731, checked in by jjsimpso, 9 years ago

sdlport: Add support for SDL2, inculding the game controller API. Configure
script will check for SDL2 and use it if present, otherwise it will fall
back to SDL v1. Some old SDL v1 features not implemented yet on SDL2, such
as saving screenshots.

core: Small change for SDL2 game controller API to disable the game
controller in the save/load game menu.

Summary of game controller API changes:

  • Enable with -gamepad
  • Tested with PS3 dualshock 3.
  • D-pad moves, right analog controls aiming
  • X: change weapon, []: jump, R1: fire, L1: special ability, /\:use/activate
  • All menu navigation requires the mouse, which is disabled during normal game play.
File size: 5.6 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(abuse, 0.8)
3AC_CONFIG_AUX_DIR(.auto)
4AM_INIT_AUTOMAKE
5AM_CONFIG_HEADER(config.h)
6
7dnl Checks for programs.
8AC_PROG_LIBTOOL
9AC_ISC_POSIX
10AC_PROG_CC
11AC_PROG_CPP
12AC_PROG_CXX
13AC_PROG_INSTALL
14AC_C_BIGENDIAN
15
16dnl Check for X
17AC_PATH_X
18if [ "x$x_libraries" != "x" ]; then
19  X_LIBS="-L$x_libraries"
20fi
21
22AC_ARG_ENABLE(debug,
23  [  --enable-debug          build debug versions of the game (default disabled)])
24AC_ARG_ENABLE(release,
25  [  --enable-release        build final release of the game (default disabled)])
26AC_ARG_ENABLE(nonfree,
27  [  --disable-nonfree       disable non-free data (default enabled)])
28AC_ARG_ENABLE(network,
29  [  --disable-network       disable networking (default enabled)])
30
31AC_ARG_WITH(assetdir,
32  [  --with-assetdir=DIR     override default game data directory])
33
34dnl  Figure out where the datafiles will be
35if test "x${with_assetdir}" = x; then
36  with_assetdir='$(datadir)/games/abuse'
37fi
38AC_SUBST([assetdir], [$with_assetdir])
39
40dnl  Checks for libraries
41dnl Do we need to link against something for X shared memory support?
42AC_CHECK_LIB(Xext, XShmAttach, :,
43             [AC_CHECK_LIB(XextSam, XShmAttach, LIBS="$LIBS -lXextSam", :,
44                           $X_LIBS -lX11 -lXext)],
45             $X_LIBS -lX11)
46
47dnl Checks for Solaris compatibility
48AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm")
49AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
50AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
51
52dnl Check for SDL
53SDL2_VERSION=2.0.0
54SDL2_FOUND="no"
55SDLPORT_DIR=sdl2port
56AM_PATH_SDL2($SDL2_VERSION, SDL2_FOUND="yes",
57    AC_MSG_ERROR([*** SDL2 version $SDL2_VERSION or above not found!]))
58
59if 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!]))
64fi
65
66CFLAGS="$CFLAGS $SDL_CFLAGS"
67LIBS="$LIBS $SDL_LIBS $X_LIBS"
68AC_SUBST(SDLPORT_DIR)
69
70dnl Check for SDL mixer
71if 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"
81else
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"
91fi
92
93if test "${enable_debug}" = "yes"; then
94  AC_DEFINE(HAVE_DEBUG, 1, Define to 1 to activate debug)
95  OPT="-O0"
96else
97  OPT="-O2 -fno-strength-reduce -fomit-frame-pointer"
98fi
99
100if test "${enable_release}" = "yes"; then
101  AC_DEFINE(HAVE_RELEASE, 1, Define to 1 to activate final release)
102  REL=""
103else
104  REL="-g"
105fi
106
107dnl  Is our package stripped from its non-free data? Or did the user
108dnl  maybe disable non-free data?
109ac_cv_have_nonfree="no"
110if test -f "${srcdir}/data/sfx/ambcave1.wav"; then
111  ac_cv_have_nonfree="yes"
112fi
113if test "x${enable_nonfree}" = xno; then
114  ac_cv_have_nonfree="no"
115fi
116if test "x${ac_cv_have_nonfree}" = xno; then
117  distdir="\$(PACKAGE)-free-\$(VERSION)"
118else
119  distdir="\$(PACKAGE)-\$(VERSION)"
120fi
121AC_SUBST(distdir)
122AM_CONDITIONAL(HAVE_NONFREE, test "x${ac_cv_have_nonfree}" = xyes)
123
124dnl  Is networking enabled?
125if test "x${enable_network}" != xno; then
126  AC_DEFINE(HAVE_NETWORK, 1, Define to 1 to enable networking)
127fi
128AM_CONDITIONAL(HAVE_NETWORK, test "x${enable_network}" != xno)
129
130# Optimizations
131CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}"
132# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
133CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wsign-compare"
134
135dnl Checks for header files
136AC_HEADER_DIRENT
137AC_HEADER_STDC
138AC_CHECK_HEADERS(fcntl.h malloc.h string.h sys/ioctl.h sys/time.h unistd.h)
139AC_CHECK_HEADERS(netinet/in.h)
140
141dnl Checks for functions
142AC_FUNC_MEMCMP
143AC_CHECK_FUNCS(atexit on_exit strstr gettimeofday)
144
145dnl Check for OpenGL
146dnl Should this be more thorough?
147dnl For OpenGL support on OSX it's better to use Project Builder as -lGL
148dnl doesn't seem to work this way.
149AC_MSG_CHECKING(for OpenGL support)
150have_opengl=no
151AC_TRY_COMPILE([
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>
159    #endif],
160  [],
161  [have_opengl=yes])
162AC_MSG_RESULT($have_opengl)
163if test "x$have_opengl" = xyes; then
164    CFLAGS="$CFLAGS -DHAVE_OPENGL"
165    CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL"
166    LIBS="$LIBS -lGL -lpthread"
167fi
168
169AC_OUTPUT([
170    Makefile
171    src/Makefile
172    src/lisp/Makefile
173    src/net/Makefile
174    src/imlib/Makefile
175    data/Makefile
176    doc/Makefile
177    doc/abuse.6
178    doc/abuse-tool.6])
179
180if test $SDL2_FOUND = "yes"; then
181  AC_OUTPUT([src/sdl2port/Makefile])
182else
183  AC_OUTPUT([src/sdlport/Makefile])
184fi
185
186if test $SDL2_FOUND = "yes"; then
187echo "
188------ Configuration for $PACKAGE $VERSION ------
189    Compiler:          ${CC} (`${CC} --version | head -n 1`)
190    Install prefix:    ${prefix}
191    Asset directory:   ${with_assetdir}
192    SDL version:       `sdl2-config --version`
193
194Now type 'make' to build $PACKAGE.
195"
196else
197echo "
198------ Configuration for $PACKAGE $VERSION ------
199    Compiler:          ${CC} (`${CC} --version | head -n 1`)
200    Install prefix:    ${prefix}
201    Asset directory:   ${with_assetdir}
202    SDL version:       `sdl-config --version`
203    OpenGL support:    ${have_opengl}
204
205Now type 'make' to build $PACKAGE.
206"
207fi
Note: See TracBrowser for help on using the repository browser.