diff options
-rw-r--r-- | Game/Code/Makefile.in | 141 | ||||
-rw-r--r-- | Game/Code/config.inc.in | 127 | ||||
-rw-r--r-- | Game/Code/configure.ac | 307 | ||||
-rw-r--r-- | Game/Code/m4/fpc.m4 | 148 |
4 files changed, 723 insertions, 0 deletions
diff --git a/Game/Code/Makefile.in b/Game/Code/Makefile.in new file mode 100644 index 00000000..b702f8d6 --- /dev/null +++ b/Game/Code/Makefile.in @@ -0,0 +1,141 @@ +##
+# Makefile for @PACKAGE_NAME@ @PACKAGE_VERSION@
+# @PACKAGE_BUGREPORT@
+##
+
+# general definitions
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+libdir = @libdir@
+infodir = @infodir@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+datarootdir = @datarootdir@
+
+# install tool
+INSTALL = @INSTALL@
+# calls "ln -s"
+LN_S = @LN_S@
+
+USDX_PREFIX = UltraStar
+USDX_TOOLS_DIR = ../../Tools
+
+EXE_SUFFIX = @EXEEXT@
+
+# Free Pascal compiler
+PPC = @PPC@
+PFLAGS = @PFLAGS@
+# FPC target platform and processor
+PPLATFORM = @FPC_PLATFORM@
+PPROCESSOR = @FPC_PROCESSOR@
+
+# lazarus defines
+LAZARUS_DIR = @LAZARUS_DIR@
+PROJ_SUFFIX = .lpr
+
+# RC to LRS resource compiler
+RESCOMPILER_NAME = USDXResCompiler
+RESCOMPILER_BIN = $(USDX_TOOLS_DIR)/$(RESCOMPILER_NAME)$(EXE_SUFFIX)
+RESCOMPILER_SRC = $(USDX_TOOLS_DIR)/$(RESCOMPILER_NAME)$(PROJ_SUFFIX)
+RESCOMPILER_PFLAGS = -dRELEASE
+
+RES_SUFFIX = .lrs
+
+# Directories added to the unit path
+PUNIT_TOKEN = -Fu
+PUNIT_FLAGS = $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM) \
+ $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/images/lib/$(PPROCESSOR)-$(PPLATFORM) \
+ $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/jpeg \
+ $(PUNIT_TOKEN).
+
+# Directory where compiled units (.ppu and .o files) are stored
+PCUNIT_TOKEN = -FU
+PCUNIT_DIR = ./build/$(PPLATFORM)/lazarus
+PCUNIT_FLAGS = $(PCUNIT_TOKEN)$(PCUNIT_DIR)
+
+# Directories added to the includes path
+PINC_TOKEN = -Fi
+PINC_FLAGS = $(PINC_TOKEN)lib/JEDI-SDLv1.0/SDL/Pas
+
+# Defines
+PDEFINES = -dLCL
+
+# Misc fpc options
+PCOMPAT_FLAGS = -S2dgi
+#PCOMPAT_FLAGS += -Mdelphi
+PVERBOSE_FLAGS = -vew -l
+#PDEBUG_FLAGS = -g -gl
+#PDEBUG_FLAGS = -dDEBUG
+#POTHER_FLAGS = -Crtoi
+#POPTIMIZE_FLAGS_FPC204 = -OG2p3
+#POPTIMIZE_FLAGS_FPC220 = -O2p"NAME"
+#POPTIMIZE_FLAGS = -dRELEASE
+#POPTIMIZE_FLAGS = -Xs
+PFLAGS += $(PCOMPAT_FLAGS) \
+ $(PVERBOSE_FLAGS) \
+ $(PDEFINES)
+
+# lpr project file used as input
+USDX_SRC = $(USDX_PREFIX)$(PROJ_SUFFIX)
+# name of executable
+USDX_BIN = $(USDX_PREFIX)$(EXE_SUFFIX)
+# name of resource
+USDX_RES = $(USDX_PREFIX)$(RES_SUFFIX)
+
+.PHONY: all resources ultrastar install uninstall clean distclean clean_obj clean_res
+
+all: resources ultrastar
+
+resources: $(USDX_RES)
+
+# we need to rebuild everything, fpc does some sort of caching of old files,
+# so we have to delete all the old stuff first
+ultrastar: clean_obj
+ mkdir -p $(PCUNIT_DIR)
+ $(PPC) $(PFLAGS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$(USDX_BIN) $(USDX_SRC)
+
+install: all
+# $()/mkinstalldirs $(bindir)
+# $()/mkinstalldirs $(libdir)
+# $()/mkinstalldirs $(infodir)
+ mv $(OUTPUT) ../..
+# $(INSTALL) $(USDX_BIN) $(bindir)/$(USDX_BIN)
+
+uninstall:
+# rm -f ...
+ echo "Comming soon!"
+
+clean: clean_obj clean_res
+
+distclean: clean
+ find . -name "*.o" -o -name "*.ppu" -o -name "*.rst" | xargs rm -f
+ find . -name "*.bak" -o -name "*.orig" -o -name "*.dcu" | xargs rm -f
+ find . -name "__history" | xargs rm -r -f
+ rm -f $(OUTPUT).cfg $(OUTPUT).res $(OUTPUT).identcache
+ rm -f config.inc config.log config.status configure
+
+clean_obj:
+ find "$(PCUNIT_DIR)" -name "*.o" -o -name "*.ppu" -o -name "*.rst" | xargs rm -f
+ rm -f $(OUTPUT)
+
+clean_res:
+ rm -f $(USDX_RES) link.res
+
+$(USDX_RES): $(RESCOMPILER_BIN) $(USDX_PREFIX).rc
+ $(RESCOMPILER_BIN) $(USDX_PREFIX).rc
+
+$(RESCOMPILER_BIN): $(RESCOMPILER_SRC)
+ $(PPC) $(RESCOMPILER_PFLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(RESCOMPILER_SRC)
+
+configure: configure.ac aclocal.m4
+ autoconf
+
+aclocal.m4: m4/*
+ aclocal -I m4
+
+Makefile: Makefile.in config.status
+ ./config.status
+
+config.status: configure
+ ./config.status --recheck
\ No newline at end of file diff --git a/Game/Code/config.inc.in b/Game/Code/config.inc.in new file mode 100644 index 00000000..eaa37de7 --- /dev/null +++ b/Game/Code/config.inc.in @@ -0,0 +1,127 @@ +// Configuration include file for @PACKAGE_NAME@ @PACKAGE_VERSION@ +// @PACKAGE_BUGREPORT@ + +// Note on version comparison: +// ------------------------------------------------------------------- +// Delphi (in contrast to FPC) DOESN'T support MACROS. So we +// can't define a macro like VERSION_MAJOR(version) to extract +// parts of the version-number or to create version numbers for +// comparison purposes as with a MAKE_VERSION(maj, min, rev) macro. +// So we have to define constants for every part of the version here. +// +// In addition FPC (in contrast to delphi) DOESN'T support floating- +// point numbers in $IF compiler-directives (e.g. {$IF VERSION > 1.23}) +// It also DOESN'T support arithmetic operations so we aren't able to +// compare versions this way (brackets aren't supported too): +// {$IF VERSION > ((VER_MAJ*2)+(VER_MIN*23)+(VER_REL*1))} +// +// Hence we have to use fixed numbers in the directives. At least +// Pascal allows leading 0s so 0005 equals 5 (octals are +// preceded by & and not by 0 in FPC). +// We also fix the count of digits for each part of the version number +// to 3 (aaaiiirrr with aaa=major, iii=minor, rrr=release version) +// +// A check for a library with at least a version of 2.5.11 would look +// like this: +// {$IF LIB_VERSION >= 002005011} +// +// If you just need to check the major version to this: +// {$IF LIB_VERSION_MAJOR >= 23} +// +// PLEASE consider this if you use version numbers in $IF compiler- +// directives. Otherwise you might break portability. +// ------------------------------------------------------------------- + +{$@DEFINE_DEBUG@ DEBUG} + +const + VERSION_MAJOR = 1000000; + VERSION_MINOR = 1000; + VERSION_RELEASE = 1; + + FPC_VERSION_MAJOR = @FPC_VERSION_MAJOR@; + FPC_VERSION_MINOR = @FPC_VERSION_MINOR@; + FPC_VERSION_RELEASE = @FPC_VERSION_RELEASE@; + FPC_VERSION = (FPC_VERSION_MAJOR * VERSION_MAJOR) + + (FPC_VERSION_MINOR * VERSION_MINOR) + + (FPC_VERSION_RELEASE * VERSION_RELEASE); + + LAZARUS_VERSION_MAJOR = @LAZARUS_VERSION_MAJOR@; + LAZARUS_VERSION_MINOR = @LAZARUS_VERSION_MINOR@; + LAZARUS_VERSION_RELEASE = @LAZARUS_VERSION_RELEASE@; + LAZARUS_VERSION = (LAZARUS_VERSION_MAJOR * VERSION_MAJOR) + + (LAZARUS_VERSION_MINOR * VERSION_MINOR) + + (LAZARUS_VERSION_RELEASE * VERSION_RELEASE); + + {$@DEFINE_HAVE_FFMPEG@ HaveFFMpeg} + {$IFDEF HaveFFMpeg} + + av__codec = '@AVCODEC_LIB@'; + LIBAVCODEC_VERSION_MAJOR = @AVCODEC_VERSION_MAJOR@; + LIBAVCODEC_VERSION_MINOR = @AVCODEC_VERSION_MINOR@; + LIBAVCODEC_VERSION_RELEASE = @AVCODEC_VERSION_RELEASE@; + LIBAVCODEC_VERSION = (LIBAVCODEC_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVCODEC_VERSION_MINOR * VERSION_MINOR) + + (LIBAVCODEC_VERSION_RELEASE * VERSION_RELEASE); + + av__format = '@AVFORMAT_LIB@'; + LIBAVFORMAT_VERSION_MAJOR = @AVFORMAT_VERSION_MAJOR@; + LIBAVFORMAT_VERSION_MINOR = @AVFORMAT_VERSION_MINOR@; + LIBAVFORMAT_VERSION_RELEASE = @AVFORMAT_VERSION_RELEASE@; + LIBAVFORMAT_VERSION = (LIBAVFORMAT_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVFORMAT_VERSION_MINOR * VERSION_MINOR) + + (LIBAVFORMAT_VERSION_RELEASE * VERSION_RELEASE); + + av__util = '@AVUTIL_LIB@'; + LIBAVUTIL_VERSION_MAJOR = @AVUTIL_VERSION_MAJOR@; + LIBAVUTIL_VERSION_MINOR = @AVUTIL_VERSION_MINOR@; + LIBAVUTIL_VERSION_RELEASE = @AVUTIL_VERSION_RELEASE@; + LIBAVUTIL_VERSION = (LIBAVUTIL_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVUTIL_VERSION_MINOR * VERSION_MINOR) + + (LIBAVUTIL_VERSION_RELEASE * VERSION_RELEASE); + + {$ENDIF} + + {$@DEFINE_HAVE_SWSCALE@ HaveSWScale} + {$IFDEF HaveSWScale} + sw__scale = '@SWSCALE_LIB@'; + LIBSWSCALE_VERSION_MAJOR = @SWSCALE_VERSION_MAJOR@; + LIBSWSCALE_VERSION_MINOR = @SWSCALE_VERSION_MINOR@; + LIBSWSCALE_VERSION_RELEASE = @SWSCALE_VERSION_RELEASE@; + LIBSWSCALE_VERSION = (LIBSWSCALE_VERSION_MAJOR * VERSION_MAJOR) + + (LIBSWSCALE_VERSION_MINOR * VERSION_MINOR) + + (LIBSWSCALE_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} + + {$@DEFINE_HAVE_PROJECTM@ HaveProjectM} + {$IFDEF HaveProjectM} + libprojectM = '@PROJECTM_LIB@'; + PROJECTM_VERSION_MAJOR = @PROJECTM_VERSION_MAJOR@; + PROJECTM_VERSION_MINOR = @PROJECTM_VERSION_MINOR@; + PROJECTM_VERSION_RELEASE = @PROJECTM_VERSION_RELEASE@; + PROJECTM_VERSION = (PROJECTM_VERSION_MAJOR * VERSION_MAJOR) + + (PROJECTM_VERSION_MINOR * VERSION_MINOR) + + (PROJECTM_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} + + {$@DEFINE_HAVE_PORTAUDIO@ HavePortaudio} + {$IFDEF HavePortaudio} + libportaudio = '@PORTAUDIO_LIB@'; + PORTAUDIO_VERSION_MAJOR = @PORTAUDIO_VERSION_MAJOR@; + PORTAUDIO_VERSION_MINOR = @PORTAUDIO_VERSION_MINOR@; + PORTAUDIO_VERSION_RELEASE = @PORTAUDIO_VERSION_RELEASE@; + PORTAUDIO_VERSION = (PORTAUDIO_VERSION_MAJOR * VERSION_MAJOR) + + (PORTAUDIO_VERSION_MINOR * VERSION_MINOR) + + (PORTAUDIO_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} + + {$@DEFINE_HAVE_PORTMIXER@ HavePortmixer} + {$IFDEF HavePortmixer} + libportmixer = '@PORTMIXER_LIB@'; + PORTMIXER_VERSION_MAJOR = @PORTMIXER_VERSION_MAJOR@; + PORTMIXER_VERSION_MINOR = @PORTMIXER_VERSION_MINOR@; + PORTMIXER_VERSION_RELEASE = @PORTMIXER_VERSION_RELEASE@; + PORTMIXER_VERSION = (PORTMIXER_VERSION_MAJOR * VERSION_MAJOR) + + (PORTMIXER_VERSION_MINOR * VERSION_MINOR) + + (PORTMIXER_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} diff --git a/Game/Code/configure.ac b/Game/Code/configure.ac new file mode 100644 index 00000000..2c4e37f1 --- /dev/null +++ b/Game/Code/configure.ac @@ -0,0 +1,307 @@ +# +# UltraStar-DX configure.in script +# +# by UltraStar Deluxe Team +# +# Call "aclocal -I m4" to create the aclocal.m4 file. +# Process this file with autoconf to produce a configure script. +# + +# Require autoconf >= 2.61 +AC_PREREQ(2.61) + +# Init autoconf +AC_INIT([UltraStar Deluxe], [1.1], [TODO: send bugreport BUG-REPORT-ADDRESS]) +AC_CONFIG_SRCDIR(UltraStar.lpr) +AC_CONFIG_MACRO_DIR(m4) + +# show features and packages in one list +AC_PRESERVE_HELP_ORDER + +# ----------------------------------------- +# define switches +# ----------------------------------------- + +# print library option header +AC_ARG_WITH([cfg-dummy1], [ +External Libraries:]) + +# add lazarus option +AC_ARG_WITH([lazarus], + [AS_HELP_STRING([--with-lazarus=DIR], + [Directory of lazarus directory @<:@LAZARUSDIR@:>@])], + [with_lazarus=$withval], [with_lazarus="yes"]) +if [[ $with_lazarus = "no" ]] ; then + AC_MSG_ERROR("Lazarus is required. It is impossible to build without it."); +fi + +# add portaudio option +AC_ARG_WITH([portaudio], + [AS_HELP_STRING([--with-portaudio=DIR], + [Directory of portaudio library @<:@PORTAUDIODIR@:>@])], + [with_portaudio=$withval], [with_portaudio="yes"]) + +# add portmixer option +AC_ARG_WITH([portmixer], + [AS_HELP_STRING([--with-portmixer@<:@=DIR@:>@], + [Enable portmixer audio-mixer support @<:@default=check@:>@])], + [with_portmixer=$withval], [with_portmixer="check"]) + +# add projectM option +AC_ARG_WITH([projectM], + [AS_HELP_STRING([--with-projectM@<:@=DIR@:>@], + [Enable projectM visualization support @<:@default=check@:>@])], + [with_projectM=$withval], [with_projectM="check"]) + +# AC_ARG_ENABLE(foobar, +# [ --enable-foobar Dummy option], +# enable_foobar=$enableval, enable_foobar="no") + + +# ----------------------------------------- +# macro declarations +# ----------------------------------------- + +# AC_SPLIT_VERSION(VARIABLE_PREFIX, VERSION) +# Splits version number ("major.minor.release") into its components. +# Sets +# [$VARIABLE_PREFIX]_VERSION_MAJOR +# [$VARIABLE_PREFIX]_VERSION_MINOR +# [$VARIABLE_PREFIX]_VERSION_RELEASE +# This function calls +# AC_SUBST([$VARIABLE_PREFIX]_VERSION_type] for each type +AC_DEFUN([AC_SPLIT_VERSION], +[ + # replace "." and "-" with " " and ignore trailing tokens. + # 1.23.4-r2 will be splitted to [maj=1, min=23, rel=4]. + # In addition we delete every character which is not 0-9. + # 1.3a4-r32 will be [maj=1, min=34, rel=32]. + # + # Note: We use a here-document (<<< here-strings not POSIX compatible) + # Do NOT indent the eof-delimiter + read major minor release ignore <<eof + `echo [$2] | tr '.-' ' ' | sed s/[^0-9\ ].*//` +eof + + # strip preceding 0s and set unset version-parts to 0 + [$1][_VERSION_MAJOR]=$(($major)) + [$1][_VERSION_MINOR]=$(($minor)) + [$1][_VERSION_RELEASE]=$(($release)) + + AC_SUBST([$1][_VERSION_MAJOR]) + AC_SUBST([$1][_VERSION_MINOR]) + AC_SUBST([$1][_VERSION_RELEASE]) +]) + +# AC_PKG_CHECK_VERSION(VARIABLE_PREFIX, MODULE, REQUIRED, PATH, MIN, MAX) +# Aborts if lib was not found and REQUIRED="yes". +# The PATH can be "check", "no" or "yes" +# Sets +# [$VARIABLE_PREFIX]_HAVE=("yes"|"no") and +# [$VARIABLE_PREFIX]_VERSION=major.minor.release +# [$VARIABLE_PREFIX]_VERSION_MAJOR +# [$VARIABLE_PREFIX]_VERSION_MINOR +# [$VARIABLE_PREFIX]_VERSION_RELEASE +AC_DEFUN([AC_PKG_CHECK_VERSION], +[ + have_lib=no + if test x$4 != xno; then + # on empty PATH or PATH="yes"/"check" use the default path + if test x$4 = x -o x$4 = xyes -o x$4 = xcheck; then + # search in default path if no path is given + lib_path="" + else + # all PKG_* names are forbidden by pkg.m4 so we have to allow this first + m4_pattern_allow(PKG_CONFIG_LIBDIR) + # search only in the path given + lib_path="PKG_CONFIG_LIBDIR=$4/pkgconfig" + fi + + minmax_flags="" + minmax_text="" + + # min version + if test x$5 != x; then + minmax_flags="$minmax_flags --atleast-version=$5" + minmax_text="$minmax_text >= $5" + fi + + # max version + if test x$6 != x; then + minmax_flags="$minmax_flags --max-version=$6" + minmax_text="$minmax_text <= $6" + fi + + # call pkg-config + AC_MSG_CHECKING(for [$2]$minmax_text) + [$1][_VERSION]=`eval $lib_path $PKG_CONFIG $minmax_flags --modversion [$2] --silence-errors` + if test $? -eq 0; then + have_lib=yes + [$1][_HAVE]="yes" + AC_SPLIT_VERSION([$1], $[$1][_VERSION]) + AC_MSG_RESULT(yes @<:@$[$1][_VERSION]@:>@) + fi + else + AC_MSG_CHECKING(for [$2]) + fi + if test x$have_lib = xno; then + [$1][_HAVE]="no" + AC_SPLIT_VERSION([$1], [0.0.0]) + AC_MSG_RESULT(no) + if test x$3 = xyes -o x$4 = xyes; then + AC_MSG_ERROR(["Could not find required library $2. Please install $2 and try again."]); + fi + fi +]) + +# ----------------------------------------- +# check for compilers +# ----------------------------------------- + +# find and test the freepascal compiler +# sets PFLAGS, FPC_VERSION, FPC_DEBUG, etc. +AC_PROG_FPC +AC_SPLIT_VERSION(FPC, $FPC_VERSION) + +# find and test the C compiler (for C-libs and wrappers) +AC_PROG_CC +AC_LANG([C]) + +# find and test the C++ compiler (for C-libs and wrappers) +AC_PROG_CXX +AC_LANG([C++]) + +# options for make command +AC_PROG_MAKE_SET +# find tool for ln -s +AC_LN_S +# find the best install tool +AC_PROG_INSTALL +# some other useful tools +#AC_PROG_AWK +#AC_PROG_SED +#AC_PROG_GREP +#AC_PROG_EGREP + +# find pkg-config +PKG_PROG_PKG_CONFIG() +if [[ x$PKG_CONFIG = x ]]; then + AC_MSG_ERROR([ +!!! pkg-config was not found on your system. +!!! It is needed to determine the versions of your libraries. +!!! Install it and try again.]) +fi + +# ----------------------------------------- +# check for libraries +# ----------------------------------------- + +# set dirs to check for lazarus +if [[ x$with_lazarus = xyes ]]; then + # use default path (ignore the standard path (PATH) because the lazarus executable might + # be in /usr/bin, but what we want is the program directory with the libs) + LAZARUS_CHECK_DIRS="/usr/bin/lazarus:/usr/lib/lazarus:/usr/share/lazarus:/opt/lazarus:/usr/local/bin/lazarus:/usr/local/lib/lazarus:/usr/local/share/lazarus" +else + # check if dir is valid + if [[ -d $with_lazarus ]] ; then + LAZARUS_CHECK_DIRS=$with_lazarus + else + AC_MSG_ERROR(["LAZARUSDIR is not a directory."]); + fi +fi + +# find lazarus +AC_PATH_PROG(LAZARUS, lazarus, no, [$LAZARUS_CHECK_DIRS]) +if [[ $LAZARUS = "no" ]] ; then + AC_MSG_ERROR(["Could not find lazarus. Please install lazarus and try again."]); +fi +LAZARUS_DIR=`dirname "$LAZARUS"` + +# get lazarus version +AC_MSG_CHECKING(for version of lazarus) +# (do this in a temporary shell to prevent a change of directory) +LAZARUS_VERSION=`(cd "$LAZARUS_DIR/tools/install"; ./get_lazarus_version.sh)` +#LAZARUS_VERSION=`cat ide/version.inc | tr -d "' \t"` +AC_SPLIT_VERSION([LAZARUS], [$LAZARUS_VERSION]) +AC_MSG_RESULT(@<:@$LAZARUS_VERSION@:>@) + +# find sdl +AC_PKG_CHECK_VERSION(SDL, [sdl], yes) + +# find sqlite3 +AC_PKG_CHECK_VERSION(SQLITE3, [sqlite3], yes) + +# find ffmpeg +AC_PKG_CHECK_VERSION(AVCODEC, [libavcodec], yes) +AC_CHECK_LIB(avcodec, avcodec_decode_audio) +AC_CHECK_LIB(avcodec, avcodec_decode_audio2) +AC_CHECK_LIB(avcodec, img_convert) +AC_PKG_CHECK_VERSION(AVFORMAT, [libavformat], yes) +AC_PKG_CHECK_VERSION(AVUTIL, [libavutil], yes) +AC_PKG_CHECK_VERSION(SWSCALE, [libswscale], no) + +if [[ x$AVCODEC_HAVE = xyes -a x$AVFORMAT_HAVE = xyes -a x$AVUTIL_HAVE = xyes ]]; then + FFMPEG_HAVE=yes +else + FFMPEG_HAVE=no +fi + +# find projectM version +AC_PKG_CHECK_VERSION(PROJECTM, [libprojectM], no, $with_projectM, [], 0.99) + +# find portaudio version +AC_PKG_CHECK_VERSION(PORTAUDIO, [portaudio-2.0], yes, $with_portaudio) +AC_PKG_CHECK_VERSION(PORTMIXER, [portmixer], no, $with_portmixer) + +# ----------------------------------------- +# defines for config.inc +# ----------------------------------------- + +# AC_SUBST_DEFINE(DEFINE_SUFFIX, IS_DEFINED) +AC_DEFUN([AC_SUBST_DEFINE], +[ + if [[ x$2 = xyes ]]; then + DEFINE_[$1]=DEFINE + else + DEFINE_[$1]=UNDEF + fi + AC_SUBST(DEFINE_[$1]) +]) + +AC_SUBST_DEFINE(DEBUG, $FPC_DEBUG) + +AC_SUBST(AVCODEC_LIB) +AC_SUBST(AVFORMAT_LIB) +AC_SUBST(AVUTIL_LIB) +AC_SUBST_DEFINE(HAVE_FFMPEG, $FFMPEG_HAVE) + +AC_SUBST(SWSCALE_LIB) +AC_SUBST_DEFINE(HAVE_SWSCALE, $SWSCALE_HAVE) + +AC_SUBST(PROJECTM_LIB) +AC_SUBST_DEFINE(HAVE_PROJECTM, $PROJECTM_HAVE) + +AC_SUBST(PORTAUDIO_LIB) +AC_SUBST_DEFINE(HAVE_PORTAUDIO, $PORTAUDIO_HAVE) + +AC_SUBST(PORTMIXER_LIB) +AC_SUBST_DEFINE(HAVE_PORTMIXER, $PORTMIXER_HAVE) + +AC_SUBST(LAZARUS_DIR) + +# ----------------------------------------- +# create output files +# ----------------------------------------- + +AC_CONFIG_FILES([config.inc Makefile]) +AC_OUTPUT + +# ----------------------------------------- +# show results +# ----------------------------------------- + +AC_MSG_NOTICE([ + +!!! Configuration done! +!!! Type "make" to compile the program. +]) diff --git a/Game/Code/m4/fpc.m4 b/Game/Code/m4/fpc.m4 new file mode 100644 index 00000000..44822b28 --- /dev/null +++ b/Game/Code/m4/fpc.m4 @@ -0,0 +1,148 @@ +dnl ** Version 1.1 of file is part of the LGPLed +dnl ** J Sound System (http://jss.sourceforge.net) +dnl ** +dnl ** Checks for Free Pascal Compiler by Matti "ccr/TNSP" Hamalainen +dnl ** (C) Copyright 2000-2001 Tecnic Software productions (TNSP) +dnl ** +dnl ** Versions +dnl ** -------- +dnl ** 1.0 - Created +dnl ** +dnl ** 1.1 - Added stuff to enable unix -> win32 +dnl ** cross compilation. +dnl ** +dnl ** 1.x - A few fixes (by the UltraStar Deluxe Team) +dnl ** + +AC_DEFUN([AC_PROG_FPC], [ + +AC_ARG_VAR(PFLAGS, [Free Pascal Compiler flags]) + +AC_ARG_ENABLE(dummy_fpc1,[ +Free Pascal Compiler specific options:]) + +AC_ARG_WITH(fpc, + [AS_HELP_STRING([--with-fpc], + [Directory of the FPC executable @<:@PATH@:>@])], + [PPC_PATH=$withval], []) + +FPC_DEBUG="no" + +AC_ARG_ENABLE(debug, + [AS_HELP_STRING([--enable-debug], + [Enable FPC debug options @<:@default=no@:>@])], + [FPC_DEBUG="yes"], []) + + +AC_ARG_ENABLE(release, + [AS_HELP_STRING([--enable-release], + [Enable FPC release options (same as --enable-debug=no)])], + [FPC_DEBUG="no"], []) + +dnl use -dDEBUG (instead of -g) so it uses the fpc.cfg defaults +AC_ARG_WITH(debug-flags, + [AS_HELP_STRING([--with-debug-flags], + [FPC debug flags @<:@-dDEBUG@:>@])], + [fpc_debugflags="$withval"], + [fpc_debugflags="-dDEBUG"]) + +dnl use -dDEBUG (instead of e.g. -O2) so it uses the fpc.cfg defaults +AC_ARG_WITH(release-flags, + [AS_HELP_STRING([--with-release-flags], + [FPC release flags @<:@-dRELEASE@:>@])], + [fpc_releaseflags="$withval"], + [fpc_releaseflags="-dRELEASE"]) + +if test x$FPC_DEBUG = xyes; then + PFLAGS="$PFLAGS $fpc_debugflags" +else + PFLAGS="$PFLAGS $fpc_releaseflags" +fi + +AC_ARG_ENABLE(profile, + [AS_HELP_STRING([--enable-profile], + [Enable FPC profiling options])], + [PFLAGS="$PFLAGS -pg"], []) + +PPC_CHECK_PROGS="fpc FPC ppc386 ppc PPC386 ppos2" + +if test -z "$PPC_PATH"; then + PPC_PATH=$PATH + AC_CHECK_PROGS(PPC, $PPC_CHECK_PROGS) +else + AC_PATH_PROGS(PPC, $PPC_CHECK_PROGS, [], $PPC_PATH) +fi +if test -z "$PPC"; then + AC_MSG_ERROR([no Free Pascal Compiler found in $PPC_PATH]) +fi + +AC_PROG_FPC_WORKS +AC_PROG_FPC_LINKS + +dnl *** Get the FPC version and some paths +FPC_VERSION=`${PPC} ${PFLAGS} -iV` +FPC_PLATFORM=`${PPC} ${PFLAGS} -iTO` +FPC_PROCESSOR=`${PPC} ${PFLAGS} -iTP` +if test "x$prefix" != xNONE; then + FPC_PREFIX=$prefix +else + FPC_PREFIX=$ac_default_prefix +fi +FPC_BASE_PATH="${FPC_PREFIX}/lib/fpc/${FPC_VERSION}" +FPC_UNIT_PATH="${FPC_BASE_PATH}/units/${FPC_PLATFORM}" +AC_SUBST(PFLAGS) +AC_SUBST(FPC_VERSION) +AC_SUBST(FPC_PLATFORM) +AC_SUBST(FPC_PROCESSOR) +AC_SUBST(FPC_PREFIX) +AC_SUBST(FPC_BASE_PATH) +AC_SUBST(FPC_UNIT_PATH) +]) + + +dnl *** +dnl *** Check if FPC works and can compile a program +dnl *** +AC_DEFUN([AC_PROG_FPC_WORKS], +[AC_CACHE_CHECK([whether the Free Pascal Compiler ($PPC $PFLAGS) works], ac_cv_prog_ppc_works, +[ +rm -f conftest* +echo "program foo; begin writeln; end." > conftest.pp +${PPC} ${PFLAGS} conftest.pp >> config.log + +if test -f conftest || test -f conftest.exe; then +dnl *** It works! + ac_cv_prog_ppc_works="yes" + +else + ac_cv_prog_ppc_works="no" +fi +rm -f conftest* +dnl AC_MSG_RESULT($ac_cv_prog_ppc_works) +if test x$ac_cv_prog_ppc_works = xno; then + AC_MSG_ERROR([installation or configuration problem: Cannot create executables.]) +fi +])]) + + +dnl *** +dnl *** Check if FPC can link with standard libraries +dnl *** +AC_DEFUN([AC_PROG_FPC_LINKS], +[AC_CACHE_CHECK([whether the Free Pascal Compiler ($PPC $PFLAGS) can link], ac_cv_prog_ppc_works, +[ +rm -f conftest* +echo "program foo; uses crt; begin writeln; end." > conftest.pp +${PPC} ${PFLAGS} conftest.pp >> config.log +if test -f conftest || test -f conftest.exe; then + ac_cv_prog_ppc_links="yes" +else + ac_cv_prog_ppc_links="no" +fi +rm -f conftest* +AC_MSG_RESULT($ac_cv_prog_ppc_links) +if test x$ac_cv_prog_ppc_links = xno; then + AC_MSG_ERROR([installation or configuration problem: Cannot link with some standard libraries.]) +fi +])]) + |