source: abuse/trunk/configure.ac @ 610

Last change on this file since 610 was 610, checked in by Sam Hocevar, 8 years ago

doc: put manual pages in the doc/ directory.

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