root/trunk/configure.ac @ 17

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

[svn] * Restore make dist.

Original author: derex_tri
Date: 2008-10-06 04:27:18-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
70AC_ARG_ENABLE([scripts], AC_HELP_STRING([--enable-scripts], [Enable TrinityScripts (default: yes) ]), [], [enable_scripts=yes])
71
72AM_CONDITIONAL([USE_TSCRIPTS], [test X$enable_scripts = Xyes])
73
74# Check for doxygen
75AC_ARG_ENABLE(doxygen, AC_HELP_STRING([--enable-doxygen], [turn on generating documentation]))
76
77enable_doxygen_support=no
78
79if test "x$enable_doxygen" = "xyes";
80then
81  AC_PATH_PROG(DOXYGEN, doxygen, no)
82  if test "x$DOXYGEN" = "xno"; then
83    AC_MSG_ERROR([You need to install the doxygen package])
84  fi
85  enable_doxygen_support=yes
86fi
87AM_CONDITIONAL(DOXYGEN_ENABLED, test x$enable_doxygen_support = xyes)
88
89## Check for required libraries.
90AC_CHECK_LIB( pthread, pthread_create, [],
91    [LDFLAGS="-pthread $LDFLAGS"
92     AC_TRY_LINK([char pthread_create();],
93         pthread_create();,
94         [], [AC_MSG_ERROR([Missing pthread])])
95    ])
96AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] )
97AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] )
98AC_CHECK_LIB( crypto, SHA1_Init, [SSLLIB=-lssl], [AC_MSG_ERROR([Missing openssl])])
99
100AC_ARG_WITH(postgresql,
101[  --with-postgresql       Use PostgreSQL as a backend (default: no)],
102[case "${withval}" in
103        yes) DO_POSTGRESQL=yes ;;
104        no)  DO_POSTGRESQL=no ;;
105        maybe) DO_POSTGRESQL=maybe ;;
106        *)   AC_MSG_ERROR(Bad value ${withval} for --with-postgresql) ;;
107    esac],
108[DO_POSTGRESQL=no])
109                                 
110AC_ARG_WITH(mysql,
111[  --with-mysql            Use MySQL as a backend (default: yes)],
112[case "${withval}" in
113        yes) DO_MYSQL=yes ;;
114        no)  DO_MYSQL=no ;;
115        maybe) DO_MYSQL=maybe ;;
116        *)   AC_MSG_ERROR(Bad value ${withval} for --with-mysql) ;;
117    esac],
118[DO_MYSQL=yes])
119
120# here Postgre
121AC_MSG_CHECKING(whether to build/link POSTGRESQL)
122if test "x$DO_POSTGRESQL" = "xyes"; then
123DO_MYSQL=no
124POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES"
125POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto $POSTGRE_LIBS "
126CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS"
127fi
128AC_MSG_RESULT($DO_POSTGRESQL)
129       
130# here mysql
131AC_MSG_CHECKING(whether to build/link MYSQL)
132if test "x$DO_MYSQL" = "xyes"; then
133AC_MSG_RESULT($DO_MYSQL)
134AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $PATH)
135    if test -x "$MYSQL_CONFIG"
136        then
137    # MySQL v4 uses --include while v3 uses --cflags
138        MYSQL_INCLUDES="`$MYSQL_CONFIG --include`" || \
139            MYSQL_INCLUDES="`$MYSQL_CONFIG --cflags`"
140        MYSQL_LIBS="`$MYSQL_CONFIG --libs_r`"
141        CXXFLAGS="-DDO_MYSQL $CXXFLAGS"
142    fi
143else
144AC_MSG_RESULT($DO_MYSQL)
145fi
146
147## Check for options
148#  Include debug info in library?
149AC_MSG_CHECKING(whether to include debug info in library)
150MANGOSD_DEBUG_INFO=no
151AC_ARG_WITH(debug-info,
152[
153Debugging options:
154
155  --with-debug-info       Include debug info in library],
156[
157    if test "$withval" = "yes" ; then
158        CFLAGS="-g -DMANGOS_DEBUG $CFLAGS"
159        CXXFLAGS="-g -DMANGOS_DEBUG $CXXFLAGS"
160        MANGOSD_DEBUG_INFO=yes
161    elif test "$withval" != "no" ; then
162        AC_MSG_ERROR(Please choose yes or no)
163    fi
164])
165AC_MSG_RESULT($MANGOSD_DEBUG_INFO)
166
167
168# Enable CLI console?
169AC_MSG_CHECKING(whether cli console is enabled)
170MANGOSD_ENABLE_CLI=no
171AC_ARG_ENABLE(cli,
172[  --enable-cli Turn on command console system],
173[
174    if test "$enableval" = "yes" ; then
175        CFLAGS="-DENABLE_CLI $CFLAGS"
176        CXXFLAGS="-DENABLE_CLI $CXXFLAGS"
177        MANGOSD_ENABLE_CLI=yes
178    elif test "$withval" != "no" ; then
179        AC_MSG_ERROR(Please choose yes or no)
180    fi
181])
182AC_MSG_RESULT($MANGOSD_ENABLE_CLI)
183
184# Enable remote console?
185AC_MSG_CHECKING(whether remote console is enabled)
186MANGOSD_ENABLE_RA=no
187AC_ARG_ENABLE(ra,
188[  --enable-ra Turn on remote console system],
189[
190    if test "$enableval" = "yes" ; then
191        CFLAGS="-DENABLE_RA $CFLAGS"
192        CXXFLAGS="-DENABLE_RA $CXXFLAGS"
193        MANGOSD_ENABLE_RA=yes
194    elif test "$withval" != "no" ; then
195        AC_MSG_ERROR(Please choose yes or no)
196    fi
197])
198AC_MSG_RESULT($MANGOSD_ENABLE_RA)
199
200## Check for required header files.
201AC_HEADER_STDC
202AC_HEADER_DIRENT
203AC_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  ])
204
205AC_CHECK_HEADERS([pthread.h])
206AC_CHECK_HEADERS([openssl/md5.h openssl/rand.h openssl/ssl.h openssl/sha.h openssl/bn.h])
207AC_CHECK_HEADERS([mysql.h mysql/mysql.h])
208AC_CHECK_HEADERS([libpq-fe.h])
209AC_CHECK_HEADERS([zlib.h])
210
211## Check for typedefs, structures, and compiler characteristics.
212AC_HEADER_STDBOOL
213AC_C_CONST
214AC_C_INLINE
215AC_TYPE_SIZE_T
216AC_HEADER_TIME
217AC_STRUCT_TM
218AC_TYPE_UINT64_T
219AC_C_VOLATILE
220AC_CHECK_TYPES([ptrdiff_t])
221
222## Check for required library functions.
223AC_FUNC_CLOSEDIR_VOID
224AC_FUNC_ERROR_AT_LINE
225AC_FUNC_MALLOC
226AC_FUNC_MEMCMP
227AC_FUNC_REALLOC
228AC_FUNC_SELECT_ARGTYPES
229AC_TYPE_SIGNAL
230AC_FUNC_VPRINTF
231AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr])
232
[8]233## Check what to do with ACE library
234AC_LANG_PUSH([C++])
235AC_CHECK_HEADER([ace/Reactor.h], [tri_have_ace_headers=yes], [tri_have_ace_headers=no])
236AC_CHECK_LIB([ACE], [main], [tri_have_ace_lib=yes], [tri_have_ace_lib=no])
237AC_LANG_POP([C++])
238
239AC_MSG_CHECKING([whether to build ACE])
240if test X$tri_have_ace_headers = Xyes -a X$tri_have_ace_lib = Xyes;
241then
242  tri_need_to_build_ace=no
243  ACE_LIBS="-lACE"
244  ACE_INCLUDES=""
245  AC_MSG_RESULT([no])
246else
247  if test X$tri_have_ace_headers = Xno -a X$tri_have_ace_lib = Xno; then
248    tri_need_to_build_ace=yes
249    AC_MSG_RESULT([yes])
250  else
251    if test X$tri_have_ace_headers = Xyes; then
252       AC_MSG_ERROR([looks like you have ACE headers, but you do not have ACE libs installed])
253    else
254       tri_need_to_build_ace=yes
255       AC_MSG_RESULT([yes, over-install])
256    fi
257  fi
258fi
259
260if test X$tri_need_to_build_ace = Xyes; then
[17]261   TRINI_INCLUDES="-I\$(top_srcdir)/dep/ACE_wrappers -I\$(top_builddir)/dep/ACE_wrappers $TRINI_INCLUDES"
262   TRINI_LIBS="\$(top_builddir)/dep/ACE_wrappers/ace/libACE.la $TRINI_LIBS"
[8]263else
[17]264   TRINI_LIBS="-lACE $TRINI_LIBS"
[8]265fi
266
267AM_CONDITIONAL([TRI_BUILD_ACE], [test X$tri_need_to_build_ace = Xyes])
268
[2]269## Export defined variables
270AC_SUBST(ZLIB)
271AC_SUBST(COMPATLIB)
272AC_SUBST(SSLLIB)
273AC_SUBST(MYSQL_INCLUDES)
274AC_SUBST(MYSQL_LIBS)
275AC_SUBST(POSTGRE_INCLUDES)
276AC_SUBST(POSTGRE_LIBS)
277AC_SUBST(DOXYGEN)
278AC_SUBST(MANGOSD_DEBUG_INFO)
279AC_SUBST(MANGOSD_ENABLE_CLI)
280AC_SUBST(MANGOSD_ENABLE_RA)
[17]281AC_SUBST(TRINI_INCLUDES)
282AC_SUBST(TRINI_LIBS)
[2]283
284## Set output files.
285AC_CONFIG_HEADERS([config.h])
286AC_CONFIG_FILES([
287   dep/include/Makefile
288   dep/lib/Makefile
289   dep/src/Makefile
290   dep/src/g3dlite/Makefile
291   dep/src/sockets/Makefile
292   dep/src/zlib/Makefile
293   dep/src/zthread/Makefile
294   dep/Makefile
295   doc/Doxyfile
296   doc/Makefile
297   Makefile
298   src/Makefile
299   src/framework/Makefile
300   src/shared/Makefile
301   src/shared/vmap/Makefile
302   src/game/Makefile
303   src/trinityrealm/Makefile
304   src/trinitycore/Makefile
305   src/bindings/Makefile
306   src/bindings/scripts/Makefile
307   src/bindings/interface/Makefile
308])
309
[6]310## Configure ACE
[8]311if test X$tri_need_to_build_ace = Xyes; then
312  AC_CONFIG_SUBDIRS([dep/ACE_wrappers])
313fi
[6]314
[2]315## Disabled Makefiles, until they are ready for a successful make and
316#  make dist run.
317
[6]318AC_CONFIG_COMMANDS([default],[
319  echo ""
320  echo "Configuration of TrinityCore $PACKAGE_VERSION is now complete."
321  echo ""
322 ],[PACKAGE_VERSION=$PACKAGE_VERSION])
323
[2]324## Output files.
325AC_OUTPUT
Note: See TracBrowser for help on using the browser.