ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/configure.ac
Revision: 1.25
Committed: Mon Dec 11 19:21:12 2006 UTC (17 years, 5 months ago) by root
Branch: MAIN
Changes since 1.24: +9 -26 lines
Log Message:
require gperf

File Contents

# User Rev Content
1 root 1.1 dnl Process this file with autoconf to produce a configure script.
2    
3 root 1.23 AC_INIT([crossfire], [2.0+], [crossfire-devel@listserv.real-time.com])
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 Gros - Changed this to support some external programs that do not like dmalloc (like Python).
80     dnl If you really need to make some memory debugging, uncomment the dmalloc line and comment out the dmalloclp one.
81    
82     if eval "test x$use_dmalloc = xyes"; then
83     AC_CHECK_LIB(dmalloc, main)
84     else
85     AC_CHECK_LIB(dmalloclp, main)
86     fi
87    
88     dnl Checks for header files.
89     AC_HEADER_DIRENT
90     AC_HEADER_STDC
91     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)
92    
93    
94     dnl Checks for typedefs, structures, and compiler characteristics.
95     AC_C_CONST
96     AC_C_INLINE
97     AC_TYPE_PID_T
98     AC_TYPE_SIZE_T
99     AC_HEADER_TIME
100     AC_STRUCT_TM
101     AC_TYPE_UID_T
102    
103     AC_CHECK_SIZEOF(long)
104     AC_CHECK_SIZEOF(long long)
105    
106     dnl Checks for library functions.
107     AC_PROG_GCC_TRADITIONAL
108     AC_FUNC_MEMCMP
109     AC_FUNC_SETPGRP
110     AC_TYPE_SIGNAL
111     AC_FUNC_STRFTIME
112     AC_FUNC_VPRINTF
113     AC_CHECK_FUNCS(gettimeofday mkdir mktime rmdir select socket strcspn strerror strspn strstr strtol strcasecmp strncasecmp snprintf setsid srandom getdtablesize srand48 srand sysconf scandir)
114    
115     dnl alphasort can not be added to AC_CHECK_FUNCS because
116     AC_MSG_CHECKING(checking if alphasort is defined)
117     AC_TRY_COMPILE([#include <dirent.h>], [alphasort;],
118     ac_cv_func_alphasort=yes, ac_cv_func_alphasort=no)
119     if test "$ac_cv_func_alphasort" = yes; then
120     AC_DEFINE(HAVE_ALPHASORT, 1, [Define if you have the alphasort() function declaration.])
121     AC_MSG_RESULT(yes)
122     else
123     AC_MSG_RESULT(no)
124     fi
125    
126    
127    
128     AC_MSG_CHECKING(how many args gettimeofday uses)
129     AC_CACHE_VAL(ac_cv_gettimeofday_args,
130     [AC_TRY_COMPILE([#include <sys/time.h>
131     #include <unistd.h>],
132     [struct timeval tv; struct timezone tzp;
133     gettimeofday(&tv, &tzp);],
134     [ac_gettimeofday_args=2],
135     [AC_TRY_COMPILE([#include <sys/time.h>
136     #include <unistd.h>],
137     [struct timeval tv;
138     gettimeofday(&tv, NULL);],
139     [ac_gettimeofday_args=2],
140     [AC_TRY_COMPILE([#include <sys/time.h>
141     #include <unistd.h>],
142     [struct timeval tv; gettimeofday(&tv);],
143     [ac_gettimeofday_args=1],
144     [ac_gettimeofday_args=0])])])
145     ac_cv_gettimeofday_args=$ac_gettimeofday_args])
146    
147     ac_gettimeofday_args=$ac_cv_gettimeofday_args
148     if test $ac_gettimeofday_args = 1 ; then
149     AC_DEFINE(HAVE_GETTIMEOFDAY,[],[Define if gettimeofday is available])
150     AC_MSG_RESULT(one argument)
151     elif test $ac_gettimeofday_args = 2 ; then
152     AC_DEFINE(HAVE_GETTIMEOFDAY,[],[Define if gettimeofday is available])
153     AC_DEFINE(GETTIMEOFDAY_TWO_ARGS,[],[Define if gettimeofday takes two arguments])
154     AC_MSG_RESULT(two arguments)
155     else
156     AC_MSG_RESULT(unknown)
157     fi
158    
159 root 1.18 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
160    
161     AC_MSG_CHECKING(glib >= 2.10)
162     if $PKG_CONFIG glib-2.0 --atleast-version 2.10; then
163     CXXFLAGS="$CXXFLAGS `$PKG_CONFIG glib-2.0 --cflags`"
164     LIBS="$LIBS `$PKG_CONFIG glib-2.0 --libs`"
165     AC_MSG_RESULT(ok)
166     else
167     AC_MSG_ERROR(no)
168     fi
169    
170 root 1.1 AC_SUBST(x_includes)
171     AC_SUBST(x_libraries)
172     AC_SUBST(no_x)
173     AM_CONDITIONAL(HAVE_X,test "x$no_x" = "x")
174     AC_SUBST(X11LIBS)
175    
176     AC_SUBST(pkgstatedir,$localstatedir/$PACKAGE)
177     AC_SUBST(pkgconfdir,$sysconfdir/$PACKAGE)
178    
179     AC_DEFINE_UNQUOTED(COMPRESS,"${COMPRESS}",[Path to the compress binary])
180     AC_DEFINE_UNQUOTED(UNCOMPRESS,"${UNCOMPRESS}",[Path to the uncompress binary])
181     AC_DEFINE_UNQUOTED(GZIP,"${GZIP}",[Path to the gzip binary])
182     AC_DEFINE_UNQUOTED(GUNZIP,"${GUNZIP}",[Path to the gunzip binary])
183     AC_DEFINE_UNQUOTED(BZIP,"${BZIP}",[Path to the bzip binary])
184     AC_DEFINE_UNQUOTED(BUNZIP,"${BUNZIP}",[Path to the bunzip binary])
185    
186 root 1.3 AC_MSG_CHECKING(for $PERL suitability)
187     if $PERL -MExtUtils::Embed -e "use v5.8" >/dev/null 2>/dev/null; then
188    
189 root 1.18 save_CXXFLAGS="$CXXFLAGS"
190 root 1.3 save_LIBS="$LIBS"
191 root 1.12 CXXFLAGS="$CXXFLAGS `$PERL -MExtUtils::Embed -e ccopts` `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`"
192 root 1.3 LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`"
193     AC_TRY_LINK([
194 root 1.2 #include <EXTERN.h>
195     #include <perl.h>
196     #include <XSUB.h>
197 root 1.8 #include "EventAPI.h"
198 root 1.2 ],[
199 root 1.3 PerlInterpreter *perl = perl_alloc ();
200 root 1.2 ],[perl_link=yes],[perl_link=no])
201 root 1.12 CXXFLAGS="$save_CXXFLAGS"
202 root 1.3 LIBS="$save_LIBS"
203 root 1.2
204 root 1.3 if test x$perl_link = xyes; then
205     AC_MSG_RESULT(ok)
206     AC_DEFINE(ENABLE_PERL, 1, Define if you can embed a perl interpreter)
207 root 1.8 PERLFLAGS="`$PERL -MExtUtils::Embed -e ccopts` `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`"
208 root 1.3 PERLLIB="`$PERL -MExtUtils::Embed -e ldopts`"
209     PERLPRIVLIBEXP="`$PERL -MConfig -e 'print $Config{privlibexp}'`"
210 root 1.15 CPPFLAGS="$CPPFLAGS $PERLFLAGS"
211 root 1.2 else
212 root 1.3 AC_MSG_ERROR([no, unable to link])
213 root 1.2 fi
214 root 1.3 else
215     AC_MSG_ERROR([no working perl found, or perl not version >= 5.8])
216 root 1.2 fi
217     AC_SUBST(PERLLIB)
218     AC_SUBST(PERLFLAGS)
219     AC_SUBST(PERLPRIVLIBEXP)
220     AC_SUBST(PERL)
221    
222 root 1.1 AC_OUTPUT([Makefile
223 pippijn 1.22 include/Makefile lib/Makefile pod/Makefile random_maps/Makefile socket/Makefile
224     server/Makefile src/Makefile utils/Makefile
225 pippijn 1.21 lib/checkarch.pl lib/collect.pl utils/add_throw.perl
226     utils/crossloop.tmpl utils/crossloop.pl.tmpl utils/metaserver.pl
227     utils/crossloop.web utils/scores.pl utils/player_dl.pl common/Makefile
228 pippijn 1.22 ])