1 | # Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
---|
2 | # |
---|
3 | # Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> |
---|
4 | # |
---|
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 |
---|
16 | AC_INIT( [trinitycore], [0.0.1], [devs@trinitycore.org]) |
---|
17 | |
---|
18 | AC_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. |
---|
23 | AM_INIT_AUTOMAKE([-Wall -Werror gnu tar-pax]) |
---|
24 | AM_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 |
---|
29 | # to break parallel build trees (a.k.a. VPATH builds). |
---|
30 | if 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 |
---|
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). |
---|
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 | |
---|
50 | If however you realy want to disable this error, |
---|
51 | use --enable-maintainer-mode switch. |
---|
52 | ]) |
---|
53 | fi |
---|
54 | |
---|
55 | ## Disable building of static libraries by default |
---|
56 | AC_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. |
---|
65 | AC_PROG_CC |
---|
66 | AC_PROG_CXX |
---|
67 | AC_PROG_LIBTOOL |
---|
68 | AC_PROG_INSTALL |
---|
69 | AM_PROG_CC_C_O |
---|
70 | |
---|
71 | # Check if enable scripts |
---|
72 | AC_ARG_ENABLE([scripts], AC_HELP_STRING([--enable-scripts], [Enable TrinityScripts (default: check) ]), [], [enable_scripts=yes]) |
---|
73 | |
---|
74 | AC_MSG_CHECKING(whether to build scripting module) |
---|
75 | if test X$enable_scripts = Xyes -a -d $srcdir/src/bindings/scripts/scripts; then |
---|
76 | tri_build_scripts=yes |
---|
77 | AC_MSG_RESULT(yes) |
---|
78 | else |
---|
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 |
---|
84 | fi |
---|
85 | |
---|
86 | AM_CONDITIONAL([USE_TSCRIPTS], [test X$tri_build_scripts = Xyes]) |
---|
87 | |
---|
88 | # Check for doxygen |
---|
89 | AC_ARG_ENABLE(doxygen, AC_HELP_STRING([--enable-doxygen], [turn on generating documentation])) |
---|
90 | |
---|
91 | enable_doxygen_support=no |
---|
92 | |
---|
93 | if test "x$enable_doxygen" = "xyes"; |
---|
94 | then |
---|
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 |
---|
100 | fi |
---|
101 | AM_CONDITIONAL(DOXYGEN_ENABLED, test x$enable_doxygen_support = xyes) |
---|
102 | |
---|
103 | ## Check for required libraries. |
---|
104 | AC_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 | ]) |
---|
110 | AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] ) |
---|
111 | AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] ) |
---|
112 | AC_CHECK_LIB( crypto, SHA1_Init, [SSLLIB=-lssl], [AC_MSG_ERROR([Missing openssl])]) |
---|
113 | |
---|
114 | AC_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 | |
---|
124 | AC_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 |
---|
135 | AC_MSG_CHECKING(whether to build/link POSTGRESQL) |
---|
136 | if test "x$DO_POSTGRESQL" = "xyes"; then |
---|
137 | DO_MYSQL=no |
---|
138 | POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES" |
---|
139 | POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto $POSTGRE_LIBS " |
---|
140 | CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS" |
---|
141 | fi |
---|
142 | AC_MSG_RESULT($DO_POSTGRESQL) |
---|
143 | |
---|
144 | # here mysql |
---|
145 | AC_MSG_CHECKING(whether to build/link MYSQL) |
---|
146 | if test "x$DO_MYSQL" = "xyes"; then |
---|
147 | AC_MSG_RESULT($DO_MYSQL) |
---|
148 | AC_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 |
---|
157 | else |
---|
158 | AC_MSG_RESULT($DO_MYSQL) |
---|
159 | fi |
---|
160 | |
---|
161 | ## Check for options |
---|
162 | # Include debug info in library? |
---|
163 | AC_MSG_CHECKING(whether to include debug info in library) |
---|
164 | TRINITYD_DEBUG_INFO=no |
---|
165 | AC_ARG_WITH(debug-info, |
---|
166 | [ |
---|
167 | Debugging options: |
---|
168 | |
---|
169 | --with-debug-info Include debug info in library], |
---|
170 | [ |
---|
171 | if test "$withval" = "yes" ; then |
---|
172 | CFLAGS="-g -DTRINITY_DEBUG $CFLAGS" |
---|
173 | CXXFLAGS="-g -DTRINITY_DEBUG $CXXFLAGS" |
---|
174 | TRINITYD_DEBUG_INFO=yes |
---|
175 | elif test "$withval" != "no" ; then |
---|
176 | AC_MSG_ERROR(Please choose yes or no) |
---|
177 | fi |
---|
178 | ]) |
---|
179 | AC_MSG_RESULT($TRINITYD_DEBUG_INFO) |
---|
180 | |
---|
181 | |
---|
182 | # Enable CLI console? |
---|
183 | AC_MSG_CHECKING(whether cli console is enabled) |
---|
184 | TRINITYD_ENABLE_CLI=no |
---|
185 | AC_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" |
---|
191 | TRINITYD_ENABLE_CLI=yes |
---|
192 | elif test "$withval" != "no" ; then |
---|
193 | AC_MSG_ERROR(Please choose yes or no) |
---|
194 | fi |
---|
195 | ]) |
---|
196 | AC_MSG_RESULT($TRINITYD_ENABLE_CLI) |
---|
197 | |
---|
198 | # Enable remote console? |
---|
199 | AC_MSG_CHECKING(whether remote console is enabled) |
---|
200 | TRINITYD_ENABLE_RA=no |
---|
201 | AC_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" |
---|
207 | TRINITYD_ENABLE_RA=yes |
---|
208 | elif test "$withval" != "no" ; then |
---|
209 | AC_MSG_ERROR(Please choose yes or no) |
---|
210 | fi |
---|
211 | ]) |
---|
212 | AC_MSG_RESULT($TRINITYD_ENABLE_RA) |
---|
213 | |
---|
214 | ## Check for required header files. |
---|
215 | AC_HEADER_STDC |
---|
216 | AC_HEADER_DIRENT |
---|
217 | 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 ]) |
---|
218 | |
---|
219 | AC_CHECK_HEADERS([pthread.h]) |
---|
220 | AC_CHECK_HEADERS([openssl/md5.h openssl/rand.h openssl/ssl.h openssl/sha.h openssl/bn.h]) |
---|
221 | AC_CHECK_HEADERS([mysql.h mysql/mysql.h]) |
---|
222 | AC_CHECK_HEADERS([libpq-fe.h]) |
---|
223 | AC_CHECK_HEADERS([zlib.h]) |
---|
224 | |
---|
225 | ## Check for typedefs, structures, and compiler characteristics. |
---|
226 | AC_HEADER_STDBOOL |
---|
227 | AC_C_CONST |
---|
228 | AC_C_INLINE |
---|
229 | AC_TYPE_SIZE_T |
---|
230 | AC_HEADER_TIME |
---|
231 | AC_STRUCT_TM |
---|
232 | AC_TYPE_UINT64_T |
---|
233 | AC_C_VOLATILE |
---|
234 | AC_CHECK_TYPES([ptrdiff_t]) |
---|
235 | |
---|
236 | ## Check for required library functions. |
---|
237 | AC_FUNC_CLOSEDIR_VOID |
---|
238 | AC_FUNC_ERROR_AT_LINE |
---|
239 | AC_FUNC_MALLOC |
---|
240 | AC_FUNC_MEMCMP |
---|
241 | AC_FUNC_REALLOC |
---|
242 | AC_FUNC_SELECT_ARGTYPES |
---|
243 | AC_TYPE_SIGNAL |
---|
244 | AC_FUNC_VPRINTF |
---|
245 | AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr]) |
---|
246 | |
---|
247 | ## Check what to do with ACE library |
---|
248 | AC_LANG_PUSH([C++]) |
---|
249 | AC_CHECK_HEADER([ace/Reactor.h], [tri_have_ace_headers=yes], [tri_have_ace_headers=no]) |
---|
250 | AC_CHECK_LIB([ACE], [main], [tri_have_ace_lib=yes], [tri_have_ace_lib=no]) |
---|
251 | AC_LANG_POP([C++]) |
---|
252 | |
---|
253 | AC_MSG_CHECKING([whether to build ACE]) |
---|
254 | if test X$tri_have_ace_headers = Xyes -a X$tri_have_ace_lib = Xyes; |
---|
255 | then |
---|
256 | tri_need_to_build_ace=no |
---|
257 | ACE_LIBS="-lACE" |
---|
258 | ACE_INCLUDES="" |
---|
259 | AC_MSG_RESULT([no]) |
---|
260 | else |
---|
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 |
---|
272 | fi |
---|
273 | |
---|
274 | if test X$tri_need_to_build_ace = Xyes; then |
---|
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" |
---|
277 | else |
---|
278 | TRINI_LIBS="-lACE $TRINI_LIBS" |
---|
279 | fi |
---|
280 | |
---|
281 | AM_CONDITIONAL([TRI_BUILD_ACE], [test X$tri_need_to_build_ace = Xyes]) |
---|
282 | |
---|
283 | ## Export defined variables |
---|
284 | AC_SUBST(ZLIB) |
---|
285 | AC_SUBST(COMPATLIB) |
---|
286 | AC_SUBST(SSLLIB) |
---|
287 | AC_SUBST(MYSQL_INCLUDES) |
---|
288 | AC_SUBST(MYSQL_LIBS) |
---|
289 | AC_SUBST(POSTGRE_INCLUDES) |
---|
290 | AC_SUBST(POSTGRE_LIBS) |
---|
291 | AC_SUBST(DOXYGEN) |
---|
292 | AC_SUBST(TRINITYD_DEBUG_INFO) |
---|
293 | AC_SUBST(TRINITYD_ENABLE_CLI) |
---|
294 | AC_SUBST(TRINITYD_ENABLE_RA) |
---|
295 | AC_SUBST(TRINI_INCLUDES) |
---|
296 | AC_SUBST(TRINI_LIBS) |
---|
297 | |
---|
298 | ## Set output files. |
---|
299 | AC_CONFIG_HEADERS([config.h]) |
---|
300 | AC_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 | |
---|
323 | if test X$tri_build_scripts = Xyes; then |
---|
324 | AC_CONFIG_FILES([src/bindings/scripts/Makefile]) |
---|
325 | fi |
---|
326 | |
---|
327 | ## Configure ACE |
---|
328 | if test X$tri_need_to_build_ace = Xyes; then |
---|
329 | AC_CONFIG_SUBDIRS([dep/ACE_wrappers]) |
---|
330 | fi |
---|
331 | |
---|
332 | ## Disabled Makefiles, until they are ready for a successful make and |
---|
333 | # make dist run. |
---|
334 | |
---|
335 | AC_CONFIG_COMMANDS([default],[ |
---|
336 | echo "" |
---|
337 | echo "Configuration of TrinityCore $PACKAGE_VERSION is now complete." |
---|
338 | echo "" |
---|
339 | ],[PACKAGE_VERSION=$PACKAGE_VERSION]) |
---|
340 | |
---|
341 | ## Output files. |
---|
342 | AC_OUTPUT |
---|