source: abuse/trunk/configure.ac @ 625

Last change on this file since 625 was 623, checked in by Sam Hocevar, 11 years ago

build: fix a problem with --with-assetdir and make sure the flag
name does not have an `s'.

File size: 4.1 KB
RevLine 
[2]1dnl Process this file with autoconf to produce a configure script.
[608]2AC_INIT(abuse, 0.8)
[32]3AC_CONFIG_AUX_DIR(.auto)
4AM_INIT_AUTOMAKE
[41]5AM_CONFIG_HEADER(config.h)
[2]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
[160]18if [ "x$x_libraries" != "x" ]; then
19  X_LIBS="-L$x_libraries"
20fi
[2]21
[478]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)])
[609]26AC_ARG_ENABLE(nonfree,
27  [  --disable-nonfree       disable non-free data (default no)])
[478]28
[623]29AC_ARG_WITH(assetdir,
30  [  --with-assetdir=DIR     override default game data directory])
[614]31
32dnl  Figure out where the datafiles will be
[623]33if test "x${with_assetdir}" = x; then
34  with_assetdir='$(datadir)/games/abuse'
[614]35fi
[623]36AC_SUBST([assetdir], [$with_assetdir])
[614]37
38dnl  Checks for libraries
[2]39dnl Do we need to link against something for X shared memory support?
[614]40AC_CHECK_LIB(Xext, XShmAttach, :,
41             [AC_CHECK_LIB(XextSam, XShmAttach, LIBS="$LIBS -lXextSam", :,
42                           $X_LIBS -lX11 -lXext)],
43             $X_LIBS -lX11)
[2]44
45dnl Checks for Solaris compatibility
[614]46AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm")
47AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
48AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
[2]49
50dnl Check for SDL
51SDL_VERSION=1.1.6
52AM_PATH_SDL($SDL_VERSION, :,
[42]53    AC_MSG_ERROR([*** SDL version $SDL_VERSION or above not found!]))
[2]54CFLAGS="$CFLAGS $SDL_CFLAGS"
[160]55LIBS="$LIBS $SDL_LIBS $X_LIBS"
[2]56
[537]57dnl Check for SDL mixer
58ac_cv_my_have_sdl_mixer="no"
59save_CPPFLAGS="${CPPFLAGS}"
60CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}"
[551]61AC_CHECK_HEADERS(SDL/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
[537]62CPPFLAGS="${save_CPPFLAGS}"
[551]63if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
64  AC_MSG_ERROR([*** SDL_mixer not found!])
[537]65fi
[551]66LIBS="$LIBS -lSDL_mixer"
[479]67
[478]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
[609]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
[37]93# Optimizations
[478]94CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}"
[37]95# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
[511]96CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wsign-compare"
[37]97
[2]98dnl Checks for header files
99AC_HEADER_DIRENT
100AC_HEADER_STDC
[556]101AC_CHECK_HEADERS(fcntl.h malloc.h string.h sys/ioctl.h sys/time.h unistd.h)
102AC_CHECK_HEADERS(netinet/in.h)
[2]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([
[42]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>
[614]122    #endif],
123  [],
124  [have_opengl=yes])
[2]125AC_MSG_RESULT($have_opengl)
[614]126if test "x$have_opengl" = xyes; then
[42]127    CFLAGS="$CFLAGS -DHAVE_OPENGL"
128    CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL"
129    LIBS="$LIBS -lGL -lpthread"
[2]130fi
131
[42]132AC_OUTPUT([
133    Makefile
134    src/Makefile
[62]135    src/lisp/Makefile
[42]136    src/net/Makefile
137    src/imlib/Makefile
[606]138    src/sdlport/Makefile
[610]139    data/Makefile
140    doc/Makefile
141    doc/abuse.6
142    doc/abuse-tool.6])
[2]143
144echo "
145------ Configuration for $PACKAGE $VERSION ------
[614]146    Compiler:          ${CC} (`${CC} --version | head -n 1`)
147    Install prefix:    ${prefix}
[623]148    Asset directory:   ${with_assetdir}
[614]149    SDL version:       `sdl-config --version`
150    OpenGL support:    ${have_opengl}
[2]151
152Now type 'make' to build $PACKAGE.
153"
Note: See TracBrowser for help on using the repository browser.