# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) AC_INIT(mysql-proxy, 0.6.0, jan@mysql.com) AC_CONFIG_SRCDIR([src/mysql-proxy.c]) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(1.9 gnits) AC_CONFIG_HEADER([config.h]) AM_MAINTAINER_MODE # Checks for programs. AC_PROG_CC AC_PROG_LD AC_PROG_INSTALL AC_PROG_AWK AC_PROG_LEX AC_PROG_CPP dnl AC_PROG_CXX AC_PROG_LN_S AC_PROG_MAKE_SET AM_PROG_CC_C_O dnl check environment AC_AIX AC_ISC_POSIX AC_MINIX AC_EXEEXT dnl more automake stuff AM_C_PROTOTYPES dnl libtool dnl we don't want to get static libs of the lua-libs AC_DISABLE_STATIC dnl AC_ENABLE_SHARED dnl AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([\ arpa/inet.h \ netinet/in.h \ sys/filio.h \ sys/socket.h \ sys/time.h \ sys/un.h \ signal.h \ fcntl.h \ valgrind/valgrind.h ]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_C_CHAR_UNSIGNED # Checks for library functions. AC_TYPE_SIGNAL AC_FUNC_STAT AC_FUNC_STRFTIME # AC_SEARCH_LIBS(socket,socket) AC_SEARCH_LIBS(gethostbyname,nsl socket) AC_SEARCH_LIBS(hstrerror,resolv) dnl Checks for database. MYSQL_INCLUDE="" MYSQL_LIBS="" AC_MSG_CHECKING(for MySQL support) AC_ARG_WITH(mysql, AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],[Include MySQL support. PATH is the path to 'mysql_config']), [WITH_MYSQL=$withval],[WITH_MYSQL=yes]) if test "$WITH_MYSQL" = "no"; then AC_MSG_ERROR([mysql support is required, don't use --with-mysql=no or --without-mysql]) fi AC_MSG_RESULT(yes) if test "$WITH_MYSQL" = "yes"; then AC_PATH_PROG(MYSQL_CONFIG, mysql_config) else MYSQL_CONFIG=$WITH_MYSQL fi if test "$MYSQL_CONFIG" = ""; then AC_MSG_ERROR([mysql_config is not found]) fi if test -d $MYSQL_CONFIG; then MYSQL_CONFIG="$MYSQL_CONFIG/bin/mysql_config" fi if test \! -x $MYSQL_CONFIG; then AC_MSG_ERROR([mysql_config not exists or not executable, use $ ./configure --with-mysql=/path/to/mysql_config]) fi if $MYSQL_CONFIG | grep -- '--include' > /dev/null ; then MYSQL_INCLUDE="`$MYSQL_CONFIG --include | sed s/\'//g`" else MYSQL_INCLUDE="`$MYSQL_CONFIG --cflags | sed s/\'//g`" fi AC_MSG_CHECKING(for MySQL includes at) AC_MSG_RESULT($MYSQL_INCLUDE) dnl check for errmsg.h, which isn't installed by some versions of 3.21 old_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE" AC_CHECK_HEADERS(errmsg.h mysql.h) CPPFLAGS="$old_CPPFLAGS" if test x"$ac_cv_header_mysql_h" = xno; then AC_MSG_ERROR([mysql.h is required, please install the mysql header package]) fi AC_DEFINE([HAVE_MYSQL], [1], [mysql support]) AC_MSG_CHECKING(for mysqltest binary) MYSQL_TEST_BIN=`dirname "$MYSQL_CONFIG"`/mysqltest if test -x "$MYSQL_TEST_BIN"; then AC_MSG_RESULT([$MYSQL_TEST_BIN]) else MYSQL_TEST_BIN=mysqltest AC_MSG_RESULT([$MYSQL_TEST_BIN]) fi AC_MSG_CHECKING(for mysql libs) if test x"$MYSQL_LIBS" = x; then MYSQL_LIBS="`$MYSQL_CONFIG --libs | sed s/\'//g`" fi AC_MSG_RESULT([$MYSQL_LIBS]) AC_SUBST(MYSQL_TEST_BIN) AC_SUBST(MYSQL_LIBS) AC_SUBST(MYSQL_INCLUDE) dnl Check for pkg-config if test -z "$PKG_CONFIG"; then AC_PATH_PROG(PKG_CONFIG, pkg-config, AC_MSG_ERROR([pkg-config wasn't found. Pass it's path via $ ./configure PKG_CONFIG=/path/to/pkg-config])) fi dnl Check for lua AC_MSG_CHECKING(for lua) AC_ARG_WITH(lua, AC_HELP_STRING([--with-lua],[lua]), [WITH_LUA=$withval],[WITH_LUA=yes]) AC_MSG_RESULT($WITH_LUA) if test "$WITH_LUA" != "no"; then # try pkgconfig if test "$WITH_LUA" = "yes"; then LUAPC=lua else LUAPC=$WITH_LUA fi PKG_CHECK_MODULES(LUA, $LUAPC >= 5.1, [ AC_DEFINE([HAVE_LUA], [1], [liblua]) AC_DEFINE([HAVE_LUA_H], [1], [lua.h]) ],[ PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1, [ AC_DEFINE([HAVE_LUA], [1], [liblua]) AC_DEFINE([HAVE_LUA_H], [1], [lua.h]) ]) ]) AC_SUBST(LUA_CFLAGS) AC_SUBST(LUA_LIBS) fi PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6.0, [ AC_DEFINE([HAVE_GLIB], [1], [libglib]) AC_DEFINE([HAVE_GLIB_H], [1], [glib.h]) ]) case $host_os in *mingw* ) LIBS="$LIBS -lwsock32";; * ) ;; esac dnl on windows we need wsock32 to get socket support AC_CHECK_FUNCS([inet_ntoa inet_ntop strerror getcwd chdir]) dnl make sure we off_t is 64bit CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES" EVENT_LIBS= AC_CHECK_LIB(event, event_init, EVENT_LIBS="-levent",AC_MSG_ERROR([libevent is required])) AC_CHECK_HEADERS([event.h]) AC_SUBST(EVENT_LIBS) AM_PATH_CHECK(0.8.2,use_check=true,use_check=false) AM_CONDITIONAL([USE_CHECK], [test x$use_check = xtrue]) dnl build version-id PACKAGE_VERSION_ID=`echo $PACKAGE_VERSION | $AWK -F '.' '{print "(" $1 " << 16 | " $2 " << 8 | " $3 ")"}'` AC_DEFINE_UNQUOTED([PACKAGE_VERSION_ID], [$PACKAGE_VERSION_ID], [lpackage-version-id]) AC_CONFIG_FILES([Makefile \ src/Makefile \ examples/Makefile \ lib/Makefile \ lib/proxy/Makefile \ tests/Makefile \ tests/suite/Makefile \ tests/suite/base/Makefile \ tests/suite/base/t/Makefile \ tests/suite/base/r/Makefile \ tests/suite/bugs/Makefile \ tests/suite/bugs/t/Makefile \ tests/suite/bugs/r/Makefile \ tests/unit/Makefile \ mysql-proxy.spec \ ]) AC_OUTPUT