source: abuse/trunk/configure.ac @ 655

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

build: add a --disable-network compilation flag and get rid of most of
the CELLOS_LV2 ifdefs.

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