AC_INIT(configure.in) AC_PREREQ([2.50]) CXXFLAGS=$CXXFLAGS AC_PROG_CXX AM_CONFIG_HEADER(config.h) OBJDIR=obj if test "`uname -a | grep -is cygwin`" -o "`uname -a | grep -is mingw`"; then ARCH=win32 OBJDIR=winobj CPPFLAGS="$CPPFLAGS -DUSE_WIN32" elif test "`uname -a | grep -is bsd`"; then ARCH=bsd CPPFLAGS="$CPPFLAGS -DBSD" elif test "`uname -a | grep -is beos`"; then ARCH=beos CPPFLAGS="$CPPFLAGS -DUSE_BEOS" elif test "`uname -a | grep -is darwin`"; then ARCH=macosx CPPFLAGS="$CPPFLAGS -DUSE_MAC" else ARCH=linux fi if test "$ARCH" = "bsd" ; then CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include -I/usr/local/include" LIBS="$LIBS -L/usr/local/lib" fi if test "$ARCH" = "macosx" ; then if test -d /usr/local/include; then CPPFLAGS="$CPPFLAGS -I/usr/local/include" fi if test -d /usr/local/lib; then LIBS="$LIBS -L/usr/local/lib" fi if test -d /sw/include; then CPPFLAGS="$CPPFLAGS -I/sw/include" fi if test -d /sw/lib; then LIBS="$LIBS -L/sw/lib" fi if test -d /opt/local/include; then CPPFLAGS="$CPPFLAGS -I/opt/local/include" fi if test -d /opt/local/lib; then LIBS="$LIBS -L/opt/local/lib" fi fi if test -d /usr/include/lua50; then CPPFLAGS="$CPPFLAGS -I/usr/include/lua50" fi dnl --- EXTRA DIRS ------------- AC_ARG_WITH(extra-includes, [ --with-extra-includes=DIR [Location of additional include directiories]], CPPFLAGS="$CPPFLAGS -I$withval") AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR [Location of additional library directories]], LDFLAGS="$LDFLAGS -L$withval") AC_CHECK_FUNCS(strcasestr) AC_CHECK_FUNCS(strnlen) AC_PATH_X if test "$no_x" != "yes"; then if test "x$x_includes" != "x"; then CPPFLAGS="$CPPFLAGS -I$x_includes" fi if test "x$x_libraries" != "x"; then LDFLAGS="$LDFLAGS -L$x_libraries" fi LDFLAGS="$LDFLAGS -lX11" AC_DEFINE(HAVE_X, 1, Define to 1 if you have X. Used for pasting from the clipboard.) fi AC_CHECK_HEADER(zlib.h,, AC_MSG_ERROR(could not find zlib.h)) AC_CHECK_HEADER(png.h,, AC_MSG_ERROR(could not find png.h)) AC_ARG_ENABLE(win32, [ --enable-win32 Force win32, useful for cross-compiling (default: no)]) if test "$enable_win32" = "yes"; then ARCH=win32 OBJDIR=winobj CPPFLAGS="$CPPFLAGS -DUSE_WIN32" PATH="/usr/local/cross/bin:$PATH" fi AC_SUBST(OBJDIR) AC_ARG_ENABLE(static, [ --enable-static Compile a static binary (default: no)]) if test "$enable_static" = "yes"; then LDFLAGS="$LDFLAGS -static" fi AC_ARG_ENABLE(profile, [ --enable-profile Enable profiling support, implies --enable-debug (default: no)]) if test "$enable_profile" = "yes"; then CXXFLAGS="-pg" fi AC_ARG_ENABLE(debug, [ --enable-debug [Enable debug (default: no)]]) if test "$enable_debug" != "yes" -a "$enable_profile" != "yes"; then CXXFLAGS="$CXXFLAGS -O2 -pipe -fsigned-char -fomit-frame-pointer -fexpensive-optimizations -ffast-math" else CXXFLAGS="$CXXFLAGS -O0 -g -fsigned-char -Wsign-compare -Werror -Wall" CPPFLAGS="$CPPFLAGS -DDEBUG" fi dnl --- OPENGL ----------------- AC_ARG_WITH(opengl, [ --with-opengl [Use opengl (default: no)]],, with_opengl="no") if test "$with_opengl" != "no"; then CPPFLAGS="$CPPFLAGS -DUSE_OPENGL" if test "$ARCH" = "win32"; then AC_CHECK_LIB(opengl32, main, LDFLAGS="$LDFLAGS -lopengl32", AC_MSG_ERROR(opengl libraries cannot be not found)) else AC_SEARCH_LIBS(glViewport, GL opengl32 sdl, LDFLAGS="$LDFLAGS $LIBS", AC_MSG_ERROR(opengl libraries cannot be not found)) fi fi dnl --- BZIP2 ------------------ AC_ARG_WITH(bzip2, [ --with-bzip2 [Use bzip2 (default: yes)]]) if test "$with_bzip2" != "no"; then AC_CHECK_HEADER(bzlib.h,, BZIP2=no) if test "$BZIP2" != "no"; then AC_CHECK_LIB(bz2, main, CPPFLAGS="$CPPFLAGS -DUSE_BZ2LIB" LDFLAGS="$LDFLAGS -lbz2", BZIP2=no) fi if test "$BZIP2" = "no"; then AC_MSG_ERROR(libbzip2 headers and/or libraries could not be found) fi fi dnl --- VORBIS ----------------- AC_ARG_WITH(vorbis, [ --with-vorbis [Use vorbis (default: autodetect)]]) if test "$with_vorbis" != "no"; then AC_CHECK_HEADER(ogg/ogg.h,, VORBIS=no) AC_CHECK_HEADER(vorbis/codec.h,, VORBIS=no) if test "$VORBIS" != "no"; then AC_CHECK_LIB(vorbis, vorbis_info_init, CPPFLAGS="$CPPFLAGS -DUSE_VORBIS" LDFLAGS="$LDFLAGS -lvorbis -logg", VORBIS=no, -logg) fi if test "x$with_vorbis" != "x" -a "$VORBIS" = "no"; then AC_MSG_ERROR(vorbis headers and/or libraries could not be found) fi else VORBIS=no fi dnl --- THEORA ----------------- AC_ARG_WITH(theora, [ --with-theora [Use theora (default: no)]]) if test "$with_theora" != "no" -a "x$with_theora" != "x"; then if test "$VORBIS" = "no"; then AC_MSG_ERROR(vorbis is required for theora support) fi AC_CHECK_HEADER(ogg/ogg.h,, THEORA=no) AC_CHECK_HEADER(theora/theora.h,, THEORA=no) if test "$THEORA" != "no"; then AC_CHECK_LIB(theora, theora_decode_init, CPPFLAGS="$CPPFLAGS -DUSE_THEORA" LDFLAGS="$LDFLAGS -ltheora -logg", THEORA=no, -logg) fi if test "x$with_theora" != "x" -a "$THEORA" = "no"; then AC_MSG_ERROR(theora headers and/or libraries could not be found) fi fi dnl --- MIKMOD ----------------- AC_ARG_WITH(mikmod, [ --with-mikmod [Use mikmod (default: autodetect)]]) if test "$with_mikmod" != "no"; then AC_CHECK_HEADER(mikmod.h,, MIKMOD=no) if test "$MIKMOD" != "no"; then AC_CHECK_LIB(mikmod, MikMod_Init, CPPFLAGS="$CPPFLAGS -DUSE_MIKMOD" LDFLAGS="$LDFLAGS -lmikmod", MIKMOD=no) fi if test "x$with_mikmod" != "x" -a "$MIKMOD" = "no"; then AC_MSG_ERROR(mikmod headers and/or libraries could not be found) fi fi dnl --- MNG -------------------- AC_ARG_WITH(mng, [ --with-mng [Use mng (default: no)]]) if test "$with_mng" != "no" -a "x$with_mng" != "x"; then AC_CHECK_HEADER(libmng.h,, MNG=no) if test "$MNG" != "no"; then AC_CHECK_LIB(mng, main, CPPFLAGS="$CPPFLAGS -DUSE_MNG" LDFLAGS="$LDFLAGS -lmng", MNG=no) fi if test "$MNG" = "no"; then AC_MSG_ERROR(mng headers and/or libraries could not be found) fi fi dnl --- LUA -------------------- if test "$ARCH" = "linux"; then LDFLAGS="$LDFLAGS -ldl" fi AC_CHECK_HEADER(lua.h,, AC_MSG_ERROR(could not find lua.h)) AC_SEARCH_LIBS(lua_getfenv, lua lua50 lua5.0, LDFLAGS="$LDFLAGS $LIBS", AC_MSG_ERROR(Lua5 is required)) AC_SEARCH_LIBS(luaopen_base, lualib lualib50 lualib5.0, LDFLAGS="$LDFLAGS $LIBS", AC_MSG_ERROR(Lualib5 is required)) dnl --- SDL -------------------- AC_CHECK_PROGS(SDLCONFIG, sdl-config) if test "x$SDLCONFIG" = "x"; then AC_CHECK_PROGS(SDLCONFIG, sdl11-config) fi if test "x$SDLCONFIG" = "x"; then echo "*** sdl-config not found"; exit 1; fi CPPFLAGS="$CPPFLAGS `$SDLCONFIG --cflags`" if test "$enable_static" != "yes"; then LDFLAGS="$LDFLAGS `$SDLCONFIG --libs`" else LDFLAGS="$LDFLAGS `$SDLCONFIG --static-libs`" fi if test "$prefix" = "NONE"; then PREFIX=/usr/local else PREFIX="$prefix" fi AC_SUBST(PREFIX) if test "$ARCH" = "win32"; then if test "`uname -a | grep -is cygwin`"; then LDFLAGS="$LDFLAGS -lwsock32 -lws2_32" else LDFLAGS="$LDFLAGS -lwsock32 -lws2_32 -lmingwex -lgmon" fi fi AC_SUBST(CPPFLAGS) AC_SUBST(CXXFLAGS) AC_SUBST(LDFLAGS) if test "$ARCH" = "win32"; then if ! test -f Rules.make; then echo "include Rules.make.WIN32" >Rules.make else # touch it for dependency reasons touch Rules.make fi AC_CONFIG_FILES(Rules.make.WIN32:Rules.make.in) else AC_CONFIG_FILES(Rules.make) fi AC_OUTPUT # EOF #