root/trunk/configure.ac @ 39

Revision 39, 10.0 kB (checked in by yumileroy, 17 years ago)

[svn] * Various small changes here and there.
* Implementing MangChat? IRC system.
* Added new config option, MAX_WHO, can be used to set the limit of characters being sent in a /who request from client.

Original author: XTZGZoReX
Date: 2008-10-12 14:03:38-05:00

RevLine 
[2]1# Copyright (C) 2005-2008 MaNGOS project <http://www.mangosproject.org/>
2#
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.
6#
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.
10
11## Process this file with autoconf to produce a configure script.
12
13## Prelude, basic settings for Autoconf
14AC_INIT( [trinitycore], [0.0.1], [devs@trinitycore.org])
15
16AC_CONFIG_SRCDIR([src/shared/Base.cpp])
17
18## Prelude, basic settings for Automake
19#  Turn on all warnings and error messages, and enforce GNU
20#  standards for the package.
[17]21AM_INIT_AUTOMAKE([-Wall -Werror gnu tar-pax])
[2]22AM_MAINTAINER_MODE
23
24## Prevent the configure script from continuing any further if
25# configuration is being performed in the top-level directory.
26# The idea is to prevent this ,because some maintainers tend
[16]27# to break parallel build trees (a.k.a. VPATH builds).
[2]28if test "$srcdir" = "." && test "$enable_maintainer_mode" != "yes"; then
29  AC_MSG_ERROR(
30     [
31      Please configure and build in a directory other than the
32      top-level source directory. This is needed because a lot
[16]33      of maintainers tend to break parallel build trees
34      (a.k.a. VPATH builds). This is kinda real ensurance they
35      will not do it (by enforcing everybody to do VPATH builds).
[2]36
37      For example, try the following from the top-level source
38      directory:
39
40          mkdir objdir
41          cd objdir
42          ../configure
43          make
44
45      This will create a build space in the directory `objdir' and
46      start a build in that directory.
47
[16]48      If however you realy want to disable this error,
49      use --enable-maintainer-mode switch.
[2]50     ])
51fi
52
53## Disable building of static libraries by default
54AC_DISABLE_STATIC
55
56## Check for required dependencies.
57
58## Check for a valid build environment.
59#  Valid equals having:
60#  - a C++ compiler compliant with the ISO98 C++ specification.
61#  - a working library tool for creating convenience libraries.
62#  - a working linker for creating static and shared libraries.
63AC_PROG_CC
64AC_PROG_CXX
65AC_PROG_LIBTOOL
66AC_PROG_INSTALL
67AM_PROG_CC_C_O
68
69# Check if enable scripts
[31]70AC_ARG_ENABLE([scripts], AC_HELP_STRING([--enable-scripts], [Enable TrinityScripts (default: check) ]), [], [enable_scripts=yes])
[2]71
[31]72AC_MSG_CHECKING(whether to build scripting module)
73if test X$enable_scripts = Xyes -a -d $srcdir/src/bindings/scripts/scripts; then
74  tri_build_scripts=yes
75  AC_MSG_RESULT(yes)
76else
77  tri_build_scripts=no
78  AC_MSG_RESULT(no)
79  if test X$enable_scripts = Xyes; then
80    AC_MSG_WARN([src/bindings/scripts/scripts folder does not exist, scripts will be disabled])
81  fi
82fi
[2]83
[31]84AM_CONDITIONAL([USE_TSCRIPTS], [test X$tri_build_scripts = Xyes])
85
[2]86# Check for doxygen
87AC_ARG_ENABLE(doxygen, AC_HELP_STRING([--enable-doxygen], [turn on generating documentation]))
88
89enable_doxygen_support=no
90
91if test "x$enable_doxygen" = "xyes";
92then
93  AC_PATH_PROG(DOXYGEN, doxygen, no)
94  if test "x$DOXYGEN" = "xno"; then
95    AC_MSG_ERROR([You need to install the doxygen package])
96  fi
97  enable_doxygen_support=yes
98fi
99AM_CONDITIONAL(DOXYGEN_ENABLED, test x$enable_doxygen_support = xyes)
100
101## Check for required libraries.
102AC_CHECK_LIB( pthread, pthread_create, [],
103    [LDFLAGS="-pthread $LDFLAGS"
104     AC_TRY_LINK([char pthread_create();],
105         pthread_create();,
106         [], [AC_MSG_ERROR([Missing pthread])])
107    ])
108AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] )
109AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] )
110AC_CHECK_LIB( crypto, SHA1_Init, [SSLLIB=-lssl], [AC_MSG_ERROR([Missing openssl])])
111
112AC_ARG_WITH(postgresql,
113[  --with-postgresql       Use PostgreSQL as a backend (default: no)],
114[case "${withval}" in
115        yes) DO_POSTGRESQL=yes ;;
116        no)  DO_POSTGRESQL=no ;;
117        maybe) DO_POSTGRESQL=maybe ;;
118        *)   AC_MSG_ERROR(Bad value ${withval} for --with-postgresql) ;;
119    esac],
120[DO_POSTGRESQL=no])
121                                 
122AC_ARG_WITH(mysql,
123[  --with-mysql            Use MySQL as a backend (default: yes)],
124[case "${withval}" in
125        yes) DO_MYSQL=yes ;;
126        no)  DO_MYSQL=no ;;
127        maybe) DO_MYSQL=maybe ;;
128        *)   AC_MSG_ERROR(Bad value ${withval} for --with-mysql) ;;
129    esac],
130[DO_MYSQL=yes])
131
132# here Postgre
133AC_MSG_CHECKING(whether to build/link POSTGRESQL)
134if test "x$DO_POSTGRESQL" = "xyes"; then
135DO_MYSQL=no
136POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES"
137POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto $POSTGRE_LIBS "
138CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS"
139fi
140AC_MSG_RESULT($DO_POSTGRESQL)
141       
142# here mysql
143AC_MSG_CHECKING(whether to build/link MYSQL)
144if test "x$DO_MYSQL" = "xyes"; then
145AC_MSG_RESULT($DO_MYSQL)
146AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $PATH)
147    if test -x "$MYSQL_CONFIG"
148        then
149    # MySQL v4 uses --include while v3 uses --cflags
150        MYSQL_INCLUDES="`$MYSQL_CONFIG --include`" || \
151            MYSQL_INCLUDES="`$MYSQL_CONFIG --cflags`"
152        MYSQL_LIBS="`$MYSQL_CONFIG --libs_r`"
153        CXXFLAGS="-DDO_MYSQL $CXXFLAGS"
154    fi
155else
156AC_MSG_RESULT($DO_MYSQL)
157fi
158
159## Check for options
160#  Include debug info in library?
161AC_MSG_CHECKING(whether to include debug info in library)
162MANGOSD_DEBUG_INFO=no
163AC_ARG_WITH(debug-info,
164[
165Debugging options:
166
167  --with-debug-info       Include debug info in library],
168[
169    if test "$withval" = "yes" ; then
170        CFLAGS="-g -DMANGOS_DEBUG $CFLAGS"
171        CXXFLAGS="-g -DMANGOS_DEBUG $CXXFLAGS"
172        MANGOSD_DEBUG_INFO=yes
173    elif test "$withval" != "no" ; then
174        AC_MSG_ERROR(Please choose yes or no)
175    fi
176])
177AC_MSG_RESULT($MANGOSD_DEBUG_INFO)
178
179
180# Enable CLI console?
181AC_MSG_CHECKING(whether cli console is enabled)
182MANGOSD_ENABLE_CLI=no
183AC_ARG_ENABLE(cli,
184[  --enable-cli Turn on command console system],
185[
186    if test "$enableval" = "yes" ; then
187        CFLAGS="-DENABLE_CLI $CFLAGS"
188        CXXFLAGS="-DENABLE_CLI $CXXFLAGS"
189        MANGOSD_ENABLE_CLI=yes
190    elif test "$withval" != "no" ; then
191        AC_MSG_ERROR(Please choose yes or no)
192    fi
193])
194AC_MSG_RESULT($MANGOSD_ENABLE_CLI)
195
196# Enable remote console?
197AC_MSG_CHECKING(whether remote console is enabled)
198MANGOSD_ENABLE_RA=no
199AC_ARG_ENABLE(ra,
200[  --enable-ra Turn on remote console system],
201[
202    if test "$enableval" = "yes" ; then
203        CFLAGS="-DENABLE_RA $CFLAGS"
204        CXXFLAGS="-DENABLE_RA $CXXFLAGS"
205        MANGOSD_ENABLE_RA=yes
206    elif test "$withval" != "no" ; then
207        AC_MSG_ERROR(Please choose yes or no)
208    fi
209])
210AC_MSG_RESULT($MANGOSD_ENABLE_RA)
211
212## Check for required header files.
213AC_HEADER_STDC
214AC_HEADER_DIRENT
215AC_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  ])
216
217AC_CHECK_HEADERS([pthread.h])
218AC_CHECK_HEADERS([openssl/md5.h openssl/rand.h openssl/ssl.h openssl/sha.h openssl/bn.h])
219AC_CHECK_HEADERS([mysql.h mysql/mysql.h])
220AC_CHECK_HEADERS([libpq-fe.h])
221AC_CHECK_HEADERS([zlib.h])
222
223## Check for typedefs, structures, and compiler characteristics.
224AC_HEADER_STDBOOL
225AC_C_CONST
226AC_C_INLINE
227AC_TYPE_SIZE_T
228AC_HEADER_TIME
229AC_STRUCT_TM
230AC_TYPE_UINT64_T
231AC_C_VOLATILE
232AC_CHECK_TYPES([ptrdiff_t])
233
234## Check for required library functions.
235AC_FUNC_CLOSEDIR_VOID
236AC_FUNC_ERROR_AT_LINE
237AC_FUNC_MALLOC
238AC_FUNC_MEMCMP
239AC_FUNC_REALLOC
240AC_FUNC_SELECT_ARGTYPES
241AC_TYPE_SIGNAL
242AC_FUNC_VPRINTF
243AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr])
244
[8]245## Check what to do with ACE library
246AC_LANG_PUSH([C++])
247AC_CHECK_HEADER([ace/Reactor.h], [tri_have_ace_headers=yes], [tri_have_ace_headers=no])
248AC_CHECK_LIB([ACE], [main], [tri_have_ace_lib=yes], [tri_have_ace_lib=no])
249AC_LANG_POP([C++])
250
251AC_MSG_CHECKING([whether to build ACE])
252if test X$tri_have_ace_headers = Xyes -a X$tri_have_ace_lib = Xyes;
253then
254  tri_need_to_build_ace=no
255  ACE_LIBS="-lACE"
256  ACE_INCLUDES=""
257  AC_MSG_RESULT([no])
258else
259  if test X$tri_have_ace_headers = Xno -a X$tri_have_ace_lib = Xno; then
260    tri_need_to_build_ace=yes
261    AC_MSG_RESULT([yes])
262  else
263    if test X$tri_have_ace_headers = Xyes; then
264       AC_MSG_ERROR([looks like you have ACE headers, but you do not have ACE libs installed])
265    else
266       tri_need_to_build_ace=yes
267       AC_MSG_RESULT([yes, over-install])
268    fi
269  fi
270fi
271
272if test X$tri_need_to_build_ace = Xyes; then
[17]273   TRINI_INCLUDES="-I\$(top_srcdir)/dep/ACE_wrappers -I\$(top_builddir)/dep/ACE_wrappers $TRINI_INCLUDES"
274   TRINI_LIBS="\$(top_builddir)/dep/ACE_wrappers/ace/libACE.la $TRINI_LIBS"
[8]275else
[17]276   TRINI_LIBS="-lACE $TRINI_LIBS"
[8]277fi
278
279AM_CONDITIONAL([TRI_BUILD_ACE], [test X$tri_need_to_build_ace = Xyes])
280
[2]281## Export defined variables
282AC_SUBST(ZLIB)
283AC_SUBST(COMPATLIB)
284AC_SUBST(SSLLIB)
285AC_SUBST(MYSQL_INCLUDES)
286AC_SUBST(MYSQL_LIBS)
287AC_SUBST(POSTGRE_INCLUDES)
288AC_SUBST(POSTGRE_LIBS)
289AC_SUBST(DOXYGEN)
290AC_SUBST(MANGOSD_DEBUG_INFO)
291AC_SUBST(MANGOSD_ENABLE_CLI)
292AC_SUBST(MANGOSD_ENABLE_RA)
[17]293AC_SUBST(TRINI_INCLUDES)
294AC_SUBST(TRINI_LIBS)
[2]295
296## Set output files.
297AC_CONFIG_HEADERS([config.h])
298AC_CONFIG_FILES([
299   dep/include/Makefile
300   dep/lib/Makefile
301   dep/src/Makefile
302   dep/src/g3dlite/Makefile
303   dep/src/sockets/Makefile
304   dep/src/zlib/Makefile
305   dep/src/zthread/Makefile
306   dep/Makefile
307   doc/Doxyfile
308   doc/Makefile
309   Makefile
310   src/Makefile
311   src/framework/Makefile
312   src/shared/Makefile
313   src/shared/vmap/Makefile
314   src/game/Makefile
315   src/trinityrealm/Makefile
316   src/trinitycore/Makefile
[39]317   src/game/IRCConf.h
[2]318   src/bindings/Makefile
319   src/bindings/interface/Makefile
320])
321
[31]322if test X$tri_build_scripts = Xyes; then
323AC_CONFIG_FILES([src/bindings/scripts/Makefile])
324fi
325
[6]326## Configure ACE
[8]327if test X$tri_need_to_build_ace = Xyes; then
328  AC_CONFIG_SUBDIRS([dep/ACE_wrappers])
329fi
[6]330
[2]331## Disabled Makefiles, until they are ready for a successful make and
332#  make dist run.
333
[6]334AC_CONFIG_COMMANDS([default],[
335  echo ""
336  echo "Configuration of TrinityCore $PACKAGE_VERSION is now complete."
337  echo ""
338 ],[PACKAGE_VERSION=$PACKAGE_VERSION])
339
[2]340## Output files.
341AC_OUTPUT
Note: See TracBrowser for help on using the browser.