[3281] * configure.ac: Parse new Makefile in sql/updates/Makefile.
[mangos-git.git] / configure.ac
blobfa9776b95e43c47d5da773a3b94b8e8f9b79782d
1 # Copyright (C) 2007 MaNGOS project <http://www.mangosproject.org/>
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.
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.
11 ## Process this file with autoconf to produce a configure script.
13 ## Prelude, basic settings for Autoconf
14 #  PACKAGE:            mangos
15 #  VERSION:            0.7.01 (trunk)
16 #  BUG-REPORT-ADDRESS: mangos-devs@lists.sourceforge.net
17 AC_INIT( [mangos], [0.7.01], [mangos-devs@lists.sourceforge.net])
18 AC_CONFIG_SRCDIR([src/shared/Base.cpp])
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 dist-bzip2])
24 AM_MAINTAINER_MODE
26 ## Check for required dependencies.
28 ## Check for a valid build environment.
29 #  Valid equals having:
30 #  - a C++ compiler compliant with the ISO98 C++ specification.
31 #  - a working library tool for creating convenience libraries.
32 #  - a working linker for creating static and shared libraries.
33 AC_PROG_CC
34 AC_PROG_CXX
35 AC_PROG_LIBTOOL
36 AC_PROG_INSTALL
38 AC_PATH_PROG(DOXYGENPATH, doxygen)
39 if test "_$DOXYGENPATH" = _ ; then
40     AC_MSG_WARN([doxygen is required to build the API documentation.])
42 AM_CONDITIONAL([USE_DOXYGEN], [test "_$DOXYGENPATH" != _])
44 ## Check for required libraries.
45 AC_CHECK_LIB( pthread, pthread_create, [], 
46     [LDFLAGS="-pthread $LDFLAGS"
47      AC_TRY_LINK([char pthread_create();],
48          pthread_create();,
49          [], [AC_MSG_ERROR([Missing pthread])])
50     ])
51 AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] )
52 #AC_CHECK_LIB( mysqlclient, mysql_init, [],[AC_CHECK_LIB(mysql, mysql_init,[],[AC_MSG_ERROR([Missing mysql])])])
53 AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] )
54 AC_CHECK_LIB( ssl, SHA1_Init, [SSLLIB=-lssl], [AC_MSG_ERROR([Missing openssl])])
56 AC_ARG_WITH(mysql-libs,
57 [  --with-mysql-libs=DIR     Look for mysql libs in this dir ],
58     MYSQL_LIBS="-L$withval -lmysqlclient"
60 AC_ARG_WITH(mysql-includes,
61 [  --with-mysql-includes=DIR Look for mysql includes in this dir ],
62     MYSQL_INCLUDES="-I$withval"
65 AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $PATH)
66 if test -x "$MYSQL_CONFIG"
67 then
68     # MySQL v4 uses --include while v3 uses --cflags
69     MYSQL_INCLUDES="`$MYSQL_CONFIG --include`" || \
70         MYSQL_INCLUDES="`$MYSQL_CONFIG --cflags`"
71     MYSQL_LIBS="`$MYSQL_CONFIG --libs_r`"
74 ## Check for options
75 #  Include debug info in library?
76 AC_MSG_CHECKING(whether to include debug info in library)
77 MANGOSD_DEBUG_INFO=no
78 AC_ARG_WITH(debug-info,
80 Debugging options:
82   --with-debug-info       Include debug info in library],
84     if test "$withval" = "yes" ; then
85         CFLAGS="-g -DMANGOS_DEBUG $CFLAGS"
86         CXXFLAGS="-g -DMANGOS_DEBUG $CXXFLAGS"
87         MANGOSD_DEBUG_INFO=yes
88     elif test "$withval" != "no" ; then
89         AC_MSG_ERROR(Please choose yes or no)
90     fi
92 AC_MSG_RESULT($MANGOSD_DEBUG_INFO)
95 # Enable CLI console?
96 AC_MSG_CHECKING(whether cli console is enabled)
97 MANGOSD_ENABLE_CLI=no
98 AC_ARG_ENABLE(cli,
99 [  --enable-cli Turn on command console system],
101     if test "$enableval" = "yes" ; then
102         CFLAGS="-DENABLE_CLI $CFLAGS"
103         CXXFLAGS="-DENABLE_CLI $CXXFLAGS"
104         MANGOSD_ENABLE_CLI=yes
105     elif test "$withval" != "no" ; then
106         AC_MSG_ERROR(Please choose yes or no)
107     fi
109 AC_MSG_RESULT($MANGOSD_ENABLE_CLI)
111 # Enable remote console?
112 AC_MSG_CHECKING(whether remote console is enabled)
113 MANGOSD_ENABLE_RA=no
114 AC_ARG_ENABLE(ra,
115 [  --enable-ra Turn on remote console system],
117     if test "$enableval" = "yes" ; then
118         CFLAGS="-DENABLE_RA $CFLAGS"
119         CXXFLAGS="-DENABLE_RA $CXXFLAGS"
120         MANGOSD_ENABLE_RA=yes
121     elif test "$withval" != "no" ; then
122         AC_MSG_ERROR(Please choose yes or no)
123     fi
125 AC_MSG_RESULT($MANGOSD_ENABLE_RA)
127 ## Check for required header files.
128 AC_HEADER_STDC
129 AC_HEADER_DIRENT
130 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  ])
132 ## Check for typedefs, structures, and compiler characteristics.
133 AC_HEADER_STDBOOL
134 AC_C_CONST
135 AC_C_INLINE
136 AC_TYPE_SIZE_T
137 AC_HEADER_TIME
138 AC_STRUCT_TM
139 AC_TYPE_UINT64_T
140 AC_C_VOLATILE
141 AC_CHECK_TYPES([ptrdiff_t])
143 ## Check for required library functions.
144 AC_FUNC_CLOSEDIR_VOID
145 AC_FUNC_ERROR_AT_LINE
146 AC_FUNC_MALLOC
147 AC_FUNC_MEMCMP
148 AC_FUNC_REALLOC
149 AC_FUNC_SELECT_ARGTYPES
150 AC_TYPE_SIGNAL
151 AC_FUNC_VPRINTF
152 AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr])
154 ## Export defined variables
155 AC_SUBST(ZLIB)
156 AC_SUBST(COMPATLIB)
157 AC_SUBST(SSLLIB)
158 AC_SUBST(MYSQL_INCLUDES)
159 AC_SUBST(MYSQL_LIBS)
160 AC_SUBST(DOXYGENPATH)
161 AC_SUBST(MANGOSD_DEBUG_INFO)
162 AC_SUBST(MANGOSD_ENABLE_CLI)
163 AC_SUBST(MANGOSD_ENABLE_RA)
165 ## Set output files.
166 AC_CONFIG_HEADERS( [config.h] )
167 AC_CONFIG_FILES([
168    dep/include/Makefile
169    dep/lib/Makefile
170    dep/src/Makefile
171    dep/src/zlib/Makefile
172    dep/src/zthread/Makefile
173    dep/Makefile
174    doc/Doxyfile
175    doc/Makefile
176    Makefile
177    sql/Makefile
178    sql/updates/Makefile
179    src/Makefile
180    src/framework/Makefile
181    src/shared/Makefile
182    src/shared/SystemConfig.h
183    src/game/Makefile
184    src/realmd/Makefile
185    src/realmd/realmd.conf
186    src/mangosd/Makefile
187    src/mangosd/mangosd.conf
188    src/bindings/Makefile
189    src/bindings/universal/Makefile
192 ## Disabled Makefiles, until they are ready for a successful make and
193 #  make dist run.
195 ## Output files.
196 AC_OUTPUT