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 |
---|
14 | AC_INIT( [trinitycore], [0.0.1], [devs@trinitycore.org]) |
---|
15 | |
---|
16 | AC_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. |
---|
21 | AM_INIT_AUTOMAKE([-Wall -Werror gnu tar-pax]) |
---|
22 | AM_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 |
---|
27 | # to break parallel build trees (a.k.a. VPATH builds). |
---|
28 | if 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 |
---|
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). |
---|
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 | |
---|
48 | If however you realy want to disable this error, |
---|
49 | use --enable-maintainer-mode switch. |
---|
50 | ]) |
---|
51 | fi |
---|
52 | |
---|
53 | ## Disable building of static libraries by default |
---|
54 | AC_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. |
---|
63 | AC_PROG_CC |
---|
64 | AC_PROG_CXX |
---|
65 | AC_PROG_LIBTOOL |
---|
66 | AC_PROG_INSTALL |
---|
67 | AM_PROG_CC_C_O |
---|
68 | |
---|
69 | # Check if enable scripts |
---|
70 | AC_ARG_ENABLE([scripts], AC_HELP_STRING([--enable-scripts], [Enable TrinityScripts (default: yes) ]), [], [enable_scripts=yes]) |
---|
71 | |
---|
72 | AM_CONDITIONAL([USE_TSCRIPTS], [test X$enable_scripts = Xyes]) |
---|
73 | |
---|
74 | # Check for doxygen |
---|
75 | AC_ARG_ENABLE(doxygen, AC_HELP_STRING([--enable-doxygen], [turn on generating documentation])) |
---|
76 | |
---|
77 | enable_doxygen_support=no |
---|
78 | |
---|
79 | if test "x$enable_doxygen" = "xyes"; |
---|
80 | then |
---|
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 |
---|
86 | fi |
---|
87 | AM_CONDITIONAL(DOXYGEN_ENABLED, test x$enable_doxygen_support = xyes) |
---|
88 | |
---|
89 | ## Check for required libraries. |
---|
90 | AC_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 | ]) |
---|
96 | AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] ) |
---|
97 | AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] ) |
---|
98 | AC_CHECK_LIB( crypto, SHA1_Init, [SSLLIB=-lssl], [AC_MSG_ERROR([Missing openssl])]) |
---|
99 | |
---|
100 | AC_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 | |
---|
110 | AC_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 |
---|
121 | AC_MSG_CHECKING(whether to build/link POSTGRESQL) |
---|
122 | if test "x$DO_POSTGRESQL" = "xyes"; then |
---|
123 | DO_MYSQL=no |
---|
124 | POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES" |
---|
125 | POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto $POSTGRE_LIBS " |
---|
126 | CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS" |
---|
127 | fi |
---|
128 | AC_MSG_RESULT($DO_POSTGRESQL) |
---|
129 | |
---|
130 | # here mysql |
---|
131 | AC_MSG_CHECKING(whether to build/link MYSQL) |
---|
132 | if test "x$DO_MYSQL" = "xyes"; then |
---|
133 | AC_MSG_RESULT($DO_MYSQL) |
---|
134 | AC_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 |
---|
143 | else |
---|
144 | AC_MSG_RESULT($DO_MYSQL) |
---|
145 | fi |
---|
146 | |
---|
147 | ## Check for options |
---|
148 | # Include debug info in library? |
---|
149 | AC_MSG_CHECKING(whether to include debug info in library) |
---|
150 | MANGOSD_DEBUG_INFO=no |
---|
151 | AC_ARG_WITH(debug-info, |
---|
152 | [ |
---|
153 | Debugging 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 | ]) |
---|
165 | AC_MSG_RESULT($MANGOSD_DEBUG_INFO) |
---|
166 | |
---|
167 | |
---|
168 | # Enable CLI console? |
---|
169 | AC_MSG_CHECKING(whether cli console is enabled) |
---|
170 | MANGOSD_ENABLE_CLI=no |
---|
171 | AC_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 | ]) |
---|
182 | AC_MSG_RESULT($MANGOSD_ENABLE_CLI) |
---|
183 | |
---|
184 | # Enable remote console? |
---|
185 | AC_MSG_CHECKING(whether remote console is enabled) |
---|
186 | MANGOSD_ENABLE_RA=no |
---|
187 | AC_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 | ]) |
---|
198 | AC_MSG_RESULT($MANGOSD_ENABLE_RA) |
---|
199 | |
---|
200 | ## Check for required header files. |
---|
201 | AC_HEADER_STDC |
---|
202 | AC_HEADER_DIRENT |
---|
203 | 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 ]) |
---|
204 | |
---|
205 | AC_CHECK_HEADERS([pthread.h]) |
---|
206 | AC_CHECK_HEADERS([openssl/md5.h openssl/rand.h openssl/ssl.h openssl/sha.h openssl/bn.h]) |
---|
207 | AC_CHECK_HEADERS([mysql.h mysql/mysql.h]) |
---|
208 | AC_CHECK_HEADERS([libpq-fe.h]) |
---|
209 | AC_CHECK_HEADERS([zlib.h]) |
---|
210 | |
---|
211 | ## Check for typedefs, structures, and compiler characteristics. |
---|
212 | AC_HEADER_STDBOOL |
---|
213 | AC_C_CONST |
---|
214 | AC_C_INLINE |
---|
215 | AC_TYPE_SIZE_T |
---|
216 | AC_HEADER_TIME |
---|
217 | AC_STRUCT_TM |
---|
218 | AC_TYPE_UINT64_T |
---|
219 | AC_C_VOLATILE |
---|
220 | AC_CHECK_TYPES([ptrdiff_t]) |
---|
221 | |
---|
222 | ## Check for required library functions. |
---|
223 | AC_FUNC_CLOSEDIR_VOID |
---|
224 | AC_FUNC_ERROR_AT_LINE |
---|
225 | AC_FUNC_MALLOC |
---|
226 | AC_FUNC_MEMCMP |
---|
227 | AC_FUNC_REALLOC |
---|
228 | AC_FUNC_SELECT_ARGTYPES |
---|
229 | AC_TYPE_SIGNAL |
---|
230 | AC_FUNC_VPRINTF |
---|
231 | AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr]) |
---|
232 | |
---|
233 | ## Check what to do with ACE library |
---|
234 | AC_LANG_PUSH([C++]) |
---|
235 | AC_CHECK_HEADER([ace/Reactor.h], [tri_have_ace_headers=yes], [tri_have_ace_headers=no]) |
---|
236 | AC_CHECK_LIB([ACE], [main], [tri_have_ace_lib=yes], [tri_have_ace_lib=no]) |
---|
237 | AC_LANG_POP([C++]) |
---|
238 | |
---|
239 | AC_MSG_CHECKING([whether to build ACE]) |
---|
240 | if test X$tri_have_ace_headers = Xyes -a X$tri_have_ace_lib = Xyes; |
---|
241 | then |
---|
242 | tri_need_to_build_ace=no |
---|
243 | ACE_LIBS="-lACE" |
---|
244 | ACE_INCLUDES="" |
---|
245 | AC_MSG_RESULT([no]) |
---|
246 | else |
---|
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 |
---|
258 | fi |
---|
259 | |
---|
260 | if test X$tri_need_to_build_ace = Xyes; then |
---|
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" |
---|
263 | else |
---|
264 | TRINI_LIBS="-lACE $TRINI_LIBS" |
---|
265 | fi |
---|
266 | |
---|
267 | AM_CONDITIONAL([TRI_BUILD_ACE], [test X$tri_need_to_build_ace = Xyes]) |
---|
268 | |
---|
269 | ## Export defined variables |
---|
270 | AC_SUBST(ZLIB) |
---|
271 | AC_SUBST(COMPATLIB) |
---|
272 | AC_SUBST(SSLLIB) |
---|
273 | AC_SUBST(MYSQL_INCLUDES) |
---|
274 | AC_SUBST(MYSQL_LIBS) |
---|
275 | AC_SUBST(POSTGRE_INCLUDES) |
---|
276 | AC_SUBST(POSTGRE_LIBS) |
---|
277 | AC_SUBST(DOXYGEN) |
---|
278 | AC_SUBST(MANGOSD_DEBUG_INFO) |
---|
279 | AC_SUBST(MANGOSD_ENABLE_CLI) |
---|
280 | AC_SUBST(MANGOSD_ENABLE_RA) |
---|
281 | AC_SUBST(TRINI_INCLUDES) |
---|
282 | AC_SUBST(TRINI_LIBS) |
---|
283 | |
---|
284 | ## Set output files. |
---|
285 | AC_CONFIG_HEADERS([config.h]) |
---|
286 | AC_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 | |
---|
310 | ## Configure ACE |
---|
311 | if test X$tri_need_to_build_ace = Xyes; then |
---|
312 | AC_CONFIG_SUBDIRS([dep/ACE_wrappers]) |
---|
313 | fi |
---|
314 | |
---|
315 | ## Disabled Makefiles, until they are ready for a successful make and |
---|
316 | # make dist run. |
---|
317 | |
---|
318 | AC_CONFIG_COMMANDS([default],[ |
---|
319 | echo "" |
---|
320 | echo "Configuration of TrinityCore $PACKAGE_VERSION is now complete." |
---|
321 | echo "" |
---|
322 | ],[PACKAGE_VERSION=$PACKAGE_VERSION]) |
---|
323 | |
---|
324 | ## Output files. |
---|
325 | AC_OUTPUT |
---|