1 # Copyright (C) 2005-2009 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.15.0 (trunk)
18 # BUG-REPORT-ADDRESS: mangos-devs@lists.sourceforge.net
19 AC_INIT( [mangos], [0.15.0], [mangos-devs@lists.sourceforge.net])
20 AC_CONFIG_SRCDIR([src/shared/Base.cpp])
22 ## Prelude, basic settings for Automake
23 # Turn on all warnings and error messages, and enforce GNU
24 # standards for the package.
25 AM_INIT_AUTOMAKE([foreign -Wall -Werror gnu tar-pax])
26 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
30 ## Prevent the configure script from continuing any further if
31 # configuration is being performed in the top-level directory.
32 # The idea is to prevent this ,because some maintainers tend
33 # to break parallel build trees (a.k.a. VPATH builds).
34 if test "$srcdir" = "." && test "$enable_maintainer_mode" != "yes"; then
37 Please configure and build in a directory other than the
38 top-level source directory. This is needed because a lot
39 of maintainers tend to break parallel build trees
40 (a.k.a. VPATH builds). This is kinda real ensurance they
41 will not do it (by enforcing everybody to do VPATH builds).
43 For example, try the following from the top-level source
51 This will create a build space in the directory 'objdir' and
52 start a build in that directory.
54 If however you realy want to disable this error,
55 use --enable-maintainer-mode switch.
59 ## Disable building of static libraries by default
62 ## Check for required dependencies.
64 ## Check for a valid build environment.
65 # Valid equals having:
66 # - a C++ compiler compliant with the ISO98 C++ specification.
67 # - a working library tool for creating convenience libraries.
68 # - a working linker for creating static and shared libraries.
77 AC_ARG_ENABLE(doxygen, AC_HELP_STRING([--enable-doxygen], [turn on generating documentation]))
79 enable_doxygen_support=no
81 if test "x$enable_doxygen" = "xyes";
83 AC_PATH_PROG(DOXYGEN, doxygen, no)
84 if test "x$DOXYGEN" = "xno"; then
85 AC_MSG_ERROR([You need to install the doxygen package])
87 enable_doxygen_support=yes
89 AM_CONDITIONAL(DOXYGEN_ENABLED, test x$enable_doxygen_support = xyes)
91 ## Check for required libraries.
92 AC_CHECK_LIB( pthread, pthread_create, [],
93 [LDFLAGS="-pthread $LDFLAGS"
94 AC_TRY_LINK([char pthread_create();],
96 [], [AC_MSG_ERROR([Missing pthread])])
98 AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] )
99 AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] )
100 PKG_CHECK_MODULES(OPENSSL, [openssl], [], [AC_MSG_ERROR([Missing openssl])])
102 AC_ARG_WITH(postgresql,
103 [ --with-postgresql Use PostgreSQL as a backend (default: no)],
104 [case "${withval}" in
105 yes) DO_POSTGRESQL=yes ;;
106 no) DO_POSTGRESQL=no ;;
107 maybe) DO_POSTGRESQL=maybe ;;
108 *) AC_MSG_ERROR(Bad value ${withval} for --with-postgresql) ;;
113 [ --with-mysql Use MySQL as a backend (default: yes)],
114 [case "${withval}" in
117 maybe) DO_MYSQL=maybe ;;
118 *) AC_MSG_ERROR(Bad value ${withval} for --with-mysql) ;;
123 AC_MSG_CHECKING(whether to build/link POSTGRESQL)
124 if test "x$DO_POSTGRESQL" = "xyes"; then
126 POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES"
127 POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib $OPENSSL_LIBS $POSTGRE_LIBS "
128 CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS"
130 AC_MSG_RESULT($DO_POSTGRESQL)
133 AC_MSG_CHECKING(whether to build/link MYSQL)
134 if test "x$DO_MYSQL" = "xyes"; then
135 AC_MSG_RESULT($DO_MYSQL)
136 AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $PATH)
137 if test -x "$MYSQL_CONFIG"
139 # MySQL v4 uses --include while v3 uses --cflags
140 MYSQL_INCLUDES="`$MYSQL_CONFIG --include`" || \
141 MYSQL_INCLUDES="`$MYSQL_CONFIG --cflags`"
142 MYSQL_LIBS="`$MYSQL_CONFIG --libs_r`"
143 CXXFLAGS="-DDO_MYSQL $CXXFLAGS"
144 # Workaround for --as-needed linker flag that comes sometimes from mysql
145 if echo $MYSQL_LIBS|grep "\-Wl,--as-needed" > /dev/null; then
146 MYSQL_LIBS=`echo $MYSQL_LIBS|sed -e "s/-Wl,--as-needed//"`;
147 AC_MSG_WARN([Your mysql libs contains -Wl,--as-needed, this is not good, problem fixed in more recent mysql versions])
151 AC_MSG_RESULT($DO_MYSQL)
155 # Include debug info in library?
156 AC_MSG_CHECKING(whether to include debug info in library)
157 MANGOSD_DEBUG_INFO=no
158 AC_ARG_WITH(debug-info,
162 --with-debug-info Include debug info in library],
164 if test "$withval" = "yes" ; then
165 CFLAGS="-g -DMANGOS_DEBUG $CFLAGS"
166 CXXFLAGS="-g -DMANGOS_DEBUG $CXXFLAGS"
167 MANGOSD_DEBUG_INFO=yes
168 elif test "$withval" != "no" ; then
169 AC_MSG_ERROR(Please choose yes or no)
172 AC_MSG_RESULT($MANGOSD_DEBUG_INFO)
174 ## Check for required header files.
177 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 ])
179 AC_CHECK_HEADERS([pthread.h])
180 AC_CHECK_HEADERS([mysql.h mysql/mysql.h])
181 AC_CHECK_HEADERS([libpq-fe.h])
182 AC_CHECK_HEADERS([zlib.h])
184 ## Check for typedefs, structures, and compiler characteristics.
191 AC_CHECK_TYPES([ptrdiff_t])
193 ## Check for required library functions.
194 AC_FUNC_CLOSEDIR_VOID
195 AC_FUNC_ERROR_AT_LINE
199 AC_FUNC_SELECT_ARGTYPES
202 AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr])
205 # Check for use buildtin ACE sources
206 AC_ARG_ENABLE(builtin_ace, AC_HELP_STRING([--enable-builtin-ace], [turn on/off using builtin ACE sources]))
208 enable_builtin_ace_support=yes
210 if test "x$enable_builtin_ace" = "xno"; then
211 PKG_CHECK_MODULES(ACE, [ACE >= 5.5.2], [need_builtin_ace=no], [need_builtin_ace=yes])
212 if test X$need_builtin_ace = Xyes ; then
213 AC_MSG_ERROR([You need to install ACE package or use built-in ACE sources])
215 enable_builtin_ace_support=no
218 if test X$enable_builtin_ace_support = Xno; then
220 # old ace versions might not have ace/Stack_Trace.h...
222 AC_CHECK_HEADERS([ace/Stack_Trace.h])
225 # ...but we certainly have it in our included version
226 AC_DEFINE(HAVE_ACE_STACK_TRACE_H)
227 ACE_INCLUDES="-I\$(top_srcdir)/dep/ACE_wrappers -I\$(top_builddir)/dep/ACE_wrappers"
228 ACE_LIBS="\$(top_builddir)/dep/ACE_wrappers/ace/libACE.la"
231 AM_CONDITIONAL([MANGOS_BUILD_ACE], [test X$enable_builtin_ace_support = Xyes])
233 ## Unify all additional includes/libs in one variable.
234 # TODO this looks kinda ugly, but when we add m4 folder I will make it look very pritey ( by Derex ).
235 MANGOS_INCLUDES="$ACE_INCLUDES $POSTGRE_INCLUDES $MYSQL_INCLUDES $OPENSSL_INCLUDES $MANGOS_INCLUDES"
236 MANGOS_LIBS="$ACE_LIBS $POSTGRE_LIBS $MYSQL_LIBS $ZLIB $COMPATLIB $OPENSSL_LIBS $MANGOS_LIBS"
238 ## Export defined variables
240 AC_SUBST(MANGOSD_DEBUG_INFO)
242 ## Additional CPPFLAGS and LDFLAGS.
243 AC_SUBST(MANGOS_INCLUDES)
244 AC_SUBST(MANGOS_LIBS)
247 AC_CONFIG_HEADERS([config.h])
252 dep/src/g3dlite/Makefile
253 dep/src/sockets/Makefile
254 dep/src/zlib/Makefile
264 src/tools/genrevision/Makefile
265 src/framework/Makefile
267 src/shared/Auth/Makefile
268 src/shared/Config/Makefile
269 src/shared/Database/Makefile
270 src/shared/vmap/Makefile
271 src/shared/SystemConfig.h
274 src/realmd/realmd.conf.dist
276 src/mangosd/mangosd.conf.dist
277 src/bindings/Makefile
278 src/bindings/universal/Makefile
281 ## Configure ACE, if needed
282 if test X$enable_builtin_ace_support = Xyes; then
283 AC_CONFIG_SUBDIRS([dep/ACE_wrappers])
286 AC_CONFIG_COMMANDS([default],[
288 echo "Configuration of MaNGOS $PACKAGE_VERSION is now complete."
290 ],[PACKAGE_VERSION=$PACKAGE_VERSION])
292 ## Disabled Makefiles, until they are ready for a successful make and