--- deliantra/server/configure.ac 2006/02/03 07:11:29 1.1.1.1 +++ deliantra/server/configure.ac 2016/11/18 04:44:13 1.191 @@ -1,250 +1,231 @@ -dnl Process this file with autoconf to produce a configure script. +dnl Process this file with autoconf to produce a configure script., -AC_REVISION($Id$) -AC_INIT([crossfire], [1.8.0], [crossfire-devel@listserv.real-time.com]) +AC_INIT([deliantra-server], [3.1], [support@deliantra.net]) +dnl AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR(utils) -AC_CONFIG_SRCDIR([server/main.c]) -AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([server/cfperl.xs]) +AM_INIT_AUTOMAKE([silent-rules subdir-objects foreign no-dist-gzip dist-xz]) AM_CONFIG_HEADER(include/autoconf.h) AM_MAINTAINER_MODE -AC_PREFIX_DEFAULT(/usr/games/crossfire) +AC_PREFIX_DEFAULT(/usr/games/deliantra) -dnl we want a config.h file instead of -D options. - -dnl Checks for programs. -AC_PROG_LIBTOOL -AC_PROG_CC - -case "$target" in - alpha-dec-osf*) - # If we are not using gcc, we want the ansi version of cc. - if test -z "$GCC"; then -# CFLAGS="$CFLAGS -std1 -warnprotos" # Not yet ready for warnprotos... - CFLAGS="$CFLAGS -std1" - fi - ;; - *) - ;; -esac - - -AC_PROG_CPP -AM_PROG_LEX -AC_PROG_AWK - -AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc Use the dmalloc library if available, may prevent plugins from working], - use_dmalloc=yes, use_dmalloc=no) - -AC_ARG_WITH(python, [ --with-python=dir Directory to look for python headers/library (default=standard system location) ], - PYTHON_HOME="$withval") - - -dnl check for some other programs -AC_PATH_PROG(LATEX, latex) -AC_PATH_PROG(GZIP, gzip) -AC_PATH_PROG(GUNZIP, gunzip) -AC_PATH_PROG(TAR, tar) -AC_PATH_PROG(PERL, perl) -AC_PATH_PROG(BASENAME, basename) - -if test -n "$GZIP" -a -z "$GUNZIP" ; then - echo "Found gzip, but not gunzip - setting GUNZIP to gzip -c"; - GUNZIP="$GZIP -c" -fi; - -if test -z "$COMPRESS" ; then - AC_PATH_PROG(COMPRESS, compress) - AC_PATH_PROG(UNCOMPRESS, uncompress) -fi - -AC_PATH_PROG(BZIP, bzip2) -AC_PATH_PROG(BUNZIP, bunzip2) - -if test -n "$BZIP" -a -z "$BUNZIP" ; then - echo "Found bzip2, but not bunzip2 - setting BUNZIP to bzip2 -c"; - BUNZIP="$BZIP -c" -fi; - -if test -z "$COMPRESS" -a -z "$GZIP" -a -z "$BZIP" ; then - echo "Unable to find either compress, bzip2, or gzip - hope you don't plan on compressing"; - echo "any files."; -fi; - -dnl nsl, socket may be needed for the X-windowing system, so check -dnl for them before before checking for X. -AC_CHECK_LIB(nsl, main) -AC_CHECK_LIB(socket, main) +AC_PATH_PROG(GPERF, gperf) +if test -z "$GPERF"; then + AC_MSG_ERROR([gperf, the GNU perfect hash generator, must be in your PATH, check the README]) +fi -dnl Checks for libraries. -dnl Start of X11 libraries -AC_PATH_XTRA +AC_PATH_PROG(RSYNC, rsync) +if test -z "$RSYNC"; then + AC_MSG_ERROR([rsync must be in your PATH, check the README]) +fi -dnl Some of these checks are probably excessive. Unfortunately, on -dnl some systems, to link in Xaw, Xt you need SM, which needs ICE. -dnl the order of the checks below is important -OLD_LD_FLAGS="$LDFLAGS" -LDFLAGS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS" +AC_PATH_PROG(OPTIPNG, optipng) +if test -z "$OPTIPNG"; then + AC_MSG_ERROR([optipng must be in your PATH, check the README]) +fi -AC_CHECK_LIB(X11, main, AC_DEFINE(HAVE_LIBX11,[],[Define if libX11 is available]) X11LIBS="$X11LIBS -lX11") +AC_PATH_PROG(PNGNQ, pngnq) +if test -z "$PNGNQ"; then + AC_MSG_ERROR([png neuquant (pngnq) must be in your PATH, check the README]) +fi -AC_CHECK_LIB(ICE, main, AC_DEFINE(HAVE_LIBICE,[],[Define if libICE is available]) X11LIBS="$X11LIBS -lICE") +AC_PATH_PROG(IDENTIFY, identify) +if test -z "$IDENTIFY"; then + AC_MSG_ERROR([ImageMagick 'identify' must be in your PATH, check the README]) +fi -AC_CHECK_LIB(SM, main, AC_DEFINE(HAVE_LIBSM,[],[Define if libSM is available]) X11LIBS="$X11LIBS -lSM", , $X11LIBS) +AC_PATH_PROG(CONVERT, convert) +if test -z "$CONVERT"; then + AC_MSG_ERROR([ImageMagick 'convert' must be in your PATH, check the README]) +fi -AC_CHECK_LIB(Xext, main, AC_DEFINE(HAVE_LIBXEXT,[],[Define if libEXT is available]) X11LIBS="$X11LIBS -lXext", , -lX11) +AC_PATH_PROG(PERL, perl5.10.1) +if test -z "$PERL"; then + AC_PATH_PROG(PERL, perl) + if test -z "$PERL"; then + AC_MSG_ERROR([perl 5.10.1 or higher must be in your PATH, check the README]) + fi +fi -AC_CHECK_LIB(Xt, main, AC_DEFINE(HAVE_LIBXT,[],[Define if libXT is available]) X11LIBS="$X11LIBS -lXt", , $X11LIBS) +for module_vers in \ + "common::sense 3.3" \ + "AnyEvent 7.0" \ + "AnyEvent::AIO 0" \ + "AnyEvent::BDB 0" \ + "BDB 1.8" \ + "Compress::LZF 3.41" \ + "Coro 6" \ + "Coro::EV 0" \ + "Deliantra 2.0" \ + "Digest::MD5 2.0" \ + "EV 4" \ + "Guard 1" \ + "IO::AIO 4" \ + "JSON::XS 2.01" \ + "AnyEvent::IRC 0.6" \ + "Pod::POM 0.27" \ + "Safe::Hole 0.10" \ + "Storable 2.0" \ + "URI 1.35" \ + "YAML::XS 0.32" \ +; do + set -- $module_vers + module=$1 + minvers=$2 + AC_MSG_CHECKING(for $module perl module version $minvers or higher) + if $PERL -M$module -e0 >/dev/null 2>&1; then + version=`$PERL -M$module -e "print \\$$module::VERSION"` + if $PERL -M$module -e "\$$module::VERSION >= $minvers or die" >/dev/null 2>&1; then + AC_MSG_RESULT([ok, version $version]) + else + AC_MSG_ERROR([no, installed version is $version]) + fi + else + AC_MSG_ERROR([no, cannot load module $module]) + fi +done -AC_CHECK_LIB(Xmu, main, AC_DEFINE(HAVE_LIBXMU,[],[Define if libXMU is available]) X11LIBS="$X11LIBS -lXmu", ,$X11LIBS) +AC_LANG(C++) +AC_PROG_CXX +AC_PROG_CPP -AC_CHECK_LIB(Xaw, main, AC_DEFINE(HAVE_LIBXAW,[],[Define if libXAW is available]) X11LIBS="-lXaw $X11LIBS", , $X11LIBS) +AX_CXX_COMPILE_STDCXX_11([noext], [mandatory]) -LDFLAGS="$OLD_LD_FLAGS" -X11LIBS="$X_LIBS $X11LIBS" +AX_CHECK_COMPILE_FLAG(-Wno-unused-result,[CXXFLAGS="$CXXFLAGS -Wno-unused-result"]) +AX_CHECK_COMPILE_FLAG(-Wno-narrowing,[CXXFLAGS="$CXXFLAGS -Wno-narrowing"]) -AC_CHECK_LIB(Xpm, main, AC_DEFINE(HAVE_LIBXPM,[],[Define if libXpm is available]) X11LIBS="$X11LIBS -lXpm", , $X11LIBS ) +AC_CHECK_HEADER(unordered_map,[],[AC_MSG_ERROR([Your compiler must support C++11 headers.])]) -AC_CHECK_LIB(m, main) +AC_CHECK_HEADER(pthread.h,[],[AC_MSG_ERROR([POSIX thread support is required.])]) -AC_CHECK_LIB(png, main, AC_DEFINE(HAVE_LIBPNG,[],[Define if libpng is available]) X11LIBS="$X11LIBS -lpng", , $X11LIBS ) +AC_PATH_PROG(PKG_CONFIG, pkg-config, no) -dnl png has a dependency in some cases on libz - if we have it, can't really -dnl be harmful to link it in. -AC_CHECK_LIB(z, main, AC_DEFINE(HAVE_LIBZ,[],[Define if libz is available]) X11LIBS="$X11LIBS -lz", , $X11LIBS ) +AC_MSG_CHECKING(blitz++ >= 0.10) +if $PKG_CONFIG blitz --atleast-version 0.10; then + CXXFLAGS="$CXXFLAGS `$PKG_CONFIG blitz --cflags`" + LIBS="$LIBS `$PKG_CONFIG blitz --libs`" + AC_MSG_RESULT(ok) +else + AC_MSG_ERROR(no) +fi -dnl Misc libraries. -AC_CHECK_LIB(crypt, main) -AC_CHECK_LIB(des, des_crypt) +AC_MSG_CHECKING(glib >= 2.32) +if $PKG_CONFIG glib-2.0 --atleast-version 2.10; then + CXXFLAGS="$CXXFLAGS `$PKG_CONFIG glib-2.0 --cflags`" + LIBS="$LIBS `$PKG_CONFIG glib-2.0 --libs`" + AC_MSG_RESULT(ok) +else + AC_MSG_ERROR(no) +fi -dnl Gros - Changed this to support some external programs that do not like dmalloc (like Python). -dnl If you really need to make some memory debugging, uncomment the dmalloc line and comment out the dmalloclp one. +AC_MSG_CHECKING(gthread >= 0.0) +if $PKG_CONFIG gthread-2.0 --atleast-version 0.0; then + CXXFLAGS="$CXXFLAGS `$PKG_CONFIG gthread-2.0 --cflags`" + LIBS="$LIBS `$PKG_CONFIG gthread-2.0 --libs`" + AC_MSG_RESULT(ok) +else + AC_MSG_ERROR(no) +fi -if eval "test x$use_dmalloc = xyes"; then - AC_CHECK_LIB(dmalloc, main) +dnl AC_MSG_CHECKING(libpng) +dnl if $PKG_CONFIG libpng --exists; then +dnl CXXFLAGS="$CXXFLAGS `$PKG_CONFIG libpng --cflags`" +dnl LIBS="$LIBS `$PKG_CONFIG libpng --libs`" +dnl AC_MSG_RESULT(ok) +dnl else +dnl AC_MSG_ERROR(no) +dnl fi + +AC_MSG_CHECKING(for $PERL suitability) +if $PERL -MExtUtils::Embed -e "use 5.10.1" >/dev/null 2>&1; then + save_CXXFLAGS="$CXXFLAGS" + save_LIBS="$LIBS" + xPERLFLAGS="`$PERL -MExtUtils::Embed -e ccopts`" + xPERLFLAGS="$xPERLFLAGS `$PERL -MEV::MakeMaker -e 'print +{&EV::MakeMaker::ev_args}->{INC}'`" + xPERLFLAGS="$xPERLFLAGS `$PERL -MCoro::MakeMaker -e 'print +{&Coro::MakeMaker::coro_args}->{INC}'`" + CXXFLAGS="$CXXFLAGS $xPERLFLAGS" + LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`" + AC_TRY_LINK([ +#include +#include +#include +#include "EVAPI.h" +#include "CoroAPI.h" +],[ + PerlInterpreter *perl = perl_alloc (); +],[perl_link=yes],[perl_link=no]) + CXXFLAGS="$save_CXXFLAGS" + LIBS="$save_LIBS" + + if test x$perl_link = xyes; then + AC_MSG_RESULT(ok) + PERLFLAGS="$xPERLFLAGS" + PERLLIB="`$PERL -MExtUtils::Embed -e ldopts`" + PERLPRIVLIBEXP="`$PERL -MConfig -e 'print $Config{privlibexp}'`" + CPPFLAGS="$CPPFLAGS $PERLFLAGS" + else + AC_MSG_ERROR([no, unable to link test program]) + fi else - AC_CHECK_LIB(dmalloclp, main) + AC_MSG_ERROR([no working perl found, or perl not version >= 5.10.1]) fi +AC_SUBST(PERLLIB) +AC_SUBST(PERLFLAGS) +AC_SUBST(PERLPRIVLIBEXP) +AC_SUBST(PERL) -dnl Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h sys/file.h sys/ioctl.h sys/time.h time.h unistd.h stddef.h stdlib.h sys/ttycom.h sys/termios.h crypt.h arpa/inet.h des.h) - - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_C_INLINE -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_STRUCT_TM -AC_TYPE_UID_T +dnl AC_PROG_LIBTOOL +AC_PROG_RANLIB -AC_CHECK_SIZEOF(long) -AC_CHECK_SIZEOF(long long) +AC_CHECK_HEADERS(execinfo.h malloc.h) +AC_CHECK_FUNCS(backtrace) -dnl Checks for library functions. -AC_PROG_GCC_TRADITIONAL -AC_FUNC_MEMCMP -AC_FUNC_SETPGRP -AC_TYPE_SIGNAL -AC_FUNC_STRFTIME -AC_FUNC_VPRINTF -AC_CHECK_FUNCS(gettimeofday mkdir mktime rmdir select socket strcspn strerror strspn strstr strtol strcasecmp strncasecmp snprintf setsid srandom getdtablesize srand48 srand sysconf scandir) - -dnl alphasort can not be added to AC_CHECK_FUNCS because -AC_MSG_CHECKING(checking if alphasort is defined) - AC_TRY_COMPILE([#include ], [alphasort;], - ac_cv_func_alphasort=yes, ac_cv_func_alphasort=no) - if test "$ac_cv_func_alphasort" = yes; then - AC_DEFINE(HAVE_ALPHASORT, 1, [Define if you have the alphasort() function declaration.]) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi +dnl check for some other programs +AC_PATH_PROG(TAR, tar) +AC_PATH_PROG(BASENAME, basename) +AC_CHECK_LIB(nsl, gethostbyname) +AC_CHECK_LIB(socket, connect) +AC_CHECK_LIB(pthread, pthread_create) +dnl Checks for libraries. +AC_CHECK_LIB(m, main) -AC_MSG_CHECKING(how many args gettimeofday uses) -AC_CACHE_VAL(ac_cv_gettimeofday_args, - [AC_TRY_COMPILE([#include - #include ], - [struct timeval tv; struct timezone tzp; - gettimeofday(&tv, &tzp);], - [ac_gettimeofday_args=2], - [AC_TRY_COMPILE([#include - #include ], - [struct timeval tv; - gettimeofday(&tv, NULL);], - [ac_gettimeofday_args=2], - [AC_TRY_COMPILE([#include - #include ], - [struct timeval tv; gettimeofday(&tv);], - [ac_gettimeofday_args=1], - [ac_gettimeofday_args=0])])]) - ac_cv_gettimeofday_args=$ac_gettimeofday_args]) - -ac_gettimeofday_args=$ac_cv_gettimeofday_args -if test $ac_gettimeofday_args = 1 ; then - AC_DEFINE(HAVE_GETTIMEOFDAY,[],[Define if gettimeofday is available]) - AC_MSG_RESULT(one argument) -elif test $ac_gettimeofday_args = 2 ; then - AC_DEFINE(HAVE_GETTIMEOFDAY,[],[Define if gettimeofday is available]) - AC_DEFINE(GETTIMEOFDAY_TWO_ARGS,[],[Define if gettimeofday takes two arguments]) - AC_MSG_RESULT(two arguments) -else - AC_MSG_RESULT(unknown) -fi +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) -AC_SUBST(x_includes) -AC_SUBST(x_libraries) -AC_SUBST(no_x) -AM_CONDITIONAL(HAVE_X,test "x$no_x" = "x") -AC_SUBST(X11LIBS) -AC_SUBST(PERL) -AC_SUBST(BASENAME) +AC_MSG_CHECKING(for tcp_info support) +AC_TRY_LINK([ +#include +#include +#include +#include +],[ + int fd; + struct tcp_info tcpi; + socklen_t len = sizeof (tcpi); + getsockopt (fd, IPPROTO_TCP, TCP_INFO, &tcpi, &len); + fd = 0 + + tcpi.tcpi_snd_mss + + tcpi.tcpi_rtt + + tcpi.tcpi_rttvar + + tcpi.tcpi_last_ack_recv + + tcpi.tcpi_last_data_sent + + tcpi.tcpi_unacked; +],[ + AC_DEFINE(HAVE_TCP_INFO, [1], [TCP_INFO info option supported]) + AC_MSG_RESULT(yes) +],[ + AC_MSG_RESULT(no) +]) AC_SUBST(pkgstatedir,$localstatedir/$PACKAGE) AC_SUBST(pkgconfdir,$sysconfdir/$PACKAGE) -AC_DEFINE_UNQUOTED(COMPRESS,"${COMPRESS}",[Path to the compress binary]) -AC_DEFINE_UNQUOTED(UNCOMPRESS,"${UNCOMPRESS}",[Path to the uncompress binary]) -AC_DEFINE_UNQUOTED(GZIP,"${GZIP}",[Path to the gzip binary]) -AC_DEFINE_UNQUOTED(GUNZIP,"${GUNZIP}",[Path to the gunzip binary]) -AC_DEFINE_UNQUOTED(BZIP,"${BZIP}",[Path to the bzip binary]) -AC_DEFINE_UNQUOTED(BUNZIP,"${BUNZIP}",[Path to the bunzip binary]) - -############################################# -# Plugin configuration -AC_CHECK_LIB(dl, dlopen,[ cf_have_libdl=yes ]) -AM_CONDITIONAL(HAVE_LIBDL,test "x$cf_have_libdl" = "xyes") - -if test "x$cf_have_libdl" = "xyes" ; then - ############### - # Python plugin - CF_CHECK_PYTHON( - [PLUGIN_PYTHON="cfpython.la"], - [AC_MSG_NOTICE([No Python found. Python plugin will not be built.])] - ) - dnl *** Put other plugins configuration code here *** -else - AC_MSG_NOTICE([No dl library found. Plugins will not be supported.]) -fi -AM_CONDITIONAL(PYTHON_PLUGIN,test "x$PLUGIN_PYTHON" != "x") -AC_SUBST(PLUGIN_PYTHON) - AC_OUTPUT([Makefile - crossedit/Makefile crossedit/doc/Makefile crossedit/include/Makefile - crossedit/Cnv/Makefile crossedit/bitmaps/Makefile - doc/Makefile doc/Developers/Makefile doc/spell-docs/Makefile - doc/spoiler/Makefile doc/spoiler-html/Makefile - doc/playbook/Makefile doc/playbook-html/Makefile - doc/scripts/Makefile - lib/Makefile random_maps/Makefile socket/Makefile server/Makefile - include/Makefile utils/Makefile lib/checkarch.pl - lib/collect.pl utils/add_throw.perl utils/crossloop.tmpl utils/crossloop.pl.tmpl - utils/metaserver.pl utils/crossloop.web utils/scores.pl utils/player_dl.pl - common/Makefile plugins/Makefile plugins/cfpython/Makefile plugins/cfanim/Makefile devel/Makefile - ]) + include/Makefile lib/Makefile + utils/cfutil +]) +