Skip to content

Commit

Permalink
[8396] Misc cleanup patches to configure.ac
Browse files Browse the repository at this point in the history
* Use pkg-config for ACE (req. ACE 5.5.2 or later), in mangos included 5.6.6.
* Use pkg-config for OpenSSL
* Enable silent builds with >=automake-1.11

Note: possible you will need install pkg-config tool at your Unix/Linux

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
plaes authored and VladimirMangos committed Aug 20, 2009
1 parent 5f59edb commit f3a5a93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 37 deletions.
48 changes: 12 additions & 36 deletions configure.ac
Expand Up @@ -22,7 +22,9 @@ AC_CONFIG_SRCDIR([src/shared/Base.cpp])
## Prelude, basic settings for Automake
# Turn on all warnings and error messages, and enforce GNU
# standards for the package.
AM_INIT_AUTOMAKE([-Wall -Werror gnu tar-pax])
AM_INIT_AUTOMAKE([foreign -Wall -Werror gnu tar-pax])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AM_MAINTAINER_MODE

## Prevent the configure script from continuing any further if
Expand Down Expand Up @@ -69,6 +71,7 @@ AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
AC_PROG_INSTALL
PKG_PROG_PKG_CONFIG

# Check for doxygen
AC_ARG_ENABLE(doxygen, AC_HELP_STRING([--enable-doxygen], [turn on generating documentation]))
Expand All @@ -94,7 +97,7 @@ AC_CHECK_LIB( pthread, pthread_create, [],
])
AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] )
AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] )
AC_CHECK_LIB( crypto, SHA1_Init, [SSLLIB=-lssl], [AC_MSG_ERROR([Missing openssl])])
PKG_CHECK_MODULES(OPENSSL, [openssl], [], [AC_MSG_ERROR([Missing openssl])])

AC_ARG_WITH(postgresql,
[ --with-postgresql Use PostgreSQL as a backend (default: no)],
Expand All @@ -121,7 +124,7 @@ AC_MSG_CHECKING(whether to build/link POSTGRESQL)
if test "x$DO_POSTGRESQL" = "xyes"; then
DO_MYSQL=no
POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES"
POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto $POSTGRE_LIBS "
POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib $OPENSSL_LIBS $POSTGRE_LIBS "
CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS"
fi
AC_MSG_RESULT($DO_POSTGRESQL)
Expand Down Expand Up @@ -174,7 +177,6 @@ AC_HEADER_DIRENT
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 ])

AC_CHECK_HEADERS([pthread.h])
AC_CHECK_HEADERS([openssl/md5.h openssl/rand.h openssl/ssl.h openssl/sha.h openssl/bn.h])
AC_CHECK_HEADERS([mysql.h mysql/mysql.h])
AC_CHECK_HEADERS([libpq-fe.h])
AC_CHECK_HEADERS([zlib.h])
Expand All @@ -199,36 +201,10 @@ AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr])

## Check what to do with ACE library
AC_LANG_PUSH([C++])
AC_CHECK_HEADER([ace/Reactor.h], [have_ace_headers=yes], [have_ace_headers=no])
AC_CHECK_LIB([ACE], [main], [have_ace_lib=yes], [have_ace_lib=no])
AC_LANG_POP([C++])

AC_MSG_CHECKING([whether to build ACE])
if test X$have_ace_headers = Xyes -a X$have_ace_lib = Xyes;
then
need_to_build_ace=no
AC_MSG_RESULT([no])
else
if test X$have_ace_headers = Xno -a X$have_ace_lib = Xno; then
need_to_build_ace=yes
AC_MSG_RESULT([yes])
else
if test X$have_ace_headers = Xyes; then
AC_MSG_ERROR([looks like you have ACE headers, but you do not have ACE libs installed])
else
need_to_build_ace=yes
AC_MSG_RESULT([yes, over-install])
fi
fi
fi

if test X$need_to_build_ace = Xyes; then
MANGOS_INCLUDES="-I\$(top_srcdir)/dep/ACE_wrappers -I\$(top_builddir)/dep/ACE_wrappers $MANGOS_INCLUDES"
MANGOS_LIBS="\$(top_builddir)/dep/ACE_wrappers/ace/libACE.la $MANGOS_LIBS"
else
MANGOS_LIBS="-lACE $MANGOS_LIBS"
PKG_CHECK_MODULES(ACE, [ACE >= 5.5.2], [need_to_build_ace=no], [need_to_build_ace=yes])
if test X$need_to_build_ace = Xyes ; then
ACE_INCLUDES="-I\$(top_srcdir)/dep/ACE_wrappers -I\$(top_builddir)/dep/ACE_wrappers"
ACE_LIBS="\$(top_builddir)/dep/ACE_wrappers/ace/libACE.la"
fi

AM_CONDITIONAL([MANGOS_BUILD_ACE], [test X$need_to_build_ace = Xyes])
Expand All @@ -238,8 +214,8 @@ AC_CHECK_HEADERS([ace/Stack_Trace.h])

## Unify all additional includes/libs in one variable.
# TODO this looks kinda ugly, but when we add m4 folder I will make it look very pritey ( by Derex ).
MANGOS_INCLUDES="$POSTGRE_INCLUDES $MYSQL_INCLUDES $MANGOS_INCLUDES"
MANGOS_LIBS="$POSTGRE_LIBS $MYSQL_LIBS $ZLIB $COMPATLIB $SSLLIB $MANGOS_LIBS"
MANGOS_INCLUDES="$ACE_INCLUDES $POSTGRE_INCLUDES $MYSQL_INCLUDES $OPENSSL_INCLUDES $MANGOS_INCLUDES"
MANGOS_LIBS="$ACE_LIBS $POSTGRE_LIBS $MYSQL_LIBS $ZLIB $COMPATLIB $OPENSSL_LIBS $MANGOS_LIBS"

## Export defined variables
AC_SUBST(DOXYGEN)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8395"
#define REVISION_NR "8396"
#endif // __REVISION_NR_H__

0 comments on commit f3a5a93

Please sign in to comment.