source: abuse/trunk/configure.ac @ 614

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

build: add a `--with-assetsdir' configure flag to specify where the
game data should be installed.

File size: 4.1 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 no)])
24AC_ARG_ENABLE(release,
25  [  --enable-release        build final release of the game (default no)])
26AC_ARG_ENABLE(nonfree,
27  [  --disable-nonfree       disable non-free data (default no)])
28
29AC_ARG_WITH(assetsdir,
30  [  --with-assetsdir=DIR    override default game data directory])
31
32dnl  Figure out where the datafiles will be
33if test "x${with_assetsdir}" = x; then
34  with_assetsdir='$(datadir)/games/abuse'
35fi
36AC_SUBST([assetsdir], [$with_assetsdir])
37
38dnl  Checks for libraries
39dnl Do we need to link against something for X shared memory support?
40AC_CHECK_LIB(Xext, XShmAttach, :,
41             [AC_CHECK_LIB(XextSam, XShmAttach, LIBS="$LIBS -lXextSam", :,
42                           $X_LIBS -lX11 -lXext)],
43             $X_LIBS -lX11)
44
45dnl Checks for Solaris compatibility
46AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm")
47AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
48AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
49
50dnl Check for SDL
51SDL_VERSION=1.1.6
52AM_PATH_SDL($SDL_VERSION, :,
53    AC_MSG_ERROR([*** SDL version $SDL_VERSION or above not found!]))
54CFLAGS="$CFLAGS $SDL_CFLAGS"
55LIBS="$LIBS $SDL_LIBS $X_LIBS"
56
57dnl Check for SDL mixer
58ac_cv_my_have_sdl_mixer="no"
59save_CPPFLAGS="${CPPFLAGS}"
60CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}"
61AC_CHECK_HEADERS(SDL/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
62CPPFLAGS="${save_CPPFLAGS}"
63if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
64  AC_MSG_ERROR([*** SDL_mixer not found!])
65fi
66LIBS="$LIBS -lSDL_mixer"
67
68if test "${enable_debug}" = "yes"; then
69  AC_DEFINE(HAVE_DEBUG, 1, Define to 1 to activate debug)
70  OPT="-O0"
71else
72  OPT="-O2 -fno-strength-reduce -fomit-frame-pointer"
73fi
74
75if test "${enable_release}" = "yes"; then
76  AC_DEFINE(HAVE_RELEASE, 1, Define to 1 to activate final release)
77  REL=""
78else
79  REL="-g"
80fi
81
82dnl  Is our package stripped from its non-free data? Or did the user
83dnl  maybe disable non-free data?
84ac_cv_have_nonfree="no"
85if test -f "${srcdir}/data/sfx/ambcave1.wav"; then
86  ac_cv_have_nonfree="yes"
87fi
88if test "${enable_nonfree}" = "no"; then
89  ac_cv_have_nonfree="no"
90fi
91AM_CONDITIONAL(HAVE_NONFREE, test "${ac_cv_have_nonfree}" = "yes")
92
93# Optimizations
94CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}"
95# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
96CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wsign-compare"
97
98dnl Checks for header files
99AC_HEADER_DIRENT
100AC_HEADER_STDC
101AC_CHECK_HEADERS(fcntl.h malloc.h string.h sys/ioctl.h sys/time.h unistd.h)
102AC_CHECK_HEADERS(netinet/in.h)
103
104dnl Checks for functions
105AC_FUNC_MEMCMP
106AC_CHECK_FUNCS(atexit on_exit strstr gettimeofday)
107
108dnl Check for OpenGL
109dnl Should this be more thorough?
110dnl For OpenGL support on OSX it's better to use Project Builder as -lGL
111dnl doesn't seem to work this way.
112AC_MSG_CHECKING(for OpenGL support)
113have_opengl=no
114AC_TRY_COMPILE([
115    #ifdef WIN32
116    #include <windows.h>
117    #elif defined(__APPLE__) && defined(__MACH__)
118/*    #include <OpenGL/gl.h>*/
119    #error      /* Error so the compile fails on OSX */
120    #else
121    #include <GL/gl.h>
122    #endif],
123  [],
124  [have_opengl=yes])
125AC_MSG_RESULT($have_opengl)
126if test "x$have_opengl" = xyes; then
127    CFLAGS="$CFLAGS -DHAVE_OPENGL"
128    CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL"
129    LIBS="$LIBS -lGL -lpthread"
130fi
131
132AC_OUTPUT([
133    Makefile
134    src/Makefile
135    src/lisp/Makefile
136    src/net/Makefile
137    src/imlib/Makefile
138    src/sdlport/Makefile
139    data/Makefile
140    doc/Makefile
141    doc/abuse.6
142    doc/abuse-tool.6])
143
144echo "
145------ Configuration for $PACKAGE $VERSION ------
146    Compiler:          ${CC} (`${CC} --version | head -n 1`)
147    Install prefix:    ${prefix}
148    Assets directory:  ${with_assetsdir}
149    SDL version:       `sdl-config --version`
150    OpenGL support:    ${have_opengl}
151
152Now type 'make' to build $PACKAGE.
153"
Note: See TracBrowser for help on using the repository browser.