dnl This configuration script was based on that of Tuxracer. dnl http://www.tuxracer.com/ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/scourge.h) AM_INIT_AUTOMAKE(scourge, "0.21") AM_CONFIG_HEADER(config.h) dnl internationalization macros AC_GNU_SOURCE AM_GNU_GETTEXT # AM_GNU_GETTEXT_VERSION dnl Check system type AC_CANONICAL_HOST dnl Check for compilers. We set CFLAGS and CXXFLAGS to null if unset, so dnl that these macros won't set them to default values that we don't want. if test "x${CFLAGS-notset}" = "xnotset" ; then export CFLAGS CFLAGS="" fi AC_PROG_CC if test "x${CXXFLAGS-notset}" = "xnotset" ; then export CXXFLAGS CXXFLAGS="" fi AC_PROG_CXX dnl Check for ranlib AC_PROG_RANLIB dnl we'll compile subdirectories into .la files. dnl AM_PROG_LIBTOOL dnl run make in subdirectories AC_PROG_MAKE_SET dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(sys/time.h unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_HEADER_TIME dnl Checks for library functions. AC_CHECK_FUNCS(getcwd gettimeofday strdup) dnl Check for non-standard floating point functions and headers AC_CHECK_FUNCS(finite isnan) AC_CHECK_FUNCS(_finite _isnan) AC_CHECK_HEADERS(ieeefp.h) # Set up binreloc (for a relocatable autopackage file) AM_BINRELOC dnl -------------------------------------------------------------------------- dnl General options dnl -------------------------------------------------------------------------- TR_CPPFLAGS="" TR_CFLAGS="$CFLAGS" TR_CXXFLAGS="$CXXFLAGS" TR_LIBS="" dnl Only override CXXFLAGS and CFLAGS if not already defined if test "x$CXXFLAGS" = "x" -a "x$CFLAGS" = "x" ; then TR_CPPFLAGS="" TR_CFLAGS="" TR_CXXFLAGS="" TR_LIBS="" fi AC_ARG_ENABLE([optimized], AS_HELP_STRING([--enable-optimized], [enable compiler optimizations]), [if test "x${enableval}" = "xyes" ; then TR_CPPFLAGS="" TR_CFLAGS="-O3 -Wall -Wno-deprecated -fomit-frame-pointer -ffast-math -fexpensive-optimizations" TR_CXXFLAGS="-O3 -Wall -Wno-deprecated -fomit-frame-pointer -ffast-math -fexpensive-optimizations" TR_LIBS="" case "$host" in i*86-*-*) TR_CFLAGS="$TR_CFLAGS -falign-loops=2 -falign-jumps=2 -falign-functions=2"; TR_CXXFLAGS="$TR_CXXFLAGS -falign-loops=2 -falign-jumps=2 -falign-functions=2";; alpha*-*-linux-*) TR_CFLAGS="$TR_CFLAGS -mieee";; esac fi]) AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [enable debug in scourge]), [if test "x${enableval}" = "xyes" ; then TR_CFLAGS="-O0 -ggdb3 -DDEBUG -Wall -Wno-deprecated -fno-inline"; TR_CXXFLAGS="$TR_CFLAGS"; TR_CPPFLAGS="$TR_CFLAGS" fi]) AC_ARG_ENABLE(profile, [ --enable-profile Produce a profiled executable], [TR_CFLAGS="$TR_CFLAGS -pg"; TR_CXXFLAGS="$TR_CXXFLAGS -pg"]) dnl -------------------------------------------------------------------------- dnl Check if compiling for Win32 dnl -------------------------------------------------------------------------- AC_MSG_CHECKING([for Win32 platform]) AC_EGREP_CPP(yes, [ #if defined(WIN32) || defined(__CYGWIN__) yes #endif ], is_win32=yes, is_win32=no ) AC_MSG_RESULT([$is_win32]) AC_MSG_CHECKING([for Mac OSX platform]) AC_EGREP_CPP(yes, [ #if defined(__APPLE__) || defined(__MACH_O__) yes #endif ], is_macosx=yes, is_macosx=no ) AC_MSG_RESULT([$is_macosx]) dnl Add libs required for Windows dnl I don't use -mwindows since I like having the console around dnl If the console annoys you then remove "-luser32 -lgdi32" and replace dnl with "-mwindows" if test "x$is_win32" = "xyes" ; then TR_LIBS="$TR_LIBS -luser32 -lgdi32" fi dnl -------------------------------------------------------------------------- dnl Check for X dnl Note that we only need libs (so that glut links properly on all systems). dnl -------------------------------------------------------------------------- dnl if test "x$is_win32" = "xno" ; then dnl AC_PATH_XTRA dnl if test "x$no_x" = "x" ; then dnl TR_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXi -lXext -lXmu -lXt $X_EXTRA_LIBS $TR_LIBS" dnl fi dnl fi dnl -------------------------------------------------------------------------- dnl Check for some common libraries dnl -------------------------------------------------------------------------- AC_CHECK_LIB( dl, main, TR_LIBS="$TR_LIBS -ldl" ) AC_CHECK_LIB( m, main, TR_LIBS="$TR_LIBS -lm" ) AC_CHECK_LIB( z, deflate, TR_LIBS="$TR_LIBS -lz", AC_MSG_ERROR([Cannot find libz library]) ) dnl -------------------------------------------------------------------------- dnl Check for SDL dnl -------------------------------------------------------------------------- AC_ARG_ENABLE(sdl,[ --disable-sdl Disable detction and use of SDL]) AC_ARG_ENABLE(sdl,[ --disable-sdl_net Disable detction and use of SDL_net]) AC_ARG_ENABLE(sdl,[ --disable-sdl_mixer Disable detction and use of SDL_mixer]) if test "x$enable_sdl" != "xno" ; then SDL_VERSION=1.0.1 AM_PATH_SDL($SDL_VERSION, have_SDL=yes, have_SDL=no) if test "x$have_SDL" = "xyes" ; then TR_CPPFLAGS="$TR_CPPFLAGS -DHAVE_SDL=1" TR_CFLAGS="$TR_CFLAGS $SDL_CFLAGS" TR_CXXFLAGS="$TR_CXXFLAGS $SDL_CFLAGS" TR_LIBS="$TR_LIBS $SDL_LIBS" dnl Check for joystick support in SDL saved_LIBS="$LIBS" LIBS="$saved_LIBS $TR_LIBS" AC_CHECK_FUNCS( SDL_JoystickOpen, have_SDL_joystick=yes, have_SDL_joystick=no ) if test "x$have_SDL_joystick" = "xno" ; then echo "*** This version of SDL doesn't have joystick support." echo "*** Configuring without joystick support." fi if test "x$enable_sdl_mixer" != "xno" ; then dnl Check for SDL_mixer AC_CHECK_LIB( SDL_mixer, Mix_OpenAudio, have_SDL_mixer=yes, have_SDL_mixer=no ) if test "x$have_SDL_mixer" = "xyes" ; then TR_CPPFLAGS="$TR_CPPFLAGS -DHAVE_SDL_MIXER=1" TR_LIBS="$TR_LIBS -lSDL_mixer" else echo "*** SDL_mixer not found. Configuring without audio support." fi fi if test "x$enable_sdl_net" != "xno" ; then dnl Check for SDL_net AC_CHECK_LIB( SDL_net, SDLNet_Init, have_SDL_net=yes, have_SDL_net=no ) if test "x$have_SDL_net" = "xyes" ; then TR_CPPFLAGS="$TR_CPPFLAGS -DHAVE_SDL_NET=1" TR_LIBS="$TR_LIBS -lSDL_net" else echo "*** SDL_net not found. Configuring without network support." fi fi dnl Check for SDL_ttf AC_CHECK_LIB( SDL_ttf, TTF_Init, have_SDL_ttf=yes, have_SDL_ttf=no ) if test "x$have_SDL_ttf" = "xyes" ; then TR_LIBS="$TR_LIBS -lSDL_ttf" else AC_MSG_ERROR([Cannot find SDL_ttf library]) fi dnl Check for SDL_image AC_CHECK_LIB( SDL_image, IMG_Load, have_SDL_image=yes, have_SDL_image=no ) if test "x$have_SDL_image" = "xyes" ; then TR_LIBS="$TR_LIBS -lSDL_image" else AC_MSG_ERROR([Cannot find SDL_image library]) fi LIBS="$saved_LIBS" else echo "*** SDL not found. Configuring without audio or joystick support." fi fi dnl -------------------------------------------------------------------------- dnl Check for GL library dnl -------------------------------------------------------------------------- AC_ARG_WITH(gl-libs, [ --with-gl-libs=DIR GL/MesaGL library location]) AC_ARG_WITH(gl-lib-name, [ --with-gl-lib-name=NAME GL library name]) if test "x$with_gl_libs" = "x" ; then GL_LDOPTS="" else GL_LDOPTS="-L$with_gl_libs" fi saved_LIBS="$LIBS" AC_DEFUN([CHECK_FOR_GL_LIB], [ AC_MSG_CHECKING([for $GL_LIB_NAME library]) LIBS="$saved_LIBS $TR_LIBS $GL_LDOPTS -l$GL_LIB_NAME" AC_TRY_LINK( , , have_GL=yes, have_GL=no) AC_MSG_RESULT([$have_GL]) if test "x$have_GL" = "xyes" ; then TR_LIBS="$TR_LIBS $GL_LDOPTS -l$GL_LIB_NAME" else dnl Try with -lpthread AC_MSG_CHECKING([for $GL_LIB_NAME library (with pthreads)]) LIBS="$saved_LIBS $TR_LIBS $GL_LDOPTS -l$GL_LIB_NAME -lpthread" AC_TRY_LINK( , , have_GL=yes, have_GL=no) AC_MSG_RESULT([$have_GL]) if test "x$have_GL" = "xyes" ; then TR_LIBS="$TR_LIBS $GL_LDOPTS -l$GL_LIB_NAME -lpthread" fi fi ]) AC_DEFUN([FIND_GL_LIB], [ if test "x$with_gl_lib_name" = "x" ; then GL_LIB_NAME="GL" else GL_LIB_NAME="$with_gl_lib_name" fi CHECK_FOR_GL_LIB if test "x$have_GL" = "xno" -a "x$with_gl_lib_name" = "x" ; then GL_LIB_LIST=`grep -v -E "^$GL_LIB_NAME\$" < ], have_gl_h=yes, have_gl_h=no ) AC_MSG_RESULT([$have_gl_h]) ]) CHECK_FOR_GL_H if test "x$have_gl_h" = "xno" -a "x$GL_CPPFLAGS" = "x" ; then echo "*** Hmm, you don't seem to have OpenGL headers installed in the standard" echo "*** location (/usr/include). I'll check in /usr/X11R6/include, since" echo "*** many distributions (incorrectly) put OpenGL headers there." GL_CPPFLAGS="-I/usr/X11R6/include" CHECK_FOR_GL_H fi if test "x$have_gl_h" = "xno" ; then AC_MSG_ERROR([Cannot find GL/gl.h]) fi if test "x$has_glx_get_proc" = "xyes" ; then dnl Check for glx.h AC_CHECK_HEADERS([GL/glx.h], have_glx_h=yes, have_glx_h=no ) if test "x$have_glx_h" = "xno" ; then AC_MSG_ERROR([Cannot find GL/glx.h]) fi dnl Check that glXGetProcAddressARB is defined in glx.h dnl AC_MSG_CHECKING([whether glx.h defines glXGetProcAddressARB]); dnl AC_TRY_COMPILE( [#include ], [ char *foo = (char*) glXGetProcAddressARB; ], dnl glx_h_up_to_date=yes, glx_h_up_to_date=no ) dnl AC_MSG_RESULT([$glx_h_up_to_date]) dnl if test "x$glx_h_up_to_date" = "xno" ; then dnl AC_MSG_ERROR([Your copy of glx.h is out of date. You can get a more recent copy from the latest Mesa distribution (http://mesa3d.sourceforge.net).]) dnl fi fi dnl Check for glext.h dnl XXX: which requires GL/gl.h, and autoconf > 2.64 is barfing on this dnk XXX: use following check to cover the bases dnl AC_CHECK_HEADERS( "GL/glext.h", have_glext_h=yes, have_glext_h=no ) have_glext_h=yes if test "x$have_glext_h" = "xno" ; then AC_MSG_ERROR([ ***************************************************************** You are missing the file glext.h. You can get a copy at http://oss.sgi.com/projects/ogl-sample/ABI/glext.h Place it in the directory /usr/include/GL. *****************************************************************]) fi dnl Check that glext.h version is recent enough AC_MSG_CHECKING([whether glext.h is recent enough]); AC_EGREP_CPP(yes, [ #include #if defined(GL_GLEXT_VERSION) && GL_GLEXT_VERSION >= 6 yes #endif ], is_glext_h_recent=yes, is_glext_h_recent=no ) AC_MSG_RESULT([$is_glext_h_recent]) if test "x$is_glext_h_recent" = "xno" ; then AC_MSG_ERROR([ ***************************************************************** Your copy of glext.h is out of date. You can get a copy of the latest version at http://oss.sgi.com/projects/ogl-sample/ABI/glext.h Place it in the directory /usr/include/GL. *****************************************************************]) fi CPPFLAGS="$saved_CPPFLAGS" TR_CPPFLAGS="$TR_CPPFLAGS $GL_CPPFLAGS" dnl -------------------------------------------------------------------------- dnl Borrowed from the Battle for Wesnoth: create the translations directory. dnl -------------------------------------------------------------------------- AC_CONFIG_COMMANDS([translations], [rm -rf translations case $srcdir in /*) topdir=$srcdir ;; *) topdir=`pwd`/$srcdir ;; esac domain="scourge" # Symlinks that allow message catalogs to be used from build tree if test -w $srcdir; then pushd po make update-po popd for lang in `cat $srcdir/po/LINGUAS` do mkdir -p $srcdir/../scourge_data/translations/$lang/LC_MESSAGES cp -f $topdir/po/$lang.gmo $srcdir/../scourge_data/translations/$lang/LC_MESSAGES/$domain.mo done fi ]) dnl -------------------------------------------------------------------------- dnl Other options dnl -------------------------------------------------------------------------- dnl Turn use of stencil buffer on/off AC_ARG_ENABLE(stencil-buffer,[ --enable-stencil-buffer Use if your hardware has a stencil buffer],TR_CPPFLAGS="$TR_CPPFLAGS -DUSE_STENCIL_BUFFER") dnl Specify data directory AC_ARG_WITH(data-dir,[ --with-data-dir=PATH Default scourge data directory],TR_CPPFLAGS="$TR_CPPFLAGS -DDATA_DIR=\\\"$withval\\\"") AC_SUBST(TR_CPPFLAGS) AC_SUBST(TR_CFLAGS) AC_SUBST(TR_CXXFLAGS) AC_SUBST(TR_LIBS) CPPFLAGS="$CPPFLAGS $TR_CPPFLAGS" CFLAGS="$TR_CFLAGS" CXXFLAGS="$TR_CXXFLAGS" LIBS="$LIBS $TR_LIBS" AC_OUTPUT(Makefile src/Makefile intl/Makefile po/Makefile.in \ src/common/Makefile \ src/gui/Makefile \ src/test/Makefile \ src/rpg/Makefile \ src/events/Makefile src/freetype/Makefile \ src/net/Makefile \ src/render/Makefile \ src/io/Makefile \ src/squirrel/Makefile \ src/sqstdlib/Makefile \ src/sqbinding/Makefile \ autopackage/default.apspec ) if test "$have_WXWIDGET" = "yes"; then AC_OUTPUT(src/tools/Makefile) fi