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])
34 dnl Checks for programs.
38 dnl use defaults if cross-compiling, otherwise use the default path.
40 if test "$cross_compiling" = "yes"; then
43 # MYPATH="/bin:/usr/bin:/usr/local/bin:$PATH:/sbin:/usr/sbin:/usr/local/sbin:/opt/gnu/bin"
48 dnl Find some common programs
50 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
52 dnl Set up ZThread build.
53 LIBZTHREAD_MAJOR_VERSION=2
54 LIBZTHREAD_MINOR_VERSION=3
55 LIBZTHREAD_MICRO_VERSION=2
56 LT_RELEASE=$LIBZTHREAD_MAJOR_VERSION.$LIBZTHREAD_MINOR_VERSION.$LIBZTHREAD_MICRO_VERSION
57 LT_CURRENT=$LIBZTHREAD_MAJOR_VERSION
58 LT_REVISION=$LIBZTHREAD_MINOR_VERSION
59 LT_AGE=$LIBZTHREAD_MICRO_VERSION
61 dnl Set up Scripting build.
62 LIBMANGOSSCRIPT_MAJOR_VERSION=0
63 LIBMANGOSSCRIPT_MINOR_VERSION=2
64 LIBMANGOSSCRIPT_MICRO_VERSION=0
65 LTMS_RELEASE=$LIBMANGOSSCRIPT_MAJOR_VERSION.$LIBMANGOSSCRIPT_MINOR_VERSION.$LIBMANGOSSCRIPT_MICRO_VERSION
66 LTMS_CURRENT=$LIBMANGOSSCRIPT_MAJOR_VERSION
67 LTMS_REVISION=$LIBMANGOSSCRIPT_MINOR_VERSION
68 LTMS_AGE=$LIBMANGOSSCRIPT_MICRO_VERSION
73 # check for openssl path given
75 [ --with-openssl=/path/to/openssl/dir OpenSSL directory],
77 AC_CHECK_FILE($withval/include/openssl/ssl.h,
79 OPENSSL_INCLUDES="-I$withval/include"
80 OPENSSL_LDFLAGS="-L$withval/lib"],
81 [AC_MSG_ERROR([Directory '$withval' does not exist, or does not contain OpenSSL])]) ],
86 AC_SUBST(OPENSSL_INCLUDES)
87 AC_SUBST(OPENSSL_LDFLAGS)
89 # check for mysql path given
91 [ --with-mysql=/path/to/mysql/dir MySQL directory]],
93 AC_CHECK_FILE($withval/include/mysql.h,
94 [MYSQL_INCLUDES="-I$withval/include"
95 MYSQL_LDFLAGS="-L$withval/lib"],
96 [AC_MSG_ERROR([Directory '$withval' does not exist, or does not contain MySQL])]) ],
98 MYSQL_INCLUDES="-I/usr/include/mysql -I/usr/local/include/mysql"
99 MYSQL_LDFLAGS="-L/usr/lib/mysql -L/usr/local/lib/mysql"])
101 AC_SUBST(MYSQL_INCLUDES)
102 AC_SUBST(MYSQL_LDFLAGS)
104 INCLUDES="$MYSQL_INCLUDES $OPENSSL_INCLUDES"
105 LDFLAGS="$MYSQL_LDFLAGS $OPENSSL_LDFLAGS"
110 dnl Checks for libraries.
112 dnl Checks for library functions.
113 AC_CHECK_LIB( pthread, pthread_create, [],
114 [LDFLAGS="-pthread $LDFLAGS"
115 AC_TRY_LINK([char pthread_create();],
117 [], [AC_MSG_ERROR([Missing pthread])])
119 AC_CHECK_LIB( z, compress, [],[AC_MSG_ERROR([Missing zlib])] )
120 AC_CHECK_LIB( compat, ftime )
121 AC_CHECK_LIB( mysqlclient_r, mysql_init, [],[AC_CHECK_LIB(mysql, mysql_init,[],[AC_MSG_ERROR([Missing mysql])])])
122 AC_CHECK_LIB( ssl, SHA1_Init, [], [AC_CHECK_LIB(ssl, SHA1_Init,[],[AC_MSG_ERROR([Missing openssl])])])
124 CPPFLAGS_SAVE=$CPPFLAGS
125 CPPFLAGS=$INCLUDES $CPPFLAGS
127 dnl Checks for header files.
132 limits.h sys/ioctl.h unistd.h fcntl.h float.h mysql.h \
133 netdb.h netinet/in.h stddef.h sys/socket.h \
134 sys/time.h sys/timeb.h openssl/opensslv.h \
135 ,[],[AC_MSG_ERROR([Missing required header])])
137 CPPFLAGS=$CPPFLAGS_SAVE
139 dnl Checks for typedefs, structures, and compiler characteristics.
147 AC_CHECK_TYPES([ ptrdiff_t ])
149 dnl Checks for library functions.
155 AC_FUNC_SELECT_ARGTYPES
160 ftime strcspn strtoul atexit bzero floor gethostbyname \
161 gettimeofday localtime_r memset rint select socket \
162 sqrt stpcpy strchr strpbrk strrchr strstr strtol strtoul \
166 dnl Auto-detect which python bindings should be built.
169 AC_ARG_WITH(python, [ --with-python build python bindings ])
171 WITH_PYTHON_VERSION=$withval
172 if test $withval = auto ; then
174 AC_MSG_CHECKING(for python 2.4)
175 AC_RUN_IFELSE([AC_LANG_SOURCE([[
176 #include <python2.4/Python.h>
178 exit(strncmp("2.4", PY_VERSION, 3));
179 } ]])],[withval=yes],[withval=no],[withval=yes])
180 AC_MSG_RESULT($withval)
181 if test $withval = yes ; then
182 WITH_PYTHON_VERSION="2.4"
185 AC_MSG_CHECKING(for python 2.3)
186 AC_RUN_IFELSE([AC_LANG_SOURCE([[
187 #include <python2.3/Python.h>
189 exit(strncmp("2.3", PY_VERSION, 3));
190 } ]])],[withval=yes],[withval=no],[withval=yes])
191 AC_MSG_RESULT($withval)
192 if test $withval = yes ; then
193 WITH_PYTHON_VERSION="2.3"
196 AC_MSG_CHECKING(for python 2.2)
197 AC_RUN_IFELSE([AC_LANG_SOURCE([[
198 #include <python2.2/Python.h>
200 exit(strncmp("2.2", PY_VERSION, 3));
201 } ]])],[withval=yes],[withval=no],[withval=yes])
202 AC_MSG_RESULT($withval)
203 if test $withval = yes ; then
204 WITH_PYTHON_VERSION="2.2"
207 AC_MSG_CHECKING(for python 1.5.2)
208 AC_RUN_IFELSE([AC_LANG_SOURCE([[
209 #include <python1.5/Python.h>
211 exit(strcmp("1.5.2", PY_VERSION));
212 } ]])],[withval=yes],[withval=no],[withval=yes])
213 AC_MSG_RESULT($withval)
214 if test $withval = yes ; then
215 WITH_PYTHON_VERSION="1.5"
222 if test "$WITH_PYTHON_VERSION" != no ; then
223 WITH_PYTHON_SUBDIR=python
224 WITH_PYTHON_SUBPACKAGE=1
227 WITH_PYTHON_SUBPACKAGE=0
230 AC_SUBST(WITH_PYTHON_SUBDIR)
231 AC_SUBST(WITH_PYTHON_SUBPACKAGE)
232 AC_SUBST(WITH_PYTHON_VERSION)
234 AC_PATH_PROG(__DOXYGEN, doxygen, no, $PATH)
236 dnl Auto-detect whether doxygen generated API docs should be included.
239 AC_ARG_WITH(apidocs, [ --with-apidocs build MaNGOS API docs ])
241 if test $withval = auto -a $__DOXYGEN != no ; then
243 elif test $withval = yes -a $__DOXYGEN = no ; then
244 AC_MSG_ERROR(--> MaNGOS API docs needs doxygen in PATH)
247 if test $withval = yes; then
248 WITH_APIDOCS_TARGET=apidocs
253 AC_SUBST(WITH_APIDOCS_TARGET)
254 AC_SUBST(WITH_APIDOCS)
256 AC_MSG_CHECKING(whether to include debug info in library)
257 MANGOSD_DEBUG_INFO=no
258 AC_ARG_WITH(debug-info,
262 --with-debug-info Include debug info in library],
264 if test "$withval" = "yes" ; then
265 CFLAGS="-g -DMANGOS_DEBUG $CFLAGS"
266 CXXFLAGS="-g -DMANGOS_DEBUG $CXXFLAGS"
267 MANGOSD_DEBUG_INFO=yes
268 elif test "$withval" != "no" ; then
269 AC_MSG_ERROR(Please choose yes or no)
272 AC_MSG_RESULT($MANGOSD_DEBUG_INFO)
275 # check for cli console enable
276 AC_MSG_CHECKING(whether cli console is enabled)
277 MANGOSD_ENABLE_CLI=no
279 [ --enable-cli Turn on command console system],
281 if test "$enableval" = "yes" ; then
282 CFLAGS="-DENABLE_CLI $CFLAGS"
283 CXXFLAGS="-DENABLE_CLI $CXXFLAGS"
284 MANGOSD_ENABLE_CLI=yes
285 elif test "$withval" != "no" ; then
286 AC_MSG_ERROR(Please choose yes or no)
289 AC_MSG_RESULT($MANGOSD_ENABLE_CLI)
291 # check for remote console enable
292 AC_MSG_CHECKING(whether remote console is enabled)
295 [ --enable-ra Turn on remote console system],
297 if test "$enableval" = "yes" ; then
298 CFLAGS="-DENABLE_RA $CFLAGS"
299 CXXFLAGS="-DENABLE_RA $CXXFLAGS"
300 MANGOSD_ENABLE_RA=yes
301 elif test "$withval" != "no" ; then
302 AC_MSG_ERROR(Please choose yes or no)
305 AC_MSG_RESULT($MANGOSD_ENABLE_RA)
308 MANGOSD_CONFIG_TEMP="$sysconfdir/mangosd.conf"
309 MANGOSD_CONFIGDIR_TEMP="$sysconfdir"
310 REALMD_CONFIG_TEMP="$sysconfdir/realmd.conf"
311 REALMD_CONFIGDIR_TEMP="$sysconfdir"
312 if test $sysconfdir = '${prefix}/etc'; then
313 MANGOSD_CONFIG_TEMP="${prefix}/mangos/mangosd.conf"
314 MANGOSD_CONFIGDIR_TEMP="${prefix}/mangos"
315 REALMD_CONFIG_TEMP="${prefix}/mangos/realmd.conf"
316 REALMD_CONFIGDIR_TEMP="${prefix}/mangos"
318 if test $sysconfdir = '/'; then
319 MANGOSD_CONFIG_TEMP="/mangosd.conf"
320 MANGOSD_CONFIGDIR_TEMP="/"
321 REALMD_CONFIG_TEMP="/realmd.conf"
322 REALMD_CONFIGDIR_TEMP="/"
324 MANGOSD_CONFIG_TEMP="$sysconfdir/mangosd.conf"
325 MANGOSD_CONFIGDIR_TEMP="$sysconfdir"
326 REALMD_CONFIG_TEMP="$sysconfdir/realmd.conf"
327 REALMD_CONFIGDIR_TEMP="$sysconfdir"
331 if test $datadir = '${prefix}/share'; then
332 MANGOSD_DATA_TEMP="${prefix}/share/mangos"
334 if test $datadir = '/'; then
335 MANGOSD_DATA_TEMP="/mangos"
337 MANGOSD_DATA_TEMP="$datadir/mangos"
341 eval "MANGOSD_CONFIG=$MANGOSD_CONFIG_TEMP"
342 eval "MANGOSD_CONFIGDIR=$MANGOSD_CONFIGDIR_TEMP"
343 eval "REALMD_CONFIG=$REALMD_CONFIG_TEMP"
344 eval "REALMD_CONFIGDIR=$REALMD_CONFIGDIR_TEMP"
345 eval "MANGOSD_DATA=$MANGOSD_DATA_TEMP"
347 dnl Configure the final compiler & linker options
348 COMPILER_OPTIONS="$COMPILER_OPTIONS $CXXFLAGS"
349 LINKER_OPTIONS="$LINKER_OPTIONS $LDFLAGS"
351 dnl Configured flags for compiling
352 AC_SUBST(LINKER_OPTIONS)
353 AC_SUBST(COMPILER_OPTIONS)
355 dnl Extra variables users can customize
356 AC_SUBST(EXTRA_LINKER_OPTIONS)
357 AC_SUBST(EXTRA_COMPILER_OPTIONS)
359 dnl Configured MaNGOS variables
360 AC_SUBST(MANGOSD_CONFIG)
361 AC_SUBST(MANGOSD_CONFIGDIR)
362 AC_SUBST(REALMD_CONFIG)
363 AC_SUBST(REALMD_CONFIGDIR)
364 AC_SUBST(MANGOSD_DATA)
365 AC_SUBST(MANGOSD_ENABLE_CLI)
366 AC_SUBST(MANGOSD_ENABLE_RA)
371 AC_SUBST(LT_REVISION)
372 AC_SUBST(LTMS_RELEASE)
373 AC_SUBST(LTMS_CURRENT)
375 AC_SUBST(LTMS_REVISION)
384 src/shared/SystemConfig.h
386 src/realmd/realmd.conf
387 src/framework/Makefile
389 src/bindings/Makefile
390 src/bindings/python/Makefile
391 src/bindings/universal/Makefile
393 src/mangosd/mangosd.conf
396 dep/src/zlib/Makefile
397 dep/src/zthread/Makefile