summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in188
1 files changed, 188 insertions, 0 deletions
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..6a90748
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,188 @@
+dnl Process this file with autoconf to produce a configure script.
+
+dnl initialisation
+AC_INIT(src/gltron.c)
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+AM_INIT_AUTOMAKE(gltron, 0.70)
+
+AC_PREFIX_DEFAULT("/usr/local")
+
+dnl AM_MAINTAINER_MODE
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_CPP
+AC_PROG_RANLIB
+
+dnl CFLAGS set-up
+CFLAGS="-DSEPARATOR=\"'/'\""
+dnl CFLAGS="-ansi -pedantic"
+dnl CXXFLAGS=""
+dnl CPPFLAGS=""
+
+AC_ARG_ENABLE(warn,
+AC_HELP_STRING([--enable-warn],[Enable compiler warnings @<:@default=on@:>@]),
+ enable_warn=$enableval, enable_warn=yes)
+if test "x$enable_warn" = xyes; then
+ CFLAGS="$CFLAGS -Wall -Werror"
+fi
+
+AC_ARG_ENABLE(debug,
+AC_HELP_STRING([--enable-debug],[Enable debugging @<:@default=off@:>@]),
+ enable_debug=$enableval, enable_debug=off)
+if test "x$enable_debug" = xyes; then
+ CFLAGS="$CFLAGS -g3"
+ CXXFLAGS="$CXXFLAGS -g3"
+fi
+
+AC_ARG_ENABLE(profile,
+AC_HELP_STRING([--enable-profile],[Enable profiling @<:@default=off@:>@]),
+ enable_profile=$enableval, enable_profile=off)
+if test "x$enable_profile" = xyes; then
+ if test "x$GCC" = xyes; then
+ CFLAGS="$CFLAGS -pg"
+ else
+ CFLAGS="$CFLAGS -p"
+ fi
+fi
+
+AC_ARG_ENABLE(optimize,
+AC_HELP_STRING([--enable-optimize=@<:@level@:>@],[Enable optimization @<:@default=s@:>@]),
+ enable_optmize=$enableval, enable_optimize=s)
+dnl this is always true
+if test "x$enable_optimize" ; then
+ CFLAGS="$CFLAGS -O$enable_optimize"
+ CXXFLAGS="$CXXFLAGS -O$enable_optimize"
+fi
+
+dnl library checks
+AM_PATH_SDL(1.1.0, CFLAGS="$CFLAGS $SDL_CFLAGS"; CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"; LIBS="$LIBS $SDL_LIBS",
+ AC_MSG_ERROR(SDL is not installed))
+AC_CHECK_LIB(GL, main,, AC_MSG_ERROR(OpenGL is not installed))
+dnl AC_CHECK_LIB(opengl32, main,, AC_MSG_ERROR(OpenGL is not installed))
+AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR(libz is not installed))
+AC_CHECK_LIB(png, png_read_info,, AC_MSG_ERROR(libpng is not installed))
+
+dnl local data dir setup
+AC_ARG_ENABLE(localdata,
+AC_HELP_STRING([--enable-localdata],[Use local data directory @<:@default=no@:>@]),
+ CPPFLAGSA="$CPPFLAGSA -DLOCAL_DATA",
+ CPPFLAGSA="$CPPFLAGSA -DDATA_DIR=\\\"\$(datadir)/\$(PACKAGE)\\\"")
+
+dnl snapshot dir setup
+AC_ARG_WITH(snapshot-dir,
+AC_HELP_STRING([--with-snapshot-dir=@<:@path@:>@],[Snapshot directory @<:@default=~@:>@]),
+ CPPFLAGSA="$CPPFLAGSA -DSNAP_DIR=\\\"$withval\\\"",
+ CPPFLAGSA="$CPPFLAGSA -DSNAP_DIR=\\\"~\\\"")
+
+dnl preferences dir setup
+AC_ARG_WITH(preferences-dir,
+AC_HELP_STRING([--with-preferences-dir=@<:@path@:>@],[Preferences directory @<:@default=~@:>@]),
+ CPPFLAGSA="$CPPFLAGSA -DPREF_DIR=\\\"$withval\\\"",
+ CPPFLAGSA="$CPPFLAGSA -DPREF_DIR=\\\"~\\\"")
+
+dnl sound set-up
+AC_ARG_ENABLE(sound,
+AC_HELP_STRING([--disable-sound],[Don't compile in sound @<:@default=off@:>@]),
+ use_sound=no, use_sound=yes)
+if test "x$use_sound" = xyes; then
+ AC_CHECK_LIB(smpeg, main,, AC_MSG_WARN(smpeg not found - music playback may not work correctly))
+ AC_CHECK_LIB(ogg, main,, AC_MSG_WARN(ogg not found - music playback may not work correctly))
+ AC_CHECK_LIB(vorbis, main,, AC_MSG_WARN(vorbis not found - music playback may not work correctly))
+ AC_CHECK_LIB(vorbisfile, main,, AC_MSG_WARN(vorbisfile not found - music playback may not work correctly))
+ AC_CHECK_LIB(smpeg, main,, AC_MSG_WARN(smpeg not found - music playback may not work correctly))
+ AC_CHECK_LIB(mikmod, main,, AC_MSG_WARN(mikmod not found - music playback may not work correctly))
+ AC_CHECK_LIB(SDL_sound, Sound_Init,
+ LIBS="-lSDL_sound $LIBS";
+ SOUND_OBJS="sound.o sound_glue.o Source.o Source3D.o SourceMusic.o SourceSample.o SoundSystem.o SourceCopy.o SourceEngine.o",
+ AC_MSG_WARN(SDL_sound not found - disabling sound);
+ SOUND_OBJS="sound_stubs.o sound_glue_stubs.o")
+
+ AC_SUBST(SOUND_OBJS)
+else
+ SOUND_OBJS="sound_stubs.o sound_glue_stubs.o"
+ AC_SUBST(SOUND_OBJS)
+fi
+
+dnl network set-up
+AC_ARG_ENABLE(network,
+AC_HELP_STRING([--enable-network],[Experimental network mode @<:@default=off@:>@]),
+ enable_network=$enableval, enable_network=off)
+if test "x$enable_network" = xyes; then
+ AC_CHECK_LIB(SDL_net, SDLNet_Init,
+ CFLAGS="$CFLAGS -DNETWORK";
+ LIBS="$LIBS -lSDL_net";
+ NETWORK_OBJS="network.o system_net.o",
+ AC_MSG_WARN(SDL_net not found - disabling network))
+ AC_SUBST(NETWORK_OBJS)
+fi
+
+dnl CXXFLAGS="$CFLAGS"
+
+dnl header checks
+AC_HEADER_STDC
+AC_CHECK_HEADERS(unistd.h)
+
+AC_CHECK_HEADERS(GL/gl.h, have_gl_h=true, have_gl_h=false)
+$have_gl_h || {
+ AC_CHECK_HEADERS(/usr/X11R6/include/GL/gl.h, includes_in_x=1 have_gl_h=true, have_gl_h=false)
+}
+$have_gl_h || {
+ AC_CHECK_HEADERS(/usr/local/include/GL/gl.h, includes_in_local=1 have_gl_h=true, have_gl_h=false)
+}
+$have_gl_h || {
+ AC_MSG_ERROR(cant find GL headers)
+}
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+
+dnl Checks for library functions.
+AC_CHECK_FUNCS(strstr mkstemp)
+
+CPPFLAGS="$CPPFLAGS $CPPFLAGSA"
+
+AC_OUTPUT([Makefile \
+ lua/Makefile \
+ lua/include/Makefile \
+ lua/src/Makefile \
+ lua/src/lib/Makefile \
+ nebu/Makefile \
+ nebu/include/Makefile \
+ nebu/include/audio/Makefile \
+ nebu/include/base/Makefile \
+ nebu/include/filesystem/Makefile \
+ nebu/include/input/Makefile \
+ nebu/include/scripting/Makefile \
+ nebu/include/video/Makefile \
+ nebu/base/Makefile \
+ nebu/filesystem/Makefile \
+ nebu/scripting/Makefile \
+ nebu/input/Makefile \
+ nebu/video/Makefile \
+ nebu/audio/Makefile
+ src/Makefile \
+ src/include/Makefile \
+ src/include/audio/Makefile \
+ src/include/base/Makefile \
+ src/include/configuration/Makefile \
+ src/include/filesystem/Makefile \
+ src/include/game/Makefile \
+ src/include/input/Makefile \
+ src/include/scripting/Makefile \
+ src/include/video/Makefile \
+ src/base/Makefile \
+ src/filesystem/Makefile \
+ src/configuration/Makefile \
+ src/audio/Makefile \
+ src/video/Makefile \
+ src/input/Makefile \
+ src/game/Makefile \
+ art/Makefile \
+ art/default/Makefile \
+ data/Makefile \
+ music/Makefile \
+ scripts/Makefile \
+ ])