1dnl Process this file with autoconf to produce a configure script. 2 3AC_PREREQ([2.52]) 4AC_INIT([Crimson Fields], [0.5.3], [jensgr@gmx.net], [crimson]) 5AC_COPYRIGHT([Copyright (C) 2000-2009 Jens Granseuer]) 6AC_CONFIG_SRCDIR([src/common/globals.h]) 7AC_CONFIG_AUX_DIR([config]) 8AM_INIT_AUTOMAKE([foreign dist-bzip2 nostdinc]) 9 10dnl build time options 11ZLIB_HOME= 12AC_ARG_WITH([zlib], 13 AC_HELP_STRING([--with-zlib=DIR], [use zlib in DIR]), 14 [if test "x$withval" != xno; then 15 use_zlib=yes 16 if test "x$withval" != xyes; then 17 ZLIB_HOME="$withval" 18 fi 19 else 20 use_zlib=no 21 fi], [use_zlib=yes]) 22 23AC_ARG_ENABLE([sound], 24 AC_HELP_STRING([--disable-sound], [compile without sound support]),, 25 [enable_sound=yes]) 26 27AC_ARG_ENABLE([network], 28 AC_HELP_STRING([--disable-network], [compile without networking support]),, 29 [enable_network=yes]) 30 31AC_ARG_ENABLE([cfed], 32 AC_HELP_STRING([--enable-cfed], [build and install the level compiler]),, 33 [enable_cfed=no]) 34AM_CONDITIONAL([BUILD_CFED], [test x$enable_cfed = xyes]) 35 36AC_ARG_ENABLE([comet], 37 AC_HELP_STRING([--enable-comet], [build and install the graphical level editor]),, 38 [enable_comet=no]) 39AM_CONDITIONAL([BUILD_COMET], [test x$enable_comet = xyes]) 40 41AC_ARG_ENABLE([bi2cf], 42 AC_HELP_STRING([--enable-bi2cf], [build and install the Battle Isle map converter]),, 43 [enable_bi2cf=no]) 44AM_CONDITIONAL([BUILD_BI2CF], [test x$enable_bi2cf = xyes]) 45 46AC_ARG_ENABLE([cf2bmp], 47 AC_HELP_STRING([--enable-cf2bmp], [build and install the map to image converter]),, 48 [enable_cf2bmp=no]) 49AM_CONDITIONAL([BUILD_CF2BMP], [test x$enable_cf2bmp = xyes]) 50 51dnl Checks for programs. 52AC_PROG_CC 53AC_PROG_CXX 54AC_PATH_PROG([XSLTPROC], [xsltproc]) 55AC_PATH_PROG([XMLLINT], [xmllint]) 56 57dnl Checks for libraries. 58SDL_VERSION=1.1.5 59AM_PATH_SDL([$SDL_VERSION],:, 60 [AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])]) 61CFLAGS="$CFLAGS $SDL_CFLAGS" 62CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" 63CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" 64LIBS="$LIBS $SDL_LIBS" 65 66AC_CHECK_LIB(SDL_ttf, TTF_OpenFont, 67 [AC_CHECK_HEADER(SDL_ttf.h, 68 [CF_LIBS="-lSDL_ttf"], 69 [AC_MSG_ERROR([*** SDL_ttf.h not found!])])], 70 [AC_MSG_ERROR([*** SDL_ttf not found!])]) 71 72if test x$enable_sound = xyes; then 73 AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, 74 [AC_CHECK_HEADER(SDL_mixer.h, 75 [CF_LIBS="$CF_LIBS -lSDL_mixer"], 76 [AC_MSG_WARN([*** SDL_mixer.h not found - disabling audio support!]) 77 enable_sound=no])], 78 [AC_MSG_WARN([*** SDL_mixer not found - disabling audio support!]) 79 enable_sound=no]) 80fi 81if test x$enable_sound != xyes; then 82 AC_DEFINE(DISABLE_SOUND) 83fi 84 85if test x$enable_network = xyes; then 86 AC_CHECK_LIB(SDL_net, SDLNet_Init, 87 [AC_CHECK_HEADER(SDL_net.h, 88 [CF_LIBS="$CF_LIBS -lSDL_net"], 89 [AC_MSG_WARN([*** SDL_net.h not found - disabling network support!]) 90 enable_network=no])], 91 [AC_MSG_WARN([*** SDL_net not found - disabling network support!]) 92 enable_network=no]) 93fi 94if test x$enable_network != xyes; then 95 AC_DEFINE(DISABLE_NETWORK) 96fi 97 98if test x$use_zlib = xyes; then 99 ac_save_cppflags="$CPPFLAGS" 100 ac_save_ldflags="$LDFLAGS" 101 if test -n "$ZLIB_HOME"; then 102 CPPFLAGS="-I${ZLIB_HOME}/include $CPPFLAGS" 103 LDFLAGS="-L${ZLIB_HOME}/lib $LDFLAGS" 104 fi 105 AC_CHECK_LIB(z, compress, 106 [AC_CHECK_HEADER(zlib.h, 107 [AC_DEFINE(HAVE_LIBZ) 108 LIBS="-lz $LIBS"] 109 )] 110 ) 111 if test "x$ac_cv_header_zlib_h" = xno; then 112 CPPFLAGS="$ac_save_cppflags" 113 LDFLAGS="$ac_save_ldflags" 114 fi 115fi 116 117dnl Checks for header files and functions. 118AC_HEADER_DIRENT 119AC_CHECK_FUNCS(strcasecmp strncasecmp) 120 121dnl Checks for typedefs, structures, and compiler characteristics. 122AC_C_CONST 123 124AC_SUBST(CF_LIBS) 125 126AC_CONFIG_FILES([doc/Makefile gfx/Makefile levels/Makefile \ 127 locale/Makefile music/Makefile sfx/Makefile \ 128 src/Makefile src/cf/Makefile src/comet/Makefile \ 129 tools/Makefile Makefile crimson.spec]) 130AC_OUTPUT 131 132