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