1 | dnl Process this file with autoconf to produce a configure script. |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | |
2 | |
3 | AC_INIT([crossfire], [2.0+], [crossfire-devel@listserv.real-time.com]) |
3 | AC_INIT([crossfire], [2.0+], [crossfire@schmorp.de]) |
4 | AC_CONFIG_AUX_DIR(utils) |
4 | AC_CONFIG_AUX_DIR(utils) |
5 | AC_CONFIG_SRCDIR([server/main.C]) |
5 | AC_CONFIG_SRCDIR([server/main.C]) |
6 | AM_INIT_AUTOMAKE |
6 | AM_INIT_AUTOMAKE |
7 | AM_CONFIG_HEADER(include/autoconf.h) |
7 | AM_CONFIG_HEADER(include/autoconf.h) |
8 | |
8 | |
9 | AM_MAINTAINER_MODE |
9 | AM_MAINTAINER_MODE |
10 | |
10 | |
11 | AC_PREFIX_DEFAULT(/usr/games/crossfire) |
11 | AC_PREFIX_DEFAULT(/usr/games/crossfire) |
12 | |
12 | |
13 | dnl we want a config.h file instead of -D options. |
13 | AC_PATH_PROG(PERL, perl5.8) |
|
|
14 | AC_PATH_PROG(PERL, perl5) |
|
|
15 | AC_PATH_PROG(PERL, perl) |
|
|
16 | |
|
|
17 | for module_vers in "Coro 3.4" "Coro::Event 2.0" "Event 1.08" \ |
|
|
18 | "IO::AIO 2.32" "Storable 2.0" "Time::HiRes 1.0" "YAML::Syck 0.71" \ |
|
|
19 | "Digest::MD5 2.0" "Compress::LZF 1.7" "Safe::Hole 0.10"; do |
|
|
20 | set -- $module_vers |
|
|
21 | module=$1 |
|
|
22 | minvers=$2 |
|
|
23 | AC_MSG_CHECKING(for $module perl module version $minvers or higher) |
|
|
24 | if $PERL -M$module -e0 >/dev/null 2>&1; then |
|
|
25 | version=`$PERL -M$module -e "print \\$$module::VERSION"` |
|
|
26 | if $PERL -M$module=$minvers -e0 >/dev/null 2>&1; then |
|
|
27 | AC_MSG_RESULT([ok, version $version]) |
|
|
28 | else |
|
|
29 | AC_MSG_ERROR([no, installed version is $version]) |
|
|
30 | fi |
|
|
31 | else |
|
|
32 | AC_MSG_ERROR([no, cannot load module $module]) |
|
|
33 | fi |
|
|
34 | done |
14 | |
35 | |
15 | dnl Checks for programs. |
36 | dnl Checks for programs. |
16 | AC_LANG(C++) |
37 | AC_LANG(C++) |
17 | AC_PROG_CXX |
38 | AC_PROG_CXX |
18 | AC_PROG_LIBTOOL |
39 | AC_PROG_LIBTOOL |
… | |
… | |
28 | *) |
49 | *) |
29 | ;; |
50 | ;; |
30 | esac |
51 | esac |
31 | |
52 | |
32 | AC_PROG_CPP |
53 | AC_PROG_CPP |
33 | AM_PROG_LEX |
|
|
34 | AC_PROG_AWK |
|
|
35 | |
54 | |
36 | dnl AC_ARG_WITH(python, [ --with-python=dir Directory to look for python headers/library (default=standard system location) ], PYTHON_HOME="$withval") |
55 | dnl AC_ARG_WITH(python, [ --with-python=dir Directory to look for python headers/library (default=standard system location) ], PYTHON_HOME="$withval") |
37 | |
56 | |
38 | dnl check for some other programs |
57 | dnl check for some other programs |
39 | AC_PATH_PROG(LATEX, latex) |
58 | AC_PATH_PROG(LATEX, latex) |
40 | AC_PATH_PROG(GZIP, gzip) |
59 | AC_PATH_PROG(GZIP, gzip) |
41 | AC_PATH_PROG(BZIP, bzip2) |
60 | AC_PATH_PROG(BZIP, bzip2) |
42 | AC_PATH_PROG(TAR, tar) |
61 | AC_PATH_PROG(TAR, tar) |
43 | AC_PATH_PROG(BASENAME, basename) |
62 | AC_PATH_PROG(BASENAME, basename) |
44 | |
|
|
45 | AC_PATH_PROG(PERL, perl5.8) |
|
|
46 | AC_PATH_PROG(PERL, perl5) |
|
|
47 | AC_PATH_PROG(PERL, perl) |
|
|
48 | |
63 | |
49 | AC_PATH_PROG(GPERF, gperf) |
64 | AC_PATH_PROG(GPERF, gperf) |
50 | if test -z "$GPERF"; then |
65 | if test -z "$GPERF"; then |
51 | AC_MSG_ERROR([we need gperf, the GNU perfect hash generator]) |
66 | AC_MSG_ERROR([we need gperf, the GNU perfect hash generator]) |
52 | fi |
67 | fi |
… | |
… | |
70 | |
85 | |
71 | dnl png has a dependency in some cases on libz - if we have it, can't really |
86 | 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. |
87 | 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 ) |
88 | AC_CHECK_LIB(z, main, AC_DEFINE(HAVE_LIBZ,[],[Define if libz is available]) X11LIBS="$X11LIBS -lz", , $X11LIBS ) |
74 | |
89 | |
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. |
90 | dnl Checks for typedefs, structures, and compiler characteristics. |
95 | AC_C_CONST |
|
|
96 | AC_C_INLINE |
91 | 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 | |
92 | |
103 | AC_CHECK_SIZEOF(long) |
93 | AC_CHECK_SIZEOF(long) |
104 | AC_CHECK_SIZEOF(long long) |
94 | AC_CHECK_SIZEOF(long long) |
105 | |
95 | |
106 | dnl Checks for library functions. |
96 | dnl Checks for library functions. |
107 | AC_PROG_GCC_TRADITIONAL |
97 | AC_PROG_GCC_TRADITIONAL |
108 | AC_FUNC_MEMCMP |
|
|
109 | AC_FUNC_SETPGRP |
|
|
110 | AC_TYPE_SIGNAL |
98 | 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 | |
99 | |
159 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
100 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
160 | |
101 | |
161 | AC_MSG_CHECKING(glib >= 2.10) |
102 | AC_MSG_CHECKING(glib >= 2.10) |
162 | if $PKG_CONFIG glib-2.0 --atleast-version 2.10; then |
103 | if $PKG_CONFIG glib-2.0 --atleast-version 2.10; then |
… | |
… | |
182 | AC_DEFINE_UNQUOTED(GUNZIP,"${GUNZIP}",[Path to the gunzip binary]) |
123 | AC_DEFINE_UNQUOTED(GUNZIP,"${GUNZIP}",[Path to the gunzip binary]) |
183 | AC_DEFINE_UNQUOTED(BZIP,"${BZIP}",[Path to the bzip binary]) |
124 | AC_DEFINE_UNQUOTED(BZIP,"${BZIP}",[Path to the bzip binary]) |
184 | AC_DEFINE_UNQUOTED(BUNZIP,"${BUNZIP}",[Path to the bunzip binary]) |
125 | AC_DEFINE_UNQUOTED(BUNZIP,"${BUNZIP}",[Path to the bunzip binary]) |
185 | |
126 | |
186 | AC_MSG_CHECKING(for $PERL suitability) |
127 | AC_MSG_CHECKING(for $PERL suitability) |
187 | if $PERL -MExtUtils::Embed -e "use v5.8" >/dev/null 2>/dev/null; then |
128 | if $PERL -MExtUtils::Embed -e "use v5.8" >/dev/null 2>&1; then |
188 | |
|
|
189 | save_CXXFLAGS="$CXXFLAGS" |
129 | save_CXXFLAGS="$CXXFLAGS" |
190 | save_LIBS="$LIBS" |
130 | save_LIBS="$LIBS" |
|
|
131 | xPERLFLAGS="`$PERL -MExtUtils::Embed -e ccopts`" |
191 | CXXFLAGS="$CXXFLAGS `$PERL -MExtUtils::Embed -e ccopts` `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`" |
132 | xPERLFLAGS="$xPERLFLAGS `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`" |
|
|
133 | xPERLFLAGS="$xPERLFLAGS `$PERL -MCoro::MakeMaker -e 'print +{&Coro::MakeMaker::coro_args}->{INC}'`" |
|
|
134 | CXXFLAGS="$CXXFLAGS $xPERLFLAGS" |
192 | LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`" |
135 | LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`" |
193 | AC_TRY_LINK([ |
136 | AC_TRY_LINK([ |
194 | #include <EXTERN.h> |
137 | #include <EXTERN.h> |
195 | #include <perl.h> |
138 | #include <perl.h> |
196 | #include <XSUB.h> |
139 | #include <XSUB.h> |
… | |
… | |
202 | LIBS="$save_LIBS" |
145 | LIBS="$save_LIBS" |
203 | |
146 | |
204 | if test x$perl_link = xyes; then |
147 | if test x$perl_link = xyes; then |
205 | AC_MSG_RESULT(ok) |
148 | AC_MSG_RESULT(ok) |
206 | AC_DEFINE(ENABLE_PERL, 1, Define if you can embed a perl interpreter) |
149 | AC_DEFINE(ENABLE_PERL, 1, Define if you can embed a perl interpreter) |
207 | PERLFLAGS="`$PERL -MExtUtils::Embed -e ccopts` `$PERL -MEvent::MakeMaker -e 'print +{&Event::MakeMaker::event_args}->{INC}'`" |
150 | PERLFLAGS="$xPERLFLAGS" |
208 | PERLLIB="`$PERL -MExtUtils::Embed -e ldopts`" |
151 | PERLLIB="`$PERL -MExtUtils::Embed -e ldopts`" |
209 | PERLPRIVLIBEXP="`$PERL -MConfig -e 'print $Config{privlibexp}'`" |
152 | PERLPRIVLIBEXP="`$PERL -MConfig -e 'print $Config{privlibexp}'`" |
210 | CPPFLAGS="$CPPFLAGS $PERLFLAGS" |
153 | CPPFLAGS="$CPPFLAGS $PERLFLAGS" |
211 | else |
154 | else |
212 | AC_MSG_ERROR([no, unable to link]) |
155 | AC_MSG_ERROR([no, unable to link]) |
… | |
… | |
219 | AC_SUBST(PERLPRIVLIBEXP) |
162 | AC_SUBST(PERLPRIVLIBEXP) |
220 | AC_SUBST(PERL) |
163 | AC_SUBST(PERL) |
221 | |
164 | |
222 | AC_OUTPUT([Makefile |
165 | AC_OUTPUT([Makefile |
223 | include/Makefile lib/Makefile pod/Makefile random_maps/Makefile socket/Makefile |
166 | include/Makefile lib/Makefile pod/Makefile random_maps/Makefile socket/Makefile |
224 | server/Makefile src/Makefile utils/Makefile |
167 | server/Makefile src/Makefile utils/Makefile ext/Makefile |
225 | lib/checkarch.pl lib/collect.pl utils/add_throw.perl |
168 | lib/checkarch.pl lib/collect.pl utils/add_throw.perl |
226 | utils/crossloop.tmpl utils/crossloop.pl.tmpl utils/metaserver.pl |
169 | utils/crossloop.tmpl utils/crossloop.pl.tmpl utils/metaserver.pl |
227 | utils/crossloop.web utils/scores.pl utils/player_dl.pl common/Makefile |
170 | utils/crossloop.web utils/scores.pl utils/player_dl.pl common/Makefile |
228 | ]) |
171 | ]) |
|
|
172 | |