2
# Process this file with autoconf to produce a configure script.
4
AC_INIT(mysql-proxy, 0.5.0, jan@mysql.com)
5
AC_CONFIG_SRCDIR([src/mysql-proxy.c])
9
AM_INIT_AUTOMAKE(1.5 gnits)
11
AC_CONFIG_HEADER([config.h])
15
# Checks for programs.
32
dnl more automake stuff
42
dnl Checks for header files.
54
# Checks for typedefs, structures, and compiler characteristics.
59
# Checks for library functions.
65
AC_SEARCH_LIBS(socket,socket)
66
AC_SEARCH_LIBS(gethostbyname,nsl socket)
67
AC_SEARCH_LIBS(hstrerror,resolv)
70
dnl Checks for database.
74
AC_MSG_CHECKING(for MySQL support)
76
AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],[Include MySQL support. PATH is the path to 'mysql_config']),
77
[WITH_MYSQL=$withval],[WITH_MYSQL=yes])
79
if test "$WITH_MYSQL" = "no"; then
80
AC_MSG_ERROR([mysql support is required, don't use --with-mysql=no])
84
if test "$WITH_MYSQL" = "yes"; then
85
AC_PATH_PROG(MYSQL_CONFIG, mysql_config)
87
MYSQL_CONFIG=$WITH_MYSQL
90
if test "$MYSQL_CONFIG" = ""; then
91
AC_MSG_ERROR(mysql_config is not found)
94
if test \! -x $MYSQL_CONFIG; then
95
AC_MSG_ERROR(mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config)
98
if $MYSQL_CONFIG | grep -- '--include' > /dev/null ; then
99
MYSQL_INCLUDE="`$MYSQL_CONFIG --include | sed s/\'//g`"
101
MYSQL_INCLUDE="`$MYSQL_CONFIG --cflags | sed s/\'//g`"
104
AC_MSG_CHECKING(for MySQL includes at)
105
AC_MSG_RESULT($MYSQL_INCLUDE)
107
dnl check for errmsg.h, which isn't installed by some versions of 3.21
108
old_CPPFLAGS="$CPPFLAGS"
109
CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE"
110
AC_CHECK_HEADERS(errmsg.h mysql.h)
111
CPPFLAGS="$old_CPPFLAGS"
113
AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
116
AC_SUBST(MYSQL_INCLUDE)
118
dnl Check for pkg-config
119
if test -z "$PKG_CONFIG"; then
120
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
124
AC_MSG_CHECKING(for lua)
125
AC_ARG_WITH(lua, AC_HELP_STRING([--with-lua],[lua]),
126
[WITH_LUA=$withval],[WITH_LUA=yes])
128
AC_MSG_RESULT($WITH_LUA)
129
if test "$WITH_LUA" != "no"; then
131
if test "$WITH_LUA" = "yes"; then
137
PKG_CHECK_MODULES(LUA, $LUAPC >= 5.1, [
138
AC_DEFINE([HAVE_LUA], [1], [liblua])
139
AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
146
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.4.0, [
147
AC_DEFINE([HAVE_GLIB], [1], [libglib])
148
AC_DEFINE([HAVE_GLIB_H], [1], [glib.h])
152
*mingw* ) LIBS="$LIBS -lwsock32";;
156
dnl on windows we need wsock32 to get socket support
157
AC_CHECK_FUNCS([inet_ntoa inet_ntop])
159
dnl make sure we off_t is 64bit
160
CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES"
162
AC_CHECK_LIB(event, event_init, LIBS="$LIBS -levent",AC_MSG_ERROR([libevent is required]))
163
AC_CHECK_HEADERS([event.h])
165
AC_CONFIG_FILES([Makefile src/Makefile])