AC_INIT(configure.in) dnl ---------------------------------------------------------------- dnl append SVN revision to the version number OSIRIONVERSION='0.1.0' SVNREVISION=`svnversion $srcdir` if test ! -z "$SVNREVISION"; then OSIRIONVERSION="${OSIRIONVERSION}-svn${SVNREVISION}" fi AM_CONFIG_HEADER(src/config.h) AM_INIT_AUTOMAKE(osirion, $OSIRIONVERSION) AC_LANG_CPLUSPLUS AC_PROG_CXX AM_PROG_LIBTOOL dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, dnl if-not-found, test-parameter) AC_DEFUN([KDE_FIND_PATH], [ AC_MSG_CHECKING([for $1]) if test -n "$$2"; then kde_cv_path="$$2"; else kde_cache=`echo $1 | sed 'y%./+-%__p_%'` AC_CACHE_VAL(kde_cv_path_$kde_cache, [ kde_cv_path="NONE" dirs="$3" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/$1"; then if test -n "$5" then evalstr="$dir/$1 $5 2>&1 " if eval $evalstr; then kde_cv_path="$dir/$1" break fi else kde_cv_path="$dir/$1" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" ]) eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then AC_MSG_RESULT(not found) $4 else AC_MSG_RESULT($kde_cv_path) $2=$kde_cv_path fi ]) dnl ---------------------------------------------------------------- dnl HOST dependend variables dnl AC_MSG_CHECKING([host type]) case "$host" in *-apple-darwin*) HOST_LIBS="-lz" HOST_GL_LIBS="-framework OpenGL" HOST_AL_LIBS="-framework OpenAL" HOST_SDL_LIBS="-framework SDL -framework Cocoa" ICON_CLIENT="" ICON_SERVER="" SDLMAIN="SDLMain.o" INSTALLTYPE="application bundle" OS=OSX AC_MSG_RESULT(OS X) AC_DEFINE_UNQUOTED(_OSX, 1, [Define this if you're building for native OS X]) dnl dnl Don't rely on AC_PROG_OBJC presence (e.g. autoconf 2.59) dnl http://www.mail-archive.com/xine-cvslog@lists.sourceforge.net/msg01693.html dnl m4_ifdef( [AC_PROG_OBJC], [AC_PROG_OBJC], [AC_CHECK_TOOL([OBJC], [gcc]) AC_SUBST(OBJC) AC_SUBST(OBJCFLAGS)] ) ;; *-*-mingw*) HOST_LIBS="-lws2_32 -lz" HOST_GL_LIBS="-lopengl32 -lglu32" HOST_AL_LIBS="-lopenal32" ICON_CLIENT="osirion-res.o" ICON_SERVER="osiriond-res.o" SDLMAIN="" INSTALLTYPE="single directory" OS=WIN32 AC_MSG_RESULT(win32) ;; *) HOST_LIBS="-lz" HOST_GL_LIBS="-lGL -lGLU" HOST_AL_LIBS="-lopenal" ICON_CLIENT="" ICON_SERVER="" SDLMAIN="" INSTALLTYPE="standard" AC_MSG_RESULT(generic unix) OS=UNIX ;; esac dnl dnl Make Objective-C work with automake 1.7.x dnl http://mlblog.osdir.com/sysutils.automake.general/2003-05/msg00030.shtml dnl AM_CONDITIONAL([am__fastdepOBJC], false) AC_SUBST(OS) AC_SUBST(HOST_LIBS) AC_SUBST(ICON_CLIENT) AC_SUBST(ICON_SERVER) AC_SUBST(SDLMAIN) AC_DEFINE(OS, $OS, [Operating System]) dnl ---------------------------------------------------------------- dnl enable compiler warnings or not dnl AC_MSG_CHECKING(whether to abort on compiler warnings) WARN_CFLAGS="" AC_ARG_ENABLE(warn, AC_HELP_STRING( [--disable-warn], [don't abort on compiler warnings] ), AC_MSG_RESULT(no), AC_MSG_RESULT(yes) WARN_CFLAGS="$WARN_CFLAGS -Wall -Werror" ) AC_SUBST(WARN_CFLAGS) dnl ---------------------------------------------------------------- dnl enable DEBUG messages or not dnl AC_MSG_CHECKING(whether to include debug messages) AC_ARG_ENABLE(debug_messages, AC_HELP_STRING( [--disable-debug-messages], [build without extra debug information] ), AC_MSG_RESULT(no), AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_DEBUG_MESSAGES, 1, [Defines if debug information is enabled]) ) dnl ---------------------------------------------------------------- dnl curses dnl HAVE_CURSES=no AC_ARG_WITH(curses, AC_HELP_STRING([--without-curses], [do not include curses support] ) ) if test "x${with_curses}" != "xno"; then save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $CURSES_CFLAGS" AC_CHECK_HEADER(curses.h, HAVE_CURSES="maybe", HAVE_CURSES="no" ) if test "x${HAVE_CURSES}" = "xmaybe"; then AC_CHECK_LIB(ncurses, initscr, HAVE_CURSES="ncurses" AC_DEFINE(HAVE_CURSES, ncurses, [Define this if you have the curses library]) CURSES_LIBS="$CURSES_LIBS -lncurses", HAVE_CURSES="maybe" ) fi if test "x${HAVE_CURSES}" = "xmaybe"; then AC_CHECK_LIB(pdcurses, initscr, HAVE_CURSES="pdcurses" AC_DEFINE(HAVE_CURSES, pdcurses, [Define this if you have the curses library]) CURSES_LIBS="$CURSES_LIBS -lpdcurses", HAVE_CURSES="maybe" ) fi if test "x${HAVE_CURSES}" = "xmaybe"; then AC_CHECK_LIB(curses, initscr, HAVE_CURSES="curses" AC_DEFINE(HAVE_CURSES, curses, [Define this if you have the curses library]) CURSES_LIBS="$CURSES_LIBS -lcurses", HAVE_CURSES="maybe" ) fi if test "x${HAVE_CURSES}" = "xmaybe"; then HAVE_CURSES=no fi CPPFLAGS="$save_CPPFLAGS" fi AC_SUBST(CURSES_CFLAGS) AC_SUBST(CURSES_LIBS) dnl ---------------------------------------------------------------- dnl bullet dnl HAVE_BULLET=no AC_ARG_WITH(bullet, AC_HELP_STRING([--with-bullet=DIR], [use the bullet physics library in DIR (read the documentation)] ) ) dnl disable bullet for now with_bullet=no if test "x${with_bullet}" != "xno"; then save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" AC_MSG_CHECKING(for bullet directory) BULLET_DIR="/usr/local" if test "x${with_bullet}" != "x"; then BULLET_DIR="${with_bullet}" fi AC_MSG_RESULT([$BULLET_DIR]) BULLET_CFLAGS="-I${BULLET_DIR}/include/bullet" BULLET_LIBS="-L${BULLET_DIR}/lib" CPPFLAGS="$save_CPPFLAGS $BULLET_CFLAGS" LDFLAGS="$save_LDFLAGS $BULLET_LIBS" AC_CHECK_HEADER(btBulletDynamicsCommon.h, AC_DEFINE(HAVE_BULLET, yes, [Define this if you have the bullet physics library]) BULLET_LIBS="$BULLET_LIBS -lbulletmath -lbulletdynamics -lbulletcollision" HAVE_BULLET="yes", BULLET_LIBS="" BULLET_CFLAGS="" HAVE_BULLET="no" ) CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" fi AC_SUBST(BULLET_CFLAGS) AC_SUBST(BULLET_LIBS) dnl ---------------------------------------------------------------- dnl zlib dnl AC_CHECK_HEADER(zlib.h, [], AC_MSG_ERROR([zlib.h not found]) ) AC_CHECK_LIB(z, compress, [], AC_MSG_ERROR([zlib not found]) ) dnl ---------------------------------------------------------------- dnl build client and server or dedicated server only dnl BUILD_CLIENT=no AC_ARG_WITH(client, AC_HELP_STRING([--without-client], [do not build the client application]) ) AC_MSG_CHECKING(whether to build client) if test "x${with_client}" = xno; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) LDFLAGS_save="$LDFLAGS" dnl --------------------------------------------------------------- dnl OpenGL dnl if test "x${OS}" = "xOSX"; then AC_CHECK_HEADER(OpenGL/gl.h, [], [AC_MSG_ERROR([OpenGL/gl.h not found])] ) AC_CHECK_HEADER(OpenGL/glu.h, [], [AC_MSG_ERROR([OpenGL/glu.h not found])] ) else AC_CHECK_HEADER(GL/gl.h, [], [AC_MSG_ERROR([GL/gl.h not found])] ) AC_CHECK_HEADER(GL/glu.h, [], [AC_MSG_ERROR([GL/glu.h not found])] ) fi LD_FLAGS="$LDFLAGS_save" GL_LIBS="$HOST_GL_LIBS" AC_SUBST(GL_LIBS) AC_SUBST(GL_CFLAGS) dnl --------------------------------------------------------------- dnl OpenAL if test "x${OS}" = "xOSX"; then AC_CHECK_HEADER(OpenAL/al.h, [], [AC_MSG_ERROR([OpenAL/al.h not found])] ) else AC_CHECK_HEADER(AL/al.h, [], [AC_MSG_ERROR([AL/al.h not found])] ) fi LD_FLAGS="$LDFLAGS_save" AL_LIBS="$HOST_AL_LIBS" AC_SUBST(AL_LIBS) AC_SUBST(AL_CFLAGS) dnl --------------------------------------------------------------- dnl libpng dnl AC_CHECK_HEADER(png.h, [], [AC_MSG_ERROR([png.h not found])] ) AC_CHECK_LIB(png, png_create_info_struct, HAVE_LIBPNG=yes, [AC_MSG_ERROR([libpng not found])] ) LIBPNG_LIBS="-lpng" AC_SUBST(LIBPNG_LIBS) dnl --------------------------------------------------------------- dnl libjpeg dnl AC_CHECK_HEADER(jpeglib.h, [], [AC_MSG_ERROR([jpeglib.h not found])] ) AC_CHECK_LIB(jpeg, jpeg_start_decompress, HAVE_LIBJPEG=yes AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define this if you have libjpeg]), AC_MSG_ERROR([libjpeg not found]) ) LIBJPG_LIBS="-ljpeg" AC_SUBST(LIBJPG_LIBS) dnl --------------------------------------------------------------- dnl SDL dnl if test "x${OS}" = "xOSX"; then AC_CHECK_HEADER(SDL/SDL.h, [], [AC_MSG_ERROR([SDL/SDL.h not found])] ) LIBSDL_LIBS="$HOST_SDL_LIBS" LIBSDL_CFLAGS="$HOST_SDL_LIBS" AC_SUBST(LIBSDL_LIBS) AC_SUBST(LIBSDL_CFLAGS) else AC_MSG_CHECKING([looking for SDL]) KDE_FIND_PATH(sdl-config, LIBSDL_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [ AC_MSG_ERROR([SDL not found]) ]) if test -n "$LIBSDL_CONFIG"; then LIBSDL_LIBS="`$LIBSDL_CONFIG --libs`" LIBSDL_RPATH= for args in $LIBSDL_LIBS; do case $args in -L*) LIBSDL_RPATH="$LIBSDL_RPATH $args" ;; esac done LIBSDL_RPATH=`echo $LIBSDL_RPATH | sed -e "s/-L/-R/g"` LIBSDL_CFLAGS="`$LIBSDL_CONFIG --cflags`" fi AC_MSG_RESULT($HAVE_LIBSDL) AC_SUBST(LIBSDL_LIBS) AC_SUBST(LIBSDL_CFLAGS) AC_SUBST(LIBSDL_RPATH) fi BUILD_CLIENT=yes AC_DEFINE_UNQUOTED(BUILD_CLIENT, 1, [Define this to build the client]) fi CXXFLAGS="-pipe $DEBUG_CFLAGS $WARN_CFLAGS $CXXFLAGS" AC_SUBST(CXXFLAGS) CPPFLAGS="$CPPFLAGS $BULLET_CFLAGS" AC_SUBST(CPPFLAGS) dnl --------------------------------------------------------------- dnl Installation paths AC_MSG_CHECKING(installation type) AC_ARG_ENABLE(single_directory, AC_HELP_STRING( [--enable-single-directory], [install everything in a single directory] ), AC_MSG_RESULT(single directory) INSTALLTYPE="single directory", AC_MSG_RESULT(standard) INSTALLTYPE="standard" ) if test "x${INSTALLTYPE}" = xstandard; then test "$prefix" = "NONE" && prefix="/usr/local" bindir="$prefix/bin" pkgdatadir="$prefix/share/${PACKAGE}" docdir="$pkgdatadir/doc" else test "$prefix" = "NONE" && prefix="/opt/games/$PACKAGE" bindir="$prefix" pkgdatadir="$prefix" docdir="$prefix/doc" fi PACKAGE_DATADIR="$pkgdatadir/data" AC_DEFINE(PACKAGE_DATADIR, "$PACKAGE_DATADIR", [Define this to the path containing the game data.] ) dnl --------------------------------------------------------------- dnl Write makefiles and config.h AM_CONDITIONAL(BUILD_CLIENT, test "x$BUILD_CLIENT" = xyes) AM_CONDITIONAL(BUILD_DEDICATED, test "x$BUILD_CLIENT" = xno) AC_OUTPUT(Makefile src/Makefile src/audio/Makefile src/auxiliary/Makefile \ src/client/Makefile src/core/Makefile src/dedicated/Makefile src/filesystem/Makefile \ src/game/Makefile src/game/base/Makefile src/game/example/Makefile src/game/intro/Makefile \ src/math/Makefile src/model/Makefile src/render/Makefile src/sys/Makefile src/ui/Makefile) dnl --------------------------------------------------------------- dnl Configuration summary AC_MSG_RESULT([ Project::OSiRiON $VERSION Configuration summary: platform ........... $host flags .............. $CPPFLAGS $CXXFLAGS libraries .......... $HOST_LIBS $LIBJPG_LIBS $LIBPNG_LIBS $CURSES_LIBS $BULLET_LIBS curses ............. $HAVE_CURSES bullet ............. $HAVE_BULLET build client ....... $BUILD_CLIENT]) if test "x$BUILD_CLIENT" = xyes; then AC_MSG_RESULT([SDL .................$LIBSDL_LIBS opengl ............. $GL_LIBS openal ............. $AL_LIBS]) fi AC_MSG_RESULT([ Installation directories: installation type .. $INSTALLTYPE prefix ............. $prefix binaries ........... $bindir documentation ...... $docdir game data .......... $PACKAGE_DATADIR ])