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