-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure.ac
352 lines (307 loc) · 9.96 KB
/
configure.ac
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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
## Process this file with autoconf to produce a configure script.
AC_INIT([AscentNG],
[3.6],
[www.ascentemulator.net],
[ascent])
AC_PREREQ(2.5)
if test -d obj; then rm -rf obj; fi
AM_CONFIG_HEADER( config.h )
INCLUDES="-I/usr/include -I/usr/local/include"
AC_SUBST(INCLUDES)
LDFLAGS="-L/usr/lib -L/usr/local/lib"
AC_SUBST(LDFLAGS)
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL
# autoheader templates
AH_TEMPLATE([USE_EPOLL], Define if you want to use the epoll socket engine module.)
AH_TEMPLATE([USE_KQUEUE], Define if you want to use the kqueue socket engine module.)
AH_TEMPLATE([HAVE_DARWIN], Define if you have MacOSX Darwin, to include the correct headers for kevent)
AH_TEMPLATE([ENABLE_CLUSTERING], Define if you want to enable clustering, this is experimental.)
AH_TEMPLATE([ENABLE_COLLISION], Define if you want to enable collision calculation, warning. this can cause. a heavy load)
AH_TEMPLATE([ENABLE_VOICECHAT], Define this if you want to enable voice chat system)
AH_TEMPLATE([USING_BIG_ENDIAN], Define this if you are on a big-endian system.)
AH_TEMPLATE([USING_LITTLE_ENDIAN], Define this if you are on a non-big-endian system.)
AH_TEMPLATE([X64], Define this if you are under an X64-based operating system.)
AH_TEMPLATE([X86], Define this if you are under an X86-based 32bit operating system.)
AH_TEMPLATE([NO_DBLAYER_MYSQL], Define this if you want to disable mysql support.)
AH_TEMPLATE([ENABLE_DATABASE_POSTGRES], Define this if you want postgres support.)
AH_TEMPLATE([ENABLE_DATABASE_SQLITE], Define this if you want sqlite support.)
# Default prefix
AC_PREFIX_DEFAULT(`pwd`)
test "$prefix" = "NONE" && prefix=`pwd`
test "$sysconfdir" = "\${prefix}/etc" && sysconfdir='../etc'
test "$scriptdir" = "" && scriptdir='../lib'
# Determine the operating system
AC_MSG_CHECKING([uname -s for detecting host operating system])
OSNAME=`uname -s`
case "$OSNAME" in
FreeBSD*)
dnl FreeBSD Owns !
AC_MSG_RESULT(FreeBSD Owns your hd)
FREEBSD=yes
;;
Linux*)
dnl Linux...
AC_MSG_RESULT(Linux)
LINUX=yes
;;
Darwin*)
dnl Darwin owns to (includes BSD) :P
AC_MSG_RESULT(Darwin)
FREEBSD=yes
;;
*)
AC_MSG_RESULT(no)
;;
esac
AC_MSG_CHECKING([uname -m for detecting host operating system architecture])
ARCH=`uname -m`
case "$ARCH" in
amd64*)
dnl yay 21st century hardware
AC_MSG_RESULT(x64 feel teh power)
AC_DEFINE(X64)
AC_SUBST(ARCH,x64)
;;
x86_64*)
dnl yay 21st century hardware
AC_MSG_RESULT(x64 feel teh power)
AC_DEFINE(X64)
AC_SUBST(ARCH,x64)
;;
*)
AC_MSG_RESULT(x86 oh noes i ran out of address space)
AC_DEFINE(X86)
AC_SUBST(ARCH,x86)
;;
esac
AC_C_BIGENDIAN([AC_DEFINE(USING_BIG_ENDIAN)],[AC_DEFINE(USING_LITTLE_ENDIAN)],[])
AC_CHECK_PROG([SVN], [svn], yes)
if test -z "$SVN"; then AC_MSG_ERROR(Subversion not found); fi
# Checks for libraries.
# Reset
CFLAGS="$INCLUDES -Wall -D_BACKWARD_BACKWARD_WARNING_H"
CXXFLAGS="$INCLUDES -Wall -D_BACKWARD_BACKWARD_WARNING_H"
# Check for pthread
ACX_PTHREAD( [
LDFLAGS="$PTHREAD_LIBS $LDFLAGS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
],AC_MSG_ERROR(pthread not found) )
AC_CHECK_LIB( z, compress, [],[AC_MSG_ERROR([Missing zlib])] )
AC_CHECK_LIB( compat, ftime )
if test "x$OSNAME" = "xDarwin" ; then
AC_CHECK_LIB( crypto, SHA1_Init, [], [AC_CHECK_LIB(ssl, SHA1_Init,[],[AC_MSG_ERROR([Missing openssl])])])
AC_DEFINE(HAVE_DARWIN)
LIB_EXPORT="-framework System -framework Foundation"
AC_SUBST(LIB_EXPORT)
else
#AC_CHECK_LIB( ssl, SHA1_Init, [], [AC_CHECK_LIB(ssl, SHA1_Init,[],[AC_MSG_ERROR([Missing openssl])])])
CHECK_SSL(1)
LIB_EXPORT="-Wl,--export-dynamic"
AC_SUBST(LIB_EXPORT)
fi
AC_ARG_ENABLE(clustering,
AC_HELP_STRING([--enable-clustering],enable clustering. warning this is experimental.),
[ if test "x$enable_clustering" = "xyes" ; then
AC_DEFINE(ENABLE_CLUSTERING)
fi
],
)
AC_ARG_ENABLE(collision,
AC_HELP_STRING([--enable-collision],enable collision calculation. warning this can cause a high load),
[ if test "x$enable_collision" = "xyes" ; then
AC_DEFINE(ENABLE_COLLISION)
fi
],
)
AC_ARG_ENABLE(gcov,
AC_HELP_STRING([--enable-gcov],[enable codecovering]),
[ if test "x$enable_gcov" = "xyes" ; then
CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
fi
],
)
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[enable debug]),
[ if test "x$enable_debug" = "xyes" ; then
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CXXFLAGS -g"
fi
],
)
AC_ARG_ENABLE(optimize,
AC_HELP_STRING([--enable-optimize],[enable code optimization]),
[ if test "x$enable_optimize" = "xyes" ; then
CFLAGS="$CFLAGS -O2"
CXXFLAGS="$CXXFLAGS -O2"
fi
],
)
AC_ARG_ENABLE(warnings,
AC_HELP_STRING([--enable-warnings],[enable Wall compiling]),
[ if test "x$enable_warnings" = "xyes" ; then
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CXXFLAGS -Wall"
fi
],
)
AC_ARG_ENABLE(profiling,
AC_HELP_STRING([--enable-profiling],[build for profiling using gprof.]),
[ if test "x$enable_profiling" = "xyes" ; then
CXXFLAGS="$CXXFLAGS -pg" ;
#CFLAGS="$CFLAGS -pg" ;
fi
],
)
AC_ARG_ENABLE(voicechat,
AC_HELP_STRING([--enable-voicechat],enable voice chat system),
[ if test "x$enable_voicechat" = "xyes" ; then
AC_DEFINE(ENABLE_VOICECHAT)
AC_SUBST(ENABLE_VOICECHAT)
fi
],
)
AC_ARG_ENABLE(mysql,
AC_HELP_STRING([--without-mysql],disables mysql backend),
[ if test "x$without_mysql" = "xyes" ; then
AC_DEFINE(NO_DBLAYER_MYSQL)
fi
],
)
AC_ARG_ENABLE(postgres,
AC_HELP_STRING([--enable-postgres],enables postgres backend),
[ if test "x$enable_postgres" = "xyes" ; then
AC_DEFINE(ENABLE_DATABASE_POSTGRES)
AX_LIB_POSTGRESQL
fi
],
)
AC_ARG_ENABLE(sqlite,
AC_HELP_STRING([--enable-sqlite],enables sqlite backend),
[ if test "x$enable_sqlite" = "xyes" ; then
AC_DEFINE(ENABLE_DATABASE_SQLITE)
fi
],
)
# Check for networking stuff
AC_MSG_CHECKING([detecting network socket engine])
if test "x$OSNAME" = "xLinux" ; then
AC_MSG_RESULT(epoll)
AC_CHECK_HEADERS(sys/epoll.h)
AC_CHECK_FUNC(epoll_ctl, ,
[AC_CHECK_LIB(epoll, epoll_ctl, , AC_MSG_ERROR([Cannot find epoll_ctl() function for socket engine]))])
AC_DEFINE(USE_EPOLL)
AC_SUBST(NETWORKING, "epoll (Linux)")
fi
if test "x$OSNAME" = "xFreeBSD" ; then
AC_MSG_RESULT(kqueue)
AC_CHECK_FUNC(kevent, , AC_MSG_ERROR([Cannot find kevent() function for socket engine]))
AC_CHECK_HEADER(sys/event.h, , AC_MSG_ERROR([Cannot find sys/event.h for socket engine]))
AC_DEFINE(USE_KQUEUE)
AC_SUBST(NETWORKING, "kqueue (FreeBSD)")
fi
if test "x$OSNAME" = "xDarwin" ; then
AC_MSG_RESULT(kqueue)
AC_CHECK_FUNC(kevent, , AC_MSG_ERROR([Cannot find kevent() function for socket engine]))
AC_CHECK_HEADER(sys/event.h, , AC_MSG_ERROR([Cannot find sys/event.h for socket engine]))
AC_DEFINE(USE_KQUEUE)
AC_SUBST(NETWORKING, "kqueue (Darwin)")
INCLUDES+="-I/sw/include -I/sw/include/mysql -I/usr/include/openssl"
LDFLAGS+="-L/sw/lib -L/sw/lib/mysql -L/usr/lib"
fi
# Check for mysql
MYSQL_FOUND=AX_LIB_MYSQL([5.0])
if test "$MYSQL_VERSION" = ""; then
AC_MSG_ERROR([*** mysql client library not found. Please install it.])
else
LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
CFLAGS="$CFLAGS $MYSQL_CFLAGS"
CXXFLAGS="$CXXFLAGS $MYSQL_CFLAGS"
fi
# pcre
AX_PATH_LIB_PCRE([
LDFLAGS="$LDFLAGS $PCRE_LIBS"
CFLAGS="$CFLAGS $PCRE_CFLAGS"
CXXFLAGS="$CXXFLAGS $PCRE_CFLAGS"
],AC_MSG_ERROR(Couldn't find pcre library. Make sure your pcre path is correct.))
AX_GCC_ARCHFLAG([no], [CXXFLAGS="$CXXFLAGS $ax_cv_gcc_archflag"], AC_MSG_ERROR([Cannot detect architecture of CPU]))
AC_DEFINE_UNQUOTED([PREFIX], "${prefix}", "Prefix")
AC_DEFINE_UNQUOTED([SCRIPTDIR], "${scriptdir}", "librarydir")
AC_DEFINE_UNQUOTED([CONFDIR], "${sysconfdir}", "configdir")
AC_DEFINE_UNQUOTED([SVN_REVISION_DONE], `sh ./extract_svn_revision.sh`, [SVN revision generated])
AC_CONFIG_FILES([
Makefile
src/Makefile
src/ascent-shared/Makefile
src/ascent-world/Makefile
src/ascent-logonserver/Makefile
src/ascent-voicechat/Makefile
src/ascent-realmserver/Makefile
src/scripts/Makefile
src/scripts/src/Makefile
src/scripts/src/GossipScripts/Makefile
src/scripts/src/InstanceScripts/Makefile
src/scripts/src/ServerStatusPlugin/Makefile
src/scripts/src/SpellHandlers/Makefile
src/scripts/src/ExtraScripts/Makefile
src/scripts/src/EventsScripts/Makefile
src/scripts/src/RaidsScripts/Makefile
src/scripts/src/MiscScripts/Makefile
src/scripts/src/QuestScripts/Makefile
])
AC_OUTPUT
echo
echo "===================================="
echo "AscentNG configure report:"
echo
echo " Core:"
echo " os: ${OSNAME}"
echo " prefix: ${prefix}"
echo " architecture: ${ARCH}"
echo
echo " Database modules:"
echo " mysql: ${MYSQL_VERSION}"
if test "x$enable_postgres" = "xyes" ; then
echo " postgresql: ${POSTGRESQL_VERSION}"
fi
if test "x$enable_sqlite" = "xyes" ; then
echo " sqlite: ${SQLITE_VERSION}"
fi
echo
echo " Networking:"
echo " ${NETWORKING}"
echo
echo " Features: "
echo -n " voicechat: "
if test "x$enable_voicechat" = "xyes" ; then
echo "enabled"
else
echo "disabled"
fi
echo -n " collision: "
if test "x$enable_collision" = "xyes" ; then
echo "enabled"
else
echo "disabled"
fi
echo -n " clustering: "
if test "x$enable_clustering" = "xyes" ; then
echo "enabled"
else
echo "disabled"
fi
echo
echo "Compiler version: "
$($CC -v)
echo
echo "LIBS=${LIBS}"
echo "CXXFLAGS=${CXXFLAGS}"
echo "LDFLAGS=${LDFLAGS}"
echo "===================================="
echo