1# 2# Autoconf support for XQF 3# Initially written by Markus Fischer <mfischer@josefine.ben.tuwien.ac.at> 4# 5 6AC_INIT([XQF],[1.0.6.2],[xqf-developer@lists.sourceforge.net], [xqf]) 7AC_CONFIG_SRCDIR([src/xqf.c]) 8AC_PREREQ(2.52) 9 10AM_INIT_AUTOMAKE 11dnl AM_CONFIG_HEADER(src/gnuconfig.h:src/gnuconfig.h.in) 12AM_CONFIG_HEADER(src/gnuconfig.h) 13 14AM_GLIB_GNU_GETTEXT 15IT_PROG_INTLTOOL([0.40.0]) 16 17GETTEXT_PACKAGE=xqf 18AC_SUBST(GETTEXT_PACKAGE) 19AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext domain name.]) 20 21dnl Checks for programs. 22AC_PROG_CC 23AC_ISC_POSIX 24AC_PROG_LN_S 25AC_PROG_RANLIB 26 27dnl Checks for header files. 28AC_HEADER_STDC 29 30#The Release stuff for the spec file. 31RELEASE="1" 32AC_ARG_WITH(rpm_release,[ --with-rpm-release=VAL RPM Release (e.g. 1mdk)]) 33if test "x$with_rpm_release" != "x" ; then 34 RELEASE="$with_rpm_release" 35fi 36AC_SUBST(RELEASE) 37 38dnl GTK2 support 39OLD_GTK_SUPPORT="-DGTK_ENABLE_BROKEN=1" 40AC_SUBST(OLD_GTK_SUPPORT) 41 42pkg_modules="gtk+-2.0 >= 2.0.0 gdk-pixbuf-xlib-2.0 x11" 43PKG_CHECK_MODULES(PACKAGE, [$pkg_modules]) 44AC_SUBST(PACKAGE_CFLAGS) 45AC_SUBST(PACKAGE_LIBS) 46 47dnl check for qstat 48AC_ARG_WITH(qstat,[ --with-qstat=CMD use CMD to run qstat]) 49 50AC_MSG_CHECKING(qstat version) 51 52QSTATEXEC="qstat" 53 54if test "x$with_qstat" != "x" ; then 55 QSTATEXEC="$with_qstat" 56fi 57 58qstat_version=`$QSTATEXEC 2>/dev/null | grep version | cut -d' ' -f 3` 59 60if test "x$qstat_version" = "x" ; then 61 AC_MSG_RESULT(qstat not found) 62 qstat_is=notfound 63else 64 AC_MSG_RESULT($qstat_version) 65fi 66 67AC_SUBST(QSTATEXEC) 68 69AC_CHECK_HEADER(zlib.h,,[AC_MSG_ERROR([zlib.h not found, please install zlib development files])]) 70AC_CHECK_LIB(z, crc32,[AC_DEFINE([HAVE_LIBZ],[],[Whether libz is installed])],[AC_MSG_ERROR([libz not found])]) 71 72dnl determine if we should include readline support... 73dnl ripped from physfs package 74dnl AC_ARG_ENABLE(readline, 75dnl AC_HELP_STRING([--enable-externalrcon],[compile external rcon program (default=yes)]) 76dnl , ,enable_rcon=yes) 77XQFRCON_LIBS= 78AC_ARG_ENABLE(externalrcon,[ --enable-externalrcon compile external rcon program (default=no)]) 79if test x$enable_externalrcon = xyes; then 80 AC_CHECK_HEADER(readline/readline.h, have_readline_hdr=yes) 81 AC_CHECK_LIB(readline, readline, have_readline_lib=yes) 82 AC_CHECK_HEADER(readline/history.h, have_history_hdr=yes) 83 AC_CHECK_LIB(readline, add_history, have_history_lib=yes) 84 if test x$have_readline_hdr = xyes -a x$have_readline_lib = xyes; then 85 if test x$have_history_hdr = xyes -a x$have_history_lib = xyes; then 86 XQFRCON_LIBS="-lreadline" 87 AC_SUBST(XQFRCON_LIBS) 88 else 89 AC_MSG_WARN([libreadline not found, rcon program disabled]) 90 fi 91 else 92 AC_MSG_WARN([libreadline not found, rcon program disabled]) 93 fi 94fi 95AM_CONDITIONAL(BUILD_XQFRCON, test "x$XQFRCON_LIBS" != x) 96 97dnl determine whether GeoIP should be used 98AC_CHECK_HEADER(GeoIP.h,have_geoip_hdr=yes,have_geoip_hdr=no) 99AC_MSG_CHECKING([whether GeoIP should be used]) 100AC_ARG_ENABLE(geoip,[ --enable-geoip use GeoIP (default=auto)],USE_GEOIP=$enableval, USE_GEOIP=yes) 101AC_MSG_RESULT([$USE_GEOIP]) 102 103# --enable-geoip-dummy=/usr/lib/libGeoIP.so 104AC_MSG_CHECKING([whether a GeoIP dummy library should be used]) 105AC_ARG_ENABLE(geoip_dummy, 106 [ --enable-geoip-dummy=FILE use dummy GeoIP lib based on FILE (default=no)], 107 use_geoip_dummy="$enableval", use_geoip_dummy=no) 108AC_MSG_RESULT([$use_geoip_dummy]) 109 110if test "x$USE_GEOIP" != "xno"; then 111 if test "x$have_geoip_hdr" = "xyes";then 112 AC_DEFINE_UNQUOTED(USE_GEOIP,1,Define if we should use GeoIP) 113 if test "x$USE_GEOIP" = "xyes"; then 114 if test "x$use_geoip_dummy" != "xno"; then 115 DUMMY_LIBGEOIP_SONAME=`objdump -p "$use_geoip_dummy"|awk '$1 == "SONAME" {print $2}'` 116 if test "x$DUMMY_LIBGEOIP_SONAME" != x; then 117 DUMMY_LIBGEOIP_ORIG="$use_geoip_dummy" 118 GEOIP_LIB='-L$(top_builddir)/src -lxqf_dummy_GeoIP' 119 120 AC_SUBST(DUMMY_LIBGEOIP_SONAME) 121 AC_SUBST(DUMMY_LIBGEOIP_ORIG) 122 else 123 AC_MSG_ERROR([$use_geoip_dummy is no valid GeoIP library]) 124 fi 125 else 126 GEOIP_LIB="-lGeoIP" 127 fi 128 else 129 GEOIP_LIB="$USE_GEOIP" 130 fi 131 AC_SUBST(GEOIP_LIB) 132 133 else 134 AC_MSG_WARN([GeoIP.h not found, GeoIP feature disabled]) 135 fi 136fi 137 138AM_CONDITIONAL(DUMMY_LIBGEOIP, test x$DUMMY_LIBGEOIP_SONAME != x) 139 140# --enable-geoip-dummy=/usr/lib/libGeoIP.so 141AC_MSG_CHECKING([whether a GDK-Pixbuf dummy library should be used]) 142AC_ARG_ENABLE(pixbuf_dummy, 143 [ --enable-pixbuf-dummy=FILE use dummy gdk-pixbuf lib based on FILE (default=no)], 144 use_pixbuf_dummy="$enableval", use_pixbuf_dummy=no) 145AC_MSG_RESULT([$use_pixbuf_dummy]) 146if test "x$use_pixbuf_dummy" != "xno"; then 147 DUMMY_LIBGDKPIXBUF_SONAME=`objdump -p "$use_pixbuf_dummy"|awk '$1 == "SONAME" {print $2}'` 148 if test "x$DUMMY_LIBGDKPIXBUF_SONAME" != x; then 149 DUMMY_LIBGDKPIXBUF_ORIG="$use_pixbuf_dummy" 150 GDK_PIXBUF_LIBS='-L$(top_builddir)/src -lxqf_dummy_gdk_pixbuf' 151 152 AC_SUBST(DUMMY_LIBGDKPIXBUF_SONAME) 153 AC_SUBST(DUMMY_LIBGDKPIXBUF_ORIG) 154 else 155 AC_MSG_ERROR([$use_pixbuf_dummy is no valid library]) 156 fi 157 AC_SUBST(GDK_PIXBUF_LIBS) 158fi 159AM_CONDITIONAL(DUMMY_LIBGDKPIXBUF, test x$DUMMY_LIBGDKPIXBUF_SONAME != x) 160 161dnl check if user wants bzip2 compression instead of gzip 162COMPRESSION="-DCOMPRESSOR_GZIP" 163AC_ARG_ENABLE(bzip2,[ --enable-bzip2 use bzip2 for data compression]) 164if test x$enable_bzip2 = xyes; then 165 COMPRESSION="-DCOMPRESSOR_BZIP2" 166fi 167AC_SUBST(COMPRESSION) 168 169dnl check if user wants debug 170AC_ARG_ENABLE(debug,[ --enable-debug turn on debugging ]) 171if test x$enable_debug = xyes; then 172 DEBUG="-DDEBUG" 173 CFLAGS="-g -O0" 174else 175 DEBUG="" 176fi 177AC_SUBST(DEBUG) 178 179AC_SUBST(VERSION) 180AC_SUBST(QSTATEXEC) 181 182AC_DEFINE_UNQUOTED(XQF_VERSION, "$VERSION", XQF Version number) 183AC_DEFINE_UNQUOTED(QSTAT_EXEC, "$QSTATEXEC", QSTAT executable path) 184 185# workaround for intl/ which requires config.h 186echo "configure: creating link config.h -> src/gnuconfig.h" 187test -e config.h -a ! -L config.h && rm config.h 188test ! -e config.h && ln -s src/gnuconfig.h config.h 189 190rm -f intl/libintl.h 191# damn gettext should do that itself! 192if test "$USE_INCLUDED_LIBINTL" = "yes"; then 193 echo "configure: creating link intl/libintl.h -> libgnuintl.h" 194 ln -s libgnuintl.h intl/libintl.h 195fi 196 197dnl Use -Wall if we have gcc. 198changequote(,)dnl 199if test "x$GCC" = "xyes"; then 200 case " $CFLAGS " in 201 *[\ \ ]-Wall[\ \ ]*) ;; 202 *) CFLAGS="$CFLAGS -Wall" ;; 203 esac 204fi 205changequote([,])dnl 206 207AC_ARG_ENABLE(profiling,[ --enable-profiling compile with profiling (default=no)]) 208AC_MSG_CHECKING(whether profiling is requested) 209if test x$enable_profiling = xyes; then 210 CFLAGS="$CFLAGS -pg" 211 AC_MSG_RESULT([yes]) 212else 213 AC_MSG_RESULT([no]) 214fi 215 216AC_CONFIG_FILES([ 217 Makefile 218 src/Makefile 219 src/xpm/Makefile 220 src/zip/Makefile 221 src/tga/Makefile 222 docs/Makefile 223 pixmaps/Makefile 224 pixmaps/flags/Makefile 225 pixmaps/trayicon/Makefile 226 xqf.spec 227 po/Makefile.in 228]) 229AC_OUTPUT 230 231if test "x$qstat_is" = "xnotfound" ; then 232 AC_MSG_RESULT([ 233*** QStat is *required* to run XQF 234*** Get it from http://qstat.org/ 235*** and put it in your path 236]) 237fi 238