source: abuse/trunk/configure.ac @ 478

Last change on this file since 478 was 478, checked in by Sam Hocevar, 12 years ago

build: add --enable-debug and --enable-release configure flags.

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