[go: up one dir, main page]

Menu

[f6e48d]: / configure.ac  Maximize  Restore  History

Download this file

494 lines (416 with data), 14.5 kB

### Package information
AC_PREREQ(2.61)
AC_INIT(ViLE,0.4.13,basf@vilevn.org)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(ViLE,0.4.13)
AC_DEFINE(PACKAGE_LINE,"Locutus",Name of current line)


### Checks for compiler and core header files
AC_PROG_CXX
AC_PROG_CC
AC_HEADER_STDC


### pkg-config checks
SDL_REQUIRED_VERSION=1.2
PKG_CHECK_MODULES(SDL, sdl >= $SDL_REQUIRED_VERSION)
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)

ZLIB_REQUIRED_VERSION=1.2.3
PKG_CHECK_MODULES(ZLIB, zlib >= $ZLIB_REQUIRED_VERSION)
AC_SUBST(ZLIB_CFLAGS)
AC_SUBST(ZLIB_LIBS)

FREETYPE_REQUIRED_VERSION=12
PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_REQUIRED_VERSION)
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)

PNG_REQUIRED_VERSION=1.2
#PKG_CHECK_MODULES(PNG, libpng12 >= $PNG_REQUIRED_VERSION)
PKG_CHECK_MODULES(PNG, libpng >= $PNG_REQUIRED_VERSION)
AC_SUBST(PNG_CFLAGS)
AC_SUBST(PNG_LIBS)

### _REQUIRED_VERSION=
### PKG_CHECK_MODULES(,  >= $_REQUIRED_VERSION)
### AC_SUBST(_CFLAGS)
### AC_SUBST(_LIBS)



### Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_HEADER_TIME
AC_STRUCT_TM
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_CHECK_FUNC([gettimeofday],
			  [AC_DEFINE(HAVE_GETTIMEOFDAY,1,Handles timezone and days)],
			  [AC_MSG_ERROR([Cannot find gettimeofday function])])

AC_CHECK_FUNC([memset],
			  [AC_DEFINE(HAVE_MEMSET,1,Updates blocks of ram)],
			  [AC_MSG_ERROR([Cannot find memset function])])

AC_CHECK_HEADER([wordexp.h],
			  [AC_DEFINE(HAVE_WORDEXP_H,1,Updates blocks of ram)])



### Detect target platform
case "$host" in
	*-*-linux*)
		vile_arch_linux=true
		;;
	*-*-freebsd*)
		vile_arch_freebsd=true
		;;
	*-*-cygwin* | *-*-mingw32*)
		vile_arch_win32=true
		;;
	*)
		AC_MSG_ERROR([*** Invalid host])
		;;
esac


### Detect MSYS environment
if test `uname -o` == "Msys"; then
	vile_build_msys=1
fi


### Read input parameters
AC_ARG_ENABLE(internalgfx,
		[  --enable-internalgfx    Use internal SDL_gfx code instead of library],
		[ vile_build_internalgfx="true" ],
		[ vile_build_internalgfx="" ])

AC_ARG_ENABLE(internalttf,
		[  --enable-internalttf    Use internal SDL_ttf code instead of library],
		[ vile_build_internalttf="true" ],
		[ vile_build_internalttf="" ])

AC_ARG_ENABLE(internalimage,
		[  --enable-internalimage  Use internal SDL_image code instead of library],
		[ vile_build_internalimage="true" ],
		[ vile_build_internalimage="" ])

AC_ARG_ENABLE(unicode,
		[  --enable-unicode        Enable UNICODE (Not supported)],
		[ vile_build_unicode="true" ],
		[ vile_build_unicode="" ])

AC_ARG_ENABLE(sdlhg,
		[  --enable-sdlhg          Enable support for unstable SDL (1.3)],
		[ vile_build_sdlhg="true" ],
		[ vile_build_sdlhg="" ])

AC_ARG_ENABLE(crowd,
		[  --disable-crowd         Dont support Crowd titles ],
		[ vile_support_crowd="" ],
		[ vile_support_crowd="true" ])

AC_ARG_ENABLE(ikura,
		[  --disable-ikura         Dont support ikurabased titles ],
		[ vile_support_ikura="" ],
		[ vile_support_ikura="true" ])

AC_ARG_ENABLE(windy,
		[  --disable-windy         Dont support windybased titles ],
		[ vile_support_windy="" ],
		[ vile_support_windy="true" ])

AC_ARG_ENABLE(jast,
		[  --disable-jast          Dont support jast titles ],
		[ vile_support_jast="" ],
		[ vile_support_jast="true" ])

AC_ARG_ENABLE(cware,
		[  --disable-cware         Dont support cware titles ],
		[ vile_support_cware="" ],
		[ vile_support_cware="true" ])

AC_ARG_ENABLE(will,
		[  --disable-will          Dont support will titles ],
		[ vile_support_will="" ],
		[ vile_support_will="true" ])

AC_ARG_ENABLE(tlove,
		[  --disable-tlove         Dont support True love ],
		[ vile_support_tlove="" ],
		[ vile_support_tlove="true" ])

AC_ARG_ENABLE(ffmpeg,
		[  --disable-ffmpeg        Disable ffmpeg audio/video decoders ],
		[ vile_feature_ffmpeg="" ],
		[ vile_feature_ffmpeg="true" ])

AC_ARG_ENABLE(fluidsynth,
		[  --disable-fluidsynth    Disable fluidsynth MIDI decoder ],
		[ vile_feature_fluidsynth="" ],
		[ vile_feature_fluidsynth="true" ])

AC_ARG_ENABLE(scaler,
		[  --disable-scaler        Disable high quality scalers ],
		[ vile_feature_scaler="" ],
		[ vile_feature_scaler="true" ])

AC_ARG_ENABLE(logging,
		[  --disable-logging       Discard logging information ],
		[ vile_logging_enabled="" ],
		[ vile_logging_enabled="true" ])

AC_ARG_ENABLE(unittest,
		[  --enable-unittest       Enable compiled-in unittesting],
		[ vile_feature_unittest="true" ],
		[ vile_feature_unittest="" ])

AC_ARG_ENABLE(efence,
		[  --enable-efence         Enable efence mmalloc debugging (SLOW!)],
		[ vile_feature_efence="true" ],
		[ vile_feature_efence="" ])

AC_ARG_ENABLE(logdebug,
		[  --enable-logdebug       Enable game debugging features (Slow!) ],
		[ vile_logging_debug="true" ],
		[ vile_logging_debug="" ])

AC_ARG_ENABLE(static,
		[  --enable-static         Enable static executable (Intended for Windows) ],
		[ vile_build_static="true" ],
		[ vile_build_static="" ])
		
AC_ARG_ENABLE(w32console,
		[  --enable-w32console     Enable console output on Windows. ],
		[ vile_build_w32console="true" ],
		[ vile_build_w32console="" ])
		


# Get default working directory
AC_ARG_VAR(CWD,[Default working directory (For savegames etc)])
if test "X$CWD" == "X"; then
	AC_DEFINE_UNQUOTED(VILE_PATH_CWD,[""],Current working directory)
else
	AC_DEFINE_UNQUOTED(VILE_PATH_CWD,["$CWD"],Current working directory)
fi

# Get default configuration file
AC_ARG_VAR(CFG,[Default configuration file])
if test "X$CFG" == "X"; then
	AC_DEFINE_UNQUOTED(VILE_PATH_CFG,[""],Default configuration file)
else
	AC_DEFINE_UNQUOTED(VILE_PATH_CFG,["$CFG"],Default configuration file)
fi

# Get default resource file
AC_ARG_VAR(RES,[Default resource file])
if test "X$RES" == "X"; then
	AC_DEFINE_UNQUOTED(VILE_PATH_RES,["vilevn.pck"],Default resource file)
else
	AC_DEFINE_UNQUOTED(VILE_PATH_RES,["$RES"],Default resource file)
fi

# Get default load path
AC_ARG_VAR(GAME,[Default path to load game resources from])
if test "X$GAME" == "X"; then
	AC_DEFINE_UNQUOTED(VILE_PATH_GAME,[""],Default path to load games from)
else
	AC_DEFINE_UNQUOTED(VILE_PATH_GAME,["$GAME"],Default path to load games from)
fi

# Get default savegame path
AC_ARG_VAR(SAVE,[Default path for savegames ])
if test "X$SAVE" == "X"; then
	AC_DEFINE_UNQUOTED(VILE_PATH_SAVE,[""],Default path for savegames)
else
	AC_DEFINE_UNQUOTED(VILE_PATH_SAVE,["$SAVE"],Default path for savegames)
fi


## Record git revision code
AC_PATH_PROG(gitcmd,git)
if test "X$gitcmd" != "X"; then
	AC_MSG_RESULT(Recording current git revision code)
	`$gitcmd rev-parse --short HEAD > scmtest.txt 2>/dev/null`
	if test -e scmtest.txt; then
		if test -s scmtest.txt; then
			mv scmtest.txt scmrevision.txt
		else
			rm scmtest.txt
		fi
	fi
fi
AC_DEFINE_UNQUOTED(SCM_VERSION,["`cat scmrevision.txt`"], SCM Revision)


### Record compilation date
AC_PATH_PROG(datecmd, date)
if test "X$datecmd" = "X"; then
	AC_DEFINE_UNQUOTED(COMPILATION_DATE,["UNKNOWN"],Compilation date)
else
	AC_MSG_RESULT(Recording compilation date)
	AC_DEFINE_UNQUOTED(COMPILATION_DATE,["`date`"],Compilation date)
fi


# Handle conditional dependencies
if test "$vile_build_internalttf"
then
	AC_MSG_RESULT(Using internal SDL_ttf code rather than library)
	AC_DEFINE(VILE_BUILD_INTERNALTTF,1,Use internal SDL_ttf code (Not library))
else
	SDL_TTF_REQUIRED_VERSION=2.0
	PKG_CHECK_MODULES(SDL_TTF, SDL_ttf >= $SDL_TTF_REQUIRED_VERSION)
	AC_SUBST(SDL_TTF_CFLAGS)
	AC_SUBST(SDL_TTF_LIBS)
fi
if test "$vile_build_internalgfx"
then
	AC_MSG_RESULT(Using internal SDL_gfx code rather than library)
	AC_DEFINE(VILE_BUILD_INTERNALGFX,1,Use internal SDL_gfx code (Not library))
else
	SDL_GFX_REQUIRED_VERSION=2.0
	PKG_CHECK_MODULES(SDL_GFX, SDL_gfx >= $SDL_GFX_REQUIRED_VERSION)
	AC_SUBST(SDL_GFX_CFLAGS)
	AC_SUBST(SDL_GFX_LIBS)
fi
if test "$vile_build_internalimage"
then
	AC_MSG_RESULT(Using internal SDL_image code rather than library)
	AC_DEFINE(VILE_BUILD_INTERNALIMAGE,1,Use internal SDL_image code (Not library))
else
	SDL_IMAGE_REQUIRED_VERSION=1.2
	PKG_CHECK_MODULES(SDL_IMAGE, SDL_image >= $SDL_IMAGE_REQUIRED_VERSION)
	AC_SUBST(SDL_IMAGE_CFLAGS)
	AC_SUBST(SDL_IMAGE_LIBS)
fi


## Check Features
if test "$vile_feature_ffmpeg"
then
	LIBSWSCALE_REQUIRED_VERSION=2.0.0
	PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= $LIBSWSCALE_REQUIRED_VERSION)
	AC_SUBST(LIBSWSCALE_CFLAGS)
	AC_SUBST(LIBSWSCALE_LIBS)

	LIBAVFORMAT_REQUIRED_VERSION=52
	PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= $LIBAVFORMAT_REQUIRED_VERSION)
	AC_SUBST(LIBAVFORMAT_CFLAGS)
	AC_SUBST(LIBAVFORMAT_LIBS)

	LIBAVCODEC_REQUIRED_VERSION=52
	PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= $LIBAVCODEC_REQUIRED_VERSION)
	AC_SUBST(LIBAVCODEC_CFLAGS)
	AC_SUBST(LIBAVCODEC_LIBS)

	LIBAVUTIL_REQUIRED_VERSION=51
	PKG_CHECK_MODULES(LIBAVUTIL, libavutil >= $LIBAVUTIL_REQUIRED_VERSION)
	AC_SUBST(LIBAVUTIL_CFLAGS)
	AC_SUBST(LIBAVUTIL_LIBS)

	AC_MSG_RESULT(Building with ffmpeg library)
	AC_DEFINE(VILE_FEATURE_FFMPEG,1,Building with ffmpeg)
else
	AC_MSG_RESULT(Disabling ffmpeg features)
fi
if test "$vile_feature_fluidsynth"
then
	FLUIDSYNTH_REQUIRED_VERSION=1.1.4
	PKG_CHECK_MODULES(FLUIDSYNTH, fluidsynth >= $FLUIDSYNTH_REQUIRED_VERSION)
	AC_SUBST(FLUIDSYNTH_CFLAGS)
	AC_SUBST(FLUIDSYNTH_LIBS)

	GTHREAD_REQUIRED_VERSION=2.28
	PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= $GTHREAD_REQUIRED_VERSION)
	AC_SUBST(GTHREAD_CFLAGS)
	AC_SUBST(GTHREAD_LIBS)

	AC_MSG_RESULT(Building with fluidsynth library)
	AC_DEFINE(VILE_FEATURE_FLUIDSYNTH,1,Building with fluidsynth)
else
	AC_MSG_RESULT(Disabling fluidsynth features)
fi

## Report settings while setting autoconf vars
if test "$vile_feature_scaler"
then
	AC_MSG_RESULT(Building with high quality scalers)
	AC_DEFINE(VILE_FEATURE_SCALER,1,Building with hq scalers enabled)
else
	AC_MSG_RESULT(Disabling high quality scalers)
fi
if test "$vile_feature_unittest"
then
	AC_MSG_RESULT(Building with unittests compiled-in)
	AC_DEFINE(VILE_FEATURE_UNITTEST,1,Building with unittests enabled)
fi
if test "$vile_feature_efence"
then
	AC_MSG_RESULT(Building with Electric Fence)
	AC_DEFINE(VILE_FEATURE_EFENCE,1,Building with Electric Fence enabled)
fi



## Check Support
if test "$vile_support_crowd"
then
	AC_MSG_RESULT(Building with support for Crowd titles)
	AC_DEFINE(VILE_SUPPORT_CROWD,1,Building with crowd support)
fi
if test "$vile_support_ikura"
then
	AC_MSG_RESULT(Building with support for Ikura GDL titles)
	AC_DEFINE(VILE_SUPPORT_IKURA,1,Building with ikura support)
fi
if test "$vile_support_windy"
then
	AC_MSG_RESULT(Building with support for Windy titles)
	AC_DEFINE(VILE_SUPPORT_WINDY,1,Building with windy support)
fi
if test "$vile_support_jast"
then
	AC_MSG_RESULT(Building with support for JAST titles)
	AC_DEFINE(VILE_SUPPORT_JAST,1,Building with jast support)
fi
if test "$vile_support_cware"
then
	AC_MSG_RESULT(Building with support for CWare titles)
	AC_DEFINE(VILE_SUPPORT_CWARE,1,Building with cware support)
fi
if test "$vile_support_will"
then
	AC_MSG_RESULT(Building with support for Will titles)
	AC_DEFINE(VILE_SUPPORT_WILL,1,Building with will support)
fi
if test "$vile_support_tlove"
then
	AC_MSG_RESULT(Building with support for True love)
	AC_DEFINE(VILE_SUPPORT_TLOVE,1,Building with True love support)
fi

## Check debug features
if test "$vile_logging_enabled"
then
	AC_MSG_RESULT(Building with embedded logging information)
	AC_DEFINE(VILE_LOGGING_ENABLED,1,Build with logging information)
fi
if test "$vile_logging_debug"
then
	AC_MSG_RESULT(Building with embedded debugging information)
	AC_DEFINE(VILE_LOGGING_DEBUG,1,Build with debug information)
fi


### Report arch
if test "$vile_arch_linux"
then
	AC_MSG_RESULT(Building Linux targets)
	AC_DEFINE(VILE_ARCH_LINUX,1,Compile code for a linuxbased target)
fi
if test "$vile_arch_freebsd"
then
	AC_MSG_RESULT(Building FreeBSD targets)
	AC_DEFINE(VILE_ARCH_FREEBSD,1,Compile code for a BSD based target)
fi
if test "$vile_arch_win32"
then
	AC_MSG_RESULT(Building Windows targets)
	AC_DEFINE(VILE_ARCH_MICROSOFT,1,Compile code for wintendo)
fi

### Report build options
if test "$vile_build_msys"
then
	AC_MSG_RESULT(Building Msys compatible Makefile)
	AC_DEFINE(VILE_BUILD_MSYS,1,Build a native msys makefile)
fi
if test "$vile_build_unicode"
then
	AC_MSG_RESULT(Enabling UNICODE support)
	AC_DEFINE(VILE_BUILD_UNICODE,1,Enabling UNICODE support)
fi
if test "$vile_build_sdlhg"
then
	AC_MSG_RESULT(Enabling SDL 1.3 support)
	AC_DEFINE(VILE_BUILD_SDLHG,1,Enabling SDL 1.3 support)
fi

if test "$vile_build_static"
then
	AC_MSG_RESULT(Building a standalone executable)
	AC_DEFINE(VILE_BUILD_STATIC,1,Build standalone executable)
fi
if test "$vile_build_w32console"
then
	AC_MSG_RESULT(Building with experimental Windows Console output)
	AC_DEFINE(VILE_BUILD_W32CONSOLE,1,Build with win32 console)
fi



### Declare automake macros
AM_CONDITIONAL(VILE_FEATURE_FFMPEG,test "$vile_feature_ffmpeg")
AM_CONDITIONAL(VILE_FEATURE_FLUIDSYNTH,test "$vile_feature_fluidsynth")
AM_CONDITIONAL(VILE_FEATURE_EFENCE,test "$vile_feature_efence")
AM_CONDITIONAL(VILE_FEATURE_SCALER,test "$vile_feature_scaler")
AM_CONDITIONAL(VILE_FEATURE_UNITTEST,test "$vile_feature_unittest")
AM_CONDITIONAL(VILE_SUPPORT_CROWD,test "$vile_support_crowd")
AM_CONDITIONAL(VILE_SUPPORT_IKURA,test "$vile_support_ikura")
AM_CONDITIONAL(VILE_SUPPORT_WINDY,test "$vile_support_windy")
AM_CONDITIONAL(VILE_SUPPORT_JAST,test "$vile_support_jast")
AM_CONDITIONAL(VILE_SUPPORT_CWARE,test "$vile_support_cware")
AM_CONDITIONAL(VILE_SUPPORT_WILL,test "$vile_support_will")
AM_CONDITIONAL(VILE_SUPPORT_TLOVE,test "$vile_support_tlove")
AM_CONDITIONAL(VILE_LOGGING_ENABLED,test "$vile_logging_enabled")
AM_CONDITIONAL(VILE_LOGGING_DEBUG,test "$vile_logging_debug")
AM_CONDITIONAL(VILE_BUILD_UNICODE,test "$vile_build_unicode")
AM_CONDITIONAL(VILE_BUILD_SDLHG,test "$vile_build_sdlhg")
AM_CONDITIONAL(VILE_BUILD_STATIC,test "$vile_build_static")
AM_CONDITIONAL(VILE_BUILD_W32CONSOLE,test "$vile_build_w32console")
AM_CONDITIONAL(VILE_BUILD_MSYS,test "$vile_build_msys")
AM_CONDITIONAL(VILE_BUILD_INTERNALTTF,test "$vile_build_internalttf")
AM_CONDITIONAL(VILE_BUILD_INTERNALGFX,test "$vile_build_internalgfx")
AM_CONDITIONAL(VILE_BUILD_INTERNALIMAGE,test "$vile_build_internalimage")
AM_CONDITIONAL(VILE_ARCH_LINUX,test "$vile_arch_linux")
AM_CONDITIONAL(VILE_ARCH_FREEBSD,test "$vile_arch_freebsd")
AM_CONDITIONAL(VILE_ARCH_MICROSOFT,test "$vile_arch_win32")



# Generate output
AC_CONFIG_HEADER([src/common/config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT