[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 | # PACKAGE: mangos |
---|
| 15 | # VERSION: 0.12.0 (trunk) |
---|
| 16 | # BUG-REPORT-ADDRESS: mangos-devs@lists.sourceforge.net |
---|
| 17 | AC_INIT( [trinitycore], [0.0.1], [devs@trinitycore.org]) |
---|
| 18 | |
---|
| 19 | AC_CONFIG_SRCDIR([src/shared/Base.cpp]) |
---|
| 20 | |
---|
| 21 | ## Prelude, basic settings for Automake |
---|
| 22 | # Turn on all warnings and error messages, and enforce GNU |
---|
| 23 | # standards for the package. |
---|
| 24 | AM_INIT_AUTOMAKE([-Wall -Werror]) |
---|
| 25 | AM_MAINTAINER_MODE |
---|
| 26 | |
---|
| 27 | ## Prevent the configure script from continuing any further if |
---|
| 28 | # configuration is being performed in the top-level directory. |
---|
| 29 | # The idea is to prevent this ,because some maintainers tend |
---|
| 30 | # to break "off src dir" builds. |
---|
| 31 | if test "$srcdir" = "." && test "$enable_maintainer_mode" != "yes"; then |
---|
| 32 | AC_MSG_ERROR( |
---|
| 33 | [ |
---|
| 34 | Please configure and build in a directory other than the |
---|
| 35 | top-level source directory. This is needed because a lot |
---|
| 36 | of maintainers tend to break "off src dir" builds. This |
---|
| 37 | is kinda real ensurance they wont do it. |
---|
| 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 build in src dir, |
---|
| 51 | then 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: yes) ]), [], [enable_scripts=yes]) |
---|
| 73 | |
---|
| 74 | AM_CONDITIONAL([USE_TSCRIPTS], [test X$enable_scripts = Xyes]) |
---|
| 75 | |
---|
| 76 | # Check for doxygen |
---|
| 77 | AC_ARG_ENABLE(doxygen, AC_HELP_STRING([--enable-doxygen], [turn on generating documentation])) |
---|
| 78 | |
---|
| 79 | enable_doxygen_support=no |
---|
| 80 | |
---|
| 81 | if test "x$enable_doxygen" = "xyes"; |
---|
| 82 | then |
---|
| 83 | AC_PATH_PROG(DOXYGEN, doxygen, no) |
---|
| 84 | if test "x$DOXYGEN" = "xno"; then |
---|
| 85 | AC_MSG_ERROR([You need to install the doxygen package]) |
---|
| 86 | fi |
---|
| 87 | enable_doxygen_support=yes |
---|
| 88 | fi |
---|
| 89 | AM_CONDITIONAL(DOXYGEN_ENABLED, test x$enable_doxygen_support = xyes) |
---|
| 90 | |
---|
| 91 | ## Check for required libraries. |
---|
| 92 | AC_CHECK_LIB( pthread, pthread_create, [], |
---|
| 93 | [LDFLAGS="-pthread $LDFLAGS" |
---|
| 94 | AC_TRY_LINK([char pthread_create();], |
---|
| 95 | pthread_create();, |
---|
| 96 | [], [AC_MSG_ERROR([Missing pthread])]) |
---|
| 97 | ]) |
---|
| 98 | AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] ) |
---|
| 99 | AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] ) |
---|
| 100 | AC_CHECK_LIB( crypto, SHA1_Init, [SSLLIB=-lssl], [AC_MSG_ERROR([Missing openssl])]) |
---|
| 101 | |
---|
| 102 | AC_ARG_WITH(postgresql, |
---|
| 103 | [ --with-postgresql Use PostgreSQL as a backend (default: no)], |
---|
| 104 | [case "${withval}" in |
---|
| 105 | yes) DO_POSTGRESQL=yes ;; |
---|
| 106 | no) DO_POSTGRESQL=no ;; |
---|
| 107 | maybe) DO_POSTGRESQL=maybe ;; |
---|
| 108 | *) AC_MSG_ERROR(Bad value ${withval} for --with-postgresql) ;; |
---|
| 109 | esac], |
---|
| 110 | [DO_POSTGRESQL=no]) |
---|
| 111 | |
---|
| 112 | AC_ARG_WITH(mysql, |
---|
| 113 | [ --with-mysql Use MySQL as a backend (default: yes)], |
---|
| 114 | [case "${withval}" in |
---|
| 115 | yes) DO_MYSQL=yes ;; |
---|
| 116 | no) DO_MYSQL=no ;; |
---|
| 117 | maybe) DO_MYSQL=maybe ;; |
---|
| 118 | *) AC_MSG_ERROR(Bad value ${withval} for --with-mysql) ;; |
---|
| 119 | esac], |
---|
| 120 | [DO_MYSQL=yes]) |
---|
| 121 | |
---|
| 122 | # here Postgre |
---|
| 123 | AC_MSG_CHECKING(whether to build/link POSTGRESQL) |
---|
| 124 | if test "x$DO_POSTGRESQL" = "xyes"; then |
---|
| 125 | DO_MYSQL=no |
---|
| 126 | POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES" |
---|
| 127 | POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto $POSTGRE_LIBS " |
---|
| 128 | CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS" |
---|
| 129 | fi |
---|
| 130 | AC_MSG_RESULT($DO_POSTGRESQL) |
---|
| 131 | |
---|
| 132 | # here mysql |
---|
| 133 | AC_MSG_CHECKING(whether to build/link MYSQL) |
---|
| 134 | if test "x$DO_MYSQL" = "xyes"; then |
---|
| 135 | AC_MSG_RESULT($DO_MYSQL) |
---|
| 136 | AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $PATH) |
---|
| 137 | if test -x "$MYSQL_CONFIG" |
---|
| 138 | then |
---|
| 139 | # MySQL v4 uses --include while v3 uses --cflags |
---|
| 140 | MYSQL_INCLUDES="`$MYSQL_CONFIG --include`" || \ |
---|
| 141 | MYSQL_INCLUDES="`$MYSQL_CONFIG --cflags`" |
---|
| 142 | MYSQL_LIBS="`$MYSQL_CONFIG --libs_r`" |
---|
| 143 | CXXFLAGS="-DDO_MYSQL $CXXFLAGS" |
---|
| 144 | fi |
---|
| 145 | else |
---|
| 146 | AC_MSG_RESULT($DO_MYSQL) |
---|
| 147 | fi |
---|
| 148 | |
---|
| 149 | ## Check for options |
---|
| 150 | # Include debug info in library? |
---|
| 151 | AC_MSG_CHECKING(whether to include debug info in library) |
---|
| 152 | MANGOSD_DEBUG_INFO=no |
---|
| 153 | AC_ARG_WITH(debug-info, |
---|
| 154 | [ |
---|
| 155 | Debugging options: |
---|
| 156 | |
---|
| 157 | --with-debug-info Include debug info in library], |
---|
| 158 | [ |
---|
| 159 | if test "$withval" = "yes" ; then |
---|
| 160 | CFLAGS="-g -DMANGOS_DEBUG $CFLAGS" |
---|
| 161 | CXXFLAGS="-g -DMANGOS_DEBUG $CXXFLAGS" |
---|
| 162 | MANGOSD_DEBUG_INFO=yes |
---|
| 163 | elif test "$withval" != "no" ; then |
---|
| 164 | AC_MSG_ERROR(Please choose yes or no) |
---|
| 165 | fi |
---|
| 166 | ]) |
---|
| 167 | AC_MSG_RESULT($MANGOSD_DEBUG_INFO) |
---|
| 168 | |
---|
| 169 | |
---|
| 170 | # Enable CLI console? |
---|
| 171 | AC_MSG_CHECKING(whether cli console is enabled) |
---|
| 172 | MANGOSD_ENABLE_CLI=no |
---|
| 173 | AC_ARG_ENABLE(cli, |
---|
| 174 | [ --enable-cli Turn on command console system], |
---|
| 175 | [ |
---|
| 176 | if test "$enableval" = "yes" ; then |
---|
| 177 | CFLAGS="-DENABLE_CLI $CFLAGS" |
---|
| 178 | CXXFLAGS="-DENABLE_CLI $CXXFLAGS" |
---|
| 179 | MANGOSD_ENABLE_CLI=yes |
---|
| 180 | elif test "$withval" != "no" ; then |
---|
| 181 | AC_MSG_ERROR(Please choose yes or no) |
---|
| 182 | fi |
---|
| 183 | ]) |
---|
| 184 | AC_MSG_RESULT($MANGOSD_ENABLE_CLI) |
---|
| 185 | |
---|
| 186 | # Enable remote console? |
---|
| 187 | AC_MSG_CHECKING(whether remote console is enabled) |
---|
| 188 | MANGOSD_ENABLE_RA=no |
---|
| 189 | AC_ARG_ENABLE(ra, |
---|
| 190 | [ --enable-ra Turn on remote console system], |
---|
| 191 | [ |
---|
| 192 | if test "$enableval" = "yes" ; then |
---|
| 193 | CFLAGS="-DENABLE_RA $CFLAGS" |
---|
| 194 | CXXFLAGS="-DENABLE_RA $CXXFLAGS" |
---|
| 195 | MANGOSD_ENABLE_RA=yes |
---|
| 196 | elif test "$withval" != "no" ; then |
---|
| 197 | AC_MSG_ERROR(Please choose yes or no) |
---|
| 198 | fi |
---|
| 199 | ]) |
---|
| 200 | AC_MSG_RESULT($MANGOSD_ENABLE_RA) |
---|
| 201 | |
---|
| 202 | ## Check for required header files. |
---|
| 203 | AC_HEADER_STDC |
---|
| 204 | AC_HEADER_DIRENT |
---|
| 205 | 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 ]) |
---|
| 206 | |
---|
| 207 | AC_CHECK_HEADERS([pthread.h]) |
---|
| 208 | AC_CHECK_HEADERS([openssl/md5.h openssl/rand.h openssl/ssl.h openssl/sha.h openssl/bn.h]) |
---|
| 209 | AC_CHECK_HEADERS([mysql.h mysql/mysql.h]) |
---|
| 210 | AC_CHECK_HEADERS([libpq-fe.h]) |
---|
| 211 | AC_CHECK_HEADERS([zlib.h]) |
---|
| 212 | |
---|
| 213 | ## Check for typedefs, structures, and compiler characteristics. |
---|
| 214 | AC_HEADER_STDBOOL |
---|
| 215 | AC_C_CONST |
---|
| 216 | AC_C_INLINE |
---|
| 217 | AC_TYPE_SIZE_T |
---|
| 218 | AC_HEADER_TIME |
---|
| 219 | AC_STRUCT_TM |
---|
| 220 | AC_TYPE_UINT64_T |
---|
| 221 | AC_C_VOLATILE |
---|
| 222 | AC_CHECK_TYPES([ptrdiff_t]) |
---|
| 223 | |
---|
| 224 | ## Check for required library functions. |
---|
| 225 | AC_FUNC_CLOSEDIR_VOID |
---|
| 226 | AC_FUNC_ERROR_AT_LINE |
---|
| 227 | AC_FUNC_MALLOC |
---|
| 228 | AC_FUNC_MEMCMP |
---|
| 229 | AC_FUNC_REALLOC |
---|
| 230 | AC_FUNC_SELECT_ARGTYPES |
---|
| 231 | AC_TYPE_SIGNAL |
---|
| 232 | AC_FUNC_VPRINTF |
---|
| 233 | AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr]) |
---|
| 234 | |
---|
| 235 | ## Export defined variables |
---|
| 236 | AC_SUBST(ZLIB) |
---|
| 237 | AC_SUBST(COMPATLIB) |
---|
| 238 | AC_SUBST(SSLLIB) |
---|
| 239 | AC_SUBST(MYSQL_INCLUDES) |
---|
| 240 | AC_SUBST(MYSQL_LIBS) |
---|
| 241 | AC_SUBST(POSTGRE_INCLUDES) |
---|
| 242 | AC_SUBST(POSTGRE_LIBS) |
---|
| 243 | AC_SUBST(DOXYGEN) |
---|
| 244 | AC_SUBST(MANGOSD_DEBUG_INFO) |
---|
| 245 | AC_SUBST(MANGOSD_ENABLE_CLI) |
---|
| 246 | AC_SUBST(MANGOSD_ENABLE_RA) |
---|
| 247 | |
---|
| 248 | ## Set output files. |
---|
| 249 | AC_CONFIG_HEADERS([config.h]) |
---|
| 250 | AC_CONFIG_FILES([ |
---|
| 251 | dep/include/Makefile |
---|
| 252 | dep/lib/Makefile |
---|
| 253 | dep/src/Makefile |
---|
| 254 | dep/src/g3dlite/Makefile |
---|
| 255 | dep/src/sockets/Makefile |
---|
| 256 | dep/src/zlib/Makefile |
---|
| 257 | dep/src/zthread/Makefile |
---|
| 258 | dep/Makefile |
---|
| 259 | doc/Doxyfile |
---|
| 260 | doc/Makefile |
---|
| 261 | Makefile |
---|
| 262 | sql/Makefile |
---|
| 263 | sql/tools/Makefile |
---|
| 264 | sql/updates/Makefile |
---|
| 265 | src/Makefile |
---|
| 266 | src/framework/Makefile |
---|
| 267 | src/shared/Makefile |
---|
| 268 | src/shared/vmap/Makefile |
---|
| 269 | src/game/Makefile |
---|
| 270 | src/trinityrealm/Makefile |
---|
| 271 | src/trinitycore/Makefile |
---|
| 272 | src/bindings/Makefile |
---|
| 273 | src/bindings/scripts/Makefile |
---|
| 274 | src/bindings/interface/Makefile |
---|
| 275 | ]) |
---|
| 276 | |
---|
| 277 | ## Disabled Makefiles, until they are ready for a successful make and |
---|
| 278 | # make dist run. |
---|
| 279 | |
---|
| 280 | ## Output files. |
---|
| 281 | AC_OUTPUT |
---|