1 # Copyright (C) 2007 MaNGOS project <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 ## Prelude, basic settings for Autoconf
15 # VERSION: 0.8.01 (trunk)
16 # BUG-REPORT-ADDRESS: mangos-devs@lists.sourceforge.net
17 AC_INIT( [mangos], [0.8.01], [mangos-devs@lists.sourceforge.net])
18 AC_CONFIG_SRCDIR([src/shared/Base.cpp])
20 ## Prelude, basic settings for Automake
21 # Turn on all warnings and error messages, and enforce GNU
22 # standards for the package.
23 AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2])
26 ## Check for required dependencies.
28 ## Check for a valid build environment.
29 # Valid equals having:
30 # - a C++ compiler compliant with the ISO98 C++ specification.
31 # - a working library tool for creating convenience libraries.
32 # - a working linker for creating static and shared libraries.
38 AC_PATH_PROG(DOXYGENPATH, doxygen)
39 if test "_$DOXYGENPATH" = _ ; then
40 AC_MSG_WARN([doxygen is required to build the API documentation.])
42 AM_CONDITIONAL([USE_DOXYGEN], [test "_$DOXYGENPATH" != _])
44 ## Check for required libraries.
45 AC_CHECK_LIB( pthread, pthread_create, [],
46 [LDFLAGS="-pthread $LDFLAGS"
47 AC_TRY_LINK([char pthread_create();],
49 [], [AC_MSG_ERROR([Missing pthread])])
51 AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] )
52 AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] )
53 AC_CHECK_LIB( crypto, SHA1_Init, [SSLLIB=-lssl], [AC_MSG_ERROR([Missing openssl])])
55 AC_ARG_WITH(postgresql,
56 [ --with-postgresql Use PostgreSQL as a backend (default: no)],
58 yes) DO_POSTGRESQL=yes ;;
59 no) DO_POSTGRESQL=no ;;
60 maybe) DO_POSTGRESQL=maybe ;;
61 *) AC_MSG_ERROR(Bad value ${withval} for --with-postgresql) ;;
66 [ --with-mysql Use MySQL as a backend (default: yes)],
70 maybe) DO_MYSQL=maybe ;;
71 *) AC_MSG_ERROR(Bad value ${withval} for --with-mysql) ;;
76 AC_MSG_CHECKING(whether to build/link POSTGRESQL)
77 if test "x$DO_POSTGRESQL" = "xyes"; then
79 POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES"
80 POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto $POSTGRE_LIBS "
81 CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS"
83 AC_MSG_RESULT($DO_POSTGRESQL)
86 AC_MSG_CHECKING(whether to build/link MYSQL)
87 if test "x$DO_MYSQL" = "xyes"; then
88 AC_MSG_RESULT($DO_MYSQL)
89 AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $PATH)
90 if test -x "$MYSQL_CONFIG"
92 # MySQL v4 uses --include while v3 uses --cflags
93 MYSQL_INCLUDES="`$MYSQL_CONFIG --include`" || \
94 MYSQL_INCLUDES="`$MYSQL_CONFIG --cflags`"
95 MYSQL_LIBS="`$MYSQL_CONFIG --libs_r`"
96 CXXFLAGS="-DDO_MYSQL $CXXFLAGS"
99 AC_MSG_RESULT($DO_MYSQL)
103 # Include debug info in library?
104 AC_MSG_CHECKING(whether to include debug info in library)
105 MANGOSD_DEBUG_INFO=no
106 AC_ARG_WITH(debug-info,
110 --with-debug-info Include debug info in library],
112 if test "$withval" = "yes" ; then
113 CFLAGS="-g -DMANGOS_DEBUG $CFLAGS"
114 CXXFLAGS="-g -DMANGOS_DEBUG $CXXFLAGS"
115 MANGOSD_DEBUG_INFO=yes
116 elif test "$withval" != "no" ; then
117 AC_MSG_ERROR(Please choose yes or no)
120 AC_MSG_RESULT($MANGOSD_DEBUG_INFO)
123 # Enable CLI console?
124 AC_MSG_CHECKING(whether cli console is enabled)
125 MANGOSD_ENABLE_CLI=no
127 [ --enable-cli Turn on command console system],
129 if test "$enableval" = "yes" ; then
130 CFLAGS="-DENABLE_CLI $CFLAGS"
131 CXXFLAGS="-DENABLE_CLI $CXXFLAGS"
132 MANGOSD_ENABLE_CLI=yes
133 elif test "$withval" != "no" ; then
134 AC_MSG_ERROR(Please choose yes or no)
137 AC_MSG_RESULT($MANGOSD_ENABLE_CLI)
139 # Enable remote console?
140 AC_MSG_CHECKING(whether remote console is enabled)
143 [ --enable-ra Turn on remote console system],
145 if test "$enableval" = "yes" ; then
146 CFLAGS="-DENABLE_RA $CFLAGS"
147 CXXFLAGS="-DENABLE_RA $CXXFLAGS"
148 MANGOSD_ENABLE_RA=yes
149 elif test "$withval" != "no" ; then
150 AC_MSG_ERROR(Please choose yes or no)
153 AC_MSG_RESULT($MANGOSD_ENABLE_RA)
155 ## Check for required header files.
158 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 ])
160 AC_CHECK_HEADERS([pthread.h])
161 AC_CHECK_HEADERS([openssl/md5.h openssl/rand.h openssl/ssl.h openssl/sha.h openssl/bn.h])
162 AC_CHECK_HEADERS([mysql.h mysql/mysql.h])
163 AC_CHECK_HEADERS([libpq-fe.h])
164 AC_CHECK_HEADERS([zlib.h])
166 ## Check for typedefs, structures, and compiler characteristics.
175 AC_CHECK_TYPES([ptrdiff_t])
177 ## Check for required library functions.
178 AC_FUNC_CLOSEDIR_VOID
179 AC_FUNC_ERROR_AT_LINE
183 AC_FUNC_SELECT_ARGTYPES
186 AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr])
188 ## Export defined variables
192 AC_SUBST(MYSQL_INCLUDES)
194 AC_SUBST(POSTGRE_INCLUDES)
195 AC_SUBST(POSTGRE_LIBS)
196 AC_SUBST(DOXYGENPATH)
197 AC_SUBST(MANGOSD_DEBUG_INFO)
198 AC_SUBST(MANGOSD_ENABLE_CLI)
199 AC_SUBST(MANGOSD_ENABLE_RA)
202 AC_CONFIG_HEADERS([config.h])
207 dep/src/g3dlite/Makefile
208 dep/src/zlib/Makefile
209 dep/src/zthread/Makefile
217 src/framework/Makefile
219 src/shared/SystemConfig.h
222 src/realmd/realmd.conf
224 src/mangosd/mangosd.conf
225 src/bindings/Makefile
226 src/bindings/universal/Makefile
229 ## Disabled Makefiles, until they are ready for a successful make and