source: abuse/trunk/configure.ac @ 581

Last change on this file since 581 was 556, checked in by Sam Hocevar, 9 years ago

build: fix a spurious newline in configure.ac.

File size: 3.4 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
49dnl Check for SDL mixer
50ac_cv_my_have_sdl_mixer="no"
51save_CPPFLAGS="${CPPFLAGS}"
52CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}"
53AC_CHECK_HEADERS(SDL/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
54CPPFLAGS="${save_CPPFLAGS}"
55if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
56  AC_MSG_ERROR([*** SDL_mixer not found!])
57fi
58LIBS="$LIBS -lSDL_mixer"
59
60if test "${enable_debug}" = "yes"; then
61  AC_DEFINE(HAVE_DEBUG, 1, Define to 1 to activate debug)
62  OPT="-O0"
63else
64  OPT="-O2 -fno-strength-reduce -fomit-frame-pointer"
65fi
66
67if test "${enable_release}" = "yes"; then
68  AC_DEFINE(HAVE_RELEASE, 1, Define to 1 to activate final release)
69  REL=""
70else
71  REL="-g"
72fi
73
74# Optimizations
75CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}"
76# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
77CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wsign-compare"
78
79dnl Checks for header files
80AC_HEADER_DIRENT
81AC_HEADER_STDC
82AC_CHECK_HEADERS(fcntl.h malloc.h string.h sys/ioctl.h sys/time.h unistd.h)
83AC_CHECK_HEADERS(netinet/in.h)
84
85dnl Checks for functions
86AC_FUNC_MEMCMP
87AC_CHECK_FUNCS(atexit on_exit strstr gettimeofday)
88
89dnl Check for OpenGL
90dnl Should this be more thorough?
91dnl For OpenGL support on OSX it's better to use Project Builder as -lGL
92dnl doesn't seem to work this way.
93AC_MSG_CHECKING(for OpenGL support)
94have_opengl=no
95AC_TRY_COMPILE([
96    #ifdef WIN32
97    #include <windows.h>
98    #elif defined(__APPLE__) && defined(__MACH__)
99/*    #include <OpenGL/gl.h>*/
100    #error      /* Error so the compile fails on OSX */
101    #else
102    #include <GL/gl.h>
103    #endif
104],[
105],[
106have_opengl=yes
107])
108AC_MSG_RESULT($have_opengl)
109if test x$have_opengl = xyes; then
110    CFLAGS="$CFLAGS -DHAVE_OPENGL"
111    CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL"
112    LIBS="$LIBS -lGL -lpthread"
113fi
114
115AC_OUTPUT([
116    Makefile
117    abuse.6
118    src/Makefile
119    src/lisp/Makefile
120    src/net/Makefile
121    src/imlib/Makefile
122    src/sdlport/Makefile])
123
124echo "
125------ Configuration for $PACKAGE $VERSION ------
126    Compiler:         ${CC} (version `${CC} --version`)
127    Install prefix:   $prefix
128    SDL version:      `sdl-config --version`
129    OpenGL support:   $have_opengl
130
131Now type 'make' to build $PACKAGE.
132"
Note: See TracBrowser for help on using the repository browser.