AC_INIT(sql_mysql.c) AC_REVISION($Revision: 1.6 $) AC_DEFUN(modname,[rlm_sql_mysql]) AC_PROG_CC AC_PROG_CPP AC_ARG_WITH(mysql-include-dir, [ --with-mysql-include-dir=DIR Directory where the MySQL includes may be found ], [ mysql_include_dir="$withval" ] ) AC_ARG_WITH(mysql-lib-dir, [ --with-mysql-lib-dir=DIR Directory where the MySQL libraries may be found ], [ mysql_lib_dir="$withval" ] ) AC_ARG_WITH(mysql-dir, [ --with-mysql-dir=DIR Base directory where MySQL is installed ], [ mysql_lib_dir="$withval/lib/mysql" mysql_include_dir="$withval/include" ] ) if test x$with_[]modname != xno; then targetname=modname # we might change this later. AC_CHECK_LIB(z, compress, LIBS="$LIBS -lz") AC_MSG_CHECKING([for mysql/mysql.h]) AC_TRY_COMPILE([#include ], [int a = 1;], MYSQL_INCLUDE=" ", MYSQL_INCLUDE= ) if test "x$MYSQL_INCLUDE" = "x"; then old_CFLAGS="$CFLAGS" dnl AC_LOCATE_DIR(mysql_include_dir,[mysql/mysql.h]) for try in /usr/local/include /usr/local/mysql/include $mysql_include_dir; do CFLAGS="$old_CFLAGS -I$try" AC_TRY_COMPILE([#include ], [int a = 1;], MYSQL_INCLUDE="-I$try", MYSQL_INCLUDE= ) if test "x$MYSQL_INCLUDE" != "x"; then break; fi done CFLAGS="$old_CFLAGS" fi if test "x$MYSQL_INCLUDE" = "x"; then AC_MSG_RESULT(no) AC_MSG_WARN([mysql headers not found. Use --with-mysql-include-dir=.]) targetname= # disabled module else sql_mysql_cflags="${sql_mysql_cflags} ${MYSQL_INCLUDE}" AC_MSG_RESULT(yes) AC_DEFINE(HAVE_MYSQL_H) AC_MSG_CHECKING([for mysql_init in -lmysqlclient]) old_LIBS="$LIBS" dnl AC_LOCATE_DIR(mysql_lib_dir,[libmysqlclient.so]) dnl AC_LOCATE_DIR(mysql_lib_dir,[libmysqlclient.a]) for try in /usr/lib /usr/lib/mysql /usr/local/lib/mysql /usr/local/mysql/lib/mysql $mysql_lib_dir; do LIBS="$old_LIBS -L$try -lmysqlclient" AC_TRY_LINK([extern char mysql_init();], [mysql_init()], MYSQL_LIBS="-L$try -lmysqlclient", MYSQL_LIBS= ) if test "x$MYSQL_LIBS" != "x"; then break; fi done LIBS="$old_LIBS" dnl # If one or the other isn't found, disable them both.. dnl # If both are found, enable them both. if test "x$MYSQL_LIBS" = "x"; then AC_MSG_RESULT(no) MYSQL_INCLUDE= AC_MSG_WARN([mysql libraries not found. Use --with-mysql-lib-dir=.]) targetname= # disabled module else AC_MSG_RESULT(yes) sql_mysql_ldflags="$sql_mysql_ldflags $MYSQL_LIBS" fi fi sql_mysql_ldflags="$sql_mysql_ldflags $LIBS" if test "x$targetname" = "x"; then AC_MSG_WARN([sql submodule 'mysql' disabled]) fi else targetname= echo \*\*\* module modname is disabled. fi AC_SUBST(sql_mysql_ldflags) AC_SUBST(sql_mysql_cflags) AC_SUBST(targetname) AC_OUTPUT(Makefile)