ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/configure.ac
Revision: 1.41
Committed: Thu Jan 18 17:54:49 2007 UTC (17 years, 3 months ago) by root
Branch: MAIN
Changes since 1.40: +67 -72 lines
Log Message:
simplify and upgrade configury

File Contents

# User Rev Content
1 root 1.1 dnl Process this file with autoconf to produce a configure script.
2    
3 root 1.29 AC_INIT([crossfire], [2.0+], [crossfire@schmorp.de])
4 root 1.1 AC_CONFIG_AUX_DIR(utils)
5 elmex 1.9 AC_CONFIG_SRCDIR([server/main.C])
6 root 1.1 AM_INIT_AUTOMAKE
7     AM_CONFIG_HEADER(include/autoconf.h)
8    
9     AM_MAINTAINER_MODE
10    
11     AC_PREFIX_DEFAULT(/usr/games/crossfire)
12    
13 root 1.41 dnl Checks for programs.
14     AC_LANG(C++)
15     AC_PROG_CXX
16     AC_PROG_LIBTOOL
17    
18     case "$target" in
19     alpha-dec-osf*)
20     # If we are not using gcc, we want the ansi version of cc.
21     if test -z "$GCC"; then
22     # CFLAGS="$CFLAGS -std1 -warnprotos" # Not yet ready for warnprotos...
23     CFLAGS="$CFLAGS -std1"
24     fi
25     ;;
26     *)
27     ;;
28     esac
29    
30     AC_PROG_CPP
31    
32 root 1.33 AC_PATH_PROG(PERL, perl5.8)
33     AC_PATH_PROG(PERL, perl5)
34     AC_PATH_PROG(PERL, perl)
35    
36 root 1.41 AC_MSG_CHECKING(for $PERL suitability)
37     if $PERL -MExtUtils::Embed -e "use v5.8" >/dev/null 2>&1; then
38     save_CXXFLAGS="$CXXFLAGS"
39     save_LIBS="$LIBS"
40     xPERLFLAGS="`$PERL -MExtUtils::Embed -e ccopts`"
41     xPERLFLAGS="$xPERLFLAGS `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`"
42     xPERLFLAGS="$xPERLFLAGS `$PERL -MCoro::MakeMaker -e 'print +{&Coro::MakeMaker::coro_args}->{INC}'`"
43     CXXFLAGS="$CXXFLAGS $xPERLFLAGS"
44     LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`"
45     AC_TRY_LINK([
46     #include <EXTERN.h>
47     #include <perl.h>
48     #include <XSUB.h>
49     #include "EventAPI.h"
50     ],[
51     PerlInterpreter *perl = perl_alloc ();
52     ],[perl_link=yes],[perl_link=no])
53     CXXFLAGS="$save_CXXFLAGS"
54     LIBS="$save_LIBS"
55    
56     if test x$perl_link = xyes; then
57     AC_MSG_RESULT(ok)
58     AC_DEFINE(ENABLE_PERL, 1, Define if you can embed a perl interpreter)
59     PERLFLAGS="$xPERLFLAGS"
60     PERLLIB="`$PERL -MExtUtils::Embed -e ldopts`"
61     PERLPRIVLIBEXP="`$PERL -MConfig -e 'print $Config{privlibexp}'`"
62     CPPFLAGS="$CPPFLAGS $PERLFLAGS"
63     else
64     AC_MSG_ERROR([no, unable to link])
65     fi
66     else
67     AC_MSG_ERROR([no working perl found, or perl not version >= 5.8])
68     fi
69     AC_SUBST(PERLLIB)
70     AC_SUBST(PERLFLAGS)
71     AC_SUBST(PERLPRIVLIBEXP)
72     AC_SUBST(PERL)
73    
74 root 1.39 for module_vers in "Coro 3.4" "Coro::Event 2.0" "Event 1.08" \
75 root 1.37 "IO::AIO 2.32" "Storable 2.0" "Time::HiRes 1.0" "YAML::Syck 0.71" \
76 root 1.38 "Digest::MD5 2.0" "Compress::LZF 1.7" "Safe::Hole 0.10"; do
77 root 1.33 set -- $module_vers
78     module=$1
79     minvers=$2
80     AC_MSG_CHECKING(for $module perl module version $minvers or higher)
81     if $PERL -M$module -e0 >/dev/null 2>&1; then
82     version=`$PERL -M$module -e "print \\$$module::VERSION"`
83     if $PERL -M$module=$minvers -e0 >/dev/null 2>&1; then
84     AC_MSG_RESULT([ok, version $version])
85     else
86     AC_MSG_ERROR([no, installed version is $version])
87     fi
88     else
89     AC_MSG_ERROR([no, cannot load module $module])
90     fi
91     done
92 root 1.1
93     dnl check for some other programs
94     AC_PATH_PROG(LATEX, latex)
95     AC_PATH_PROG(GZIP, gzip)
96 root 1.25 AC_PATH_PROG(BZIP, bzip2)
97 root 1.1 AC_PATH_PROG(TAR, tar)
98     AC_PATH_PROG(BASENAME, basename)
99    
100 root 1.25 AC_PATH_PROG(GPERF, gperf)
101     if test -z "$GPERF"; then
102     AC_MSG_ERROR([we need gperf, the GNU perfect hash generator])
103 root 1.1 fi
104    
105 root 1.25 GUNZIP="$GZIP -c"
106     BUNZIP="$BZIP -c"
107 root 1.1
108     if test -z "$COMPRESS" -a -z "$GZIP" -a -z "$BZIP" ; then
109     echo "Unable to find either compress, bzip2, or gzip - hope you don't plan on compressing";
110     echo "any files.";
111     fi;
112    
113     AC_CHECK_LIB(nsl, main)
114     AC_CHECK_LIB(socket, main)
115    
116     dnl Checks for libraries.
117     AC_CHECK_LIB(m, main)
118    
119 root 1.41 AC_CHECK_HEADER(tr1/unordered_map,[],[AC_MSG_ERROR([Your compiler must support the Library Technical Report 1 extensions.])])
120 root 1.1
121     AC_CHECK_SIZEOF(long)
122     AC_CHECK_SIZEOF(long long)
123    
124 root 1.18 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
125    
126     AC_MSG_CHECKING(glib >= 2.10)
127     if $PKG_CONFIG glib-2.0 --atleast-version 2.10; then
128     CXXFLAGS="$CXXFLAGS `$PKG_CONFIG glib-2.0 --cflags`"
129     LIBS="$LIBS `$PKG_CONFIG glib-2.0 --libs`"
130     AC_MSG_RESULT(ok)
131     else
132     AC_MSG_ERROR(no)
133     fi
134    
135 root 1.41 AC_MSG_CHECKING(libpng)
136     if $PKG_CONFIG libpng --exists; then
137     CXXFLAGS="$CXXFLAGS `$PKG_CONFIG libpng --cflags`"
138     LIBS="$LIBS `$PKG_CONFIG libpng --libs`"
139     AC_MSG_RESULT(ok)
140     else
141     AC_MSG_ERROR(no)
142     fi
143    
144 root 1.1 AC_SUBST(x_includes)
145     AC_SUBST(x_libraries)
146     AC_SUBST(no_x)
147     AM_CONDITIONAL(HAVE_X,test "x$no_x" = "x")
148     AC_SUBST(X11LIBS)
149    
150     AC_SUBST(pkgstatedir,$localstatedir/$PACKAGE)
151     AC_SUBST(pkgconfdir,$sysconfdir/$PACKAGE)
152    
153     AC_DEFINE_UNQUOTED(COMPRESS,"${COMPRESS}",[Path to the compress binary])
154     AC_DEFINE_UNQUOTED(UNCOMPRESS,"${UNCOMPRESS}",[Path to the uncompress binary])
155     AC_DEFINE_UNQUOTED(GZIP,"${GZIP}",[Path to the gzip binary])
156     AC_DEFINE_UNQUOTED(GUNZIP,"${GUNZIP}",[Path to the gunzip binary])
157     AC_DEFINE_UNQUOTED(BZIP,"${BZIP}",[Path to the bzip binary])
158     AC_DEFINE_UNQUOTED(BUNZIP,"${BUNZIP}",[Path to the bunzip binary])
159    
160     AC_OUTPUT([Makefile
161 pippijn 1.22 include/Makefile lib/Makefile pod/Makefile random_maps/Makefile socket/Makefile
162 root 1.27 server/Makefile src/Makefile utils/Makefile ext/Makefile
163 pippijn 1.21 lib/checkarch.pl lib/collect.pl utils/add_throw.perl
164     utils/crossloop.tmpl utils/crossloop.pl.tmpl utils/metaserver.pl
165     utils/crossloop.web utils/scores.pl utils/player_dl.pl common/Makefile
166 pippijn 1.22 ])
167 root 1.30