mysql-admutils/configure.in

99 lines
2.8 KiB
Plaintext
Raw Normal View History

dnl Process this file with autoconf to produce a configure script.
AC_INIT(mysql-dbadm.c)
AM_CONFIG_HEADER(config.h)
2002-03-07 16:06:26 +01:00
AM_INIT_AUTOMAKE(mysql-admutils, 0.4)
AM_SANITY_CHECK
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AM_PROG_LEX
AC_PROG_YACC
dnl Checks for libraries.
AC_CHECK_LIB(c, floor, [:], [
AC_CHECK_LIB(m, floor, [
LIBS="$LIBS -lm"
AC_DEFINE(HAVE_LIBM) ], []) ])
AC_CHECK_LIB(mysqlclient, mysql_connect, [
LIBS="$LIBS -lmysqlclient" ], [])
AC_CHECK_LIB(c, gethostbyaddr, [:], [
AC_CHECK_LIB(nsl, gethostbyaddr, [
LIBS="$LIBS -lnsl"
AC_DEFINE(HAVE_LIBNSL) ], []) ])
AC_CHECK_LIB(c, socket, [:], [
AC_CHECK_LIB(socket, socket, [
LIBS="$LIBS -lsocket"
AC_DEFINE(HAVE_LIBSOCKET) ], []) ])
AC_MSG_CHECKING(for MySQL support)
AC_ARG_WITH(mysql,
[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base
install directory, defaults to /usr/local.],
[
if test "$withval" != "no"; then
if test "$withval" = "yes"; then
MYSQL_INCDIR=/usr/local/include/mysql
MYSQL_LIBDIR=/usr/local/lib/mysql
else
if test -f $withval/include/mysql/mysql.h; then
MYSQL_INCDIR=$withval/include/mysql
MYSQL_LIBDIR=$withval/lib/mysql
elif test -f $withval/include/mysql.h; then
MYSQL_INCDIR=$withval/include
MYSQL_LIBDIR=$withval/lib
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $withval)
fi
fi
MYSQL_INCLUDE=-I$MYSQL_INCDIR
MYSQL_LFLAGS="-L$MYSQL_LIBDIR -Wl,-rpath,$MYSQL_LIBDIR"
MYSQL_LFLAGS="-L$MYSQL_LIBDIR"
MYSQL_LIBS=-lmysqlclient
AC_DEFINE(HAVE_MYSQL)
AC_MSG_RESULT(yes)
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)
CPPFLAGS="$old_CPPFLAGS"
else
AC_MSG_RESULT(no)
fi
],[
AC_MSG_RESULT(no)
AC_MSG_RESULT("Giving up - You need to install MySQL somewhere"); exit
])
AC_SUBST(MYSQL_LIBS)
AC_SUBST(MYSQL_LFLAGS)
AC_SUBST(MYSQL_INCLUDE)
AC_MSG_CHECKING([whether to enable -Wall -pedantic])
AC_ARG_ENABLE(warnings,
[ --enable-warnings Enable -Wall -pedantic if using gcc.],
[ if test -n "$GCC"; then
AC_MSG_RESULT(adding -Wall -pedantic to CFLAGS.)
CFLAGS="$CFLAGS -Wall -pedantic"
fi
],AC_MSG_RESULT(no))
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_SUBST(SYSCONFDIR)
AC_OUTPUT(Makefile, [date > stamp-h])