source: abuse/trunk/configure.ac @ 479

Last change on this file since 479 was 479, checked in by Sam Hocevar, 11 years ago

sdlport: add music playback support through SDL_Mixer, courtesy of
Jochen Schleu.

File size: 3.2 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(abuse, 0.7.1)
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
22dnl Figure out where the datafiles will be
23EXPDATADIR="-DEXPDATADIR=\\\"$datadir/games/abuse\\\""
24AC_SUBST(EXPDATADIR)
25
26AC_ARG_ENABLE(debug,
27  [  --enable-debug          build debug versions of the game (default no)])
28AC_ARG_ENABLE(release,
29  [  --enable-release        build final release of the game (default no)])
30
31dnl Checks for libraries
32dnl Do we need to link against something for X shared memory support?
33AC_CHECK_LIB(Xext,XShmAttach,:,[
34AC_CHECK_LIB(XextSam,XShmAttach,LIBS="$LIBS -lXextSam",,$X_LIBS -lX11 -lXext)
35],$X_LIBS -lX11)
36
37dnl Checks for Solaris compatibility
38AC_CHECK_LIB(m,pow,LIBS="$LIBS -lm")
39AC_CHECK_LIB(socket,socket,LIBS="$LIBS -lsocket")
40AC_CHECK_LIB(nsl,gethostbyname,LIBS="$LIBS -lnsl")
41
42dnl Check for SDL
43SDL_VERSION=1.1.6
44AM_PATH_SDL($SDL_VERSION, :,
45    AC_MSG_ERROR([*** SDL version $SDL_VERSION or above not found!]))
46CFLAGS="$CFLAGS $SDL_CFLAGS"
47LIBS="$LIBS $SDL_LIBS $X_LIBS"
48
49# Add SDL_Mixer
50LIBS="$LIBS -lSDL_mixer"
51CFLAGS="${CFLAGS} -DUSE_SDL_MIXER"
52CPPFLAGS="${CPPFLAGS} -DUSE_SDL_MIXER"
53
54if test "${enable_debug}" = "yes"; then
55  AC_DEFINE(HAVE_DEBUG, 1, Define to 1 to activate debug)
56  OPT="-O0"
57else
58  OPT="-O2 -fno-strength-reduce -fomit-frame-pointer"
59fi
60
61if test "${enable_release}" = "yes"; then
62  AC_DEFINE(HAVE_RELEASE, 1, Define to 1 to activate final release)
63  REL=""
64else
65  REL="-g"
66fi
67
68# Optimizations
69CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}"
70# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
71CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Waggregate-return -Wsign-compare"
72
73dnl Checks for header files
74AC_HEADER_DIRENT
75AC_HEADER_STDC
76AC_CHECK_HEADERS(fcntl.h malloc.h string.h sys/ioctl.h sys/time.h unistd.h)
77
78dnl Checks for functions
79AC_FUNC_MEMCMP
80AC_CHECK_FUNCS(atexit on_exit strstr gettimeofday)
81
82dnl Check for OpenGL
83dnl Should this be more thorough?
84dnl For OpenGL support on OSX it's better to use Project Builder as -lGL
85dnl doesn't seem to work this way.
86AC_MSG_CHECKING(for OpenGL support)
87have_opengl=no
88AC_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],[
99have_opengl=yes
100])
101AC_MSG_RESULT($have_opengl)
102if test x$have_opengl = xyes; then
103    CFLAGS="$CFLAGS -DHAVE_OPENGL"
104    CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL"
105    LIBS="$LIBS -lGL -lpthread"
106fi
107
108AC_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
117echo "
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
124Now type 'make' to build $PACKAGE.
125"
Note: See TracBrowser for help on using the repository browser.