root/trunk/configure.ac @ 44

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

[svn] * Merge Temp dev SVN with Assembla.
* Changes include:

  • Implementation of w12x's Outdoor PvP and Game Event Systems.
  • Temporary removal of IRC Chat Bot (until infinite loop when disabled is fixed).
  • All mangos -> trinity (to convert your mangos_string table, please run mangos_string_to_trinity_string.sql).
  • Improved Config cleanup.
  • And many more changes.

Original author: Seline
Date: 2008-10-14 11:57:03-05:00

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