source: abuse/trunk/configure.ac @ 669

Last change on this file since 669 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
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
[640]18if [ "x$x_libraries" != "x" ]; then
19  X_LIBS="-L$x_libraries"
[160]20fi
[2]21
[478]22AC_ARG_ENABLE(debug,
[651]23  [  --enable-debug          build debug versions of the game (default disabled)])
[478]24AC_ARG_ENABLE(release,
[651]25  [  --enable-release        build final release of the game (default disabled)])
[609]26AC_ARG_ENABLE(nonfree,
[651]27  [  --disable-nonfree       disable non-free data (default enabled)])
28AC_ARG_ENABLE(network,
29  [  --disable-network       disable networking (default enabled)])
[478]30
[623]31AC_ARG_WITH(assetdir,
32  [  --with-assetdir=DIR     override default game data directory])
[614]33
34dnl  Figure out where the datafiles will be
[623]35if test "x${with_assetdir}" = x; then
36  with_assetdir='$(datadir)/games/abuse'
[614]37fi
[623]38AC_SUBST([assetdir], [$with_assetdir])
[614]39
40dnl  Checks for libraries
[2]41dnl Do we need to link against something for X shared memory support?
[614]42AC_CHECK_LIB(Xext, XShmAttach, :,
43             [AC_CHECK_LIB(XextSam, XShmAttach, LIBS="$LIBS -lXextSam", :,
44                           $X_LIBS -lX11 -lXext)],
45             $X_LIBS -lX11)
[2]46
47dnl Checks for Solaris compatibility
[614]48AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm")
49AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
50AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
[2]51
52dnl Check for SDL
53SDL_VERSION=1.1.6
54AM_PATH_SDL($SDL_VERSION, :,
[42]55    AC_MSG_ERROR([*** SDL version $SDL_VERSION or above not found!]))
[2]56CFLAGS="$CFLAGS $SDL_CFLAGS"
[160]57LIBS="$LIBS $SDL_LIBS $X_LIBS"
[2]58
[537]59dnl Check for SDL mixer
60ac_cv_my_have_sdl_mixer="no"
61save_CPPFLAGS="${CPPFLAGS}"
62CPPFLAGS="${CPPFLAGS} ${SDL_CFLAGS}"
[551]63AC_CHECK_HEADERS(SDL/SDL_mixer.h, [ac_cv_my_have_sdl_mixer="yes"])
[537]64CPPFLAGS="${save_CPPFLAGS}"
[551]65if test "${ac_cv_my_have_sdl_mixer}" = "no"; then
66  AC_MSG_ERROR([*** SDL_mixer not found!])
[537]67fi
[551]68LIBS="$LIBS -lSDL_mixer"
[479]69
[478]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
[609]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
[651]90if test "x${enable_nonfree}" = xno; then
[609]91  ac_cv_have_nonfree="no"
92fi
[640]93if test "x${ac_cv_have_nonfree}" = xno; then
94  distdir="\$(PACKAGE)-free-\$(VERSION)"
95else
96  distdir="\$(PACKAGE)-\$(VERSION)"
97fi
98AC_SUBST(distdir)
[651]99AM_CONDITIONAL(HAVE_NONFREE, test "x${ac_cv_have_nonfree}" = xyes)
[609]100
[651]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
[37]107# Optimizations
[478]108CXXFLAGS="${CXXFLAGS} ${OPT} ${REL}"
[37]109# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
[511]110CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wsign-compare"
[37]111
[2]112dnl Checks for header files
113AC_HEADER_DIRENT
114AC_HEADER_STDC
[556]115AC_CHECK_HEADERS(fcntl.h malloc.h string.h sys/ioctl.h sys/time.h unistd.h)
116AC_CHECK_HEADERS(netinet/in.h)
[2]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([
[42]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>
[614]136    #endif],
137  [],
138  [have_opengl=yes])
[2]139AC_MSG_RESULT($have_opengl)
[614]140if test "x$have_opengl" = xyes; then
[42]141    CFLAGS="$CFLAGS -DHAVE_OPENGL"
142    CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL"
143    LIBS="$LIBS -lGL -lpthread"
[2]144fi
145
[42]146AC_OUTPUT([
147    Makefile
148    src/Makefile
[62]149    src/lisp/Makefile
[42]150    src/net/Makefile
151    src/imlib/Makefile
[606]152    src/sdlport/Makefile
[610]153    data/Makefile
154    doc/Makefile
155    doc/abuse.6
156    doc/abuse-tool.6])
[2]157
158echo "
159------ Configuration for $PACKAGE $VERSION ------
[614]160    Compiler:          ${CC} (`${CC} --version | head -n 1`)
161    Install prefix:    ${prefix}
[623]162    Asset directory:   ${with_assetdir}
[614]163    SDL version:       `sdl-config --version`
164    OpenGL support:    ${have_opengl}
[2]165
166Now type 'make' to build $PACKAGE.
167"
Note: See TracBrowser for help on using the repository browser.