ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/configure.ac
Revision: 1.28
Committed: Fri Dec 15 20:07:02 2006 UTC (17 years, 4 months ago) by root
Branch: MAIN
Changes since 1.27: +1 -1 lines
Log Message:
more slight copyright adjustments

File Contents

# User Rev Content
1 root 1.1 dnl Process this file with autoconf to produce a configure script.
2    
3 root 1.28 AC_INIT([crossfire], [2.0+], [crossfire.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     dnl we want a config.h file instead of -D options.
14    
15     dnl Checks for programs.
16 root 1.17 AC_LANG(C++)
17 root 1.12 AC_PROG_CXX
18 root 1.1 AC_PROG_LIBTOOL
19    
20     case "$target" in
21     alpha-dec-osf*)
22     # If we are not using gcc, we want the ansi version of cc.
23     if test -z "$GCC"; then
24     # CFLAGS="$CFLAGS -std1 -warnprotos" # Not yet ready for warnprotos...
25     CFLAGS="$CFLAGS -std1"
26     fi
27     ;;
28     *)
29     ;;
30     esac
31    
32     AC_PROG_CPP
33     AM_PROG_LEX
34     AC_PROG_AWK
35    
36 root 1.14 dnl AC_ARG_WITH(python, [ --with-python=dir Directory to look for python headers/library (default=standard system location) ], PYTHON_HOME="$withval")
37 root 1.1
38     dnl check for some other programs
39     AC_PATH_PROG(LATEX, latex)
40     AC_PATH_PROG(GZIP, gzip)
41 root 1.25 AC_PATH_PROG(BZIP, bzip2)
42 root 1.1 AC_PATH_PROG(TAR, tar)
43     AC_PATH_PROG(BASENAME, basename)
44    
45 root 1.25 AC_PATH_PROG(PERL, perl5.8)
46     AC_PATH_PROG(PERL, perl5)
47     AC_PATH_PROG(PERL, perl)
48 root 1.1
49 root 1.25 AC_PATH_PROG(GPERF, gperf)
50     if test -z "$GPERF"; then
51     AC_MSG_ERROR([we need gperf, the GNU perfect hash generator])
52 root 1.1 fi
53    
54 root 1.25 GUNZIP="$GZIP -c"
55     BUNZIP="$BZIP -c"
56 root 1.1
57     if test -z "$COMPRESS" -a -z "$GZIP" -a -z "$BZIP" ; then
58     echo "Unable to find either compress, bzip2, or gzip - hope you don't plan on compressing";
59     echo "any files.";
60     fi;
61    
62     dnl nsl, socket may be needed for the X-windowing system, so check
63     dnl for them before before checking for X.
64     AC_CHECK_LIB(nsl, main)
65     AC_CHECK_LIB(socket, main)
66    
67     dnl Checks for libraries.
68     AC_CHECK_LIB(m, main)
69     AC_CHECK_LIB(png, main, AC_DEFINE(HAVE_LIBPNG,[],[Define if libpng is available]) X11LIBS="$X11LIBS -lpng", , $X11LIBS )
70    
71     dnl png has a dependency in some cases on libz - if we have it, can't really
72     dnl be harmful to link it in.
73     AC_CHECK_LIB(z, main, AC_DEFINE(HAVE_LIBZ,[],[Define if libz is available]) X11LIBS="$X11LIBS -lz", , $X11LIBS )
74    
75     dnl Misc libraries.
76     AC_CHECK_LIB(crypt, main)
77     AC_CHECK_LIB(des, des_crypt)
78    
79     dnl Checks for header files.
80 root 1.26 AC_CHECK_HEADERS(crypt.h des.h)
81 root 1.1
82     dnl Checks for typedefs, structures, and compiler characteristics.
83     AC_C_INLINE
84    
85     AC_CHECK_SIZEOF(long)
86     AC_CHECK_SIZEOF(long long)
87    
88     dnl Checks for library functions.
89     AC_PROG_GCC_TRADITIONAL
90     AC_TYPE_SIGNAL
91    
92     dnl alphasort can not be added to AC_CHECK_FUNCS because
93     AC_MSG_CHECKING(checking if alphasort is defined)
94     AC_TRY_COMPILE([#include <dirent.h>], [alphasort;],
95     ac_cv_func_alphasort=yes, ac_cv_func_alphasort=no)
96     if test "$ac_cv_func_alphasort" = yes; then
97     AC_DEFINE(HAVE_ALPHASORT, 1, [Define if you have the alphasort() function declaration.])
98     AC_MSG_RESULT(yes)
99     else
100     AC_MSG_RESULT(no)
101     fi
102    
103    
104    
105     AC_MSG_CHECKING(how many args gettimeofday uses)
106     AC_CACHE_VAL(ac_cv_gettimeofday_args,
107     [AC_TRY_COMPILE([#include <sys/time.h>
108     #include <unistd.h>],
109     [struct timeval tv; struct timezone tzp;
110     gettimeofday(&tv, &tzp);],
111     [ac_gettimeofday_args=2],
112     [AC_TRY_COMPILE([#include <sys/time.h>
113     #include <unistd.h>],
114     [struct timeval tv;
115     gettimeofday(&tv, NULL);],
116     [ac_gettimeofday_args=2],
117     [AC_TRY_COMPILE([#include <sys/time.h>
118     #include <unistd.h>],
119     [struct timeval tv; gettimeofday(&tv);],
120     [ac_gettimeofday_args=1],
121     [ac_gettimeofday_args=0])])])
122     ac_cv_gettimeofday_args=$ac_gettimeofday_args])
123    
124     ac_gettimeofday_args=$ac_cv_gettimeofday_args
125     if test $ac_gettimeofday_args = 1 ; then
126     AC_DEFINE(HAVE_GETTIMEOFDAY,[],[Define if gettimeofday is available])
127     AC_MSG_RESULT(one argument)
128     elif test $ac_gettimeofday_args = 2 ; then
129     AC_DEFINE(HAVE_GETTIMEOFDAY,[],[Define if gettimeofday is available])
130     AC_DEFINE(GETTIMEOFDAY_TWO_ARGS,[],[Define if gettimeofday takes two arguments])
131     AC_MSG_RESULT(two arguments)
132     else
133     AC_MSG_RESULT(unknown)
134     fi
135    
136 root 1.18 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
137    
138     AC_MSG_CHECKING(glib >= 2.10)
139     if $PKG_CONFIG glib-2.0 --atleast-version 2.10; then
140     CXXFLAGS="$CXXFLAGS `$PKG_CONFIG glib-2.0 --cflags`"
141     LIBS="$LIBS `$PKG_CONFIG glib-2.0 --libs`"
142     AC_MSG_RESULT(ok)
143     else
144     AC_MSG_ERROR(no)
145     fi
146    
147 root 1.1 AC_SUBST(x_includes)
148     AC_SUBST(x_libraries)
149     AC_SUBST(no_x)
150     AM_CONDITIONAL(HAVE_X,test "x$no_x" = "x")
151     AC_SUBST(X11LIBS)
152    
153     AC_SUBST(pkgstatedir,$localstatedir/$PACKAGE)
154     AC_SUBST(pkgconfdir,$sysconfdir/$PACKAGE)
155    
156     AC_DEFINE_UNQUOTED(COMPRESS,"${COMPRESS}",[Path to the compress binary])
157     AC_DEFINE_UNQUOTED(UNCOMPRESS,"${UNCOMPRESS}",[Path to the uncompress binary])
158     AC_DEFINE_UNQUOTED(GZIP,"${GZIP}",[Path to the gzip binary])
159     AC_DEFINE_UNQUOTED(GUNZIP,"${GUNZIP}",[Path to the gunzip binary])
160     AC_DEFINE_UNQUOTED(BZIP,"${BZIP}",[Path to the bzip binary])
161     AC_DEFINE_UNQUOTED(BUNZIP,"${BUNZIP}",[Path to the bunzip binary])
162    
163 root 1.3 AC_MSG_CHECKING(for $PERL suitability)
164     if $PERL -MExtUtils::Embed -e "use v5.8" >/dev/null 2>/dev/null; then
165    
166 root 1.18 save_CXXFLAGS="$CXXFLAGS"
167 root 1.3 save_LIBS="$LIBS"
168 root 1.12 CXXFLAGS="$CXXFLAGS `$PERL -MExtUtils::Embed -e ccopts` `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`"
169 root 1.3 LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`"
170     AC_TRY_LINK([
171 root 1.2 #include <EXTERN.h>
172     #include <perl.h>
173     #include <XSUB.h>
174 root 1.8 #include "EventAPI.h"
175 root 1.2 ],[
176 root 1.3 PerlInterpreter *perl = perl_alloc ();
177 root 1.2 ],[perl_link=yes],[perl_link=no])
178 root 1.12 CXXFLAGS="$save_CXXFLAGS"
179 root 1.3 LIBS="$save_LIBS"
180 root 1.2
181 root 1.3 if test x$perl_link = xyes; then
182     AC_MSG_RESULT(ok)
183     AC_DEFINE(ENABLE_PERL, 1, Define if you can embed a perl interpreter)
184 root 1.8 PERLFLAGS="`$PERL -MExtUtils::Embed -e ccopts` `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`"
185 root 1.3 PERLLIB="`$PERL -MExtUtils::Embed -e ldopts`"
186     PERLPRIVLIBEXP="`$PERL -MConfig -e 'print $Config{privlibexp}'`"
187 root 1.15 CPPFLAGS="$CPPFLAGS $PERLFLAGS"
188 root 1.2 else
189 root 1.3 AC_MSG_ERROR([no, unable to link])
190 root 1.2 fi
191 root 1.3 else
192     AC_MSG_ERROR([no working perl found, or perl not version >= 5.8])
193 root 1.2 fi
194     AC_SUBST(PERLLIB)
195     AC_SUBST(PERLFLAGS)
196     AC_SUBST(PERLPRIVLIBEXP)
197     AC_SUBST(PERL)
198    
199 root 1.1 AC_OUTPUT([Makefile
200 pippijn 1.22 include/Makefile lib/Makefile pod/Makefile random_maps/Makefile socket/Makefile
201 root 1.27 server/Makefile src/Makefile utils/Makefile ext/Makefile
202 pippijn 1.21 lib/checkarch.pl lib/collect.pl utils/add_throw.perl
203     utils/crossloop.tmpl utils/crossloop.pl.tmpl utils/metaserver.pl
204     utils/crossloop.web utils/scores.pl utils/player_dl.pl common/Makefile
205 pippijn 1.22 ])