[4284] Running 'make dist' works once again. When adding source files, please
[mangos-git.git] / configure.ac
blobdb2084e29f86a018f30e38fb680a4d7c892a1a14
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.8.01 (trunk)
16 #  BUG-REPORT-ADDRESS: mangos-devs@lists.sourceforge.net
17 AC_INIT( [mangos], [0.8.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( compat, ftime, [COMPATLIB=-lcompat] )
53 AC_CHECK_LIB( crypto, SHA1_Init, [SSLLIB=-lssl], [AC_MSG_ERROR([Missing openssl])])
55 AC_ARG_WITH(postgresql,
56 [  --with-postgresql       Use PostgreSQL as a backend (default: no)],
57 [case "${withval}" in
58         yes) DO_POSTGRESQL=yes ;;
59         no)  DO_POSTGRESQL=no ;;
60         maybe) DO_POSTGRESQL=maybe ;;
61         *)   AC_MSG_ERROR(Bad value ${withval} for --with-postgresql) ;;
62     esac],
63 [DO_POSTGRESQL=no])
64                                  
65 AC_ARG_WITH(mysql,
66 [  --with-mysql            Use MySQL as a backend (default: yes)],
67 [case "${withval}" in
68         yes) DO_MYSQL=yes ;;
69         no)  DO_MYSQL=no ;;
70         maybe) DO_MYSQL=maybe ;;
71         *)   AC_MSG_ERROR(Bad value ${withval} for --with-mysql) ;;
72     esac],
73 [DO_MYSQL=yes])
75 # here Postgre
76 AC_MSG_CHECKING(whether to build/link POSTGRESQL)
77 if test "x$DO_POSTGRESQL" = "xyes"; then
78 DO_MYSQL=no
79 POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES"
80 POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto $POSTGRE_LIBS "
81 CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS"
83 AC_MSG_RESULT($DO_POSTGRESQL)
84         
85 # here mysql
86 AC_MSG_CHECKING(whether to build/link MYSQL)
87 if test "x$DO_MYSQL" = "xyes"; then
88 AC_MSG_RESULT($DO_MYSQL)
89 AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $PATH)
90     if test -x "$MYSQL_CONFIG"
91         then
92     # MySQL v4 uses --include while v3 uses --cflags
93         MYSQL_INCLUDES="`$MYSQL_CONFIG --include`" || \
94             MYSQL_INCLUDES="`$MYSQL_CONFIG --cflags`"
95         MYSQL_LIBS="`$MYSQL_CONFIG --libs_r`"
96         CXXFLAGS="-DDO_MYSQL $CXXFLAGS"
97     fi
98 else
99 AC_MSG_RESULT($DO_MYSQL)
102 ## Check for options
103 #  Include debug info in library?
104 AC_MSG_CHECKING(whether to include debug info in library)
105 MANGOSD_DEBUG_INFO=no
106 AC_ARG_WITH(debug-info,
108 Debugging options:
110   --with-debug-info       Include debug info in library],
112     if test "$withval" = "yes" ; then
113         CFLAGS="-g -DMANGOS_DEBUG $CFLAGS"
114         CXXFLAGS="-g -DMANGOS_DEBUG $CXXFLAGS"
115         MANGOSD_DEBUG_INFO=yes
116     elif test "$withval" != "no" ; then
117         AC_MSG_ERROR(Please choose yes or no)
118     fi
120 AC_MSG_RESULT($MANGOSD_DEBUG_INFO)
123 # Enable CLI console?
124 AC_MSG_CHECKING(whether cli console is enabled)
125 MANGOSD_ENABLE_CLI=no
126 AC_ARG_ENABLE(cli,
127 [  --enable-cli Turn on command console system],
129     if test "$enableval" = "yes" ; then
130         CFLAGS="-DENABLE_CLI $CFLAGS"
131         CXXFLAGS="-DENABLE_CLI $CXXFLAGS"
132         MANGOSD_ENABLE_CLI=yes
133     elif test "$withval" != "no" ; then
134         AC_MSG_ERROR(Please choose yes or no)
135     fi
137 AC_MSG_RESULT($MANGOSD_ENABLE_CLI)
139 # Enable remote console?
140 AC_MSG_CHECKING(whether remote console is enabled)
141 MANGOSD_ENABLE_RA=no
142 AC_ARG_ENABLE(ra,
143 [  --enable-ra Turn on remote console system],
145     if test "$enableval" = "yes" ; then
146         CFLAGS="-DENABLE_RA $CFLAGS"
147         CXXFLAGS="-DENABLE_RA $CXXFLAGS"
148         MANGOSD_ENABLE_RA=yes
149     elif test "$withval" != "no" ; then
150         AC_MSG_ERROR(Please choose yes or no)
151     fi
153 AC_MSG_RESULT($MANGOSD_ENABLE_RA)
155 ## Check for required header files.
156 AC_HEADER_STDC
157 AC_HEADER_DIRENT
158 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  ])
160 AC_CHECK_HEADERS([pthread.h])
161 AC_CHECK_HEADERS([openssl/md5.h openssl/rand.h openssl/ssl.h openssl/sha.h openssl/bn.h])
162 AC_CHECK_HEADERS([mysql.h mysql/mysql.h])
163 AC_CHECK_HEADERS([libpq-fe.h])
164 AC_CHECK_HEADERS([zlib.h])
166 ## Check for typedefs, structures, and compiler characteristics.
167 AC_HEADER_STDBOOL
168 AC_C_CONST
169 AC_C_INLINE
170 AC_TYPE_SIZE_T
171 AC_HEADER_TIME
172 AC_STRUCT_TM
173 AC_TYPE_UINT64_T
174 AC_C_VOLATILE
175 AC_CHECK_TYPES([ptrdiff_t])
177 ## Check for required library functions.
178 AC_FUNC_CLOSEDIR_VOID
179 AC_FUNC_ERROR_AT_LINE
180 AC_FUNC_MALLOC
181 AC_FUNC_MEMCMP
182 AC_FUNC_REALLOC
183 AC_FUNC_SELECT_ARGTYPES
184 AC_TYPE_SIGNAL
185 AC_FUNC_VPRINTF
186 AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr])
188 ## Export defined variables
189 AC_SUBST(ZLIB)
190 AC_SUBST(COMPATLIB)
191 AC_SUBST(SSLLIB)
192 AC_SUBST(MYSQL_INCLUDES)
193 AC_SUBST(MYSQL_LIBS)
194 AC_SUBST(POSTGRE_INCLUDES)
195 AC_SUBST(POSTGRE_LIBS)
196 AC_SUBST(DOXYGENPATH)
197 AC_SUBST(MANGOSD_DEBUG_INFO)
198 AC_SUBST(MANGOSD_ENABLE_CLI)
199 AC_SUBST(MANGOSD_ENABLE_RA)
201 ## Set output files.
202 AC_CONFIG_HEADERS([config.h])
203 AC_CONFIG_FILES([
204    dep/include/Makefile
205    dep/lib/Makefile
206    dep/src/Makefile
207    dep/src/g3dlite/Makefile
208    dep/src/zlib/Makefile
209    dep/src/zthread/Makefile
210    dep/Makefile
211    doc/Doxyfile
212    doc/Makefile
213    Makefile
214    sql/Makefile
215    sql/updates/Makefile
216    src/Makefile
217    src/framework/Makefile
218    src/shared/Makefile
219    src/shared/SystemConfig.h
220    src/game/Makefile
221    src/realmd/Makefile
222    src/realmd/realmd.conf
223    src/mangosd/Makefile
224    src/mangosd/mangosd.conf
225    src/bindings/Makefile
226    src/bindings/universal/Makefile
229 ## Disabled Makefiles, until they are ready for a successful make and
230 #  make dist run.
232 ## Output files.
233 AC_OUTPUT