source: abuse/trunk/configure.ac @ 640

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

build: if --disable-nonfree is specified, name the directory "abuse-free".

File size: 4.3 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(assetdir,
30  [  --with-assetdir=DIR     override default game data directory])
31
32dnl  Figure out where the datafiles will be
33if test "x${with_assetdir}" = x; then
34  with_assetdir='$(datadir)/games/abuse'
35fi
36AC_SUBST([assetdir], [$with_assetdir])
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
91if test "x${ac_cv_have_nonfree}" = xno; then
92  distdir="\$(PACKAGE)-free-\$(VERSION)"
93else
94  distdir="\$(PACKAGE)-\$(VERSION)"
95fi
96AC_SUBST(distdir)
97AM_CONDITIONAL(HAVE_NONFREE, test "${ac_cv_have_nonfree}" = "yes")
98
99# Optimizations
100CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}"
101# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
102CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wsign-compare"
103
104dnl Checks for header files
105AC_HEADER_DIRENT
106AC_HEADER_STDC
107AC_CHECK_HEADERS(fcntl.h malloc.h string.h sys/ioctl.h sys/time.h unistd.h)
108AC_CHECK_HEADERS(netinet/in.h)
109
110dnl Checks for functions
111AC_FUNC_MEMCMP
112AC_CHECK_FUNCS(atexit on_exit strstr gettimeofday)
113
114dnl Check for OpenGL
115dnl Should this be more thorough?
116dnl For OpenGL support on OSX it's better to use Project Builder as -lGL
117dnl doesn't seem to work this way.
118AC_MSG_CHECKING(for OpenGL support)
119have_opengl=no
120AC_TRY_COMPILE([
121    #ifdef WIN32
122    #include <windows.h>
123    #elif defined(__APPLE__) && defined(__MACH__)
124/*    #include <OpenGL/gl.h>*/
125    #error      /* Error so the compile fails on OSX */
126    #else
127    #include <GL/gl.h>
128    #endif],
129  [],
130  [have_opengl=yes])
131AC_MSG_RESULT($have_opengl)
132if test "x$have_opengl" = xyes; then
133    CFLAGS="$CFLAGS -DHAVE_OPENGL"
134    CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL"
135    LIBS="$LIBS -lGL -lpthread"
136fi
137
138AC_OUTPUT([
139    Makefile
140    src/Makefile
141    src/lisp/Makefile
142    src/net/Makefile
143    src/imlib/Makefile
144    src/sdlport/Makefile
145    data/Makefile
146    doc/Makefile
147    doc/abuse.6
148    doc/abuse-tool.6])
149
150echo "
151------ Configuration for $PACKAGE $VERSION ------
152    Compiler:          ${CC} (`${CC} --version | head -n 1`)
153    Install prefix:    ${prefix}
154    Asset directory:   ${with_assetdir}
155    SDL version:       `sdl-config --version`
156    OpenGL support:    ${have_opengl}
157
158Now type 'make' to build $PACKAGE.
159"
Note: See TracBrowser for help on using the repository browser.