1 # Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
3 # This file is free software; as a special exception the author gives
4 # unlimited permission to copy and/or distribute it, with or without
5 # modifications, as long as this notice is preserved.
7 # This program is distributed in the hope that it will be useful, but
8 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
9 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 ## Process this file with autoconf to produce a configure script.
16 [http://www.mangosproject.org/],
18 AM_CONFIG_HEADER([config.h])
19 AC_CONFIG_SRCDIR(src/mangosd/Main.cpp)
21 dnl Automake is needed for the build system.
23 AM_INIT_AUTOMAKE([1.6 dist-bzip2])
35 dnl Checks for programs.
39 dnl use defaults if cross-compiling, otherwise use the default path.
41 if test "$cross_compiling" = "yes"; then
44 # MYPATH="/bin:/usr/bin:/usr/local/bin:$PATH:/sbin:/usr/sbin:/usr/local/sbin:/opt/gnu/bin"
49 dnl Find some common programs
51 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
53 dnl Set up ZThread build.
54 LIBZTHREAD_MAJOR_VERSION=2
55 LIBZTHREAD_MINOR_VERSION=3
56 LIBZTHREAD_MICRO_VERSION=2
57 LT_RELEASE=$LIBZTHREAD_MAJOR_VERSION.$LIBZTHREAD_MINOR_VERSION.$LIBZTHREAD_MICRO_VERSION
58 LT_CURRENT=$LIBZTHREAD_MAJOR_VERSION
59 LT_REVISION=$LIBZTHREAD_MINOR_VERSION
60 LT_AGE=$LIBZTHREAD_MICRO_VERSION
62 dnl Set up Scripting build.
63 LIBMANGOSSCRIPT_MAJOR_VERSION=0
64 LIBMANGOSSCRIPT_MINOR_VERSION=2
65 LIBMANGOSSCRIPT_MICRO_VERSION=0
66 LTMS_RELEASE=$LIBMANGOSSCRIPT_MAJOR_VERSION.$LIBMANGOSSCRIPT_MINOR_VERSION.$LIBMANGOSSCRIPT_MICRO_VERSION
67 LTMS_CURRENT=$LIBMANGOSSCRIPT_MAJOR_VERSION
68 LTMS_REVISION=$LIBMANGOSSCRIPT_MINOR_VERSION
69 LTMS_AGE=$LIBMANGOSSCRIPT_MICRO_VERSION
74 INCLUDES="-I/usr/include/mysql -I/usr/local/include/mysql -I/usr/include/openssl -I/usr/local/include/openssl"
76 LDFLAGS="-L/usr/lib/mysql -L/usr/local/lib/mysql"
79 # check for openssl path given
80 AC_MSG_CHECKING(whether openssl path was given)
82 AC_ARG_ENABLE(with-openssl,
83 [ --with-openssl Specify openssl path],
85 if test "$enableval" != "" ; then
86 INCLUDES="-I$enableval/include/openssl -I/usr/include/mysql -I/usr/local/include/mysql"
88 elif test "$enableval" = "" ; then
89 AC_MSG_ERROR(Please choose openssl path)
93 AC_MSG_RESULT($MANGOSD_WITH_OPENSSL)
96 # check for mysql path given
97 AC_MSG_CHECKING(whether mysql path was given)
99 AC_ARG_ENABLE(with-mysql,
100 [ --with-mysql Specify mysql path],
102 if test "$enableval" != "" ; then
103 INCLUDES="-I$enableval/include/mysql -I/usr/include/openssl -I/usr/local/include/openssl"
105 LDFLAGS="-L$enableval/lib/mysql"
107 elif test "$enableval" = "" ; then
108 AC_MSG_ERROR(Please choose mysql path)
112 AC_MSG_RESULT($MANGOSD_WITH_MYSQL)
116 dnl Checks for libraries.
118 dnl Checks for library functions.
119 AC_CHECK_LIB( pthread, pthread_create, [],
120 [LDFLAGS="-pthread $LDFLAGS"
121 AC_TRY_LINK([char pthread_create();],
123 [], [AC_MSG_ERROR([Missing pthread])])
125 AC_CHECK_LIB( z, compress, [],[AC_MSG_ERROR([Missing zlib])] )
126 AC_CHECK_LIB( compat, ftime )
127 AC_CHECK_LIB( mysqlclient, mysql_init, [],[AC_CHECK_LIB(mysql, mysql_init,[],[AC_MSG_ERROR([Missing mysql])])])
128 AC_CHECK_LIB( ssl, SHA1_Init, [], [AC_CHECK_LIB(ssl, SHA1_Init,[],[AC_MSG_ERROR([Missing openssl])])])
130 CPPFLAGS_SAVE=$CPPFLAGS
131 CPPFLAGS=$INCLUDES $CPPFLAGS
133 dnl Checks for header files.
138 limits.h sys/ioctl.h unistd.h fcntl.h float.h mysql.h \
139 netdb.h netinet/in.h stddef.h sys/socket.h \
140 sys/time.h sys/timeb.h opensslv.h \
141 ,[],[AC_MSG_ERROR([Missing required header])])
143 CPPFLAGS=$CPPFLAGS_SAVE
145 dnl Checks for typedefs, structures, and compiler characteristics.
153 AC_CHECK_TYPES([ ptrdiff_t ])
155 dnl Checks for library functions.
161 AC_FUNC_SELECT_ARGTYPES
166 ftime strcspn strtoul atexit bzero floor gethostbyname \
167 gettimeofday localtime_r memset rint select socket \
168 sqrt stpcpy strchr strpbrk strrchr strstr strtol strtoul \
172 dnl Auto-detect which python bindings should be built.
175 AC_ARG_WITH(python, [ --with-python build python bindings ])
177 WITH_PYTHON_VERSION=$withval
178 if test $withval = auto ; then
180 AC_MSG_CHECKING(for python 2.4)
181 AC_RUN_IFELSE([AC_LANG_SOURCE([[
182 #include <python2.4/Python.h>
184 exit(strncmp("2.4", PY_VERSION, 3));
185 } ]])],[withval=yes],[withval=no],[withval=yes])
186 AC_MSG_RESULT($withval)
187 if test $withval = yes ; then
188 WITH_PYTHON_VERSION="2.4"
191 AC_MSG_CHECKING(for python 2.3)
192 AC_RUN_IFELSE([AC_LANG_SOURCE([[
193 #include <python2.3/Python.h>
195 exit(strncmp("2.3", PY_VERSION, 3));
196 } ]])],[withval=yes],[withval=no],[withval=yes])
197 AC_MSG_RESULT($withval)
198 if test $withval = yes ; then
199 WITH_PYTHON_VERSION="2.3"
202 AC_MSG_CHECKING(for python 2.2)
203 AC_RUN_IFELSE([AC_LANG_SOURCE([[
204 #include <python2.2/Python.h>
206 exit(strncmp("2.2", PY_VERSION, 3));
207 } ]])],[withval=yes],[withval=no],[withval=yes])
208 AC_MSG_RESULT($withval)
209 if test $withval = yes ; then
210 WITH_PYTHON_VERSION="2.2"
213 AC_MSG_CHECKING(for python 1.5.2)
214 AC_RUN_IFELSE([AC_LANG_SOURCE([[
215 #include <python1.5/Python.h>
217 exit(strcmp("1.5.2", PY_VERSION));
218 } ]])],[withval=yes],[withval=no],[withval=yes])
219 AC_MSG_RESULT($withval)
220 if test $withval = yes ; then
221 WITH_PYTHON_VERSION="1.5"
228 if test "$WITH_PYTHON_VERSION" != no ; then
229 WITH_PYTHON_SUBDIR=python
230 WITH_PYTHON_SUBPACKAGE=1
233 WITH_PYTHON_SUBPACKAGE=0
236 AC_SUBST(WITH_PYTHON_SUBDIR)
237 AC_SUBST(WITH_PYTHON_SUBPACKAGE)
238 AC_SUBST(WITH_PYTHON_VERSION)
240 AC_PATH_PROG(__DOXYGEN, doxygen, no, $PATH)
242 dnl Auto-detect whether doxygen generated API docs should be included.
245 AC_ARG_WITH(apidocs, [ --with-apidocs build MaNGOS API docs ])
247 if test $withval = auto -a $__DOXYGEN != no ; then
249 elif test $withval = yes -a $__DOXYGEN = no ; then
250 AC_MSG_ERROR(--> MaNGOS API docs needs doxygen in PATH)
253 if test $withval = yes; then
254 WITH_APIDOCS_TARGET=apidocs
259 AC_SUBST(WITH_APIDOCS_TARGET)
260 AC_SUBST(WITH_APIDOCS)
262 AC_MSG_CHECKING(whether to include debug info in library)
263 MANGOSD_DEBUG_INFO=no
264 AC_ARG_WITH(debug-info,
268 --with-debug-info Include debug info in library],
270 if test "$withval" = "yes" ; then
271 CFLAGS="-g -DMANGOS_DEBUG $CFLAGS"
272 CXXFLAGS="-g -DMANGOS_DEBUG $CXXFLAGS"
273 MANGOSD_DEBUG_INFO=yes
274 elif test "$withval" != "no" ; then
275 AC_MSG_ERROR(Please choose yes or no)
278 AC_MSG_RESULT($MANGOSD_DEBUG_INFO)
281 # check for cli console enable
282 AC_MSG_CHECKING(whether cli console is enabled)
283 MANGOSD_ENABLE_CLI=no
285 [ --enable-cli Turn on command console system],
287 if test "$enableval" = "yes" ; then
288 CFLAGS="-DENABLE_CLI $CFLAGS"
289 CXXFLAGS="-DENABLE_CLI $CXXFLAGS"
290 MANGOSD_ENABLE_CLI=yes
291 elif test "$withval" != "no" ; then
292 AC_MSG_ERROR(Please choose yes or no)
295 AC_MSG_RESULT($MANGOSD_ENABLE_CLI)
297 # check for remote console enable
298 AC_MSG_CHECKING(whether remote console is enabled)
301 [ --enable-ra Turn on remote console system],
303 if test "$enableval" = "yes" ; then
304 CFLAGS="-DENABLE_RA $CFLAGS"
305 CXXFLAGS="-DENABLE_RA $CXXFLAGS"
306 MANGOSD_ENABLE_RA=yes
307 elif test "$withval" != "no" ; then
308 AC_MSG_ERROR(Please choose yes or no)
311 AC_MSG_RESULT($MANGOSD_ENABLE_RA)
314 MANGOSD_CONFIG_TEMP="$sysconfdir/mangosd.conf"
315 MANGOSD_CONFIGDIR_TEMP="$sysconfdir"
316 if test $sysconfdir = '${prefix}/etc'; then
317 MANGOSD_CONFIG_TEMP="${prefix}/mangos/mangosd.conf"
318 MANGOSD_CONFIGDIR_TEMP="${prefix}/mangos"
320 if test $sysconfdir = '/'; then
321 MANGOSD_CONFIG_TEMP="/mangosd.conf"
322 MANGOSD_CONFIGDIR_TEMP="/"
324 MANGOSD_CONFIG_TEMP="$sysconfdir/mangosd.conf"
325 MANGOSD_CONFIGDIR_TEMP="$sysconfdir"
329 if test $datadir = '${prefix}/share'; then
330 MANGOSD_DATA_TEMP="${prefix}/share/mangos"
332 if test $datadir = '/'; then
333 MANGOSD_DATA_TEMP="/mangos"
335 MANGOSD_DATA_TEMP="$datadir/mangos"
339 eval "MANGOSD_CONFIG=$MANGOSD_CONFIG_TEMP"
340 eval "MANGOSD_CONFIGDIR=$MANGOSD_CONFIGDIR_TEMP"
341 eval "MANGOSD_DATA=$MANGOSD_DATA_TEMP"
343 dnl Configure the final compiler & linker options
344 COMPILER_OPTIONS="$COMPILER_OPTIONS $CXXFLAGS"
345 LINKER_OPTIONS="$LINKER_OPTIONS $LDFLAGS"
347 dnl Configured flags for compiling
348 AC_SUBST(LINKER_OPTIONS)
349 AC_SUBST(COMPILER_OPTIONS)
351 dnl Extra variables users can customize
352 AC_SUBST(EXTRA_LINKER_OPTIONS)
353 AC_SUBST(EXTRA_COMPILER_OPTIONS)
355 dnl Configured MaNGOS variables
356 AC_SUBST(MANGOSD_CONFIG)
357 AC_SUBST(MANGOSD_CONFIGDIR)
358 AC_SUBST(MANGOSD_DATA)
359 AC_SUBST(MANGOSD_ENABLE_CLI)
360 AC_SUBST(MANGOSD_ENABLE_RA)
365 AC_SUBST(LT_REVISION)
366 AC_SUBST(LTMS_RELEASE)
367 AC_SUBST(LTMS_CURRENT)
369 AC_SUBST(LTMS_REVISION)
378 src/shared/SystemConfig.h
380 src/framework/Makefile
382 src/bindings/Makefile
383 src/bindings/python/Makefile
384 src/bindings/universal/Makefile
386 src/mangosd/mangosd.conf
389 dep/src/zlib/Makefile
390 dep/src/zthread/Makefile