[2304] Fixed #913 --- Added missing SQL update for revision [2297].
[mangos-git.git] / configure.ac
blob504c372158e8478eee7a67c58413848e71f66e1b
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.
13 AC_PREREQ(2.59)
14 AC_INIT([MaNGOS],
15         [0.6-SVN],
16         [http://www.mangosproject.org/],
17         [mangos])
18 AM_CONFIG_HEADER([config.h])
19 AC_CONFIG_SRCDIR(src/mangosd/Main.cpp)
21 dnl Automake is needed for the build system.
22 dnl
23 AM_INIT_AUTOMAKE([1.6 dist-bzip2])
24 AM_MAINTAINER_MODE
26 AC_PROG_CC(gcc cc)
27 AC_PROG_CXX
28 AC_PROG_LIBTOOL
29 AC_PROG_INSTALL
30 AC_LANG([C++])
31 AC_EXEEXT
32 AC_OBJEXT
34 dnl Checks for programs.
35 AM_PROG_LIBTOOL
37 dnl
38 dnl use defaults if cross-compiling, otherwise use the default path.
39 dnl
40 if test "$cross_compiling" = "yes"; then
41     MYPATH=":"
42 else
43 #    MYPATH="/bin:/usr/bin:/usr/local/bin:$PATH:/sbin:/usr/sbin:/usr/local/sbin:/opt/gnu/bin"
44     MYPATH=$PATH
47 dnl
48 dnl Find some common programs
49 dnl
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
70 COMPILER_OPTIONS=""
71 LINKER_OPTIONS=""
73 # check for openssl path given
74 +AC_ARG_WITH(openssl,
75 [  --with-openssl=/path/to/openssl/dir    OpenSSL directory],
77   AC_CHECK_FILE($withval/include/openssl/ssl.h,
78   [
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])]) ],
82  [
83   OPENSSL_INCLUDES=""
84   OPENSSL_LDFLAGS="" ])
86 AC_SUBST(OPENSSL_INCLUDES)
87 AC_SUBST(OPENSSL_LDFLAGS)
89 # check for mysql path given
90 AC_ARG_WITH(mysql,
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"
106 AC_SUBST(INCLUDES)
107 AC_SUBST(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();],
116         pthread_create();,
117         [], [AC_MSG_ERROR([Missing pthread])])
118     ])
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.
128 AC_HEADER_STDC
129 AC_HEADER_STDBOOL
130 AC_HEADER_TIME
131 AC_CHECK_HEADERS(                                             \
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.
140 AC_C_CONST
141 AC_C_INLINE
142 AC_C_VOLATILE
143 AC_TYPE_SIZE_T
144 AC_TYPE_OFF_T
145 AC_TYPE_SIGNAL
146 AC_STRUCT_TM
147 AC_CHECK_TYPES([ ptrdiff_t ])
149 dnl Checks for library functions.
150 AC_FUNC_MEMCMP
151 AC_FUNC_STRCOLL
152 AC_FUNC_ALLOCA
153 AC_FUNC_MALLOC
154 AC_FUNC_REALLOC
155 AC_FUNC_SELECT_ARGTYPES
156 AC_FUNC_STRFTIME
157 AC_FUNC_STRNLEN
158 AC_FUNC_VPRINTF
159 AC_CHECK_FUNCS(                                               \
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.
168 withval=auto
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>
177 main() {
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"
183   else
184     
185   AC_MSG_CHECKING(for python 2.3)
186   AC_RUN_IFELSE([AC_LANG_SOURCE([[
187   #include <python2.3/Python.h>
188   main() {
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"
194     else
195     
196       AC_MSG_CHECKING(for python 2.2)
197       AC_RUN_IFELSE([AC_LANG_SOURCE([[
198     #include <python2.2/Python.h>
199     main() {
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"
205       else
206     
207         AC_MSG_CHECKING(for python 1.5.2)
208         AC_RUN_IFELSE([AC_LANG_SOURCE([[
209     #include <python1.5/Python.h>
210     main() {
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"
216         fi
217       fi
218     fi
219   fi
222 if test "$WITH_PYTHON_VERSION" != no ; then
223   WITH_PYTHON_SUBDIR=python
224   WITH_PYTHON_SUBPACKAGE=1
225 else
226   WITH_PYTHON_SUBDIR=
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.
238 withval=auto
239 AC_ARG_WITH(apidocs, [  --with-apidocs          build MaNGOS API docs ])
241 if test $withval = auto -a $__DOXYGEN != no ; then
242     withval=yes
243 elif test $withval = yes -a $__DOXYGEN = no ; then
244     AC_MSG_ERROR(--> MaNGOS API docs needs doxygen in PATH)
246     
247 if test $withval = yes; then
248     WITH_APIDOCS_TARGET=apidocs
249     WITH_APIDOCS=1
250 else
251     WITH_APIDOCS=0
253 AC_SUBST(WITH_APIDOCS_TARGET)
254 AC_SUBST(WITH_APIDOCS)
255       
256 AC_MSG_CHECKING(whether to include debug info in library)
257 MANGOSD_DEBUG_INFO=no
258 AC_ARG_WITH(debug-info,
260 Debugging options:
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)
270     fi
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
278 AC_ARG_ENABLE(cli,
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)
287     fi
289 AC_MSG_RESULT($MANGOSD_ENABLE_CLI)
291 # check for remote console enable
292 AC_MSG_CHECKING(whether remote console is enabled)
293 MANGOSD_ENABLE_RA=no
294 AC_ARG_ENABLE(ra,
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)
303     fi
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"
317 else
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="/"
323   else
324         MANGOSD_CONFIG_TEMP="$sysconfdir/mangosd.conf"
325         MANGOSD_CONFIGDIR_TEMP="$sysconfdir"
326         REALMD_CONFIG_TEMP="$sysconfdir/realmd.conf"
327         REALMD_CONFIGDIR_TEMP="$sysconfdir"
328   fi
331 if test $datadir = '${prefix}/share'; then
332     MANGOSD_DATA_TEMP="${prefix}/share/mangos"
333 else
334    if test $datadir = '/'; then
335         MANGOSD_DATA_TEMP="/mangos"
336    else
337         MANGOSD_DATA_TEMP="$datadir/mangos"
338    fi
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)
367 AC_SUBST(VERSION)
368 AC_SUBST(LT_RELEASE)
369 AC_SUBST(LT_CURRENT)
370 AC_SUBST(LT_AGE)
371 AC_SUBST(LT_REVISION)
372 AC_SUBST(LTMS_RELEASE)
373 AC_SUBST(LTMS_CURRENT)
374 AC_SUBST(LTMS_AGE)
375 AC_SUBST(LTMS_REVISION)
377 AC_CONFIG_FILES([
378    ./Makefile
379    doc/Doxyfile
380    doc/Makefile
381    sql/Makefile
382    src/Makefile
383    src/shared/Makefile
384    src/shared/SystemConfig.h
385    src/realmd/Makefile
386    src/realmd/realmd.conf
387    src/framework/Makefile
388    src/game/Makefile
389    src/bindings/Makefile
390    src/bindings/python/Makefile
391    src/bindings/universal/Makefile
392    src/mangosd/Makefile
393    src/mangosd/mangosd.conf
394    dep/Makefile
395    dep/src/Makefile
396    dep/src/zlib/Makefile
397    dep/src/zthread/Makefile
400 AC_OUTPUT