File: configure.ac

package info (click to toggle)
crossfire 1.71.0+dfsg1-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 28,076 kB
  • sloc: ansic: 85,126; sh: 11,978; perl: 2,659; lex: 2,044; makefile: 1,271
file content (318 lines) | stat: -rw-r--r-- 11,793 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# Process this file with autoconf to produce a configure script.

AC_INIT([crossfire], [1.71.0], [crossfire@metalforge.org])
AC_CONFIG_AUX_DIR([utils])
AC_CONFIG_HEADERS([include/autoconf.h])
AC_CONFIG_MACRO_DIR([macros])
AC_CONFIG_SRCDIR([server/main.c])
AC_PREFIX_DEFAULT([/usr/games/crossfire])
AM_INIT_AUTOMAKE

##############################################################################
# Configuration Options
##############################################################################
AC_ARG_ENABLE(mapper, [AS_HELP_STRING([--enable-mapper],
              [Build the crossfire-mapper utility (requires libgd)])],
              [enable_mapper=yes], [enable_mapper=no])

# Options for plugins
AC_ARG_WITH(python, [AS_HELP_STRING([--with-python=dir],
            [Directory to look for python headers/library])],
            [PYTHON_HOME="$withval"])

AC_ARG_ENABLE(cfrhg, [AS_HELP_STRING([--enable-cfrhg],
              [Build the random house generator plugin])],
              [], [enable_cfrhg=no])

AC_ARG_ENABLE(logger, [AS_HELP_STRING([--enable-logger],
              [Build the SQLite logging plugin])],
              [enable_logger=yes], [enable_logger=no])

AC_ARG_ENABLE(newspaper, [AS_HELP_STRING([--enable-newspaper],
              [Build the newspaper plugin])],
              [enable_newspaper=yes], [enable_newspaper=no])

# Unit test configuration
AC_ARG_ENABLE(check, [AS_HELP_STRING([--disable-check],
              [Disable the unit tests even if check is available])],
              [enable_check=no], [enable_check=yes])

# Add support for dmalloc, if the user wants it.
AM_WITH_DMALLOC

##############################################################################
# Program Checks
##############################################################################
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LIBTOOL
AM_PROG_LEX

AC_PATH_PROG(BASENAME, basename)
AC_PATH_PROG(BZIP, bzip2)
AC_PATH_PROG(COMPRESS, compress)
AC_PATH_PROG(GZIP, gzip)
AC_PATH_PROG(LATEX, latex)
AC_PATH_PROG(PERL, perl)
AC_PATH_PROG(SVNVERSION, svnversion)
AC_PATH_PROG(TAR, tar)

AC_SUBST(BASENAME)
AC_SUBST(PERL)

if test -z "$COMPRESS" -a -z "$GZIP" -a -z "$BZIP" ; then
    AC_MSG_NOTICE([Unable to find compress, gzip, or bzip2])
fi;

AC_DEFINE_UNQUOTED(BZIP,"${BZIP}",[Path to the bzip binary])
AC_DEFINE_UNQUOTED(COMPRESS,"${COMPRESS}",[Path to the compress binary])
AC_DEFINE_UNQUOTED(GZIP,"${GZIP}",[Path to the gzip binary])

##############################################################################
# Library Checks
##############################################################################
# Check for some library functions
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([pow], [m])
AC_SEARCH_LIBS([sqrt], [m])

# Misc libraries.
AC_SEARCH_LIBS([crypt], [crypt])
AC_CHECK_LIB(des, des_crypt)

AC_CHECK_LIB(z, compress)
AC_CHECK_LIB(pthread, pthread_create)

LIBCURL_CHECK_CONFIG()
LIBS="$LIBS $LIBCURL"
CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"

# For utils/mapper
if test "$enable_mapper" = "yes"; then
    PKG_CHECK_MODULES([GD], [gdlib])
    AC_SUBST(GD_LIBS, $GD_LIBS)
fi
AM_CONDITIONAL(MAPPER, test "$enable_mapper" = "yes")

# Random house generator
AM_CONDITIONAL(CFRHG_PLUGIN, test "$enable_cfrhg" = "yes")

# Libraries used for plugins
AC_SEARCH_LIBS(dlopen, [dl], [ cf_have_libdl=yes ])
AC_CHECK_LIB(sqlite3, sqlite3_open,[ cf_have_libsqlite=yes ])

##############################################################################
# Header File, Type, Structure, and Compiler Checks
##############################################################################
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h stddef.h stdlib.h strings.h sys/file.h sys/ioctl.h sys/time.h time.h unistd.h sys/ttycom.h termios.h sys/termios.h crypt.h des.h zlib.h pthread.h curl/curl.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_STDBOOL
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT8_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T

AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)

CF_CHECK_VISIBILITY()

##############################################################################
# Library Function Checks
##############################################################################
# Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_SETPGRP
AC_FUNC_STRERROR_R
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF

AC_CHECK_FUNCS([getdtablesize gettimeofday mkdir mktime rmdir select socket strcasecmp strcspn strerror strncasecmp strspn strstr strtol snprintf setsid srandom srand48 srand sysconf scandir getaddrinfo getnameinfo])

# alphasort can not be added to AC_CHECK_FUNCS because
AC_MSG_CHECKING(checking if alphasort is defined)
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <dirent.h>]], [[alphasort;]])],[ac_cv_func_alphasort=yes],[ac_cv_func_alphasort=no])
  if test "$ac_cv_func_alphasort" = yes; then
    AC_DEFINE(HAVE_ALPHASORT, 1, [Define if you have the alphasort() function declaration.])
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
  fi

AC_MSG_CHECKING(how many args gettimeofday uses)
AC_CACHE_VAL(ac_cv_gettimeofday_args,
 [AC_TRY_COMPILE([#include <sys/time.h>
	#include <unistd.h>],
	[struct timeval tv; struct timezone tzp;
	gettimeofday(&tv, &tzp);],
	[ac_gettimeofday_args=2],
		[AC_TRY_COMPILE([#include <sys/time.h>
		#include <unistd.h>],
		[struct timeval tv;
		gettimeofday(&tv, NULL);],
		[ac_gettimeofday_args=2],
		[AC_TRY_COMPILE([#include <sys/time.h>
			#include <unistd.h>],
			[struct timeval tv; gettimeofday(&tv);],
			[ac_gettimeofday_args=1],
			[ac_gettimeofday_args=0])])])
  ac_cv_gettimeofday_args=$ac_gettimeofday_args])

ac_gettimeofday_args=$ac_cv_gettimeofday_args
if test $ac_gettimeofday_args = 1 ; then
  AC_DEFINE(HAVE_GETTIMEOFDAY,[],[Define if gettimeofday is available])
  AC_MSG_RESULT(one argument)
elif test $ac_gettimeofday_args = 2 ; then
  AC_DEFINE(HAVE_GETTIMEOFDAY,[],[Define if gettimeofday is available])
  AC_DEFINE(GETTIMEOFDAY_TWO_ARGS,[],[Define if gettimeofday takes two arguments])
  AC_MSG_RESULT(two arguments)
else
  AC_MSG_RESULT(unknown)
fi

AC_SUBST(pkgstatedir,$localstatedir/$PACKAGE)
AC_SUBST(pkgconfdir,$sysconfdir/$PACKAGE)

#############################################
# Plugin configuration
AM_CONDITIONAL(HAVE_LIBDL, test "$cf_have_libdl" = "yes")

# Test for libdl isn't taken into account for many plugins, don't take into
# account for Python. Fixes bug #3353920.
# Besides, one can hope modern systems do have that function.

#if test "$cf_have_libdl" = "yes" ; then
    ###############
    # Python plugin
    CF_CHECK_PYTHON(
        [PLUGIN_PYTHON="cfpython.la"]
        [cf_will_build_python="yes"],
        [cf_will_build_python="no"]
        [AC_MSG_NOTICE([No Python found. Python plugin will not be built.])]
    )
    # *** Put other plugins configuration code here ***
#else
#    AC_MSG_NOTICE([No dl library found. Plugins will not be supported.])
#fi
AM_CONDITIONAL(PYTHON_PLUGIN,test "x$PLUGIN_PYTHON" != "x")
AC_SUBST(PLUGIN_PYTHON)

AM_CONDITIONAL(HAVE_CFLOGGER, [test "$cf_have_libsqlite" = "yes" -a "$enable_logger" = "yes"])
AM_CONDITIONAL(HAVE_CFNEWSPAPER, [test "$cf_have_libsqlite" = "yes" -a "$enable_newspaper" = "yes"])

# Unit tests
AM_PATH_CHECK([], [have_check="yes"], [have_check="no"])
AM_CONDITIONAL(HAVE_CHECK, test "$have_check" = "yes" -a "$enable_check" = "yes")

if test "$have_check" = "yes"; then
    CF_CHECK_XSLT(xsltengine)
    AC_SUBST(XSLTENGINE, ["$xsltengine"])
else
    AC_MSG_WARN([Check not found; cannot run unit tests!])
fi

AM_CONDITIONAL(PROCESS_XSLT, [test -n "$xsltengine"])

##############################################################################
# Generate Output
##############################################################################
AC_CONFIG_FILES([Makefile
                 doc/Makefile
                 doc/Developers/Makefile
                 doc/playbook/Makefile doc/playbook-html/Makefile
                 doc/scripts/Makefile
                 doc/spell-docs/Makefile
                 doc/spoiler/Makefile doc/spoiler-html/Makefile
                 common/Makefile
                 include/Makefile
                 lib/Makefile
                 random_maps/Makefile
                 server/Makefile
                 socket/Makefile
                 types/Makefile
                 utils/Makefile
                 lib/checkarch.pl lib/collect.pl
                 utils/add_throw.perl utils/metaserver.pl utils/scores.pl utils/player_dl.pl
                 utils/crossloop.web
                 plugins/Makefile
                 plugins/cfanim/Makefile plugins/cfanim/include/Makefile
                 plugins/cflogger/Makefile
                 plugins/cfnewspaper/Makefile
                 plugins/cfnewspaper/include/Makefile
                 plugins/cfpython/Makefile plugins/cfpython/include/Makefile
                 plugins/cfrhg/Makefile
                 plugins/cfrhg/include/Makefile
                 plugins/citylife/Makefile
                 plugins/citylife/include/Makefile
                 plugins/common/Makefile plugins/common/include/Makefile
                 test/Makefile
                 test/bugs/Makefile test/bugs/bugtrack/Makefile
                 test/include/Makefile test/templates/Makefile test/toolkit/Makefile
                 test/unit/Makefile
                 test/unit/common/Makefile test/unit/random_maps/Makefile
                 test/unit/server/Makefile test/unit/socket/Makefile])
AC_OUTPUT

##############################################################################
# Configuration Summary
##############################################################################
AC_MSG_NOTICE([Configuration Summary ----------------------------------------------])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([  Paths])
AC_MSG_NOTICE([    Installation prefix                  ${prefix}])
AC_MSG_NOTICE([    Will put executables in              $bindir])
AC_MSG_NOTICE([    Will put resources in                $datadir])
AC_MSG_NOTICE([    Will put config in                   $sysconfdir])
AC_MSG_NOTICE([    Will put server runtime data in      $localstatedir])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([  Options])
AC_MSG_NOTICE([    Build metaserver2 support?      $ac_cv_header_curl_curl_h])
AC_MSG_NOTICE([    Build plugins?                  $cf_have_libdl])

if test "$cf_have_libsqlite" = "yes" ; then
AC_MSG_NOTICE([    Build cflogger?                 $enable_logger])
AC_MSG_NOTICE([    Build cfnewspaper?              $enable_newspaper])
fi

if test "$cf_have_libdl" = "yes" ; then
AC_MSG_NOTICE([    Build python plugin?            $cf_will_build_python])
fi

if test "$enable_cfrhg" = "yes" ; then
AC_MSG_NOTICE([    Build random house plugin?      yes])
else
AC_MSG_NOTICE([    Build random house plugin?      no])
fi

if test x"$xsltengine" != "x" ; then
    check_complement=["(will generate report)"]
fi
if test "$have_check" = "yes" -a "$enable_check" = "yes" ; then
AC_MSG_NOTICE([    Process unit testing?           yes $check_complement])
AC_MSG_NOTICE([      (run make; make -k check)])
else
AC_MSG_NOTICE([    Process unit testing?           no])
AC_MSG_NOTICE([      If you are a developer, you MUST install the check framework])
AC_MSG_NOTICE([      and write automated tests for all your add-ons!])
fi
AC_MSG_NOTICE([])
AC_MSG_NOTICE([  Utilities (not required to build or run the server)])
AC_MSG_NOTICE([    Build crossfire-mapper?         $enable_mapper])
AC_MSG_NOTICE([--------------------------------------------------------------------])
AC_MSG_NOTICE([Remember to add a symlink to your 'arch' directory in 'lib/arch'!])