--- deliantra/server/configure.ac 2006/12/15 20:08:45 1.29 +++ deliantra/server/configure.ac 2007/02/06 02:36:48 1.46 @@ -10,8 +10,6 @@ AC_PREFIX_DEFAULT(/usr/games/crossfire) -dnl we want a config.h file instead of -D options. - dnl Checks for programs. AC_LANG(C++) AC_PROG_CXX @@ -30,109 +28,88 @@ esac AC_PROG_CPP -AM_PROG_LEX -AC_PROG_AWK -dnl AC_ARG_WITH(python, [ --with-python=dir Directory to look for python headers/library (default=standard system location) ], PYTHON_HOME="$withval") +AC_PATH_PROG(PERL, perl5.8) +AC_PATH_PROG(PERL, perl5) +AC_PATH_PROG(PERL, perl) + +AC_MSG_CHECKING(for $PERL suitability) +if $PERL -MExtUtils::Embed -e "use v5.8" >/dev/null 2>&1; then + save_CXXFLAGS="$CXXFLAGS" + save_LIBS="$LIBS" + xPERLFLAGS="`$PERL -MExtUtils::Embed -e ccopts`" + xPERLFLAGS="$xPERLFLAGS `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_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 "EventAPI.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) + AC_DEFINE(ENABLE_PERL, 1, Define if you can embed a perl interpreter) + 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]) + fi +else + AC_MSG_ERROR([no working perl found, or perl not version >= 5.8]) +fi +AC_SUBST(PERLLIB) +AC_SUBST(PERLFLAGS) +AC_SUBST(PERLPRIVLIBEXP) +AC_SUBST(PERL) + +for module_vers in "Coro 3.5" "Coro::Event 2.1" "Event 1.08" \ + "IO::AIO 2.32" "BDB 0.1" "Storable 2.0" "Time::HiRes 1.0" "YAML::Syck 0.71" \ + "Digest::MD5 2.0" "Compress::LZF 1.7" "Safe::Hole 0.10" "Pod::POM 0.17"; 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=$minvers -e0 >/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 dnl check for some other programs -AC_PATH_PROG(LATEX, latex) -AC_PATH_PROG(GZIP, gzip) -AC_PATH_PROG(BZIP, bzip2) AC_PATH_PROG(TAR, tar) AC_PATH_PROG(BASENAME, basename) -AC_PATH_PROG(PERL, perl5.8) -AC_PATH_PROG(PERL, perl5) -AC_PATH_PROG(PERL, perl) - AC_PATH_PROG(GPERF, gperf) if test -z "$GPERF"; then AC_MSG_ERROR([we need gperf, the GNU perfect hash generator]) fi -GUNZIP="$GZIP -c" -BUNZIP="$BZIP -c" - -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) dnl Checks for libraries. AC_CHECK_LIB(m, main) -AC_CHECK_LIB(png, main, AC_DEFINE(HAVE_LIBPNG,[],[Define if libpng is available]) X11LIBS="$X11LIBS -lpng", , $X11LIBS ) - -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 ) - -dnl Misc libraries. -AC_CHECK_LIB(crypt, main) -AC_CHECK_LIB(des, des_crypt) -dnl Checks for header files. -AC_CHECK_HEADERS(crypt.h des.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_INLINE +AC_CHECK_HEADER(tr1/unordered_map,[],[AC_MSG_ERROR([Your compiler must support the Library Technical Report 1 extensions.])]) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) -dnl Checks for library functions. -AC_PROG_GCC_TRADITIONAL -AC_TYPE_SIGNAL - -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 - - - -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_PATH_PROG(PKG_CONFIG, pkg-config, no) AC_MSG_CHECKING(glib >= 2.10) @@ -144,6 +121,15 @@ AC_MSG_ERROR(no) fi +AC_MSG_CHECKING(libpng) +if $PKG_CONFIG libpng --exists; then + CXXFLAGS="$CXXFLAGS `$PKG_CONFIG libpng --cflags`" + LIBS="$LIBS `$PKG_CONFIG libpng --libs`" + AC_MSG_RESULT(ok) +else + AC_MSG_ERROR(no) +fi + AC_SUBST(x_includes) AC_SUBST(x_libraries) AC_SUBST(no_x) @@ -153,49 +139,6 @@ 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]) - -AC_MSG_CHECKING(for $PERL suitability) -if $PERL -MExtUtils::Embed -e "use v5.8" >/dev/null 2>/dev/null; then - - save_CXXFLAGS="$CXXFLAGS" - save_LIBS="$LIBS" - CXXFLAGS="$CXXFLAGS `$PERL -MExtUtils::Embed -e ccopts` `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`" - LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`" - AC_TRY_LINK([ -#include -#include -#include -#include "EventAPI.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) - AC_DEFINE(ENABLE_PERL, 1, Define if you can embed a perl interpreter) - PERLFLAGS="`$PERL -MExtUtils::Embed -e ccopts` `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`" - PERLLIB="`$PERL -MExtUtils::Embed -e ldopts`" - PERLPRIVLIBEXP="`$PERL -MConfig -e 'print $Config{privlibexp}'`" - CPPFLAGS="$CPPFLAGS $PERLFLAGS" - else - AC_MSG_ERROR([no, unable to link]) - fi -else - AC_MSG_ERROR([no working perl found, or perl not version >= 5.8]) -fi -AC_SUBST(PERLLIB) -AC_SUBST(PERLFLAGS) -AC_SUBST(PERLPRIVLIBEXP) -AC_SUBST(PERL) - AC_OUTPUT([Makefile include/Makefile lib/Makefile pod/Makefile random_maps/Makefile socket/Makefile server/Makefile src/Makefile utils/Makefile ext/Makefile @@ -203,3 +146,4 @@ utils/crossloop.tmpl utils/crossloop.pl.tmpl utils/metaserver.pl utils/crossloop.web utils/scores.pl utils/player_dl.pl common/Makefile ]) +