1 # Copyright (C) 2005-2010 MaNGOS project <http://getmangos.com/>
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 # TODO: create m4 directory and put the checks there, because this file got realy poluted ( by Derex )
15 ## Prelude, basic settings for Autoconf
17 # VERSION: 0.16.0 (trunk)
18 # BUG-REPORT-ADDRESS: mangos-devs@lists.sourceforge.net
19 AC_INIT( [mangos], [0.16.0], [mangos-devs@lists.sourceforge.net])
20 AC_CONFIG_SRCDIR([src/shared/Common.h])
21 AC_CONFIG_MACRO_DIR([m4])
23 ## Prelude, basic settings for Automake
24 # Turn on all warnings and error messages, and enforce GNU
25 # standards for the package.
26 AM_INIT_AUTOMAKE([foreign -Wall -Werror gnu tar-pax])
27 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31 ## Prevent the configure script from continuing any further if
32 # configuration is being performed in the top-level directory.
33 # The idea is to prevent this ,because some maintainers tend
34 # to break parallel build trees (a.k.a. VPATH builds).
35 if test "$srcdir" = "." && test "$enable_maintainer_mode" != "yes"; then
38 Please configure and build in a directory other than the
39 top-level source directory. This is needed because a lot
40 of maintainers tend to break parallel build trees
41 (a.k.a. VPATH builds). This is kinda real ensurance they
42 will not do it (by enforcing everybody to do VPATH builds).
44 For example, try the following from the top-level source
52 This will create a build space in the directory 'objdir' and
53 start a build in that directory.
55 If however you realy want to disable this error,
56 use --enable-maintainer-mode switch.
60 ## Disable building of static libraries by default
63 ## Check for required dependencies.
65 ## Check for a valid build environment.
66 # Valid equals having:
67 # - a C++ compiler compliant with the ISO98 C++ specification.
68 # - a working library tool for creating convenience libraries.
69 # - a working linker for creating static and shared libraries.
78 AC_ARG_ENABLE(doxygen, AC_HELP_STRING([--enable-doxygen], [turn on generating documentation]))
80 enable_doxygen_support=no
82 if test "x$enable_doxygen" = "xyes";
84 AC_PATH_PROG(DOXYGEN, doxygen, no)
85 if test "x$DOXYGEN" = "xno"; then
86 AC_MSG_ERROR([You need to install the doxygen package])
88 enable_doxygen_support=yes
90 AM_CONDITIONAL(DOXYGEN_ENABLED, test x$enable_doxygen_support = xyes)
92 ## Check for required libraries.
93 AC_CHECK_LIB( pthread, pthread_create, [],
94 [LDFLAGS="-pthread $LDFLAGS"
95 AC_TRY_LINK([char pthread_create();],
97 [], [AC_MSG_ERROR([Missing pthread])])
99 AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] )
100 AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] )
101 AX_CHECK_OPENSSL([], [AC_MSG_ERROR([Missing OpenSSL])])
103 AC_ARG_WITH(postgresql,
104 [ --with-postgresql Use PostgreSQL as a backend (default: no)],
105 [case "${withval}" in
106 yes) DO_POSTGRESQL=yes ;;
107 no) DO_POSTGRESQL=no ;;
108 maybe) DO_POSTGRESQL=maybe ;;
109 *) AC_MSG_ERROR(Bad value ${withval} for --with-postgresql) ;;
114 [ --with-mysql Use MySQL as a backend (default: yes)],
115 [case "${withval}" in
118 maybe) DO_MYSQL=maybe ;;
119 *) AC_MSG_ERROR(Bad value ${withval} for --with-mysql) ;;
124 AC_MSG_CHECKING(whether to build/link POSTGRESQL)
125 if test "x$DO_POSTGRESQL" = "xyes"; then
127 POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES"
128 POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib $OPENSSL_LIBS $POSTGRE_LIBS "
129 CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS"
131 AC_MSG_RESULT($DO_POSTGRESQL)
134 AC_MSG_CHECKING(whether to build/link MYSQL)
135 if test "x$DO_MYSQL" = "xyes"; then
136 AC_MSG_RESULT($DO_MYSQL)
137 AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $PATH)
138 if test -x "$MYSQL_CONFIG"
140 # MySQL v4 uses --include while v3 uses --cflags
141 MYSQL_INCLUDES="`$MYSQL_CONFIG --include`" || \
142 MYSQL_INCLUDES="`$MYSQL_CONFIG --cflags`"
143 MYSQL_LIBS="`$MYSQL_CONFIG --libs_r`"
144 CXXFLAGS="-DDO_MYSQL $CXXFLAGS"
145 # Workaround for --as-needed linker flag that comes sometimes from mysql
146 if echo $MYSQL_LIBS|grep "\-Wl,--as-needed" > /dev/null; then
147 MYSQL_LIBS=`echo $MYSQL_LIBS|sed -e "s/-Wl,--as-needed//"`;
148 AC_MSG_WARN([Your mysql libs contains -Wl,--as-needed, this is not good, problem fixed in more recent mysql versions])
152 AC_MSG_RESULT($DO_MYSQL)
155 ## Check for memory allocator
156 # Use libc-malloc or libtbb-malloc?
157 AC_MSG_CHECKING(whether to use libc malloc)
158 MANGOSD_STD_MALLOC=no
159 AC_ARG_WITH(std-malloc,
161 Memory allocation options:
163 --with-std-malloc Use standard malloc],
165 if test "$withval" = "yes" ; then
166 CFLAGS="-DUSE_STANDARD_MALLOC $CFLAGS"
167 CXXFLAGS="-DUSE_STANDARD_MALLOC $CXXFLAGS"
168 MANGOSD_STD_MALLOC=yes
169 elif test "$withval" != "no" ; then
170 AC_MSG_ERROR(Please choose yes or no)
173 AC_MSG_RESULT($MANGOSD_STD_MALLOC)
176 # Include debug info in library?
177 AC_MSG_CHECKING(whether to include debug info in library)
178 MANGOSD_DEBUG_INFO=no
179 AC_ARG_WITH(debug-info,
183 --with-debug-info Include debug info in library],
185 if test "$withval" = "yes" ; then
186 CFLAGS="-g -DMANGOS_DEBUG $CFLAGS"
187 CXXFLAGS="-g -DMANGOS_DEBUG $CXXFLAGS"
188 MANGOSD_DEBUG_INFO=yes
189 elif test "$withval" != "no" ; then
190 AC_MSG_ERROR(Please choose yes or no)
193 AC_MSG_RESULT($MANGOSD_DEBUG_INFO)
195 ## Check for required header files.
198 AC_CHECK_HEADERS([ arpa/inet.h fcntl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/timeb.h sys/time.h termios.h unistd.h ])
200 AC_CHECK_HEADERS([pthread.h])
201 AC_CHECK_HEADERS([mysql.h mysql/mysql.h])
202 AC_CHECK_HEADERS([libpq-fe.h])
203 AC_CHECK_HEADERS([zlib.h])
205 ## Check for typedefs, structures, and compiler characteristics.
212 AC_CHECK_TYPES([ptrdiff_t])
214 ## Check for required library functions.
215 AC_FUNC_CLOSEDIR_VOID
216 AC_FUNC_ERROR_AT_LINE
220 AC_FUNC_SELECT_ARGTYPES
223 AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr])
226 # Check for use buildtin ACE sources
227 AC_ARG_ENABLE(builtin_ace, AC_HELP_STRING([--enable-builtin-ace], [turn on/off using builtin ACE sources]))
229 enable_builtin_ace_support=yes
231 if test "x$enable_builtin_ace" = "xno"; then
232 PKG_CHECK_MODULES(ACE, [ACE >= 5.5.2], [need_builtin_ace=no], [need_builtin_ace=yes])
233 if test X$need_builtin_ace = Xyes ; then
234 AC_MSG_ERROR([You need to install ACE package or use built-in ACE sources])
236 enable_builtin_ace_support=no
239 if test X$enable_builtin_ace_support = Xno; then
241 # old ace versions might not have ace/Stack_Trace.h...
243 AC_CHECK_HEADERS([ace/Stack_Trace.h])
246 # ...but we certainly have it in our included version
247 AC_DEFINE(HAVE_ACE_STACK_TRACE_H)
248 ACE_INCLUDES="-I\$(top_srcdir)/dep/ACE_wrappers -I\$(top_builddir)/dep/ACE_wrappers"
249 ACE_LIBS="\$(top_builddir)/dep/ACE_wrappers/ace/libACE.la"
252 AM_CONDITIONAL([MANGOS_BUILD_ACE], [test X$enable_builtin_ace_support = Xyes])
254 ## Unify all additional includes/libs in one variable.
255 # TODO this looks kinda ugly, but when we add m4 folder I will make it look very pritey ( by Derex ).
256 MANGOS_INCLUDES="$ACE_INCLUDES $POSTGRE_INCLUDES $MYSQL_INCLUDES $OPENSSL_INCLUDES $MANGOS_INCLUDES"
257 MANGOS_LIBS="$ACE_LIBS $POSTGRE_LIBS $MYSQL_LIBS $ZLIB $COMPATLIB $OPENSSL_LIBS $MANGOS_LIBS"
259 ## Export defined variables
261 AC_SUBST(MANGOSD_DEBUG_INFO)
263 ## Additional CPPFLAGS and LDFLAGS.
264 AC_SUBST(MANGOS_INCLUDES)
265 AC_SUBST(MANGOS_LIBS)
268 AC_CONFIG_HEADERS([config.h])
270 AC_SEARCH_LIBS(poll, [poll], [AC_DEFINE(HAVE_POLL, 1, [Define to 1 if the OS is usabl... err, has poll().])])
277 AH_BOTTOM([#endif /* !AC_CONFIG_H */])
283 dep/src/g3dlite/Makefile
284 dep/src/zlib/Makefile
285 dep/src/gsoap/Makefile
296 src/tools/genrevision/Makefile
297 src/framework/Makefile
299 src/shared/Auth/Makefile
300 src/shared/Config/Makefile
301 src/shared/Database/Makefile
302 src/shared/vmap/Makefile
303 src/shared/SystemConfig.h
306 src/realmd/realmd.conf.dist
308 src/mangosd/mangosd.conf.dist
309 src/bindings/Makefile
310 src/bindings/universal/Makefile
313 ## Configure ACE, if needed
314 if test X$enable_builtin_ace_support = Xyes; then
315 AC_CONFIG_SUBDIRS([dep/ACE_wrappers])
318 AC_CONFIG_COMMANDS([default],[
320 echo "Configuration of MaNGOS $PACKAGE_VERSION is now complete."
322 ],[PACKAGE_VERSION=$PACKAGE_VERSION])
324 ## Disabled Makefiles, until they are ready for a successful make and