source: abuse/trunk/configure.ac @ 731

Last change on this file since 731 was 731, checked in by jjsimpso, 8 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
RevLine 
[2]1dnl Process this file with autoconf to produce a configure script.
[608]2AC_INIT(abuse, 0.8)
[32]3AC_CONFIG_AUX_DIR(.auto)
4AM_INIT_AUTOMAKE
[41]5AM_CONFIG_HEADER(config.h)
[2]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
[640]18if [ "x$x_libraries" != "x" ]; then
19  X_LIBS="-L$x_libraries"
[160]20fi
[2]21
[478]22AC_ARG_ENABLE(debug,
[651]23  [  --enable-debug          build debug versions of the game (default disabled)])
[478]24AC_ARG_ENABLE(release,
[651]25  [  --enable-release        build final release of the game (default disabled)])
[609]26AC_ARG_ENABLE(nonfree,
[651]27  [  --disable-nonfree       disable non-free data (default enabled)])
28AC_ARG_ENABLE(network,
29  [  --disable-network       disable networking (default enabled)])
[478]30
[623]31AC_ARG_WITH(assetdir,
32  [  --with-assetdir=DIR     override default game data directory])
[614]33
34dnl  Figure out where the datafiles will be
[623]35if test "x${with_assetdir}" = x; then
36  with_assetdir='$(datadir)/games/abuse'
[614]37fi
[623]38AC_SUBST([assetdir], [$with_assetdir])
[614]39
40dnl  Checks for libraries
[2]41dnl Do we need to link against something for X shared memory support?
[614]42AC_CHECK_LIB(Xext, XShmAttach, :,
43             [AC_CHECK_LIB(XextSam, XShmAttach, LIBS="$LIBS -lXextSam", :,
44                           $X_LIBS -lX11 -lXext)],
45             $X_LIBS -lX11)
[2]46
47dnl Checks for Solaris compatibility
[614]48AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm")
49AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
50AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
[2]51
52dnl Check for SDL
[731]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
[2]66CFLAGS="$CFLAGS $SDL_CFLAGS"
[160]67LIBS="$LIBS $SDL_LIBS $X_LIBS"
[731]68AC_SUBST(SDLPORT_DIR)
[2]69
[537]70dnl Check for SDL mixer
[731]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"
[537]91fi
[479]92
[478]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
[609]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
[651]113if test "x${enable_nonfree}" = xno; then
[609]114  ac_cv_have_nonfree="no"
115fi
[640]116if test "x${ac_cv_have_nonfree}" = xno; then
117  distdir="\$(PACKAGE)-free-\$(VERSION)"
118else
119  distdir="\$(PACKAGE)-\$(VERSION)"
120fi
121AC_SUBST(distdir)
[651]122AM_CONDITIONAL(HAVE_NONFREE, test "x${ac_cv_have_nonfree}" = xyes)
[609]123
[651]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
[37]130# Optimizations
[478]131CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}"
[37]132# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
[511]133CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wsign-compare"
[37]134
[2]135dnl Checks for header files
136AC_HEADER_DIRENT
137AC_HEADER_STDC
[556]138AC_CHECK_HEADERS(fcntl.h malloc.h string.h sys/ioctl.h sys/time.h unistd.h)
139AC_CHECK_HEADERS(netinet/in.h)
[2]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([
[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]162AC_MSG_RESULT($have_opengl)
[614]163if test "x$have_opengl" = xyes; then
[42]164    CFLAGS="$CFLAGS -DHAVE_OPENGL"
165    CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL"
166    LIBS="$LIBS -lGL -lpthread"
[2]167fi
168
[42]169AC_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]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
[2]187echo "
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
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}
[614]202    SDL version:       `sdl-config --version`
203    OpenGL support:    ${have_opengl}
[2]204
205Now type 'make' to build $PACKAGE.
206"
[731]207fi
Note: See TracBrowser for help on using the repository browser.