aboutsummaryrefslogtreecommitdiffstats
path: root/Game
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-04-22 15:34:31 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-04-22 15:34:31 +0000
commit69892748d7d18851c9cd7c49b351bbf86d2e2325 (patch)
tree0f404ff64eb9c04cdb6bfa0d6bf3964cd14ef6fc /Game
parentaa3fcb3f5241731357fdc4b78817c37b36ee8fe7 (diff)
downloadusdx-69892748d7d18851c9cd7c49b351bbf86d2e2325.tar.gz
usdx-69892748d7d18851c9cd7c49b351bbf86d2e2325.tar.xz
usdx-69892748d7d18851c9cd7c49b351bbf86d2e2325.zip
New Makefile:
- no need to edit config-linux.inc for non-standard installation - "make release", "make debug" targets, so reconfiguring with --enable/disable-debug is not necessary anymore - linkerflags (environment variables LDFLAGS and LIBS) (e.g. from pkg-config) like "-Lpath" or "-Wl,-rpath,'path'" are passed to fpc - some cleanup git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1028 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Makefile.in169
-rw-r--r--Game/Code/config.inc.in68
-rw-r--r--Game/Code/configure.ac597
-rw-r--r--Game/Code/m4/fpc.m4106
4 files changed, 472 insertions, 468 deletions
diff --git a/Game/Code/Makefile.in b/Game/Code/Makefile.in
index 1e895beb..0f3a21c5 100644
--- a/Game/Code/Makefile.in
+++ b/Game/Code/Makefile.in
@@ -13,11 +13,14 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
datarootdir = @datarootdir@
VPATH = @srcdir@
-
-usdxrootdir = ../..
+usdxrootdir = @usdxrootdir@
+logrootdir = @logrootdir@
INSTALL_PATH_SUFFIX = @suffix@
INSTALL_datadir = $(datarootdir)/$(INSTALL_PATH_SUFFIX)
+INSTALL_logdir = $(logrootdir)/$(INSTALL_PATH_SUFFIX)
+
+@SET_MAKE@
# recursive dir creation tool
MKDIR_P = @MKDIR_P@
@@ -27,9 +30,6 @@ INSTALL_DATA = @INSTALL_DATA@
# calls "ln -s"
LN_S = @LN_S@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-
# Package configuration
USDX_PACKAGE_NAME = @PACKAGE_NAME@
# should be $(USDX_PACKAGE_NAME) instead
@@ -38,66 +38,65 @@ USDX_VERSION = @PACKAGE_VERSION@
USDX_TARNAME = @PACKAGE_TARNAME@
USDX_TOOLS_DIR = $(usdxrootdir)/Tools
+USDX_LIB_DIR = ./lib
+USDX_BUILD_DIR = ./build
# file-type suffix of executables (e.g. ".exe" in windows)
EXE_SUFFIX = @EXEEXT@
# Free Pascal compiler
PPC = @PPC@
-PLIBS = @PLIBS@
# FPC target platform and processor
PPLATFORM = @FPC_PLATFORM@
PPROCESSOR = @FPC_PROCESSOR@
-# TODO: remove lazarus stuff
-# lazarus defines
-#LAZARUS_DIR = @LAZARUS_DIR@
-#LCL_WIDGET_TYPE = @LCL_WIDGET_TYPE@
-# $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM)
-# $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM)/$(LCL_WIDGET_TYPE)
+EXTRA_SRCDIRS =
# RC resource extraction config
RESEXTRACTOR_NAME = ResourceExtractor
RESEXTRACTOR_DIR = $(USDX_TOOLS_DIR)/$(RESEXTRACTOR_NAME)
RESEXTRACTOR_BIN = $(RESEXTRACTOR_DIR)/$(RESEXTRACTOR_NAME)$(EXE_SUFFIX)
-RESEXTRACTOR_SRC = $(RESEXTRACTOR_DIR)/$(RESEXTRACTOR_NAME).pas
-RESEXTRACTOR_PFLAGS = -dRELEASE
RESOURCE_DIR = $(usdxrootdir)/Resources
RESOURCE_FILE = resource.inc
+EXTRA_SRCDIRS += $(RESEXTRACTOR_DIR)
+
+# cwrapper settings
+PROJECTM_CWRAPPER_DIR = $(USDX_LIB_DIR)/projectM/cwrapper
+@COMMENT_PROJECTM_CWRAPPER@EXTRA_SRCDIRS += $(PROJECTM_CWRAPPER_DIR)
# Directories added to the unit path
PUNIT_TOKEN = -Fu
-PUNIT_FLAGS = \
- $(PUNIT_TOKEN).
-
+PUNIT_FLAGS = $(PUNIT_TOKEN).
+
# Directory where compiled units (.ppu and .o files) are stored
PCUNIT_TOKEN = -FU
-PCUNIT_DIR = ./build/$(PPLATFORM)/fpc
+PCUNIT_DIR = $(USDX_BUILD_DIR)/$(PPLATFORM)/fpc
PCUNIT_FLAGS = $(PCUNIT_TOKEN)$(PCUNIT_DIR)
# Directories added to the includes path
PINC_TOKEN = -Fi
-PINC_FLAGS = $(PINC_TOKEN)lib/JEDI-SDL/SDL/Pas
-
-# Defines
-#PDEFINES = -dLCL -dLCL$(LCL_WIDGET_TYPE)
+PINC_FLAGS = $(PINC_TOKEN)$(USDX_LIB_DIR)/JEDI-SDL/SDL/Pas
# FPC flags
# The user can overwrite the default flags with
-# make PFLAGS="myflags"
-PFLAGS = -S2gi -vB
-# the user's flags (specified with configure) must be the last in
-# the list to overwrite the defaults (e.g.with the - option: -Xs-).
-PFLAGS += @PFLAGS@
-
+# make PFLAGS_BASE="myflags"
+PFLAGS_BASE = -S2gi -vB
+# The user can specify additional flags with
+# make PFLAGS_EXTRA="myflags"
+PFLAGS_EXTRA = @PFLAGS_EXTRA@
PFLAGS_DEBUG = @PFLAGS_DEBUG@
PFLAGS_RELEASE = @PFLAGS_RELEASE@
+# the user's flags (specified with configure) must be the last in
+# the list to overwrite the defaults (e.g.with the - option: -Xs-).
+PFLAGS = $(PFLAGS_BASE) @PFLAGS_MAKE@ $(PFLAGS_EXTRA)
-# The user can specify additional flags with
-# make PFLAGS_EXTRA="myflags"
-PFLAGS_EXTRA =
-PFLAGS += $(PFLAGS_EXTRA)
+LIBS = @LIBS@
+LDFLAGS = @LDFLAGS@
+linkflags = $(strip $(LDFLAGS) $(LIBS))
+ifneq ($(linkflags),)
+PLINKFLAGS = -k"$(linkflags)"
+endif
# dpr project file used as input
USDX_SRC = $(USDX_PREFIX).dpr
@@ -105,36 +104,42 @@ USDX_SRC = $(USDX_PREFIX).dpr
USDX_BIN_NAME = $(USDX_PREFIX)$(EXE_SUFFIX)
USDX_BIN = $(usdxrootdir)/$(USDX_BIN_NAME)
-.PHONY: all resources ultrastardx-app install install-dev install-release install-data install-data-recursive install-exec uninstall uninstall-dev uninstall-release uninstall-data uninstall-exec clean distclean clean_obj clean_res fetch-sounds dist debian-package
+modfile = lastmod
+
+.PHONY: debug release recursive all recursive-all dependencies install install-local install-global install-data install-data-recursive install-exec uninstall uninstall-local uninstall-global uninstall-data uninstall-exec clean recursive-clean distclean recursive-distclean clean_obj clean_res fetch-sounds dist debian-package update-modfile $(EXTRA_SRCDIRS)
+
+debug: PFLAGS = $(PFLAGS_BASE) $(PFLAGS_DEBUG) $(PFLAGS_EXTRA)
+debug: all
-all: resources ultrastardx-app
+release: PFLAGS = $(PFLAGS_BASE) $(PFLAGS_RELEASE) $(PFLAGS_EXTRA)
+release: all
-resources: $(RESOURCE_FILE)
+all: recursive-all update-modfile dependencies $(USDX_BIN)
-ultrastardx-app: $(USDX_BIN)
+recursive-all: recursive-target = all
+recursive-all: recursive
-# Clean and rebuild everything because FPC caches some old files
-# (it uses an .inc-files cache for example).
-# As a result FPC misses some changes if it is called without cleaning
-# up first (very annoying while debugging).
-$(USDX_BIN): clean_obj
-# $(MAKE) clean_obj
+dependencies: $(RESOURCE_FILE)
+
+# call Makefiles in other source-dirs
+recursive: $(EXTRA_SRCDIRS)
+$(EXTRA_SRCDIRS):
+ $(MAKE) -C $@ $(recursive-target)
+
+# clean old data before compiling, otherwise FPC might miss some changes.
+$(USDX_BIN): lastmod
+ $(MAKE) clean_obj
mkdir -p $(PCUNIT_DIR)
- $(PPC) $(PFLAGS) $(PDEFINES) $(PLIBS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(USDX_SRC)
+ $(PPC) $(strip $(PFLAGS) $(PDEFINES) $(PLINKFLAGS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS)) -o$@ $(USDX_SRC)
-install: install-@install_type@
-# depends on $(USDX_BIN)
+install: all install-@install_type@
uninstall: uninstall-@install_type@
-# local development build
+# local build
-install-dev:
- @if [ ! -d "$(usdxrootdir)/Visuals" ]; then \
- echo "Copying visualizer data to $(usdxrootdir)/Visuals ..."; \
- cp -r "$(usdxrootdir)/InstallerDependencies/Visuals" "$(usdxrootdir)"; \
- fi
+install-local:
@if [ ! -f "$(usdxrootdir)/Sounds/Common start.mp3" ]; then \
echo ""; \
echo "# The sound-files from Sound-directory of the 1.0.1-branch are required."; \
@@ -148,14 +153,17 @@ fetch-sounds:
mv tmp-sounds/*.mp3 $(usdxrootdir)/Sounds
rm -rf tmp-sounds
-uninstall-dev:
+uninstall-local:
rm -f $(USDX_BIN)
+# global build
-# global release build
-
-install-release: install-data install-exec
+install-global: install-data install-exec
+# TODO: to which user/group/rights must the logdir be set
+# "drwxrwxrwx" might be too dangerous
+# $(MKDIR_P) $(INSTALL_logdir)
+# chmod ??? $(INSTALL_logdir)
install-data:
$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Themes RECURSIVE_DST_DIR=$(INSTALL_datadir)/Themes install-data-recursive
@@ -163,12 +171,12 @@ install-data:
$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Languages RECURSIVE_DST_DIR=$(INSTALL_datadir)/Languages install-data-recursive
$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Skins RECURSIVE_DST_DIR=$(INSTALL_datadir)/Skins install-data-recursive
$(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/Resources RECURSIVE_DST_DIR=$(INSTALL_datadir)/Resources install-data-recursive
- $(MAKE) RECURSIVE_SRC_DIR=$(usdxrootdir)/InstallerDependencies/Visuals RECURSIVE_DST_DIR=$(INSTALL_datadir)/Visuals install-data-recursive
install-data-recursive:
$(MKDIR_P) $(RECURSIVE_DST_DIR)
@for file in $(RECURSIVE_SRC_DIR)/*; do \
if test -f "$$file"; then \
+ echo $(INSTALL_DATA) "$$file" $(RECURSIVE_DST_DIR); \
$(INSTALL_DATA) "$$file" $(RECURSIVE_DST_DIR); \
fi; \
if test -d "$$file"; then \
@@ -182,7 +190,8 @@ install-exec:
$(MKDIR_P) $(bindir)
$(INSTALL) $(USDX_BIN) $(bindir)
-uninstall-release: uninstall-data uninstall-exec
+uninstall-global: uninstall-data uninstall-exec
+ rmdir $(INSTALL_logdir)
uninstall-data:
# TODO: delete the directories created at the first execution of usdx too (like Screenshots/Playlists)
@@ -191,8 +200,7 @@ uninstall-data:
rm -rf $(INSTALL_datadir)/Languages
rm -rf $(INSTALL_datadir)/Skins
rm -rf $(INSTALL_datadir)/Resources
- rm -rf $(INSTALL_datadir)/Visuals
- rmdir $(INSTALL_datadir)
+ rmdir $(INSTALL_datadir)
uninstall-exec:
rm -f $(bindir)/$(USDX_BIN_NAME)
@@ -216,7 +224,7 @@ debpkgname = $(debpkgprefix)_$(USDX_VERSION)_$(PPROCESSOR).deb
debian-package: $(debpkgname)
-$(debpkgname): $(USDX_BIN)
+$(debpkgname): all
rm -rf $(debpkgtmpdir)
rm -rf $(debpkgoutdir)
@@ -232,18 +240,26 @@ $(debpkgname): $(USDX_BIN)
# rm -rf $(debpkgtmpdir)
-clean: clean_obj
+rpm: all
+# rpm
+ @echo "Comming soon"
+
+clean: recursive-clean clean_obj
+
+recursive-clean: recursive-target = clean
+recursive-clean: recursive
-distclean: clean clean_res
+distclean: recursive-distclean clean clean_res
find . -name "*.o" -o -name "*.ppu" -o -name "*.rst" -o -name "*.compiled" | xargs rm -f
find . -name "*~" -name "*.bak" -o -name "*.orig" -o -name "*.dcu" | xargs rm -f
find . -name "__history" | xargs rm -r -f
rm -f $(USDX_PREFIX).res $(USDX_PREFIX).identcache
- rm -f config.inc config.log config.status configure
- rm -f Makefile
- rm -f aclocal.m4
+ rm -f config.inc Makefile config.log config.status configure aclocal.m4
rm -rf autom4te.cache
+recursive-distclean: recursive-target = distclean
+recursive-distclean: recursive
+
clean_obj:
find "$(PCUNIT_DIR)" -name "*.o" -o -name "*.ppu" -o -name "*.rst" -o -name "*.compiled" | xargs rm -f
rm -f $(USDX_BIN)
@@ -251,21 +267,26 @@ clean_obj:
clean_res:
rm -f $(RESOURCE_FILE)
-$(RESOURCE_FILE): $(RESEXTRACTOR_BIN) $(USDX_PREFIX).rc
+$(RESOURCE_FILE): $(USDX_PREFIX).rc
$(RESEXTRACTOR_BIN) $(USDX_PREFIX).rc $(RESOURCE_DIR) $(RESOURCE_FILE)
-$(RESEXTRACTOR_BIN): $(RESEXTRACTOR_SRC)
- mkdir -p $(PCUNIT_DIR)
- $(PPC) $(RESEXTRACTOR_PFLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(RESEXTRACTOR_SRC)
-
-configure: configure.ac config.inc.in aclocal.m4
- autoconf
-aclocal.m4: m4/*
- aclocal -I m4
+# FPC does not recognize changes correctly. E.g. sometimes changes in .inc-files or
+# conditional .pas dependencies are ignored which results in corrupted builds.
+# So check for changes with a modification timestamp.
+update-modfile:
+ test -e $(modfile) || touch $(modfile)
+ find . \( -name "*.pas" -o -name "*.pp" -o -name "*.inc" -o -name "*.dpr" \) -newer $(modfile) -exec touch $(modfile) \;
+ find $(USDX_LIB_DIR) -name "*.a" -newer $(modfile) -exec touch $(modfile) \;
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
+
+configure: configure.ac config.inc.in aclocal.m4
+ autoconf
+
+aclocal.m4: m4/*
+ aclocal -I m4
diff --git a/Game/Code/config.inc.in b/Game/Code/config.inc.in
index 9ac5406c..e9165c30 100644
--- a/Game/Code/config.inc.in
+++ b/Game/Code/config.inc.in
@@ -3,10 +3,6 @@
* @configure_input@
*****************************************************************}
-{* Misc options *}
-
-{$@DEFINE_DEBUG@ DEBUG}
-
{* Paths *}
{$@DEFINE_USE_LOCAL_DIRS@ UseLocalDirs}
@@ -18,70 +14,46 @@
{* Libraries *}
-{$IF Defined(LAZARUS) and Defined(IncludeConstants)}
- LAZARUS_VERSION_MAJOR = @LAZARUS_VERSION_MAJOR@;
- LAZARUS_VERSION_MINOR = @LAZARUS_VERSION_MINOR@;
- LAZARUS_VERSION_RELEASE = @LAZARUS_VERSION_RELEASE@;
-{$IFEND}
-
{$@DEFINE_HAVE_FFMPEG@ HaveFFMpeg}
{$IF Defined(HaveFFMpeg) and Defined(IncludeConstants)}
av__codec = 'libavcodec';
- //av__codec = '@AVCODEC_LIB@';
- LIBAVCODEC_VERSION_MAJOR = @AVCODEC_VERSION_MAJOR@;
- LIBAVCODEC_VERSION_MINOR = @AVCODEC_VERSION_MINOR@;
- LIBAVCODEC_VERSION_RELEASE = @AVCODEC_VERSION_RELEASE@;
+ LIBAVCODEC_VERSION_MAJOR = @libavcodec_VERSION_MAJOR@;
+ LIBAVCODEC_VERSION_MINOR = @libavcodec_VERSION_MINOR@;
+ LIBAVCODEC_VERSION_RELEASE = @libavcodec_VERSION_RELEASE@;
av__format = 'libavformat';
- //av__format = '@AVFORMAT_LIB@';
- LIBAVFORMAT_VERSION_MAJOR = @AVFORMAT_VERSION_MAJOR@;
- LIBAVFORMAT_VERSION_MINOR = @AVFORMAT_VERSION_MINOR@;
- LIBAVFORMAT_VERSION_RELEASE = @AVFORMAT_VERSION_RELEASE@;
+ LIBAVFORMAT_VERSION_MAJOR = @libavformat_VERSION_MAJOR@;
+ LIBAVFORMAT_VERSION_MINOR = @libavformat_VERSION_MINOR@;
+ LIBAVFORMAT_VERSION_RELEASE = @libavformat_VERSION_RELEASE@;
av__util = 'libavutil';
- //av__util = '@AVUTIL_LIB@';
- LIBAVUTIL_VERSION_MAJOR = @AVUTIL_VERSION_MAJOR@;
- LIBAVUTIL_VERSION_MINOR = @AVUTIL_VERSION_MINOR@;
- LIBAVUTIL_VERSION_RELEASE = @AVUTIL_VERSION_RELEASE@;
+ LIBAVUTIL_VERSION_MAJOR = @libavutil_VERSION_MAJOR@;
+ LIBAVUTIL_VERSION_MINOR = @libavutil_VERSION_MINOR@;
+ LIBAVUTIL_VERSION_RELEASE = @libavutil_VERSION_RELEASE@;
{$IFEND}
{$@DEFINE_HAVE_SWSCALE@ HaveSWScale}
{$IF Defined(HaveSWScale) and Defined(IncludeConstants)}
sw__scale = 'libswscale';
- //sw__scale = '@SWSCALE_LIB@';
- LIBSWSCALE_VERSION_MAJOR = @SWSCALE_VERSION_MAJOR@;
- LIBSWSCALE_VERSION_MINOR = @SWSCALE_VERSION_MINOR@;
- LIBSWSCALE_VERSION_RELEASE = @SWSCALE_VERSION_RELEASE@;
+ LIBSWSCALE_VERSION_MAJOR = @libswscale_VERSION_MAJOR@;
+ LIBSWSCALE_VERSION_MINOR = @libswscale_VERSION_MINOR@;
+ LIBSWSCALE_VERSION_RELEASE = @libswscale_VERSION_RELEASE@;
{$IFEND}
-// define this for versions of ProjectM < 1.0 (use C-Interface)
-{$@DEFINE_HAVE_PROJECTM_0_9@ HaveProjectM_0_9}
-// define this for versions of ProjectM >= 1.0 (use C++-Interface)
-{$@DEFINE_HAVE_PROJECTM_1_0_PLUS@ HaveProjectM_1_0_PLUS}
-{$IF Defined(HaveProjectM_0_9) or Defined(HaveProjectM_1_0_PLUS)}
- {$DEFINE HaveProjectM}
-{$IFEND}
+{$@DEFINE_HAVE_PROJECTM@ HaveProjectM}
{$IF Defined(HaveProjectM) and Defined(IncludeConstants)}
- libprojectM = '@PROJECTM_LIB@';
- // Note: Un/Define HaveProjectM_0_9 or HaveProjectM_1_0_PLUS accordingly
- PROJECTM_VERSION_MAJOR = @PROJECTM_VERSION_MAJOR@;
- PROJECTM_VERSION_MINOR = @PROJECTM_VERSION_MINOR@;
- PROJECTM_VERSION_RELEASE = @PROJECTM_VERSION_RELEASE@;
+ ProjectM_DataDir = '@libprojectM_DATADIR@';
+ PROJECTM_VERSION_MAJOR = @libprojectM_VERSION_MAJOR@;
+ PROJECTM_VERSION_MINOR = @libprojectM_VERSION_MINOR@;
+ PROJECTM_VERSION_RELEASE = @libprojectM_VERSION_RELEASE@;
{$IFEND}
{$@DEFINE_HAVE_PORTAUDIO@ HavePortaudio}
{$IF Defined(HavePortaudio) and Defined(IncludeConstants)}
- libportaudio = '@PORTAUDIO_LIB@';
- PORTAUDIO_VERSION_MAJOR = @PORTAUDIO_VERSION_MAJOR@;
- PORTAUDIO_VERSION_MINOR = @PORTAUDIO_VERSION_MINOR@;
- PORTAUDIO_VERSION_RELEASE = @PORTAUDIO_VERSION_RELEASE@;
+ PORTAUDIO_VERSION_MAJOR = @portaudio_VERSION_MAJOR@;
+ PORTAUDIO_VERSION_MINOR = @portaudio_VERSION_MINOR@;
+ PORTAUDIO_VERSION_RELEASE = @portaudio_VERSION_RELEASE@;
{$IFEND}
{$@DEFINE_HAVE_PORTMIXER@ HavePortmixer}
-{$IF Defined(HavePortmixer) and Defined(IncludeConstants)}
- libportmixer = '@PORTMIXER_LIB@';
- PORTMIXER_VERSION_MAJOR = @PORTMIXER_VERSION_MAJOR@;
- PORTMIXER_VERSION_MINOR = @PORTMIXER_VERSION_MINOR@;
- PORTMIXER_VERSION_RELEASE = @PORTMIXER_VERSION_RELEASE@;
-{$IFEND}
diff --git a/Game/Code/configure.ac b/Game/Code/configure.ac
index 3c4322b4..8856e762 100644
--- a/Game/Code/configure.ac
+++ b/Game/Code/configure.ac
@@ -15,8 +15,10 @@ AC_INIT([UltraStar-Deluxe],
[http://sourceforge.net/tracker/?group_id=191560&atid=937872])
# specify the website here
PACKAGE_WEBSITE="http://www.ultrastardeluxe.org/"
+AC_SUBST(PACKAGE_WEBSITE)
# specify the IRC-channel here
PACKAGE_IRC="#ultrastardx at quakenet.org"
+AC_SUBST(PACKAGE_IRC)
# Specify a source-file so autoconf can check if the source-dir exists
AC_CONFIG_SRCDIR(UltraStar.lpr)
@@ -28,88 +30,19 @@ AC_CONFIG_MACRO_DIR(m4)
# show features and packages in one list
AC_PRESERVE_HELP_ORDER
-# -----------------------------------------
-# define switches
-# -----------------------------------------
-
-# print library options header
-AC_ARG_WITH([cfg-dummy1], [
-External Libraries:])
-
-# add lazarus option
-#AC_ARG_WITH([lazarus],
-# [AS_HELP_STRING([--with-lazarus=DIR],
-# [Directory of lazarus @<:@LAZARUSDIR@:>@])],
-# [with_lazarus=$withval], [with_lazarus="yes"])
-#if [[ x$with_lazarus = xno ]] ; then
-# AC_MSG_ERROR([Lazarus is required. It is impossible to build without it.]);
-#fi
-
-# add lazarus widget-type option
-# the result is not used at the moment
-#AC_ARG_WITH([lcl-widget-type],
-# [AS_HELP_STRING([--with-lcl-widget-type=TYPE],
-# [Lazarus LCL Widget Type @<:@default=check@:>@])],
-# [with_lcl_widget_type=$withval], [with_lcl_widget_type=""])
-#if [[ x$with_lcl_widget_type = xno -o x$with_lcl_widget_type = xyes ]] ; then
-# AC_MSG_ERROR([Invalid LCL Widget Type (try one of gtk2/gtk/qt)]);
-#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"])
-
-# add skip pkg-config error option
-AC_ARG_ENABLE([skip-pkgconfig-errors],
- [AS_HELP_STRING([--enable-skip-pkgconfig-errors],
- [Continue if pkg-config does not find a package @<:@default=no@:>@])],
- [skip_pkgconfig_errors=$withval], [skip_pkgconfig_errors="no"])
-
-# print path options header
-AC_ARG_WITH([cfg-dummy2], [
-Additional directories:])
+# set root directory (= trunk dir)
+# ..resolved: used by configure.ac
+usdxroot=../..
+# ..unresolved: used by .in files
+usdxrootdir=\${top_srcdir}/../..
+AC_SUBST(usdxrootdir)
-# add suffix option
-AC_ARG_WITH([suffix],
- [AS_HELP_STRING([--with-suffix=SUFFIX],
- [path suffix @<:@default=UltraStarDeluxe@:>@])],
- [suffix=$withval], [suffix="UltraStarDeluxe"])
-if [[ x$suffix = xno -o x$suffix = xyes ]] ; then
- AC_MSG_ERROR([Invalid suffix.]);
-fi
-
-# add logdir option
-AC_ARG_WITH([logrootdir],
- [AS_HELP_STRING([--with-logrootdir=DIR],
- [logging root directory @<:@default=/var/log@:>@])],
- [with_logrootdir=$withval], [with_logrootdir="/var/log"])
-
-# print misc options header
-AC_ARG_WITH([cfg-dummy3], [
-Development options:])
-
-# add dev_layout option
-AC_ARG_ENABLE(dev-build,
- [AS_HELP_STRING([--enable-dev-build],
- [local development build])],
- [enable_dev_build="yes"], [enable_dev_build="no"])
+# set sharerootdir to the resolved dataroot-dir for the config-*.inc file.
+# Pascal cannot handle shell-variables like ${prefix}
+AC_DEFINE_DIR(sharerootdir, datarootdir)
# -----------------------------------------
-# tools
+# find tools
# -----------------------------------------
# options for make command
@@ -130,6 +63,37 @@ AC_PROG_GREP
# macro declarations
# -----------------------------------------
+# AC_TRIM(STRING)
+# removes surrounding whitespace
+# -------------------------------------------
+AC_DEFUN([AC_TRIM],
+[echo "[$1]" | $SED 's/^[[ \t]]*//' | $SED 's/[[ \t]]*$//'
+])
+
+# AC_SUBST_DEFINE(DEFINE_SUFFIX, IS_DEFINED)
+# used to enable/disable pascal defines
+AC_DEFUN([AC_SUBST_DEFINE],
+[
+ if [[ x$2 = xyes ]]; then
+ DEFINE_[$1]=DEFINE
+ else
+ DEFINE_[$1]=UNDEF
+ fi
+ AC_SUBST(DEFINE_[$1])
+])
+
+# AC_SUBST_COMMENT(DEFINE_SUFFIX, IS_ENABLED)
+# used to enable/disable lines in a Makefile
+AC_DEFUN([AC_SUBST_COMMENT],
+[
+ if [[ x$2 = xyes ]]; then
+ COMMENT_[$1]=""
+ else
+ COMMENT_[$1]="#"
+ fi
+ AC_SUBST(COMMENT_[$1])
+])
+
# AC_SPLIT_VERSION(VARIABLE_PREFIX, VERSION)
# Splits version number ("major.minor.release") into its components.
# Sets
@@ -171,95 +135,206 @@ eof
AC_SUBST([$1][_VERSION_INT])
])
-# set to yes if a pkg-config error was skipped
-pkgconfig_error_skipped="no"
-
-# 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],
+# PKG_VALUE(VARIABLE_PREFIX, POSTFIX, COMMAND, MODULE, HELP-STRING)
+# -----------------------------------------------------
+AC_DEFUN([PKG_VALUE],
[
- 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"
+ AC_ARG_VAR([$1]_[$2], [$5, overriding pkg-config])
+ # check if variable was defined by the user
+ if test -z "$[$1]_[$2]"; then
+ # if not, get it from pkg-config
+ if test x$[$1][_HAVE] = xyes; then
+ PKG_CHECK_EXISTS([$4],
+ [[$1]_[$2]=`$PKG_CONFIG --[$3] --silence-errors "$4"`],
+ [# print error message and quit
+ err_msg=`$PKG_CONFIG --errors-to-stdout --print-errors "$4"`
+ AC_MSG_ERROR(
+[
+
+$err_msg
+
+If --with-[$1]=nocheck is defined the environment variable
+[$1]_[$2]
+must be set to avoid the need to call pkg-config.
+
+See the pkg-config man page for more details.
+])
+
+ ])
fi
+ fi
+ AC_SUBST([$1]_[$2])
+])
- 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
+# PKG_VERSION(VARIABLE_PREFIX, MODULE)
+# Checks version of a package
+# Parameters:
+# - VARIABLE_PREFIX: the prefix for the variables storing information about the package.
+# - MODULE: package name according to pkg-config
+# Sets:
+# [$VARIABLE_PREFIX]_VERSION # full version string (format: "major.minor.release")
+# [$VARIABLE_PREFIX]_VERSION_MAJOR # major version number
+# [$VARIABLE_PREFIX]_VERSION_MINOR # minor version number
+# [$VARIABLE_PREFIX]_VERSION_RELEASE # release version number
+# [$VARIABLE_PREFIX]_VERSION_INT # integer representation: MMMmmmrrr (M:major,m:minor,r:release)
+AC_DEFUN([PKG_VERSION],
+[
+ if test x$[$1][_HAVE] = xyes; then
+ AC_MSG_CHECKING([version of $1])
+ PKG_VALUE([$1], [VERSION], [modversion], [$2], [version of $1])
+ AC_MSG_RESULT(@<:@$[$1][_VERSION]@:>@)
else
- AC_MSG_CHECKING(for [$2])
+ [$1][_VERSION]="0.0.0"
fi
- if test x$have_lib = xno; then
+ AC_SPLIT_VERSION([$1], $[$1][_VERSION])
+])
+
+# PKG_HAVE(VARIABLE_PREFIX, MODULE, [REQUIRED])
+# Checks with pkg-config if a package exists and retrieves information
+# about it.
+# Parameters:
+# - VARIABLE_PREFIX: the prefix for the variables storing information about the package.
+# - MODULE: package name according to pkg-config
+# - REQUIRED: if true, the configure-script is aborted if the package was not found
+# Uses:
+# with_[$VARIABLE_PREFIX]: whether and how the package should be checked for
+# "check": check for the package but do not abort if it does not exist (default)
+# "no": do not check for the package (sets _HAVE to "no" and _VERSION to "0.0.0")
+# "yes": check for the package and abort if it does not exist
+# "nocheck": do not check for the package (sets _HAVE to "yes")
+# Sets:
+# [$VARIABLE_PREFIX]_HAVE # package is available (values: "yes"|"no")
+# [$VARIABLE_PREFIX]_LIBS # linker flags (e.g. -Lmylibdir -lmylib)
+# [$VARIABLE_PREFIX]_LIBDIRS # library dirs (e.g. -Lmylibdir)
+AC_DEFUN([PKG_HAVE],
+[
+ have_lib="no"
+ AC_MSG_CHECKING([for $2])
+ if test x"$with_[$1]" = xnocheck; then
+ # do not call pkg-config, use user settings
+ have_lib="yes"
+ elif test x"$with_[$1]" != xno; then
+ # check if package exists
+ PKG_CHECK_EXISTS([$2], [
+ have_lib="yes"
+ [$1][_LIBS]=`$PKG_CONFIG --libs --silence-errors "$2"`
+ [$1][_LIBDIRS]=`$PKG_CONFIG --libs-only-L --silence-errors "$2"`
+ [$1][_LIBDIRS]=`AC_TRIM($[$1][_LIBDIRS])`
+ # add library directories to LIBS (ignore *_LIBS for now)
+ if test -n "$[$1][_LIBDIRS]"; then
+ LIBS="$LIBS $[$1][_LIBDIRS]"
+ fi
+ ])
+ fi
+ if test x$have_lib = xyes; then
+ [$1][_HAVE]="yes"
+ if test -n "$[$1][_LIBDIRS]"; then
+ # show additional lib-dirs
+ AC_MSG_RESULT(yes [(]$[$1][_LIBDIRS][)])
+ else
+ AC_MSG_RESULT(yes)
+ fi
+ else
[$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_WARN([
-!!! Could not find the required library $2.
-]);
- # do not abort if skip-pkgconfig-errors is set
- if test x$skip_pkgconfig_errors = xno; then
- AC_MSG_ERROR([
-!!! Please install $2 and try again.
-!!!
-!!! If it is already installed check if "[$2].pc" is present in one
-!!! of the pkg-config search directories (e.g. /usr/lib/pkgconfig).
-!!!
-!!! If the file is present but not in the standard search path you may add
-!!! its directory by prepending "PKG_CONFIG_PATH=mylibs_dir/pkgconfig/" to
-!!! your configure call.
-!!! See the man-page on pkg-config for further information.
-!!!
-!!! Some linux distributions do not provide a .pc-file by the default
-!!! package so you might have to install a special dev-package.
-!!!
-!!! If all of this does not help you may consider to skip this error and
-!!! adjust the configuration file yourself.
-!!! To do this call "./configure --enable-skip-pkgconfig-errors ...".
+
+ # check if package is required
+ if test x$3 = xyes -o x"$with_[$1]" = xyes ; then
+ # print error message and quit
+ err_msg=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+ AC_MSG_ERROR(
+[
+
+$err_msg
+
+Alternatively, you may set --with-[$1]=nocheck and the environment
+variables [$1]_[[...]] (see configure --help)
+to appropriate values to avoid the need to call pkg-config.
+
+See the pkg-config man page for more details.
])
- else
- pkgconfig_error_skipped="yes"
- fi
- fi
+ fi
fi
])
+
+# -----------------------------------------
+# define switches
+# -----------------------------------------
+
+# print library options header
+AC_ARG_WITH([cfg-dummy1], [
+External Libraries:])
+
+# add portmixer option
+AC_ARG_WITH([portmixer],
+ [AS_HELP_STRING([--with-portmixer],
+ [enable portmixer audio-mixer support @<:@default=check@:>@])],
+ [with_portmixer=$withval], [with_portmixer="check"])
+
+# add projectM option
+AC_ARG_WITH([libprojectM],
+ [AS_HELP_STRING([--with-libprojectM],
+ [enable projectM visualization support @<:@default=no@:>@])],
+ [with_libprojectM=$withval], [with_libprojectM="no"])
+
+# print path options header
+AC_ARG_WITH([cfg-dummy2], [
+Additional directories:])
+
+# add suffix option
+AC_ARG_WITH([suffix],
+ [AS_HELP_STRING([--with-suffix=SUFFIX],
+ [path suffix @<:@default=UltraStarDeluxe@:>@])],
+ [suffix=$withval], [suffix="UltraStarDeluxe"])
+if [[ x$suffix = xno -o x$suffix = xyes ]] ; then
+ AC_MSG_ERROR([Invalid suffix.]);
+fi
+AC_SUBST(suffix)
+
+# add logdir option
+AC_ARG_WITH([logrootdir],
+ [AS_HELP_STRING([--with-logrootdir=DIR],
+ [logging root directory @<:@default=/var/log@:>@])],
+ [with_logrootdir=$withval], [with_logrootdir="/var/log"])
+AC_SUBST(logrootdir, [$with_logrootdir])
+
+# print misc options header
+AC_ARG_WITH([cfg-dummy3], [
+Development options:])
+
+LOCAL_BUILD="no"
+
+# add global option
+AC_ARG_ENABLE(global,
+ [AS_HELP_STRING([--enable-global],
+ [install into global folders (PREFIX/...) @<:@default=yes@:>@])],
+ [test $enableval = "no" && LOCAL_BUILD="yes"], [])
+
+# add local option
+AC_ARG_ENABLE(local,
+ [AS_HELP_STRING([--enable-local],
+ [install into local folders (../../...) (same as --disable-global) @<:@default=no@:>@]))],
+ [test $enableval = "yes" && LOCAL_BUILD="yes"], [])
+
+# add dev_layout option
+AC_ARG_ENABLE(dev-build,
+ [AS_HELP_STRING([--enable-dev-build],
+ [development build (implies local) @<:@default=no@:>@])],
+ [enable_dev_build=$enableval], [enable_dev_build="no"])
+if [[ x$enable_dev_build = xyes ]]; then
+ LOCAL_BUILD="yes"
+fi
+
+# set default Makefile install-target according to local/global build-type
+AC_SUBST_DEFINE(USE_LOCAL_DIRS, $LOCAL_BUILD)
+if [[ x$LOCAL_BUILD = xyes ]]; then
+ AC_SUBST(install_type, ["local"])
+else
+ AC_SUBST(install_type, ["global"])
+fi
+
+
# -----------------------------------------
# check for compilers
# -----------------------------------------
@@ -279,6 +354,8 @@ AC_LANG([C])
AC_PROG_CXX
AC_LANG([C++])
+AC_PROG_RANLIB
+
# find pkg-config
PKG_PROG_PKG_CONFIG()
if [[ x$PKG_CONFIG = x ]]; then
@@ -289,163 +366,80 @@ if [[ x$PKG_CONFIG = x ]]; then
fi
# -----------------------------------------
-# check for lazarus
-# -----------------------------------------
-
-# 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=`AS_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@:>@)
-
-# check if LCL Widget type is valid
-#if [[ x$with_lcl_widget_type = x ]]; then
-# # search for standard types
-# LCL_CHECK_WIDGET_TYPES="gtk2 gtk qt win32 carbon"
-#else
- # search for user defined type only
-# LCL_CHECK_WIDGET_TYPES="$with_lcl_widget_type"
-#fi
-
-# LCL widget specific base dir
-#LCL_UNIT_DIR="$LAZARUS_DIR/lcl/units/$FPC_PROCESSOR-$FPC_PLATFORM"
-
-# check for a supported widget type
-#LCL_WIDGET_TYPE=""
-#for widget_type in $LCL_CHECK_WIDGET_TYPES; do
-# widget_dir="$LCL_UNIT_DIR/$widget_type"
-# AC_MSG_CHECKING([whether LCL Widget Type "$widget_type" is supported])
-# if [[ -d "$widget_dir" ]]; then
-# LCL_WIDGET_TYPE=$widget_type
-# AC_MSG_RESULT(yes)
-# break
-# else
-# AC_MSG_RESULT(no)
-# fi
-#done
-
-# check if a widget type was found
-#if [[ x$LCL_WIDGET_TYPE = x ]]; then
-# AC_MSG_ERROR([
-#!!! Could not detect the LCL Widget Type.
-#!!! Specify the widget type with the --with-lcl-widget-type option.])
-#fi
-
-# -----------------------------------------
# check for libraries
# -----------------------------------------
+# libpng
+PKG_HAVE([libpng], [libpng], yes)
+
# find sdl
-AC_PKG_CHECK_VERSION(SDL, [sdl], yes)
+PKG_HAVE([sdl], [sdl], yes)
# find sqlite3
-AC_PKG_CHECK_VERSION(SQLITE3, [sqlite3], yes)
+PKG_HAVE([sqlite3], [sqlite3], yes)
-# find ffmpeg
+# find FFMpeg
# Note: do not use the min/max version parameters with ffmpeg
# otherwise it might fail in ubuntu due to a wrong version number
# format in ffmpeg's .pc-files.
# For example: 0d.51.1.2 instead of the correct 51.1.2.
-# A check for a version >=52.0.0 will return version 0d.51.1.2
+# A check for version >=52.0.0 will return version 0d.51.1.2
# although it is lower because pkg-config is confused by the 0d.
-# Use [mylib]_VERSION_INT instead
-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
+# Use [mylib]_VERSION_INT for version-checking instead
+PKG_HAVE([libavcodec], [libavcodec], yes)
+PKG_VERSION([libavcodec], [libavcodec])
+AC_CHECK_LIB([avcodec], [avcodec_decode_audio], [HAVE_AVCODEC_DECODE_AUDIO="yes"])
+AC_CHECK_LIB([avcodec], [avcodec_decode_audio2], [HAVE_AVCODEC_DECODE_AUDIO2="yes"])
+AC_CHECK_LIB([avcodec], [img_convert], [HAVE_IMG_CONVERT="yes"])
+PKG_HAVE([libavformat], [libavformat], yes)
+PKG_VERSION([libavformat], [libavformat])
+PKG_HAVE([libavutil], [libavutil], yes)
+PKG_VERSION([libavutil], [libavutil])
+if [[ x$libavcodec_HAVE = xyes -a x$libavformat_HAVE = xyes -a x$libavutil_HAVE = xyes ]]; then
+ ffmpeg_HAVE=yes
else
- FFMPEG_HAVE=no
+ ffmpeg_HAVE=no
fi
+AC_SUBST_DEFINE(HAVE_FFMPEG, $ffmpeg_HAVE)
-# 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/versions.pas
-# -----------------------------------------
-
-# 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_0_9, $PROJECTM_HAVE)
-AC_SUBST_DEFINE(HAVE_PROJECTM_1_0_PLUS, $PROJECTM_HAVE)
-
-AC_SUBST(PORTAUDIO_LIB)
-AC_SUBST_DEFINE(HAVE_PORTAUDIO, $PORTAUDIO_HAVE)
-
-AC_SUBST(PORTMIXER_LIB)
-AC_SUBST_DEFINE(HAVE_PORTMIXER, $PORTMIXER_HAVE)
+# find FFMpeg's swscale lib (just if FFMpeg is compiled in GPL mode)
+PKG_HAVE([libswscale], [libswscale], no)
+PKG_VERSION([libswscale], [libswscale])
+AC_SUBST_DEFINE(HAVE_SWSCALE, $libswscale_HAVE)
-#AC_SUBST(LAZARUS_DIR)
-#AC_SUBST(LCL_WIDGET_TYPE)
-AC_SUBST_DEFINE(USE_LOCAL_DIRS, $enable_dev_build)
-if [[ x$enable_dev_build = xyes ]]; then
- AC_SUBST(install_type, ["dev"])
+# find projectM version
+libprojectM_PKG="libprojectM >= 0.98"
+PKG_HAVE([libprojectM], [$libprojectM_PKG], no)
+PKG_VERSION([libprojectM], [$libprojectM_PKG])
+AC_SUBST_DEFINE(HAVE_PROJECTM, $libprojectM_HAVE)
+# get projectM include-dir
+PKG_VALUE([libprojectM], [INCLUDEDIR], [variable=includedir], [$libprojectM_PKG],
+ [C-Header include-dir (e.g. /usr/include)])
+# get projectM data-dir (for preset- and font-dir)
+PKG_VALUE([libprojectM], [DATADIR], [variable=pkgdatadir], [$libprojectM_PKG],
+ [projectM data-directory for presets etc. (e.g. /usr/share/projectM)])
+# check if we need the c-wrapper
+if [[ "$libprojectM_VERSION_MAJOR" -ge 1 ]]; then
+ libprojectM_NEEDS_CWRAPPER=yes
else
- AC_SUBST(install_type, ["release"])
+ libprojectM_NEEDS_CWRAPPER=no
fi
-AC_SUBST(suffix)
-AC_SUBST(logrootdir, [$with_logrootdir])
-AC_DEFINE_DIR(sharerootdir, datarootdir)
-
-#AC_SUBST(LDFLAGS)
-#AC_SUBST(LIBS)
-
-AC_SUBST(PLIBS)
-AC_SUBST(PACKAGE_WEBSITE)
+AC_SUBST_COMMENT(PROJECTM_CWRAPPER, $libprojectM_NEEDS_CWRAPPER)
+
+# find portaudio
+PKG_HAVE([portaudio], [portaudio-2.0], yes)
+PKG_VERSION([portaudio], [portaudio-2.0])
+AC_SUBST_DEFINE(HAVE_PORTAUDIO, $portaudio_HAVE)
+# find portmixer
+PKG_HAVE([portmixer], [portmixer], no)
+AC_SUBST_DEFINE(HAVE_PORTMIXER, $portmixer_HAVE)
+
+# determine linker-flags
+#LDFLAGS=
+#LIBS=
+AC_SUBST(LDFLAGS)
+AC_SUBST(LIBS)
# -----------------------------------------
# create output files
@@ -453,6 +447,10 @@ AC_SUBST(PACKAGE_WEBSITE)
AC_CONFIG_FILES([config-linux.inc:config.inc.in])
AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([$usdxroot/Tools/ResourceExtractor/Makefile])
+if [[ x$libprojectM_NEEDS_CWRAPPER = xyes ]]; then
+ AC_CONFIG_FILES([lib/projectM/cwrapper/Makefile])
+fi
AC_OUTPUT
# -----------------------------------------
@@ -494,13 +492,4 @@ AC_MSG_NOTICE([
#!!! You might as well ask for help at the IRC-Channel
#!!! $PACKAGE_IRC
-if [[ x$pkgconfig_error_skipped = xyes ]]; then
- AC_MSG_WARN([
-??? pkg-config did not find all of the required libraries.
-??? Edit "config-linux.inc" to add the missing parts.
-??? If one of your libraries' directories is not in the linker's
-??? search-path add it to the LDFLAGS environment variable and
-??? rerun configure (e.g. ./configure LDFLAGS="-Lmylibdir" ...).
-])
-fi
diff --git a/Game/Code/m4/fpc.m4 b/Game/Code/m4/fpc.m4
index 51ebfc63..e2b0cfbc 100644
--- a/Game/Code/m4/fpc.m4
+++ b/Game/Code/m4/fpc.m4
@@ -16,77 +16,93 @@ dnl **
AC_DEFUN([AC_PROG_FPC], [
-AC_ARG_VAR(PFLAGS, [Free Pascal Compiler flags])
+AC_ARG_VAR(PFLAGS, [Free Pascal Compiler flags (replaces all other flags)])
+AC_ARG_VAR(PFLAGS_DEBUG, [Free Pascal Compiler debug flags @<:@-gl -Coi -Xs- -vew -dDEBUG_MODE@:>@])
+AC_ARG_VAR(PFLAGS_RELEASE, [Free Pascal Compiler release flags @<:@-O2 -Xs -vew@:>@])
+AC_ARG_VAR(PFLAGS_EXTRA, [Free Pascal Compiler additional flags])
+
+dnl set DEBUG/RELEASE flags to default-values if unset
+
+dnl - Do not use -dDEBUG because this will enable range-checks that will fail with USDX.
+dnl - Disable -Xs which is defined in fpc.cfg (TODO: is this necessary?).
+dnl - For FPC we have to use DEBUG_MODE instead of DEBUG to enable the apps debug-mode
+dnl because DEBUG enables some additional compiler-flags in fpc.cfg too
+PFLAGS_DEBUG=${PFLAGS_DEBUG-"-gl -Cit -Xs- -vew -dDEBUG_MODE"}
+dnl -dRELEASE works too but we define our own settings
+PFLAGS_RELEASE=${PFLAGS_RELEASE-"-O2 -Xs -vew"}
+
AC_ARG_ENABLE(dummy_fpc1,[
Free Pascal Compiler specific options:])
AC_ARG_WITH(fpc,
- [AS_HELP_STRING([--with-fpc],
+ [AS_HELP_STRING([--with-fpc=DIR],
[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 do not use -dDEBUG because this will enable range-checks
-dnl that will fail with USDX.
-dnl we have to disable -Xs which is defined in fpc.cfg.
-AC_ARG_WITH(debug-flags,
- [AS_HELP_STRING([--with-debug-flags],
- [FPC debug flags @<:@-gl -Coi -Xs- -vew@:>@])],
- [PFLAGS_DEBUG="$withval"],
- [PFLAGS_DEBUG="-gl -Cit -Xs- -vew"])
+ [Enable FPC release options @<:@default=yes@:>@])],
+ [test $enableval = "no" && FPC_DEBUG="yes"], [])
-dnl -dRELEASE works too but we define our own settings
-AC_ARG_WITH(release-flags,
- [AS_HELP_STRING([--with-release-flags],
- [FPC release flags @<:@-O2 -Xs -vew@:>@])],
- [PFLAGS_RELEASE="$withval"],
- [PFLAGS_RELEASE="-O2 -Xs -vew"])
-
-dnl the user's PFLAGS must *follow* this script's flags
-dnl to enable the user to overwrite the settings.
-if test x$FPC_DEBUG = xyes; then
- PFLAGS="$PFLAGS_DEBUG $PFLAGS"
-else
- PFLAGS="$PFLAGS_RELEASE $PFLAGS"
-fi
+AC_ARG_ENABLE(debug,
+ [AS_HELP_STRING([--enable-debug],
+ [Enable FPC debug options (= --disable-release) @<:@default=no@:>@])],
+ [test $enableval = "yes" && FPC_DEBUG="yes"], [])
AC_ARG_ENABLE(profile,
[AS_HELP_STRING([--enable-profile],
- [Enable FPC profiling options])],
- [PFLAGS="-pg $PFLAGS"], [])
+ [Enable FPC profiling options @<:@default=no@:>@])],
+ [PFLAGS_EXTRA="$PFLAGS_EXTRA -pg"], [])
+
+
+dnl ** set PFLAGS depending on whether it is already set by the user
+dnl Note: the user's PFLAGS must *follow* this script's flags
+dnl to enable the user to overwrite the settings.
+if test x${PFLAGS+assigned} = x; then
+dnl PFLAGS not set by the user
+ if test x$FPC_DEBUG = xyes; then
+ PFLAGS="$PFLAGS_DEBUG"
+ PFLAGS_MAKE="[\$](PFLAGS_DEBUG)"
+ else
+ PFLAGS="$PFLAGS_RELEASE"
+ PFLAGS_MAKE="[\$](PFLAGS_RELEASE)"
+ fi
+else
+dnl PFLAGS set by the user, just add additional flags
+ PFLAGS="$PFLAGS"
+ PFLAGS_MAKE="$PFLAGS"
+fi
+
+dnl ** find compiler executable
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)
+ AC_CHECK_PROGS(FPCMAKE, [fpcmake])
else
AC_PATH_PROGS(PPC, $PPC_CHECK_PROGS, [], $PPC_PATH)
+ AC_PATH_PROGS(FPCMAKE, [fpcmake], [], $PPC_PATH)
fi
if test -z "$PPC"; then
AC_MSG_ERROR([no Free Pascal Compiler found in $PPC_PATH])
fi
+if test -z "$FPCMAKE"; then
+ AC_MSG_ERROR([fpcmake not 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`
+FPC_VERSION=`${PPC} -iV`
+FPC_PLATFORM=`${PPC} -iTO`
+FPC_PROCESSOR=`${PPC} -iTP`
+
if test "x$prefix" != xNONE; then
FPC_PREFIX=$prefix
else
@@ -94,27 +110,33 @@ else
fi
FPC_BASE_PATH="${FPC_PREFIX}/lib/fpc/${FPC_VERSION}"
FPC_UNIT_PATH="${FPC_BASE_PATH}/units/${FPC_PLATFORM}"
+
AC_SUBST(PFLAGS)
+AC_SUBST(PFLAGS_MAKE)
+AC_SUBST(PFLAGS_EXTRA)
AC_SUBST(PFLAGS_DEBUG)
AC_SUBST(PFLAGS_RELEASE)
+
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)
])
+PFLAGS_TEST="$PFLAGS $PFLAGS_EXTRA"
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,
+[AC_CACHE_CHECK([whether the Free Pascal Compiler ($PPC $PFLAGS_TEST) works], ac_cv_prog_ppc_works,
[
rm -f conftest*
echo "program foo; begin writeln; end." > conftest.pp
-${PPC} ${PFLAGS} conftest.pp >> config.log
+${PPC} ${PFLAGS_TEST} conftest.pp >> config.log
if test -f conftest || test -f conftest.exe; then
dnl *** It works!
@@ -135,11 +157,11 @@ 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,
+[AC_CACHE_CHECK([whether the Free Pascal Compiler ($PPC $PFLAGS_TEST) 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
+${PPC} ${PFLAGS_TEST} conftest.pp >> config.log
if test -f conftest || test -f conftest.exe; then
ac_cv_prog_ppc_links="yes"
else