xqf/configure.ac
2015-02-09 12:20:48 +01:00

233 lines
6.8 KiB
Plaintext

#
# Autoconf support for XQF
# Initially written by Markus Fischer <mfischer@josefine.ben.tuwien.ac.at>
#
AC_INIT([XQF],[1.0.6.2],[xqf-developer@lists.sourceforge.net], [xqf])
AC_CONFIG_SRCDIR([src/xqf.c])
AC_PREREQ(2.52)
AM_INIT_AUTOMAKE
dnl AM_CONFIG_HEADER(src/gnuconfig.h:src/gnuconfig.h.in)
AM_CONFIG_HEADER(src/gnuconfig.h)
AM_GLIB_GNU_GETTEXT
IT_PROG_INTLTOOL([0.40.0])
GETTEXT_PACKAGE=xqf
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext domain name.])
dnl Checks for programs.
AC_PROG_CC
AC_ISC_POSIX
AC_PROG_LN_S
AC_PROG_RANLIB
dnl Checks for header files.
AC_HEADER_STDC
#The Release stuff for the spec file.
RELEASE="1"
AC_ARG_WITH(rpm_release,[ --with-rpm-release=VAL RPM Release (e.g. 1mdk)])
if test "x$with_rpm_release" != "x" ; then
RELEASE="$with_rpm_release"
fi
AC_SUBST(RELEASE)
pkg_modules="gtk+-2.0 >= 2.0.0 gdk-pixbuf-xlib-2.0 x11"
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
AC_SUBST(PACKAGE_CFLAGS)
AC_SUBST(PACKAGE_LIBS)
dnl check for qstat
AC_ARG_WITH(qstat,[ --with-qstat=CMD use CMD to run qstat])
AC_MSG_CHECKING(qstat version)
QSTATEXEC="qstat"
if test "x$with_qstat" != "x" ; then
QSTATEXEC="$with_qstat"
fi
qstat_version=`$QSTATEXEC 2>/dev/null | grep version | cut -d' ' -f 3`
if test "x$qstat_version" = "x" ; then
AC_MSG_RESULT(qstat not found)
qstat_is=notfound
else
AC_MSG_RESULT($qstat_version)
fi
AC_SUBST(QSTATEXEC)
AC_CHECK_HEADER(zlib.h,,[AC_MSG_ERROR([zlib.h not found, please install zlib development files])])
AC_CHECK_LIB(z, crc32,[AC_DEFINE([HAVE_LIBZ],[],[Whether libz is installed])],[AC_MSG_ERROR([libz not found])])
dnl determine if we should include readline support...
dnl ripped from physfs package
dnl AC_ARG_ENABLE(readline,
dnl AC_HELP_STRING([--enable-externalrcon],[compile external rcon program (default=yes)])
dnl , ,enable_rcon=yes)
XQFRCON_LIBS=
AC_ARG_ENABLE(externalrcon,[ --enable-externalrcon compile external rcon program (default=no)])
if test x$enable_externalrcon = xyes; then
AC_CHECK_HEADER(readline/readline.h, have_readline_hdr=yes)
AC_CHECK_LIB(readline, readline, have_readline_lib=yes)
AC_CHECK_HEADER(readline/history.h, have_history_hdr=yes)
AC_CHECK_LIB(readline, add_history, have_history_lib=yes)
if test x$have_readline_hdr = xyes -a x$have_readline_lib = xyes; then
if test x$have_history_hdr = xyes -a x$have_history_lib = xyes; then
XQFRCON_LIBS="-lreadline"
AC_SUBST(XQFRCON_LIBS)
else
AC_MSG_WARN([libreadline not found, rcon program disabled])
fi
else
AC_MSG_WARN([libreadline not found, rcon program disabled])
fi
fi
AM_CONDITIONAL(BUILD_XQFRCON, test "x$XQFRCON_LIBS" != x)
dnl determine whether GeoIP should be used
AC_CHECK_HEADER(GeoIP.h,have_geoip_hdr=yes,have_geoip_hdr=no)
AC_MSG_CHECKING([whether GeoIP should be used])
AC_ARG_ENABLE(geoip,[ --enable-geoip use GeoIP (default=auto)],USE_GEOIP=$enableval, USE_GEOIP=yes)
AC_MSG_RESULT([$USE_GEOIP])
# --enable-geoip-dummy=/usr/lib/libGeoIP.so
AC_MSG_CHECKING([whether a GeoIP dummy library should be used])
AC_ARG_ENABLE(geoip_dummy,
[ --enable-geoip-dummy=FILE use dummy GeoIP lib based on FILE (default=no)],
use_geoip_dummy="$enableval", use_geoip_dummy=no)
AC_MSG_RESULT([$use_geoip_dummy])
if test "x$USE_GEOIP" != "xno"; then
if test "x$have_geoip_hdr" = "xyes";then
AC_DEFINE_UNQUOTED(USE_GEOIP,1,Define if we should use GeoIP)
if test "x$USE_GEOIP" = "xyes"; then
if test "x$use_geoip_dummy" != "xno"; then
DUMMY_LIBGEOIP_SONAME=`objdump -p "$use_geoip_dummy"|awk '$1 == "SONAME" {print $2}'`
if test "x$DUMMY_LIBGEOIP_SONAME" != x; then
DUMMY_LIBGEOIP_ORIG="$use_geoip_dummy"
GEOIP_LIB='-L$(top_builddir)/src -lxqf_dummy_GeoIP'
AC_SUBST(DUMMY_LIBGEOIP_SONAME)
AC_SUBST(DUMMY_LIBGEOIP_ORIG)
else
AC_MSG_ERROR([$use_geoip_dummy is no valid GeoIP library])
fi
else
GEOIP_LIB="-lGeoIP"
fi
else
GEOIP_LIB="$USE_GEOIP"
fi
AC_SUBST(GEOIP_LIB)
else
AC_MSG_WARN([GeoIP.h not found, GeoIP feature disabled])
fi
fi
AM_CONDITIONAL(DUMMY_LIBGEOIP, test x$DUMMY_LIBGEOIP_SONAME != x)
# --enable-geoip-dummy=/usr/lib/libGeoIP.so
AC_MSG_CHECKING([whether a GDK-Pixbuf dummy library should be used])
AC_ARG_ENABLE(pixbuf_dummy,
[ --enable-pixbuf-dummy=FILE use dummy gdk-pixbuf lib based on FILE (default=no)],
use_pixbuf_dummy="$enableval", use_pixbuf_dummy=no)
AC_MSG_RESULT([$use_pixbuf_dummy])
if test "x$use_pixbuf_dummy" != "xno"; then
DUMMY_LIBGDKPIXBUF_SONAME=`objdump -p "$use_pixbuf_dummy"|awk '$1 == "SONAME" {print $2}'`
if test "x$DUMMY_LIBGDKPIXBUF_SONAME" != x; then
DUMMY_LIBGDKPIXBUF_ORIG="$use_pixbuf_dummy"
GDK_PIXBUF_LIBS='-L$(top_builddir)/src -lxqf_dummy_gdk_pixbuf'
AC_SUBST(DUMMY_LIBGDKPIXBUF_SONAME)
AC_SUBST(DUMMY_LIBGDKPIXBUF_ORIG)
else
AC_MSG_ERROR([$use_pixbuf_dummy is no valid library])
fi
AC_SUBST(GDK_PIXBUF_LIBS)
fi
AM_CONDITIONAL(DUMMY_LIBGDKPIXBUF, test x$DUMMY_LIBGDKPIXBUF_SONAME != x)
dnl check if user wants bzip2 compression instead of gzip
COMPRESSION="-DCOMPRESSOR_GZIP"
AC_ARG_ENABLE(bzip2,[ --enable-bzip2 use bzip2 for data compression])
if test x$enable_bzip2 = xyes; then
COMPRESSION="-DCOMPRESSOR_BZIP2"
fi
AC_SUBST(COMPRESSION)
dnl check if user wants debug
AC_ARG_ENABLE(debug,[ --enable-debug turn on debugging ])
if test x$enable_debug = xyes; then
DEBUG="-DDEBUG"
CFLAGS="-g -O0"
else
DEBUG=""
fi
AC_SUBST(DEBUG)
AC_SUBST(VERSION)
AC_SUBST(QSTATEXEC)
AC_DEFINE_UNQUOTED(XQF_VERSION, "$VERSION", XQF Version number)
AC_DEFINE_UNQUOTED(QSTAT_EXEC, "$QSTATEXEC", QSTAT executable path)
# workaround for intl/ which requires config.h
echo "configure: creating link config.h -> src/gnuconfig.h"
test -e config.h -a ! -L config.h && rm config.h
test ! -e config.h && ln -s src/gnuconfig.h config.h
rm -f intl/libintl.h
# damn gettext should do that itself!
if test "$USE_INCLUDED_LIBINTL" = "yes"; then
echo "configure: creating link intl/libintl.h -> libgnuintl.h"
ln -s libgnuintl.h intl/libintl.h
fi
dnl Use -Wall if we have gcc.
changequote(,)dnl
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
fi
changequote([,])dnl
AC_ARG_ENABLE(profiling,[ --enable-profiling compile with profiling (default=no)])
AC_MSG_CHECKING(whether profiling is requested)
if test x$enable_profiling = xyes; then
CFLAGS="$CFLAGS -pg"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_CONFIG_FILES([
Makefile
src/Makefile
src/xpm/Makefile
src/zip/Makefile
src/tga/Makefile
docs/Makefile
pixmaps/Makefile
pixmaps/flags/Makefile
pixmaps/trayicon/Makefile
po/Makefile.in
])
AC_OUTPUT
if test "x$qstat_is" = "xnotfound" ; then
AC_MSG_RESULT([
*** QStat is *required* to run XQF
*** Get it from http://qstat.org/
*** and put it in your path
])
fi