ab6aec1997-02-11Fredrik Hübinette (Hubbe) #
9d53421998-10-20Henrik Grubbström (Grubba) # $Id: configure.in,v 1.8 1998/10/20 20:29:08 grubba Exp $
ab6aec1997-02-11Fredrik Hübinette (Hubbe) # # Configure script for the mysql-module # # Henrik Grubbström # # # NOTE: # Prior to 3.20.0 After 3.20.0 # -------------------------------------------------------------- # /usr/local/mysql/mach-lib-threads /usr/local/lib/mysql # /usr/local/mysql/include /usr/local/include/mysql # libmysql.a libmysqllib.a # libstrings.a libmystrings.a # AC_INIT(mysql.c) AC_CONFIG_HEADER(config.h)
e269811998-09-20Fredrik Hübinette (Hubbe) AC_MODULE_INIT()
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  OLD_LIBS=$LIBS OLD_LDFLAGS=$LDFLAGS OLD_CPPFLAGS=$CPPFLAGS MYSQL_LIBS="" AC_ARG_WITH(mysql, [ --without-mysql no support for the Mysql database],[],[with_mysql=yes])
9d53421998-10-20Henrik Grubbström (Grubba) if test x$with_mysql = xno; then : else AC_MSG_CHECKING(for Mysql lib-directory)
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  AC_CACHE_VAL(pike_cv_mysql_lib_dir, [ for pike_cv_mysql_lib_dir in /usr/local/lib/mysql /usr/local/mysql/lib/mysql /usr/gnu/lib/mysql /usr/lib/mysql /lib/mysql /usr/local/mysql/lib /usr/local/mysql/mach-lib-thread no; do if test -d $pike_cv_mysql_lib_dir/.; then break else : fi done ]) AC_MSG_RESULT($pike_cv_mysql_lib_dir) if test x$pike_cv_mysql_lib_dir = xno; then :; else echo Adding $pike_cv_mysql_lib_dir to the library search path.
3b4b3a1998-09-25Henrik Grubbström (Grubba)  LDFLAGS="-R$pike_cv_mysql_lib_dir -L$pike_cv_mysql_lib_dir ${LDFLAGS}"
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  fi
9d53421998-10-20Henrik Grubbström (Grubba)  AC_MSG_CHECKING(for Mysql include-directory)
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  AC_CACHE_VAL(pike_cv_mysql_include_dir, [ for pike_cv_mysql_include_dir in /usr/local/include/mysql /usr/local/mysql/include/mysql /usr/gnu/include/mysql /usr/include/mysql /include/mysql /usr/local/mysql/include no; do if test -d $pike_cv_mysql_include_dir/.; then break else : fi done ]) AC_MSG_RESULT($pike_cv_mysql_include_dir) if test x$pike_cv_mysql_include_dir = xno; then :; else echo Adding $pike_cv_mysql_include_dir to the include search path. CPPFLAGS="-I$pike_cv_mysql_include_dir ${CPPFLAGS}" fi # Header file
bfbae31998-09-01Fredrik Hübinette (Hubbe)  AC_CHECK_HEADERS(winsock.h mysql.h mysql/mysql.h)
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  # Mysql libs
5251601997-04-03Henrik Grubbström (Grubba)  pike_cv_mysql="unknown"
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  AC_CHECK_LIB(mystrings, bchange, [ LIBS="-lmystrings $LIBS" MYSQL_LIBS="-lmystrings ${MYSQL_LIBS}" pike_cv_mysql="post3.20" ], [ AC_CHECK_LIB(strings, bchange, [ LIBS="-lstrings $LIBS" MYSQL_LIBS="-lstrings ${MYSQL_LIBS}" pike_cv_mysql="pre3.20" ], []) ]) AC_MSG_CHECKING(Mysql version) AC_MSG_RESULT($pike_cv_mysql)
5251601997-04-03Henrik Grubbström (Grubba)  # System libs which might be needed
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
5251601997-04-03Henrik Grubbström (Grubba)  if echo $LIBS|grep -- -lsocket >&5 2>&5; then :
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  else
5251601997-04-03Henrik Grubbström (Grubba)  AC_CHECK_LIB(socket, socket, [ LIBS="-lsocket $LIBS" MYSQL_LIBS="-lsocket ${MYSQL_LIBS}" ], []) fi if echo $LIBS|grep -- -lnsl >&5 2>&5; then : else AC_CHECK_LIB(nsl, gethostbyname, [ LIBS="-lnsl $LIBS" MYSQL_LIBS="-lnsl ${MYSQL_LIBS}" ], []) fi if echo $LIBS|grep -- -lm >&5 2>&5; then : else AC_CHECK_LIB(m, floor, [ LIBS="-lm $LIBS" MYSQL_LIBS="-lm ${MYSQL_LIBS}" ], []) fi
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
5251601997-04-03Henrik Grubbström (Grubba)  # Pthreads is still needed in 3.20.0. AC_CHECK_FUNC(pthread_self, [], [ AC_CHECK_LIB(pthread, pthread_self, [ LIBS="-lpthread $LIBS" echo Warning added -lpthread to \$LIBS\! ], [ AC_CHECK_LIB(pthreads, pthread_self, [ LIBS="-lpthreads $LIBS" echo Warning added -lpthreads to \$LIBS\!
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  ], []) ])
5251601997-04-03Henrik Grubbström (Grubba)  ])
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
5251601997-04-03Henrik Grubbström (Grubba)  AC_CHECK_LIB(dbug, _db_doprnt_, [ LIBS="-ldbug $LIBS" MYSQL_LIBS="-ldbug ${MYSQL_LIBS}" ], []) AC_CHECK_LIB(mysys, my_init, [ LIBS="-lmysys $LIBS" MYSQL_LIBS="-lmysys ${MYSQL_LIBS}" ], []) # Try a couple of mysqlclient libs # in order of age, newest first.
bfbae31998-09-01Fredrik Hübinette (Hubbe) define([AC_CHECK_SQLLIB], [ AC_MSG_CHECKING(for mysql_connect in $1) AC_CACHE_VAL(ac_cv_pike_lib_$1_mysql_connect, [ ac_save_LIBS="$LIBS" LIBS="-l$1 $LIBS" AC_TRY_LINK( [ #ifdef HAVE_WINSOCK_H #include <winsock.h> #endif #ifdef HAVE_MYSQL_H #include <mysql.h> #else #ifdef HAVE_MYSQL_MYSQL_H #include <mysql/mysql.h> #endif #endif ],[ mysql_connect(0,0,0,0); ],ac_cv_pike_lib_$1_mysql_connect=yes,ac_cv_pike_lib_$1_mysql_connect=no) LIBS="$ac_save_LIBS" ]) if test "x$ac_cv_pike_lib_$1_mysql_connect" = xyes ; then AC_MSG_RESULT(yes) $2 else AC_MSG_RESULT(no) $3 fi ]) AC_CHECK_SQLLIB(mysqlclient, [
5251601997-04-03Henrik Grubbström (Grubba)  LIBS="-lmysqlclient $LIBS" MYSQL_LIBS="-lmysqlclient ${MYSQL_LIBS}" ], [
bfbae31998-09-01Fredrik Hübinette (Hubbe)  AC_CHECK_SQLLIB(mysqllib, [
5251601997-04-03Henrik Grubbström (Grubba)  LIBS="-lmysqllib $LIBS" MYSQL_LIBS="-lmysqllib ${MYSQL_LIBS}" ], [
bfbae31998-09-01Fredrik Hübinette (Hubbe)  AC_CHECK_SQLLIB(mysql, [
5251601997-04-03Henrik Grubbström (Grubba)  LIBS="-lmysql $LIBS" MYSQL_LIBS="-lmysql ${MYSQL_LIBS}" ], [ pike_cv_mysql="no" ])
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  ])
5251601997-04-03Henrik Grubbström (Grubba)  ])
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
5251601997-04-03Henrik Grubbström (Grubba)  if test x$pike_cv_mysql = xno; then # Restore variables, so we don't link with unnessesary libs
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
c9cd161998-07-02Henrik Grubbström (Grubba)  # Note: mysql_port and mysql_unix_port aren't functions, but that shouldn't matter AC_CHECK_FUNCS(mysql_real_query mysql_fetch_lengths mysql_port mysql_unix_port)
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  fi fi AC_SUBST(MYSQL_LIBS) AC_OUTPUT(Makefile,echo FOO >stamp-h )