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.7.01 (trunk)
16 # BUG-REPORT-ADDRESS: mangos-devs@lists.sourceforge.net
17 AC_INIT( [mangos], [0.7.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_CHECK_LIB( mysqlclient, mysql_init, [],[AC_CHECK_LIB(mysql, mysql_init,[],[AC_MSG_ERROR([Missing mysql])])])
56 AC_ARG_WITH(mysql-libs,
57 [ --with-mysql-libs=DIR Look for mysql libs in this dir ],
58 MYSQL_LIBS="-L$withval -lmysqlclient"
60 AC_ARG_WITH(mysql-includes,
61 [ --with-mysql-includes=DIR Look for mysql includes in this dir ],
62 MYSQL_INCLUDES="-I$withval"
65 AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $PATH)
66 if test -x "$MYSQL_CONFIG"
68 # MySQL v4 uses --include while v3 uses --cflags
69 MYSQL_INCLUDES="`$MYSQL_CONFIG --include`" || \
70 MYSQL_INCLUDES="`$MYSQL_CONFIG --cflags`"
71 MYSQL_LIBS="`$MYSQL_CONFIG --libs_r`"
75 # Include debug info in library?
76 AC_MSG_CHECKING(whether to include debug info in library)
78 AC_ARG_WITH(debug-info,
82 --with-debug-info Include debug info in library],
84 if test "$withval" = "yes" ; then
85 CFLAGS="-g -DMANGOS_DEBUG $CFLAGS"
86 CXXFLAGS="-g -DMANGOS_DEBUG $CXXFLAGS"
87 MANGOSD_DEBUG_INFO=yes
88 elif test "$withval" != "no" ; then
89 AC_MSG_ERROR(Please choose yes or no)
92 AC_MSG_RESULT($MANGOSD_DEBUG_INFO)
96 AC_MSG_CHECKING(whether cli console is enabled)
99 [ --enable-cli Turn on command console system],
101 if test "$enableval" = "yes" ; then
102 CFLAGS="-DENABLE_CLI $CFLAGS"
103 CXXFLAGS="-DENABLE_CLI $CXXFLAGS"
104 MANGOSD_ENABLE_CLI=yes
105 elif test "$withval" != "no" ; then
106 AC_MSG_ERROR(Please choose yes or no)
109 AC_MSG_RESULT($MANGOSD_ENABLE_CLI)
111 # Enable remote console?
112 AC_MSG_CHECKING(whether remote console is enabled)
115 [ --enable-ra Turn on remote console system],
117 if test "$enableval" = "yes" ; then
118 CFLAGS="-DENABLE_RA $CFLAGS"
119 CXXFLAGS="-DENABLE_RA $CXXFLAGS"
120 MANGOSD_ENABLE_RA=yes
121 elif test "$withval" != "no" ; then
122 AC_MSG_ERROR(Please choose yes or no)
125 AC_MSG_RESULT($MANGOSD_ENABLE_RA)
127 ## Check for required header files.
130 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 ])
132 AC_CHECK_HEADERS([pthread.h])
133 AC_CHECK_HEADERS([openssl/md5.h openssl/rand.h openssl/ssl.h openssl/sha.h openssl/bn.h])
134 AC_CHECK_HEADERS([mysql.h mysql/mysql.h])
135 AC_CHECK_HEADERS([zlib.h])
137 ## Check for typedefs, structures, and compiler characteristics.
146 AC_CHECK_TYPES([ptrdiff_t])
148 ## Check for required library functions.
149 AC_FUNC_CLOSEDIR_VOID
150 AC_FUNC_ERROR_AT_LINE
154 AC_FUNC_SELECT_ARGTYPES
157 AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr])
159 ## Export defined variables
163 AC_SUBST(MYSQL_INCLUDES)
165 AC_SUBST(DOXYGENPATH)
166 AC_SUBST(MANGOSD_DEBUG_INFO)
167 AC_SUBST(MANGOSD_ENABLE_CLI)
168 AC_SUBST(MANGOSD_ENABLE_RA)
171 AC_CONFIG_HEADERS([config.h])
176 dep/src/zlib/Makefile
177 dep/src/zthread/Makefile
185 src/framework/Makefile
187 src/shared/SystemConfig.h
190 src/realmd/realmd.conf
192 src/mangosd/mangosd.conf
193 src/bindings/Makefile
194 src/bindings/universal/Makefile
197 ## Disabled Makefiles, until they are ready for a successful make and