dnl ************************************************************** dnl Process this file with autoconf to produce a configure script. dnl ************************************************************** AC_PREREQ(2.50) AC_INIT(adonthell, 0.3.4, adonthell-project@linuxgames.com, adonthell) dnl AC_PREFIX_PROGRAM(adonthell) dnl Detect the canonical host and target build environment AC_CANONICAL_HOST AC_CANONICAL_TARGET AM_INIT_AUTOMAKE([]) AM_CONFIG_HEADER(config.h) CFLAGS="-g -Wall -fno-exceptions" CPPFLAGS="" DEFS="" dnl ******************** dnl Checks for programs. dnl ******************** AC_PROG_CC AC_PROG_CXX AC_LANG_C AC_PROG_CXXCPP AM_PROG_LIBTOOL AC_PROG_MAKE_SET dnl **** dnl i18n dnl **** AM_GNU_GETTEXT([external]) dnl ******************** dnl Additional arguments dnl ******************** AC_ARG_ENABLE(unix-install, [ --disable-unix-install Disable a Unix-like install (enabled by default)], unixinst=$enableval, unixinst=yes) AC_ARG_ENABLE(memleaks, [ --enable-memleaks Enable check for memory leaks (disabled by default)], memleaks=$enableval, memleaks=no) AC_ARG_ENABLE(doc, [ --enable-doc Build the Adonthell developer documentation (disabled by default)], builddoc=$enableval, builddoc=no) AC_ARG_ENABLE(py-debug, [ --disable-py-debug Disable debugging of Python scripts (enabled by default)], pydebug=$enableval, pydebug=yes) AC_ARG_WITH(ogg, [ --with-ogg=DIR Set where the Ogg library is located]) AC_ARG_WITH(vorbis, [ --with-vorbis=DIR Set where the Vorbis library is located]) AC_ARG_WITH(data-dir, [ --with-data-dir=DIR Directory where datas will be installed], gamedatadir="$withval", gamedatadir=none) AC_ARG_WITH(py-libs, [ --with-py-libs=DIR Override Python libraries auto-detection], pylibs="$withval", pylibs=none) AC_ARG_WITH(py-cflags, [ --with-py-cflags=DIR Override Python cflags auto-detection], pycflags="$withval", pycflags=none) dnl ********************** dnl Set the data directory dnl ********************** if test x$gamedatadir = xnone; then if test x$unixinst = xno; then gamedatadir="" DEFS="$DEFS -DSINGLE_DIR_INST" case "$target" in *-*-darwin*) makebundle="yes" DEFS="$DEFS -Wno-long-double" ;; esac else case "$target" in *-*-cygwin* | *-*-mingw32*) gamedatadir="" DEFS="$DEFS -DSINGLE_DIR_INST" ;; *-*-beos*) gamedatadir="/boot/home/config/share/adonthell" DEFS="$DEFS -DDATA_DIR=\"\\\"$gamedatadir\\\"\"" ;; *) gamedatadir="${datadir}/adonthell" DEFS="$DEFS -DDATA_DIR=\"\\\"$gamedatadir\\\"\"" ;; esac fi else DEFS="$DEFS -DDATA_DIR=\"\\\"$gamedatadir\\\"\"" fi AM_CONDITIONAL(MAKE_BUNDLE, test x$makebundle = xyes) dnl ********************** dnl Check for memory leaks dnl ********************** if test x$memleaks = xyes; then DEFS="$DEFS -DMEMORY_LEAKS" fi dnl ******************** dnl Check for libraries. dnl ******************** AC_CHECK_LIB(pthread, main, PTHREADS=yes, PTHREADS=no) AC_CHECK_LIB(z, main,,echo "Adonthell requires Zlib. Exitting...";exit 1) dnl ************* dnl Check for SDL dnl ************* SDL_VERSION=1.2.0 AM_PATH_SDL($SDL_VERSION, :, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) ) dnl ******************* dnl Check for FreeType2 dnl ******************* AC_CHECK_FT2(6.0.0, :, AC_MSG_ERROR([*** Freetype version >= 6.0.0 not found!]) ) dnl ******************* dnl Check for OggVorbis dnl ******************* OGG_VORBIS=no XIPH_PATH_VORBIS( OGG_VORBIS="yes" ogg_music="enabled" OGG_LIBS="$VORBISFILE_LIBS $VORBIS_LIBS" OGG_DEFS="-DOGG_MUSIC" OGG_CFLAGS="$VORBIS_CFLAGS", AC_MSG_RESULT(Disabling OggVorbis support) ogg_music="disabled" ) dnl ******************** dnl Check for Python. dnl ******************** if test x$pylibs = xnone; then dnl Find Python executable AC_PATH_PROGS(PYPACKAGE, python) dnl Extract the version using Python, check against 2.2+ changequote(<<, >>) PYTHON_VERSION=`$PYPACKAGE -c 'import sys ; print (int(sys.version[0]) * 10 + int(sys.version[2]))'` PY_VERSION=`$PYPACKAGE -c 'import sys ; print sys.version[0:3]'` changequote([, ]) if test $PYTHON_VERSION -lt 22; then echo "Sorry, you need to have Python 2.2+ installed - update your version!" AC_MSG_ERROR([*** Python 2.2 or better required]) fi dnl Find the Python.h header file AC_MSG_CHECKING(for Python header files) changequote(<<, >>) PYINCLUDE=`$PYPACKAGE -c 'import sys ; print "%s/include/python%s" % (sys.prefix, sys.version[:3])'` changequote([, ]) if test -r "$PYINCLUDE/Python.h"; then PY_CFLAGS="-I$PYINCLUDE" else AC_MSG_ERROR([Could not find Python.h in $PYINCLUDE]) fi AC_MSG_RESULT(found) dnl Find the Python library AC_MSG_CHECKING(for Python library) PYLIB="" changequote(<<, >>) PYPREFIX=`$PYPACKAGE -c 'import sys; print sys.prefix'` PYLIBVER=`$PYPACKAGE -c 'import sys; print sys.version[:3]'` changequote([, ]) dnl look for a framework build of python first fw=`echo "$PYPREFIX" | sed 's/.*\(Python\.framework\).*/\1/;'` if test "x$fw" == "xPython.framework"; then PY_LIBS="-framework Python" PY_FWDIR="$PYPREFIX/lib/python$PYLIBVER/site-packages" PY_SPDIR="$libdir/python$PYLIBVER/site-packages" AC_SUBST(PY_FWDIR) AC_SUBST(PY_SPDIR) AC_MSG_RESULT(found) else py_paths="$PYPREFIX/lib/python$PYLIBVER/config $PYPREFIX/lib" py_suffix="$PYLIBVER.so $PYLIBVER.a .so .a" dnl Try for specific version first, then the generic version, then panic for ppath in $py_paths ; do if test -r "$ppath/libpython$PYLIBVER.so" -o \ -r "$ppath/libpython$PYLIBVER.a"; then PYLIB="-L$ppath -lpython$PYLIBVER" break fi if test -r "$ppath/libpython.so" -o \ -r "$ppath/libpython.a"; then PYLIB="-L$ppath -lpython" break fi done if test "x$PYLIB" != x ; then PY_LIBS="$PYLIB $PY_LIBS" AC_MSG_RESULT(found) else AC_MSG_ERROR([*** Python library not found]) fi fi dnl Get the libraries that python depends on AC_PATH_PROG(haveldd, ldd) AC_MSG_CHECKING(for Python's dependencies) if test x$haveldd != x ; then changequote(<<, >>) py_deps=`ldd $PYPACKAGE | sed 's/\( *.*lib\([^\/]*\)\.so.*=.*$\)/-l\2/p; d' | grep -v 'stdc++'` for py_lib in $py_deps ; do if test "$py_lib" != "-lm" && test "$py_lib" != "-lc" ; then PY_DEPS="$PY_DEPS $py_lib" fi done changequote([, ]) fi case $target in *-sun-solaris*) PY_DEPS="$PY_DEPS -lsocket -lnsl -ldl" ;; esac AC_MSG_RESULT($PY_DEPS) dnl only GNU ld seems to know -E flag if $LD -v 2>&1 &5; then PY_LIBS="-Wl,-E $PY_LIBS $PY_DEPS" else PY_LIBS="$PY_LIBS $PY_DEPS" fi else PY_CFLAGS=${pycflags} AC_MSG_CHECKING(for Python cflags) AC_MSG_RESULT($PY_CFLAGS) PY_LIBS=${pylibs} AC_MSG_CHECKING(for Python library flags) AC_MSG_RESULT($PY_LIBS) PY_VERSION="Manually specified" fi dnl See whether we should enable python debugging AC_MSG_CHECKING(whether to enable Python debugging) if test x$pydebug = xno; then AC_MSG_RESULT(no) else PY_CFLAGS="$PY_CFLAGS -DPY_DEBUG" AC_MSG_RESULT(yes) fi dnl ************** dnl Check for SWIG dnl ************** SWIG_MINVER=1.3.20 haveswig=no AC_PATH_PROG(P_SWIG,swig,no) if test "$P_SWIG" != "no" ; then $P_SWIG -version &> swig.ver changequote(<<, >>) swig_major_ver=`more swig.ver | sed 's/.* \([0-9]*\)\.[0-9]*\.[0-9]*.*/\1/p; d'` swig_minor_ver=`more swig.ver | sed 's/.* [0-9]*\.\([0-9]*\)\.[0-9]*.*/\1/p; d'` swig_micro_ver=`more swig.ver | sed 's/.* [0-9]*\.[0-9]*\.\([0-9]*\).*/\1/p; d'` changequote([, ]) rm -f swig.ver SWIG_VERSION="$swig_major_ver.$swig_minor_ver.$swig_micro_ver" if test $swig_major_ver -gt 1 -o \ $swig_major_ver -eq 1 -a $swig_minor_ver -gt 3 -o \ $swig_major_ver -eq 1 -a $swig_minor_ver -eq 3 -a $swig_micro_ver -gt 13 ; then haveswig=yes fi fi dnl SWIG is needed to compile the code from CVS dnl or after making changes to the distributed code if test x$haveswig = xno ; then if test -d "CVS"; then echo "*** To compile Adonthell from CVS, you will need SWIG ${SWIG_MINVER} or higher." echo "*** You can obtain the most recent version from http://www.swig.org." exit 1; else echo "*** NOTE: If you plan to make changes to the code you will need" echo "*** SWIG ${SWIG_MINVER} or higher. SWIG can be found at http://www.swig.org." fi fi dnl ******************************** dnl Check whether to build our tools dnl ******************************** AM_CONDITIONAL(BUILD_TOOLS, false) dnl *************************** dnl For some tools we need GTK+ dnl *************************** AM_CONDITIONAL(HAVE_GTK, false) dnl **************************************** dnl Check whether to build the documentation dnl **************************************** AC_MSG_CHECKING(whether to build the developer documentation) if test x$builddoc = xno; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) fi AM_CONDITIONAL(BUILD_DOC, test x$builddoc = xyes) dnl ***************************************************** dnl Doxygen and dot are needed to build the documentation dnl ***************************************************** if test x$builddoc = xyes; then AC_PATH_PROG(P_DOXYGEN,doxygen) if test x$P_DOXYGEN == x ; then echo "Adonthell documentation requires doxygen. Exiting..." exit 1 fi AC_PATH_PROG(P_DOT,dot) if test x$P_DOT == x ; then echo "Adonthell documentation requires dot. Exiting..." exit 1 fi fi dnl ************************** dnl Check for required headers dnl ************************** AC_CHECK_HEADERS([SDL/SDL.h zlib.h]) if test x$PTHREADS = xyes; then AC_CHECK_HEADERS([pthread.h]) fi if test x$OGG_VORBIS = xyes; then AC_CHECK_HEADERS([vorbis/vorbisfile.h]) fi AM_CONDITIONAL(HAVE_OGG_VORBIS, test x$OGG_VORBIS = xyes) dnl ******************************** dnl Generate our compiler arguements dnl ******************************** CXXFLAGS="$CFLAGS $DEFS $INCLUDES" AC_SUBST(CXX) AC_SUBST(CXXFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(LIBS) AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) AC_SUBST(SDL_DEFS) AC_SUBST(OGG_CFLAGS) AC_SUBST(OGG_LIBS) AC_SUBST(OGG_DEFS) AC_SUBST(PY_CFLAGS) AC_SUBST(PY_LIBS) AC_SUBST(P_SWIG) AC_SUBST(gamedatadir) dnl AC_SUBST(FT2_LIBS) dnl AC_SUBST(FT2_CFLAGS) AC_OUTPUT([ Makefile adonthell.spec doc/Makefile doc/devel/Makefile m4/Makefile po/Makefile.in src/Makefile src/modules/Makefile ]) dnl **************** dnl Configure Status dnl **************** echo echo "Adonthell v$VERSION" echo echo "SDL ....................... : `$SDL_CONFIG --version`" echo "Python .................... : $PY_VERSION" echo "Python debugging .......... : $pydebug" echo "Freetype .................. : `freetype-config --version`" if test x$haveswig = xyes; then echo "SWIG ...................... : $SWIG_VERSION" fi echo "Ogg music ................. : $ogg_music" echo "Building API doc .......... : $builddoc" if test x$memleaks = xyes; then echo "Test for Memory Leaks ..... : enabled" fi if test x$unixinst = xno; then echo "Data directory ............ : Single Directory install" else echo "Data directory ............ : $gamedatadir" fi echo echo "Now type 'make' to build Adonthell" echo "Afterwards, 'make install' will install Adonthell in $prefix/bin" echo