ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/configure.ac
Revision: 1.24
Committed: Mon Dec 11 19:10:58 2006 UTC (17 years, 5 months ago) by root
Branch: MAIN
Changes since 1.23: +2 -2 lines
Log Message:
- portability fixes
- fail when GPERF not found

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    
33     AC_PROG_CPP
34     AM_PROG_LEX
35     AC_PROG_AWK
36    
37     AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc Use the dmalloc library if available, may prevent plugins from working],
38     use_dmalloc=yes, use_dmalloc=no)
39    
40 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")
41 root 1.1
42    
43     dnl check for some other programs
44     AC_PATH_PROG(LATEX, latex)
45     AC_PATH_PROG(GZIP, gzip)
46     AC_PATH_PROG(GUNZIP, gunzip)
47     AC_PATH_PROG(TAR, tar)
48     AC_PATH_PROG(PERL, perl)
49     AC_PATH_PROG(BASENAME, basename)
50 root 1.24 AC_PATH_PROG(GPERF, gperf)
51 root 1.1
52     if test -n "$GZIP" -a -z "$GUNZIP" ; then
53     echo "Found gzip, but not gunzip - setting GUNZIP to gzip -c";
54     GUNZIP="$GZIP -c"
55     fi;
56    
57     if test -z "$COMPRESS" ; then
58     AC_PATH_PROG(COMPRESS, compress)
59     AC_PATH_PROG(UNCOMPRESS, uncompress)
60     fi
61    
62     AC_PATH_PROG(BZIP, bzip2)
63     AC_PATH_PROG(BUNZIP, bunzip2)
64    
65     if test -n "$BZIP" -a -z "$BUNZIP" ; then
66     echo "Found bzip2, but not bunzip2 - setting BUNZIP to bzip2 -c";
67     BUNZIP="$BZIP -c"
68     fi;
69    
70     if test -z "$COMPRESS" -a -z "$GZIP" -a -z "$BZIP" ; then
71     echo "Unable to find either compress, bzip2, or gzip - hope you don't plan on compressing";
72     echo "any files.";
73     fi;
74    
75     dnl nsl, socket may be needed for the X-windowing system, so check
76     dnl for them before before checking for X.
77     AC_CHECK_LIB(nsl, main)
78     AC_CHECK_LIB(socket, main)
79    
80     dnl Checks for libraries.
81     AC_CHECK_LIB(m, main)
82     AC_CHECK_LIB(png, main, AC_DEFINE(HAVE_LIBPNG,[],[Define if libpng is available]) X11LIBS="$X11LIBS -lpng", , $X11LIBS )
83    
84     dnl png has a dependency in some cases on libz - if we have it, can't really
85     dnl be harmful to link it in.
86     AC_CHECK_LIB(z, main, AC_DEFINE(HAVE_LIBZ,[],[Define if libz is available]) X11LIBS="$X11LIBS -lz", , $X11LIBS )
87    
88     dnl Misc libraries.
89     AC_CHECK_LIB(crypt, main)
90     AC_CHECK_LIB(des, des_crypt)
91    
92     dnl Gros - Changed this to support some external programs that do not like dmalloc (like Python).
93     dnl If you really need to make some memory debugging, uncomment the dmalloc line and comment out the dmalloclp one.
94    
95     if eval "test x$use_dmalloc = xyes"; then
96     AC_CHECK_LIB(dmalloc, main)
97     else
98     AC_CHECK_LIB(dmalloclp, main)
99     fi
100    
101     dnl Checks for header files.
102     AC_HEADER_DIRENT
103     AC_HEADER_STDC
104     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)
105    
106    
107     dnl Checks for typedefs, structures, and compiler characteristics.
108     AC_C_CONST
109     AC_C_INLINE
110     AC_TYPE_PID_T
111     AC_TYPE_SIZE_T
112     AC_HEADER_TIME
113     AC_STRUCT_TM
114     AC_TYPE_UID_T
115    
116     AC_CHECK_SIZEOF(long)
117     AC_CHECK_SIZEOF(long long)
118    
119     dnl Checks for library functions.
120     AC_PROG_GCC_TRADITIONAL
121     AC_FUNC_MEMCMP
122     AC_FUNC_SETPGRP
123     AC_TYPE_SIGNAL
124     AC_FUNC_STRFTIME
125     AC_FUNC_VPRINTF
126     AC_CHECK_FUNCS(gettimeofday mkdir mktime rmdir select socket strcspn strerror strspn strstr strtol strcasecmp strncasecmp snprintf setsid srandom getdtablesize srand48 srand sysconf scandir)
127    
128     dnl alphasort can not be added to AC_CHECK_FUNCS because
129     AC_MSG_CHECKING(checking if alphasort is defined)
130     AC_TRY_COMPILE([#include <dirent.h>], [alphasort;],
131     ac_cv_func_alphasort=yes, ac_cv_func_alphasort=no)
132     if test "$ac_cv_func_alphasort" = yes; then
133     AC_DEFINE(HAVE_ALPHASORT, 1, [Define if you have the alphasort() function declaration.])
134     AC_MSG_RESULT(yes)
135     else
136     AC_MSG_RESULT(no)
137     fi
138    
139    
140    
141     AC_MSG_CHECKING(how many args gettimeofday uses)
142     AC_CACHE_VAL(ac_cv_gettimeofday_args,
143     [AC_TRY_COMPILE([#include <sys/time.h>
144     #include <unistd.h>],
145     [struct timeval tv; struct timezone tzp;
146     gettimeofday(&tv, &tzp);],
147     [ac_gettimeofday_args=2],
148     [AC_TRY_COMPILE([#include <sys/time.h>
149     #include <unistd.h>],
150     [struct timeval tv;
151     gettimeofday(&tv, NULL);],
152     [ac_gettimeofday_args=2],
153     [AC_TRY_COMPILE([#include <sys/time.h>
154     #include <unistd.h>],
155     [struct timeval tv; gettimeofday(&tv);],
156     [ac_gettimeofday_args=1],
157     [ac_gettimeofday_args=0])])])
158     ac_cv_gettimeofday_args=$ac_gettimeofday_args])
159    
160     ac_gettimeofday_args=$ac_cv_gettimeofday_args
161     if test $ac_gettimeofday_args = 1 ; then
162     AC_DEFINE(HAVE_GETTIMEOFDAY,[],[Define if gettimeofday is available])
163     AC_MSG_RESULT(one argument)
164     elif test $ac_gettimeofday_args = 2 ; then
165     AC_DEFINE(HAVE_GETTIMEOFDAY,[],[Define if gettimeofday is available])
166     AC_DEFINE(GETTIMEOFDAY_TWO_ARGS,[],[Define if gettimeofday takes two arguments])
167     AC_MSG_RESULT(two arguments)
168     else
169     AC_MSG_RESULT(unknown)
170     fi
171    
172 root 1.18 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
173    
174     AC_MSG_CHECKING(glib >= 2.10)
175     if $PKG_CONFIG glib-2.0 --atleast-version 2.10; then
176     CXXFLAGS="$CXXFLAGS `$PKG_CONFIG glib-2.0 --cflags`"
177     LIBS="$LIBS `$PKG_CONFIG glib-2.0 --libs`"
178     AC_MSG_RESULT(ok)
179     else
180     AC_MSG_ERROR(no)
181     fi
182    
183 root 1.1 AC_SUBST(x_includes)
184     AC_SUBST(x_libraries)
185     AC_SUBST(no_x)
186     AM_CONDITIONAL(HAVE_X,test "x$no_x" = "x")
187     AC_SUBST(X11LIBS)
188    
189     AC_SUBST(pkgstatedir,$localstatedir/$PACKAGE)
190     AC_SUBST(pkgconfdir,$sysconfdir/$PACKAGE)
191    
192     AC_DEFINE_UNQUOTED(COMPRESS,"${COMPRESS}",[Path to the compress binary])
193     AC_DEFINE_UNQUOTED(UNCOMPRESS,"${UNCOMPRESS}",[Path to the uncompress binary])
194     AC_DEFINE_UNQUOTED(GZIP,"${GZIP}",[Path to the gzip binary])
195     AC_DEFINE_UNQUOTED(GUNZIP,"${GUNZIP}",[Path to the gunzip binary])
196     AC_DEFINE_UNQUOTED(BZIP,"${BZIP}",[Path to the bzip binary])
197     AC_DEFINE_UNQUOTED(BUNZIP,"${BUNZIP}",[Path to the bunzip binary])
198    
199 root 1.24 AC_PATH_PROG(PERL, perl5.8)
200 root 1.3 AC_PATH_PROG(PERL, perl5)
201     AC_PATH_PROG(PERL, perl)
202    
203     AC_MSG_CHECKING(for $PERL suitability)
204     if $PERL -MExtUtils::Embed -e "use v5.8" >/dev/null 2>/dev/null; then
205    
206 root 1.18 save_CXXFLAGS="$CXXFLAGS"
207 root 1.3 save_LIBS="$LIBS"
208 root 1.12 CXXFLAGS="$CXXFLAGS `$PERL -MExtUtils::Embed -e ccopts` `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`"
209 root 1.3 LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`"
210     AC_TRY_LINK([
211 root 1.2 #include <EXTERN.h>
212     #include <perl.h>
213     #include <XSUB.h>
214 root 1.8 #include "EventAPI.h"
215 root 1.2 ],[
216 root 1.3 PerlInterpreter *perl = perl_alloc ();
217 root 1.2 ],[perl_link=yes],[perl_link=no])
218 root 1.12 CXXFLAGS="$save_CXXFLAGS"
219 root 1.3 LIBS="$save_LIBS"
220 root 1.2
221 root 1.3 if test x$perl_link = xyes; then
222     AC_MSG_RESULT(ok)
223     AC_DEFINE(ENABLE_PERL, 1, Define if you can embed a perl interpreter)
224 root 1.8 PERLFLAGS="`$PERL -MExtUtils::Embed -e ccopts` `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`"
225 root 1.3 PERLLIB="`$PERL -MExtUtils::Embed -e ldopts`"
226     PERLPRIVLIBEXP="`$PERL -MConfig -e 'print $Config{privlibexp}'`"
227 root 1.15 CPPFLAGS="$CPPFLAGS $PERLFLAGS"
228 root 1.2 else
229 root 1.3 AC_MSG_ERROR([no, unable to link])
230 root 1.2 fi
231 root 1.3 else
232     AC_MSG_ERROR([no working perl found, or perl not version >= 5.8])
233 root 1.2 fi
234     AC_SUBST(PERLLIB)
235     AC_SUBST(PERLFLAGS)
236     AC_SUBST(PERLPRIVLIBEXP)
237     AC_SUBST(PERL)
238    
239 root 1.1 AC_OUTPUT([Makefile
240 pippijn 1.22 include/Makefile lib/Makefile pod/Makefile random_maps/Makefile socket/Makefile
241     server/Makefile src/Makefile utils/Makefile
242 pippijn 1.21 lib/checkarch.pl lib/collect.pl utils/add_throw.perl
243     utils/crossloop.tmpl utils/crossloop.pl.tmpl utils/metaserver.pl
244     utils/crossloop.web utils/scores.pl utils/player_dl.pl common/Makefile
245 pippijn 1.22 ])