root/trunk/configure.ac @ 4

Revision 2, 8.1 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

Line 
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
17AC_INIT( [trinitycore], [0.0.1], [devs@trinitycore.org])
18
19AC_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.
24AM_INIT_AUTOMAKE([-Wall -Werror])
25AM_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.
31if 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     ])
53fi
54
55## Disable building of static libraries by default
56AC_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.
65AC_PROG_CC
66AC_PROG_CXX
67AC_PROG_LIBTOOL
68AC_PROG_INSTALL
69AM_PROG_CC_C_O
70
71# Check if enable scripts
72AC_ARG_ENABLE([scripts], AC_HELP_STRING([--enable-scripts], [Enable TrinityScripts (default: yes) ]), [], [enable_scripts=yes])
73
74AM_CONDITIONAL([USE_TSCRIPTS], [test X$enable_scripts = Xyes])
75
76# Check for doxygen
77AC_ARG_ENABLE(doxygen, AC_HELP_STRING([--enable-doxygen], [turn on generating documentation]))
78
79enable_doxygen_support=no
80
81if test "x$enable_doxygen" = "xyes";
82then
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
88fi
89AM_CONDITIONAL(DOXYGEN_ENABLED, test x$enable_doxygen_support = xyes)
90
91## Check for required libraries.
92AC_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    ])
98AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] )
99AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] )
100AC_CHECK_LIB( crypto, SHA1_Init, [SSLLIB=-lssl], [AC_MSG_ERROR([Missing openssl])])
101
102AC_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                                 
112AC_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
123AC_MSG_CHECKING(whether to build/link POSTGRESQL)
124if test "x$DO_POSTGRESQL" = "xyes"; then
125DO_MYSQL=no
126POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES"
127POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto $POSTGRE_LIBS "
128CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS"
129fi
130AC_MSG_RESULT($DO_POSTGRESQL)
131       
132# here mysql
133AC_MSG_CHECKING(whether to build/link MYSQL)
134if test "x$DO_MYSQL" = "xyes"; then
135AC_MSG_RESULT($DO_MYSQL)
136AC_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
145else
146AC_MSG_RESULT($DO_MYSQL)
147fi
148
149## Check for options
150#  Include debug info in library?
151AC_MSG_CHECKING(whether to include debug info in library)
152MANGOSD_DEBUG_INFO=no
153AC_ARG_WITH(debug-info,
154[
155Debugging 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])
167AC_MSG_RESULT($MANGOSD_DEBUG_INFO)
168
169
170# Enable CLI console?
171AC_MSG_CHECKING(whether cli console is enabled)
172MANGOSD_ENABLE_CLI=no
173AC_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])
184AC_MSG_RESULT($MANGOSD_ENABLE_CLI)
185
186# Enable remote console?
187AC_MSG_CHECKING(whether remote console is enabled)
188MANGOSD_ENABLE_RA=no
189AC_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])
200AC_MSG_RESULT($MANGOSD_ENABLE_RA)
201
202## Check for required header files.
203AC_HEADER_STDC
204AC_HEADER_DIRENT
205AC_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
207AC_CHECK_HEADERS([pthread.h])
208AC_CHECK_HEADERS([openssl/md5.h openssl/rand.h openssl/ssl.h openssl/sha.h openssl/bn.h])
209AC_CHECK_HEADERS([mysql.h mysql/mysql.h])
210AC_CHECK_HEADERS([libpq-fe.h])
211AC_CHECK_HEADERS([zlib.h])
212
213## Check for typedefs, structures, and compiler characteristics.
214AC_HEADER_STDBOOL
215AC_C_CONST
216AC_C_INLINE
217AC_TYPE_SIZE_T
218AC_HEADER_TIME
219AC_STRUCT_TM
220AC_TYPE_UINT64_T
221AC_C_VOLATILE
222AC_CHECK_TYPES([ptrdiff_t])
223
224## Check for required library functions.
225AC_FUNC_CLOSEDIR_VOID
226AC_FUNC_ERROR_AT_LINE
227AC_FUNC_MALLOC
228AC_FUNC_MEMCMP
229AC_FUNC_REALLOC
230AC_FUNC_SELECT_ARGTYPES
231AC_TYPE_SIGNAL
232AC_FUNC_VPRINTF
233AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr])
234
235## Export defined variables
236AC_SUBST(ZLIB)
237AC_SUBST(COMPATLIB)
238AC_SUBST(SSLLIB)
239AC_SUBST(MYSQL_INCLUDES)
240AC_SUBST(MYSQL_LIBS)
241AC_SUBST(POSTGRE_INCLUDES)
242AC_SUBST(POSTGRE_LIBS)
243AC_SUBST(DOXYGEN)
244AC_SUBST(MANGOSD_DEBUG_INFO)
245AC_SUBST(MANGOSD_ENABLE_CLI)
246AC_SUBST(MANGOSD_ENABLE_RA)
247
248## Set output files.
249AC_CONFIG_HEADERS([config.h])
250AC_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.
281AC_OUTPUT
Note: See TracBrowser for help on using the browser.