Cleanup configure.ac
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4714 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
4c10f714c5
commit
afc1ed6605
232
configure.ac
232
configure.ac
|
@ -1,8 +1,8 @@
|
|||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_PREREQ([2.56])
|
||||
AC_INIT([Warzone 2100],[TRUNK],[http://wz2100.net/],[warzone2100])
|
||||
AM_INIT_AUTOMAKE([1.8])
|
||||
AM_INIT_AUTOMAKE([1.10])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_SRCDIR([lib/framework/frame.c])
|
||||
|
@ -11,7 +11,7 @@ AC_CONFIG_SRCDIR([lib/framework/frame.c])
|
|||
# HACK
|
||||
# Workaround stupid autoconf CFLAGS default
|
||||
# (Bash considers set but empty variables different from null for the ${VAR:+alt} operator)
|
||||
CFLAGS=${CFLAGS}
|
||||
CFLAGS="${CFLAGS}"
|
||||
|
||||
|
||||
# Checks for programs.
|
||||
|
@ -31,17 +31,15 @@ if test "x$LEX" != "xflex" ; then
|
|||
AC_MSG_ERROR([Flex is not installed])
|
||||
fi
|
||||
|
||||
|
||||
# Check for pkg-config
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
|
||||
# Enable Compiler/LibC GNU extensions
|
||||
AC_GNU_SOURCE
|
||||
|
||||
# Check for gettext
|
||||
AM_GNU_GETTEXT([external])
|
||||
|
||||
# Check for pkg-config
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
|
||||
# Check for compiler
|
||||
case ${CC} in
|
||||
|
@ -56,7 +54,7 @@ case ${host_os} in
|
|||
*mingw32*)
|
||||
host_os_mingw32=yes
|
||||
AC_CHECK_TOOL([WINDRES], [windres], AC_MSG_ERROR([windres not found]))
|
||||
WIN32_LIBS='-lz -lintl -liconv -ldbghelp -lshfolder -lwinmm -lwsock32'
|
||||
WIN32_LIBS='-ldbghelp -lshfolder -lwinmm -lwsock32'
|
||||
AC_SUBST([WIN32_LIBS], [${WIN32_LIBS}])
|
||||
;;
|
||||
*)
|
||||
|
@ -65,31 +63,34 @@ case ${host_os} in
|
|||
esac
|
||||
AM_CONDITIONAL([MINGW32], test "x$host_os_mingw32" = "xyes")
|
||||
|
||||
|
||||
# Set compilers to use when building for the build system in a cross compile build
|
||||
# Fallback to the system compilers
|
||||
if test "x$CXX_FOR_BUILD" = "x" ; then
|
||||
CXX_FOR_BUILD=${CXX}
|
||||
CXX_FOR_BUILD="${CXX}"
|
||||
fi
|
||||
AC_SUBST(CXX_FOR_BUILD)
|
||||
AC_SUBST([CXX_FOR_BUILD])
|
||||
|
||||
if test "x$CC_FOR_BUILD" = "x" ; then
|
||||
CC_FOR_BUILD=${CC}
|
||||
CC_FOR_BUILD="${CC}"
|
||||
fi
|
||||
AC_SUBST(CC_FOR_BUILD)
|
||||
AC_SUBST([CC_FOR_BUILD])
|
||||
|
||||
# Installation directories
|
||||
|
||||
AC_ARG_WITH(icondir,
|
||||
AS_HELP_STRING([--with-icondir=DIR],[icon files [DATADIR/icons]]),
|
||||
[ with_icondir=${withval} ], [ with_icondir=${datadir}/icons ])
|
||||
if test "x$CPPFLAGS_FOR_BUILD" = "x" ; then
|
||||
CPPFLAGS_FOR_BUILD="${CPPFLAGS}"
|
||||
fi
|
||||
AC_SUBST([CPPFLAGS_FOR_BUILD])
|
||||
|
||||
|
||||
AC_ARG_WITH(applicationdir,
|
||||
AS_HELP_STRING([--with-applicationdir=DIR],[application files [DATADIR/applications]]),
|
||||
[ with_applicationdir=${withval} ], [ with_applicationdir=${datadir}/applications ])
|
||||
# pkg-config hooks:
|
||||
|
||||
if test "x$PKGCONFIG_PREFIX" != "x" ; then
|
||||
PKG_CONFIG="${PKG_CONFIG} --define-variable=prefix=${PKGCONFIG_PREFIX}"
|
||||
fi
|
||||
|
||||
|
||||
AC_SUBST([icondir], [${with_icondir}])
|
||||
AC_SUBST([applicationdir], [${with_applicationdir}])
|
||||
# Variable fixes for older autoconf versions:
|
||||
|
||||
if test "x$docdir" = "x" ; then
|
||||
AC_SUBST([docdir], [${datarootdir}/doc/${AC_PACKAGE_TARNAME}])
|
||||
fi
|
||||
|
@ -98,10 +99,23 @@ if test "x$localedir" = "x" ; then
|
|||
fi
|
||||
|
||||
|
||||
# Commandline options:
|
||||
# Installation directories
|
||||
|
||||
AC_ARG_WITH(icondir,
|
||||
AS_HELP_STRING([--with-icondir=DIR],[icon files [DATADIR/icons]]),
|
||||
[ with_icondir=${withval} ], [ with_icondir=${datadir}/icons ])
|
||||
AC_SUBST([icondir], [${with_icondir}])
|
||||
|
||||
AC_ARG_WITH(applicationdir,
|
||||
AS_HELP_STRING([--with-applicationdir=DIR],[application files [DATADIR/applications]]),
|
||||
[ with_applicationdir=${withval} ], [ with_applicationdir=${datadir}/applications ])
|
||||
AC_SUBST([applicationdir], [${with_applicationdir}])
|
||||
|
||||
|
||||
# Commandline options - enable:
|
||||
|
||||
AC_ARG_ENABLE([installer],
|
||||
AS_HELP_STRING([--enable-installer],[Build NSIS installer [no]]),
|
||||
AS_HELP_STRING([--enable-installer], [Build NSIS installer [no]]),
|
||||
[ enable_installer=${enableval} ], [ enable_installer=no ])
|
||||
AM_CONDITIONAL(INSTALLER, test "x$enable_installer" = "xyes")
|
||||
AC_MSG_CHECKING([whether to build NSIS installer])
|
||||
|
@ -111,83 +125,29 @@ AC_ARG_ENABLE([static],
|
|||
AS_HELP_STRING([--enable-static], [Link statically [no]]),
|
||||
[ enable_static=${enableval} ], [ enable_static=no ])
|
||||
if test "x$enable_static" = "xyes" ; then
|
||||
PKG_CONFIG="${PKG_CONFIG} --static"
|
||||
# Add libs where even pkg-config cannot help statically linking them,
|
||||
# where one would otherwise have to provide them via commandline
|
||||
WIN32_LIBS="${WIN32_LIBS} -lz -lintl -liconv"
|
||||
# Tell pkg-config to link against static libraries, incl. all dependencies
|
||||
PKG_CONFIG="${PKG_CONFIG} --static"
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(distributor,
|
||||
AS_HELP_STRING([--with-distributor],[Name of distributor compiling this package]))
|
||||
if test "x$with_distributor" = "x" ; then
|
||||
AC_DEFINE([PACKAGE_DISTRIBUTOR], "UNKNOWN", [Name of distributor compiling this package])
|
||||
else
|
||||
AC_DEFINE_UNQUOTED([PACKAGE_DISTRIBUTOR], ["${with_distributor}"], [Name of distributor compiling this package])
|
||||
fi
|
||||
|
||||
|
||||
AC_ARG_WITH(makensis,
|
||||
AS_HELP_STRING([--with-makensis],[Path to makensis]))
|
||||
|
||||
AC_ARG_WITH(nsis_compression,
|
||||
AS_HELP_STRING([--with-nsis-compression],[Compression method to use when building NSIS [lzma]]))
|
||||
if test "x$with_nsis_compression" = "x" ; then
|
||||
# The default compression method is LZMA
|
||||
NSIS_COMPRESSION="lzma"
|
||||
else
|
||||
NSIS_COMPRESSION="${with_nsis_compression}"
|
||||
fi
|
||||
AC_SUBST(NSIS_COMPRESSION)
|
||||
|
||||
|
||||
AC_ARG_WITH(installer_libdir,
|
||||
AS_HELP_STRING([--with-installer-extdir],[Path to external data for NSIS script]))
|
||||
|
||||
|
||||
AC_ARG_WITH(installer_version,
|
||||
AS_HELP_STRING([--with-installer-version],[Version of the installer. i.e. 1.2.3.4]))
|
||||
|
||||
|
||||
if test "x$enable_installer" = "xyes" ; then
|
||||
if test "x$with_makensis" = "x" ; then
|
||||
AC_CHECK_TOOL([MAKENSIS], [makensis], [no])
|
||||
if test "x$MAKENSIS" = "xno" ; then
|
||||
AC_MSG_ERROR([makensis not found])
|
||||
fi
|
||||
else
|
||||
AC_MSG_CHECKING([for makensis])
|
||||
AC_MSG_RESULT([${with_makensis}])
|
||||
AC_SUBST([MAKENSIS], [${with_makensis}])
|
||||
fi
|
||||
if test "x$with_installer_version" = "x" ; then
|
||||
AC_MSG_ERROR([installer version invalid])
|
||||
else
|
||||
AC_MSG_CHECKING([for installer version])
|
||||
AC_MSG_RESULT([${with_installer_version}])
|
||||
AC_SUBST([INSTALLER_VERSION], [${with_installer_version}])
|
||||
fi
|
||||
if test "x$with_installer_extdir" = "x" ; then
|
||||
AC_MSG_ERROR([installer external dir not found])
|
||||
else
|
||||
AC_MSG_CHECKING([for installer extdir])
|
||||
AC_MSG_RESULT([${with_installer_extdir}])
|
||||
AC_SUBST([INSTALLER_EXTDIR], [${with_installer_extdir}])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# -O0 turns off all optimizations; this is necessary for accurate debugging
|
||||
# -Wno-unused-label is necessary because flex produces unused labels that we cannot fix
|
||||
# Add later for stricter checking: -Wextra -Wmissing-declarations -Wstrict-prototypes
|
||||
AC_ARG_ENABLE(debug,
|
||||
AC_ARG_ENABLE([debug],
|
||||
AS_HELP_STRING([--enable-debug[=yes/relaxed/profile/debugprofile/no]],[Compile debug version [yes]]),
|
||||
[ enable_debug=${enableval} ], [ enable_debug=yes ])
|
||||
AC_MSG_CHECKING([whether to compile in debug mode])
|
||||
AC_MSG_RESULT([${enable_debug}])
|
||||
|
||||
if test "x$enable_debug" = "xyes" ; then
|
||||
if test "x$cc_icc" = "xyes" ; then
|
||||
WZ_CFLAGS="${WZ_CFLAGS} -O0 -g -Wcheck -Werror"
|
||||
WZ_CPPFLAGS="${WZ_CPPFLAGS} -DDEBUG"
|
||||
else
|
||||
WZ_CFLAGS="${WZ_CFLAGS} -O0 -g -Wall -Werror -Wno-unused-label -Wno-pointer-to-int-cast -Wmissing-field-initializers -Wcast-align -Wwrite-strings"
|
||||
WZ_CFLAGS="${WZ_CFLAGS} -Wmissing-declarations -Wstrict-prototypes -fstack-protector-all -Wpointer-arith"
|
||||
WZ_CFLAGS="${WZ_CFLAGS} -O0 -g -fstack-protector-all -Wall -Werror -Wno-unused-label -Wno-pointer-to-int-cast -Wmissing-field-initializers -Wcast-align -Wwrite-strings"
|
||||
WZ_CFLAGS="${WZ_CFLAGS} -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith"
|
||||
WZ_CPPFLAGS="${WZ_CPPFLAGS} -DDEBUG"
|
||||
fi
|
||||
elif test "x$enable_debug" = "xrelaxed" ; then
|
||||
|
@ -205,29 +165,72 @@ else
|
|||
fi
|
||||
|
||||
|
||||
# Commandline options - with:
|
||||
|
||||
AC_ARG_WITH([distributor],
|
||||
AS_HELP_STRING([--with-distributor], [Name of distributor compiling this package]),
|
||||
[ with_distributor=${withval} ], [ with_applicationdir="UNKNOWN" ])
|
||||
AC_DEFINE_UNQUOTED([PACKAGE_DISTRIBUTOR], ["${with_distributor}"], [Name of distributor compiling this package])
|
||||
|
||||
AC_ARG_WITH([makensis],
|
||||
AS_HELP_STRING([--with-makensis], [Path to makensis]))
|
||||
|
||||
AC_ARG_WITH([installer_compression],
|
||||
AS_HELP_STRING([--with-installer-compression], [Compression method to use when building NSIS [lzma]]),
|
||||
[ with_installer_compression=${withval} ], [ with_installer_compression="lzma" ])
|
||||
AC_SUBST([INSTALLER_COMPRESSION], [${with_installer_compression}])
|
||||
|
||||
AC_ARG_WITH([installer_extdir],
|
||||
AS_HELP_STRING([--with-installer-extdir], [Path to external data for NSIS script]))
|
||||
|
||||
AC_ARG_WITH([installer_version],
|
||||
AS_HELP_STRING([--with-installer-version], [4-tuble version of the installer. i.e. 1.2.3.4]))
|
||||
|
||||
if test "x$enable_installer" = "xyes" ; then
|
||||
if test "x$with_makensis" = "x" ; then
|
||||
AC_CHECK_TOOL([MAKENSIS], [makensis], [no])
|
||||
if test "x$MAKENSIS" = "xno" ; then
|
||||
AC_MSG_ERROR([makensis not found])
|
||||
fi
|
||||
else
|
||||
AC_MSG_CHECKING([for makensis])
|
||||
AC_MSG_RESULT([${with_makensis}])
|
||||
AC_SUBST([MAKENSIS], [${with_makensis}])
|
||||
fi
|
||||
# Doing that check here, because without enable-installer it is not an error
|
||||
if test "x$with_installer_version" = "x" ; then
|
||||
AC_MSG_ERROR([installer version invalid])
|
||||
else
|
||||
AC_MSG_CHECKING([for installer version])
|
||||
AC_MSG_RESULT([${with_installer_version}])
|
||||
AC_SUBST([INSTALLER_VERSION], [${with_installer_version}])
|
||||
fi
|
||||
# Doing that check here, because without enable-installer it is not an error
|
||||
if test "x$with_installer_extdir" = "x" ; then
|
||||
AC_MSG_ERROR([installer external dir not found])
|
||||
else
|
||||
AC_MSG_CHECKING([for installer extdir])
|
||||
AC_MSG_RESULT([${with_installer_extdir}])
|
||||
AC_SUBST([INSTALLER_EXTDIR], [${with_installer_extdir}])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Checks for modules:
|
||||
|
||||
if test "x$PKGCONFIG_PREFIX" != "x" ; then
|
||||
PKG_CONFIG="${PKG_CONFIG} --define-variable=prefix=${PKGCONFIG_PREFIX}"
|
||||
fi
|
||||
|
||||
if test "x$host_os_mingw32" = "xyes" ; then
|
||||
PKG_CHECK_MODULES([FONTCONFIG], [fontconfig])
|
||||
PKG_CHECK_MODULES([FREETYPE], [freetype2])
|
||||
|
||||
AC_CHECK_LIB(iberty, main, AC_SUBST([IBERTY_LIBS], [-liberty]), AC_MSG_ERROR([libiberty not found.]))
|
||||
|
||||
AC_CHECK_HEADER(bfd.h, , AC_MSG_ERROR([BFD header not found.]))
|
||||
AC_CHECK_LIB(bfd, bfd_openr, AC_SUBST([BFD_LIBS], [-lbfd]), AC_MSG_ERROR([BFD not found.]), [${IBERTY_LIBS}])
|
||||
|
||||
WIN32_LIBS="${WIN32_LIBS} ${FONTCONFIG_LIBS} ${FREETYPE_LIBS} ${BFD_LIBS} ${IBERTY_LIBS}"
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES([SDL], [sdl >= 1.2])
|
||||
PKG_CHECK_MODULES([OPENAL], [openal >= 0.0.8])
|
||||
PKG_CHECK_MODULES([PNG], [libpng >= 1.2])
|
||||
PKG_CHECK_MODULES([OGGVORBIS], [vorbisfile >= 1.1])
|
||||
|
||||
if test "x$enable_static" = "xyes" ; then
|
||||
# If linking statically, make sure to include the direct dependencies of
|
||||
# QuesoGLC as well, because it does not have a pkg-config file.
|
||||
# FIXME Remove this whenever QuesoGLC has a pkg-config file
|
||||
PKG_CHECK_MODULES([FONTCONFIG], [fontconfig])
|
||||
PKG_CHECK_MODULES([FREETYPE], [freetype2])
|
||||
fi
|
||||
|
||||
|
||||
# Checks for libraries:
|
||||
|
||||
|
@ -266,8 +269,24 @@ AC_CHECK_LIB(GLC, main,
|
|||
AC_CHECK_LIB(glc32, main,
|
||||
OPENGLC_LIBS="-lglc32",
|
||||
AC_MSG_ERROR([OpenGLC library not found. Please install QuesoGLC: http://quesoglc.sourceforge.net/])))
|
||||
if test "x$enable_static" = "xyes" ; then
|
||||
# If linking statically, make sure to link against the direct dependencies, too.
|
||||
# FIXME Remove this whenever QuesoGLC has a pkg-config file
|
||||
OPENGLC_LIBS="${OPENGLC_LIBS} ${FONTCONFIG_LIBS} ${FREETYPE_LIBS}"
|
||||
fi
|
||||
AC_SUBST([OPENGLC_LIBS], [${OPENGLC_LIBS}])
|
||||
|
||||
# When (cross-)compiling for Windows (MinGW) we need to link in BFD and iberty
|
||||
# for the Dr. MinGW derived exception handler.
|
||||
if test "x$host_os_mingw32" = "xyes" ; then
|
||||
AC_CHECK_LIB(iberty, main, AC_SUBST([IBERTY_LIBS], [-liberty]), AC_MSG_ERROR([libiberty not found.]))
|
||||
|
||||
AC_CHECK_HEADER(bfd.h, , AC_MSG_ERROR([BFD header not found.]))
|
||||
AC_CHECK_LIB(bfd, bfd_openr, AC_SUBST([BFD_LIBS], [-lbfd]), AC_MSG_ERROR([BFD not found.]), [${IBERTY_LIBS}])
|
||||
|
||||
WIN32_LIBS="${WIN32_LIBS} ${BFD_LIBS} ${IBERTY_LIBS}"
|
||||
fi
|
||||
|
||||
|
||||
WZ_CPPFLAGS="${WZ_CPPFLAGS} -DDATADIR=\"\\\"\${datadir}/\${PACKAGE}\\\"\""
|
||||
WZ_CPPFLAGS="${WZ_CPPFLAGS} -DLOCALEDIR=\"\\\"\${localedir}\\\"\""
|
||||
|
@ -277,11 +296,6 @@ WZ_CPPFLAGS="${WZ_CPPFLAGS} -I\$(top_srcdir)"
|
|||
AC_SUBST([WZ_CPPFLAGS], [${WZ_CPPFLAGS}])
|
||||
AC_SUBST([WZ_CFLAGS], [${WZ_CFLAGS}])
|
||||
|
||||
if test "x$CPPFLAGS_FOR_BUILD" = "x" ; then
|
||||
CPPFLAGS_FOR_BUILD=${CPPFLAGS}
|
||||
fi
|
||||
AC_SUBST(CPPFLAGS_FOR_BUILD)
|
||||
|
||||
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AC_CONFIG_FILES([Makefile
|
||||
|
|
Loading…
Reference in New Issue