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/Common.h)
AM_INIT_AUTOMAKE(abe, "0.61")
AM_CONFIG_HEADER(config.h)
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)
dnl --------------------------------------------------------------------------
dnl General options
dnl --------------------------------------------------------------------------
TR_CPPFLAGS=""
TR_CFLAGS="-O2 -Wall -fomit-frame-pointer -ffast-math -fexpensive-optimizations"
TR_CXXFLAGS="-O2 -Wall -fomit-frame-pointer -ffast-math -fexpensive-optimizations"
TR_LIBS=""
case "$host" in
alpha*-*-linux-*) TR_CFLAGS="$TR_CFLAGS -mieee";;
esac
AC_ARG_ENABLE(debug, [ --enable-debug Produce an executable with debugging symbols],
[TR_CFLAGS="-g -Wall -fno-inline"; TR_CXXFLAGS="-g -Wall -fno-inline"],
[TR_CPPFLAGS="$TR_CPPFLAGS"])
AC_ARG_ENABLE(pedantic, [ --enable-pedantic Enable -pedantic (and -ansi for C) when compiling], TR_CFLAGS="$TR_CFLAGS -ansi -pedantic"; TR_CXXFLAGS="$TR_CXXFLAGS -pedantic")
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 --------------------------------------------------------------------------
if test "x$is_win32" = "xno" ; then
AC_PATH_XTRA
if test "x$no_x" = "x" ; then
TR_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXi -lXext -lXmu -lXt $X_EXTRA_LIBS $TR_LIBS"
fi
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" )
dnl --------------------------------------------------------------------------
dnl Check for SDL
dnl --------------------------------------------------------------------------
AC_ARG_ENABLE(sdl,[ --disable-sdl Disable detction and use of SDL])
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
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
LIBS="$saved_LIBS"
else
echo "*** SDL not found. Configuring without audio or joystick support."
fi
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 abe data directory],TR_CPPFLAGS="$TR_CPPFLAGS -DBASE_DIR=\"$withval\"")
AC_SUBST(TR_CPPFLAGS)
AC_SUBST(TR_CFLAGS)
AC_SUBST(TR_CXXFLAGS)
AC_SUBST(TR_LIBS)
CPPFLAGS="$CPPFLAGS $TR_CPPFLAGS"
CFLAGS="$CFLAGS $TR_CFLAGS"
CXXFLAGS="$CXXFLAGS $TR_CXXFLAGS"
LIBS="$LIBS $TR_LIBS"
AC_OUTPUT(Makefile src/Makefile )