ab6aec1997-02-11Fredrik Hübinette (Hubbe) # # Configure script for the mysql-module #
147f382000-09-12Fredrik Noring # Henrik Grubbström
ab6aec1997-02-11Fredrik Hübinette (Hubbe) # # # NOTE: # Prior to 3.20.0 After 3.20.0
8db4cc2002-07-16Per Hedbor # -------------------------------------------------------------------
ab6aec1997-02-11Fredrik Hübinette (Hubbe) # /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 #
543dd62013-06-17Henrik Grubbström (Grubba) # MariaDB-Client 1.0.0 # ------------------------------------------------------------------- # /usr/local/lib # /usr/local/mariadbclient/include # libmariadbclient.a #
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  AC_INIT(mysql.c) AC_CONFIG_HEADER(config.h)
e269811998-09-20Fredrik Hübinette (Hubbe) AC_MODULE_INIT()
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
3d47892012-09-19Martin Stjernholm # ___Mysql.so is wrapped by lib/modules/Mysql.pmod. MODULE_WRAPPER_PREFIX="___"
e45ef22001-02-14Mirar (Pontus Hagland) PIKE_FEATURE_WITHOUT(Mysql)
ab6aec1997-02-11Fredrik Hübinette (Hubbe) OLD_LIBS=$LIBS OLD_LDFLAGS=$LDFLAGS OLD_CPPFLAGS=$CPPFLAGS AC_ARG_WITH(mysql, [ --without-mysql no support for the Mysql database],[],[with_mysql=yes])
90cce02013-06-18Henrik Grubbström (Grubba) AC_ARG_WITH(mariadb,[ --without-mariadb disable use of MariaDB-client library],[],[with_mariadb=yes])
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
9d53421998-10-20Henrik Grubbström (Grubba) if test x$with_mysql = xno; then : else
e45ef22001-02-14Mirar (Pontus Hagland)  PIKE_FEATURE_NODEP(Mysql)
7050692014-02-14Henrik Grubbström (Grubba)  PIKE_SELECT_ABI
90cce02013-06-18Henrik Grubbström (Grubba)  if test "x$with_mariadb" = "xno"; then MARIADB_CONFIG=no else
1bd84c2017-09-05Henrik Grubbström (Grubba)  MY_AC_PATH_PROG(MARIADB_CONFIG, ${ac_tool_prefix}mariadb_config mariadb_config, no)
90cce02013-06-18Henrik Grubbström (Grubba)  fi
543dd62013-06-17Henrik Grubbström (Grubba)  if test "x${MARIADB_CONFIG}" = "xno"; then
bebd382006-01-04Henrik Grubbström (Grubba)  AC_MSG_CHECKING(for Mysql directory prefix) AC_CACHE_VAL(pike_cv_mysql_lib_dir_prefix, [ pike_cv_mysql_lib_dir_prefix=no for dir_prefix in $with_mysql \ `echo "${with_site_prefixes}"|sed -e 's/:/ /g'` \ `echo $exec_prefix | sed "s@^NONE@$prefix@g" | sed "s@^NONE@$with_root$ac_default_prefix@g"` \ $with_root/usr/local $with_root/sw/local $with_root/sw \ $with_root/usr/gnu $with_root/opt/gnu $with_root/sw/gnu \ $with_root/usr/freeware $with_root/usr/pkg \
6727fb2008-05-14Marcus Comstedt  $with_root/opt/csw $with_root/opt/csw/mysql5 $with_root/opt/csw/mysql4 \
e4dab62007-01-28Peter Bortas  $with_root/usr/sfw $with_root/opt/sfw \
bebd382006-01-04Henrik Grubbström (Grubba)  $with_root/usr $with_root do if test -d "$dir_prefix/."; then :; else continue; fi for subdir in mysql .; do if test -d "$dir_prefix/$subdir/."; then :; else continue; fi
6727fb2008-05-14Marcus Comstedt  for libdir in $pike_cv_abi_suffixes; do if test -d "$dir_prefix/$subdir/lib$libdir/mysql/." || test -d "$dir_prefix/$subdir/lib/mysql$libdir/."; then
bebd382006-01-04Henrik Grubbström (Grubba)  pike_cv_mysql_lib_dir_prefix="$dir_prefix/$subdir" break 3 fi done
974ba82004-10-05Martin Stjernholm  done
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  done ])
bebd382006-01-04Henrik Grubbström (Grubba)  AC_MSG_RESULT($pike_cv_mysql_lib_dir_prefix) if test "x$pike_cv_mysql_lib_dir_prefix" = "xno"; then :; else AC_MSG_CHECKING(for Mysql lib directory) AC_CACHE_VAL(pike_cv_mysql_lib_dir, [ pike_cv_mysql_lib_dir="no"
6727fb2008-05-14Marcus Comstedt  for libdir in $pike_cv_abi_suffixes; do if test -d "$pike_cv_mysql_lib_dir_prefix/lib$libdir/mysql/."; then pike_cv_mysql_lib_dir="$pike_cv_mysql_lib_dir_prefix/lib$libdir/mysql"
bebd382006-01-04Henrik Grubbström (Grubba)  break
6727fb2008-05-14Marcus Comstedt  else if test -d "$pike_cv_mysql_lib_dir_prefix/lib/mysql$libdir/."; then pike_cv_mysql_lib_dir="$pike_cv_mysql_lib_dir_prefix/lib/mysql$libdir" break fi
bebd382006-01-04Henrik Grubbström (Grubba)  fi done
a1d23e2011-08-18Henrik Grubbström (Grubba)  # Blastwave adds an extra lib on top. if test -d "$pike_cv_mysql_lib_dir/lib/."; then pike_cv_mysql_lib_dir="$pike_cv_mysql_lib_dir/lib" fi
bebd382006-01-04Henrik Grubbström (Grubba)  ]) 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. LDFLAGS="${LDFLAGS} -R$pike_cv_mysql_lib_dir -L$pike_cv_mysql_lib_dir" fi AC_MSG_CHECKING(for Mysql include-directory) AC_CACHE_VAL(pike_cv_mysql_include_dir, [ pike_cv_mysql_include_dir="no" for incdir in include/mysql include; do if test -d "$pike_cv_mysql_lib_dir_prefix/$incdir/."; then
1602632008-05-14Marcus Comstedt  pike_cv_mysql_include_dir="$pike_cv_mysql_lib_dir_prefix/$incdir"
bebd382006-01-04Henrik Grubbström (Grubba)  break fi done ]) AC_MSG_RESULT($pike_cv_mysql_include_dir)
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
bebd382006-01-04Henrik Grubbström (Grubba)  if test x$pike_cv_mysql_include_dir = xno; then :; else echo Adding $pike_cv_mysql_include_dir to the include search path.
85d2bf2013-08-19Henrik Grubbström (Grubba)  CPPFLAGS="-I$pike_cv_mysql_include_dir ${CPPFLAGS}"
bebd382006-01-04Henrik Grubbström (Grubba)  fi
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  fi
543dd62013-06-17Henrik Grubbström (Grubba)  else echo "MariaDB found. Attempting to use." # MariaDB # NB: mariadb_config doens't distinguish between # LDFLAGS and LIBS MARIADB_LIBS="" set ignored `${MARIADB_CONFIG} --libs_r` while test "$#" -gt 1; do case "$2" in -L*) echo "Adding `echo $2 | sed -e 's/^-L//'` to the library search path." LDFLAGS="${LDFLAGS} $2 `echo $2 | sed -e 's/^-L/-R/'`" ;; -R*) echo "Adding `echo $2 | sed -e 's/^-R//'` to the library runtime search path." LDFLAGS="${LDFLAGS} $2" ;; -lmaria*) # We handle the client library itself later. ;;
de8d902014-10-10Henrik Grubbström (Grubba)  -lmysql*) # We handle the client library itself later. ;;
543dd62013-06-17Henrik Grubbström (Grubba)  *) # NB: We need to buffer libs to get them in the correct order. echo "Adding $2 to LIBS." MARIADB_LIBS="${MARIADB_LIBS} $2" ;; esac shift done
40089d2015-09-17Henrik Grubbström (Grubba)  if echo " $MARIADB_LIBS" | grep -i iconv >/dev/null; then :; else # NB: Sometimes iconv doesn't get listed by mariadb_config. AC_CHECK_LIB(iconv, iconv_open, [ MARIADB_LIBS="${MARIADB_LIBS} -liconv" ], [ AC_CHECK_LIB(iconv, libiconv_open, [ MARIADB_LIBS="${MARIADB_LIBS} -liconv" ]) ]) fi
543dd62013-06-17Henrik Grubbström (Grubba)  echo "Adding `${MARIADB_CONFIG} --include` to CPPFLAGS."
85d2bf2013-08-19Henrik Grubbström (Grubba)  CPPFLAGS="`${MARIADB_CONFIG} --include` ${CPPFLAGS}"
543dd62013-06-17Henrik Grubbström (Grubba)  fi
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  # Header file
06b2252007-03-20Henrik Grubbström (Grubba)  AC_CHECK_HEADERS(winsock2.h winsock.h mysql.h mysql/mysql.h errmsg.h mysql/errmsg.h,,,[ #if HAVE_WINSOCK2_H #include <winsock2.h> #elif HAVE_WINSOCK_H #include <winsock.h> #endif ])
1b02b52013-10-13Arne Goedeke  AC_MSG_CHECKING(for mysql/mysqld_ername.h) AC_CACHE_VAL(ac_cv_mysqld_ername, [ AC_TRY_COMPILE([],[ struct foo { const char * a; int b; };
ac41e02014-03-14Jonas Walldén const static struct foo list[] = {
1b02b52013-10-13Arne Goedeke #include <mysql/mysqld_ername.h> };
ac41e02014-03-14Jonas Walldén  ],ac_cv_mysqld_ername=yes,ac_cv_mysqld_ername=no)
1b02b52013-10-13Arne Goedeke  ]) if test x$ac_cv_mysqld_ername = xyes; then AC_DEFINE(HAVE_MYSQL_MYSQLD_ERNAME_H) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
ac99f52004-05-01Henrik Grubbström (Grubba)  if test x$ac_cv_header_mysql_h$ac_cv_header_mysql_mysql_h = xnono; then # Required headerfile missing. PIKE_FEATURE_NODEP(Mysql) pike_cv_mysql="no" fi
438bdc2003-02-26Marcus Agehall  # Defines within headerfile define([AC_CHECK_MYSQL_OPTIONS], [ AC_MSG_CHECKING(for $1)
0ac0682008-07-18Martin Stjernholm AC_CACHE_VAL(ac_cv_pike_mysql_opt_$1, [
438bdc2003-02-26Marcus Agehall AC_TRY_COMPILE([
06b2252007-03-20Henrik Grubbström (Grubba) #if HAVE_WINSOCK2_H #include <winsock2.h> #elif HAVE_WINSOCK_H #include <winsock.h> #endif
438bdc2003-02-26Marcus Agehall #ifdef HAVE_MYSQL_H #include <mysql.h> #else #ifdef HAVE_MYSQL_MYSQL_H #include <mysql/mysql.h> #endif #endif ], [ int tmp; tmp = $1;
0ac0682008-07-18Martin Stjernholm ], ac_cv_pike_mysql_opt_$1=yes, ac_cv_pike_mysql_opt_$1=no) ]) if test "x$ac_cv_pike_mysql_opt_$1" = xyes; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_$1) else AC_MSG_RESULT(no) fi ])
438bdc2003-02-26Marcus Agehall 
bf7b382011-08-18Henrik Grubbström (Grubba)  AC_CHECK_MYSQL_OPTIONS(MYSQL_OPT_RECONNECT)
438bdc2003-02-26Marcus Agehall  AC_CHECK_MYSQL_OPTIONS(MYSQL_READ_DEFAULT_FILE) AC_CHECK_MYSQL_OPTIONS(MYSQL_OPT_CONNECT_TIMEOUT) AC_CHECK_MYSQL_OPTIONS(MYSQL_OPT_COMPRESS) AC_CHECK_MYSQL_OPTIONS(MYSQL_OPT_NAMED_PIPE) AC_CHECK_MYSQL_OPTIONS(MYSQL_INIT_COMMAND) AC_CHECK_MYSQL_OPTIONS(MYSQL_READ_DEFAULT_GROUP) AC_CHECK_MYSQL_OPTIONS(MYSQL_SET_CHARSET_DIR) AC_CHECK_MYSQL_OPTIONS(MYSQL_SET_CHARSET_NAME) AC_CHECK_MYSQL_OPTIONS(MYSQL_OPT_LOCAL_INFILE)
137fe02004-07-14Henrik Grubbström (Grubba)  AC_CHECK_MYSQL_OPTIONS(SHUTDOWN_DEFAULT)
438bdc2003-02-26Marcus Agehall 
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  # Mysql libs
0ac0682008-07-18Martin Stjernholm dnl if test x"$pike_cv_sys_os" = xWindows_NT ; then dnl LIBS="-lshell32 -lkernel32 -lws2_32 -ladvapi32 -luser32 ${LIBS}" dnl fi
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
0ac0682008-07-18Martin Stjernholm  old_LIBS="$LIBS"
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
5251601997-04-03Henrik Grubbström (Grubba)  # System libs which might be needed
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
0ac0682008-07-18Martin Stjernholm  AC_SEARCH_LIBS(socket, socket) AC_SEARCH_LIBS(gethostbyname, nsl) AC_SEARCH_LIBS(floor, m)
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
4824e82006-07-04Martin Stjernholm  # Header check necessary for PIKE_FUNCS_NEED_DECLS. AC_CHECK_HEADERS(pthread.h)
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) 
8ba1c92014-01-22Henrik Grubbström (Grubba)  if test "x${MARIADB_CONFIG}" = "xno"; then :; else
577e362014-01-22Henrik Grubbström (Grubba)  # Needed for libmariadbclient.a 1.0.0. AC_SEARCH_LIBS(OPENSSL_config, crypto) AC_SEARCH_LIBS(SSL_library_init, ssl) fi
543dd62013-06-17Henrik Grubbström (Grubba) 
0ac0682008-07-18Martin Stjernholm  AC_SEARCH_LIBS(_db_doprnt_, dbug) AC_SEARCH_LIBS(my_init, mysys)
5251601997-04-03Henrik Grubbström (Grubba) 
7a29ba2000-08-23Elias Levy  # mysql 3.23.x libmysqlclient requires zlib...
0ac0682008-07-18Martin Stjernholm  AC_SEARCH_LIBS(compress, z)
7a29ba2000-08-23Elias Levy 
8ba1c92014-01-22Henrik Grubbström (Grubba)  if test "x${MARIADB_CONFIG}" = "xno"; then :; else
543dd62013-06-17Henrik Grubbström (Grubba)  LIBS="${MARIADB_LIBS} ${LIBS}" fi
5251601997-04-03Henrik Grubbström (Grubba)  # Try a couple of mysqlclient libs # in order of age, newest first.
bfbae31998-09-01Fredrik Hübinette (Hubbe) define([AC_CHECK_SQLLIB], [
cf381a2001-11-15Henrik Grubbström (Grubba) AC_MSG_CHECKING(for mysql_real_connect in $1) AC_CACHE_VAL(ac_cv_pike_lib_$1_mysql_real_connect,
bfbae31998-09-01Fredrik Hübinette (Hubbe) [ ac_save_LIBS="$LIBS" LIBS="-l$1 $LIBS" AC_TRY_LINK( [
9a09222003-04-30Henrik Grubbström (Grubba) #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #elif defined(HAVE_WINSOCK_H)
bfbae31998-09-01Fredrik Hübinette (Hubbe) #include <winsock.h> #endif #ifdef HAVE_MYSQL_H #include <mysql.h> #else #ifdef HAVE_MYSQL_MYSQL_H #include <mysql/mysql.h> #endif #endif ],[
cf381a2001-11-15Henrik Grubbström (Grubba)  mysql_real_connect(0,0,0,0,0,0,0,0); ],ac_cv_pike_lib_$1_mysql_real_connect=yes, ac_cv_pike_lib_$1_mysql_real_connect=no)
bfbae31998-09-01Fredrik Hübinette (Hubbe) LIBS="$ac_save_LIBS" ])
cf381a2001-11-15Henrik Grubbström (Grubba) if test "x$ac_cv_pike_lib_$1_mysql_real_connect" = xyes ; then
e45ef22001-02-14Mirar (Pontus Hagland)  PIKE_FEATURE(Mysql,[yes (lib$1)])
bfbae31998-09-01Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(yes) $2 else AC_MSG_RESULT(no)
cf381a2001-11-15Henrik Grubbström (Grubba)  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( [
9a09222003-04-30Henrik Grubbström (Grubba) #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #elif defined(HAVE_WINSOCK_H)
cf381a2001-11-15Henrik Grubbström (Grubba) #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 PIKE_FEATURE(Mysql,[yes (lib$1)]) AC_MSG_RESULT(yes) $2 else AC_MSG_RESULT(no) $3 fi
bfbae31998-09-01Fredrik Hübinette (Hubbe) fi ])
de8d902014-10-10Henrik Grubbström (Grubba)  TRY_MYSQLCLIENT="yes" if test "x${MARIADB_CONFIG}" = "xno"; then :; else # Try the MariaDB client libraries. # NB: These are distributed separately from the MariaDB server. TRY_MYSQLCLIENT="no" AC_CHECK_SQLLIB(mariadbclient_r, [
ec0e0f2015-09-17Henrik Grubbström (Grubba)  LIBS="-lmariadbclient_r $LIBS"
5251601997-04-03Henrik Grubbström (Grubba)  ], [
de8d902014-10-10Henrik Grubbström (Grubba)  AC_CHECK_SQLLIB(mariadbclient, [
ec0e0f2015-09-17Henrik Grubbström (Grubba)  LIBS="-lmariadbclient $LIBS"
0ac0682008-07-18Martin Stjernholm  ], [
de8d902014-10-10Henrik Grubbström (Grubba)  AC_CHECK_SQLLIB(mariadb_r, [
ec0e0f2015-09-17Henrik Grubbström (Grubba)  LIBS="-lmariadb_r $LIBS"
0ac0682008-07-18Martin Stjernholm  ], [
de8d902014-10-10Henrik Grubbström (Grubba)  AC_CHECK_SQLLIB(mariadb, [
ec0e0f2015-09-17Henrik Grubbström (Grubba)  LIBS="-lmariadb $LIBS"
de8d902014-10-10Henrik Grubbström (Grubba)  ], [ # Fallback to using the MySQL client libraries. # NB: These are distributed together with the MariaDB server. TRY_MYSQLCLIENT="yes"
0ac0682008-07-18Martin Stjernholm  ])
de8d902014-10-10Henrik Grubbström (Grubba)  ])
0ac0682008-07-18Martin Stjernholm  ])
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  ])
de8d902014-10-10Henrik Grubbström (Grubba)  fi if test "x${TRY_MYSQLCLIENT}" = "xyes"; then # libmysql.lib is the name of the libmysql.dll wrapper in the # windows releases. There's also a mysqlclient.lib which contains the # static version. We prefer the dynamic one so check libmysql first. AC_CHECK_SQLLIB(libmysql, [ LIBS="-llibmysql $LIBS" ], [ AC_CHECK_SQLLIB(mysqlclient_r, [ LIBS="-lmysqlclient_r $LIBS"
543dd62013-06-17Henrik Grubbström (Grubba)  ], [
de8d902014-10-10Henrik Grubbström (Grubba)  AC_CHECK_SQLLIB(mysqlclient, [ LIBS="-lmysqlclient $LIBS"
543dd62013-06-17Henrik Grubbström (Grubba)  ], [
de8d902014-10-10Henrik Grubbström (Grubba)  AC_CHECK_SQLLIB(mysqllib, [ LIBS="-lmysqllib $LIBS" ], [ AC_CHECK_SQLLIB(mysql, [ LIBS="-lmysql $LIBS" ], [ PIKE_FEATURE_NODEP(Mysql) pike_cv_mysql="no" ]) ])
543dd62013-06-17Henrik Grubbström (Grubba)  ]) ])
de8d902014-10-10Henrik Grubbström (Grubba)  ])
543dd62013-06-17Henrik Grubbström (Grubba)  fi
ab6aec1997-02-11Fredrik Hübinette (Hubbe) 
e8f4592008-06-28Marcus Comstedt  if test x$pike_cv_mysql = xno; then :; else # Check version match AC_CHECK_FUNC(mysql_get_client_version,[ AC_TRY_RUN([#ifdef HAVE_WINSOCK2_H #include <winsock2.h> #else #ifdef HAVE_WINSOCK_H #include <winsock.h> #endif #endif #ifdef HAVE_MYSQL_H #include <mysql.h> #else #ifdef HAVE_MYSQL_MYSQL_H #include <mysql/mysql.h> #endif #endif #include <stdio.h> int main(int argc, char *argv[]) { #ifdef MYSQL_VERSION_ID unsigned long ver = mysql_get_client_version();
3bf11c2010-05-03Henrik Grubbström (Grubba)  if((ver/100) != (MYSQL_VERSION_ID/100)) {
e8f4592008-06-28Marcus Comstedt  fprintf(stderr, "Version mismatch: compile=%lu, run=%lu\n", (unsigned long)MYSQL_VERSION_ID, ver); exit(1); } #endif return 0; }],[],[ AC_MSG_WARN([Header version does not match library version, diabling module]) PIKE_FEATURE(Mysql,[no (header/library mismatch)]) pike_cv_mysql=no
3bf11c2010-05-03Henrik Grubbström (Grubba)  ],[ # Cross-compiling. : ])
e8f4592008-06-28Marcus Comstedt  ],[]) fi
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) 
5251601997-04-03Henrik Grubbström (Grubba)  LIBS=$OLD_LIBS CPPFLAGS=$OLD_CPPFLAGS LDFLAGS=$OLD_LDFLAGS else AC_DEFINE(HAVE_MYSQL)
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
04b20a2001-02-06Henrik Grubbström (Grubba)  define([PIKE_CHECK_MYSQL_FUNC], [ changequote(<<, >>)dnl define(<<AC_CV_NAME>>, translit(pike_cv_mysql_$1, [ *], [_p]))dnl changequote([, ])dnl AC_MSG_CHECKING(for $1) AC_CACHE_VAL(AC_CV_NAME, [
adfdb02001-02-07Henrik Grubbström (Grubba)  AC_TRY_LINK([
9a09222003-04-30Henrik Grubbström (Grubba) #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #elif defined(HAVE_WINSOCK_H)
adfdb02001-02-07Henrik Grubbström (Grubba) #include <winsock.h> #endif
04b20a2001-02-06Henrik Grubbström (Grubba) #ifdef HAVE_MYSQL_H #include <mysql.h> #else #ifdef HAVE_MYSQL_MYSQL_H #include <mysql/mysql.h> #else #error Need mysql.h headerfile! #endif #endif
b853432001-02-06Henrik Grubbström (Grubba)  ], [ void (*foo__)() = (void (*)())&$1;
f5aba22001-02-06Henrik Grubbström (Grubba)  ], [AC_CV_NAME="yes"], [AC_CV_NAME="no"])
04b20a2001-02-06Henrik Grubbström (Grubba)  ]) if test "$AC_CV_NAME" = "yes"; then
0ac0682008-07-18Martin Stjernholm  AC_DEFINE(translit(HAVE_$1,[a-z],[A-Z]), [], [Defined if $1 exists.])
04b20a2001-02-06Henrik Grubbström (Grubba)  fi AC_MSG_RESULT($AC_CV_NAME) ])
6ec7ff2015-06-10Henrik Grubbström (Grubba)  PIKE_CHECK_MYSQL_FUNC(mysql_real_connect)
04b20a2001-02-06Henrik Grubbström (Grubba)  PIKE_CHECK_MYSQL_FUNC(mysql_real_query) PIKE_CHECK_MYSQL_FUNC(mysql_fetch_lengths)
4996ea2002-03-18Henrik Grubbström (Grubba)  PIKE_CHECK_MYSQL_FUNC(mysql_options)
aa16eb2006-08-12Martin Stjernholm  PIKE_CHECK_MYSQL_FUNC(mysql_set_character_set)
0ac0682008-07-18Martin Stjernholm  PIKE_CHECK_MYSQL_FUNC(mysql_ssl_set)
506e342013-10-13Arne Goedeke  PIKE_CHECK_MYSQL_FUNC(mysql_sqlstate)
de9cfa2003-02-07Marcus Agehall 
15caf42006-08-31Martin Stjernholm  # This function should exist even in ancient versions, but it # appear to exist only in header files sometimes. PIKE_CHECK_MYSQL_FUNC(mysql_character_set_name)
b853432001-02-06Henrik Grubbström (Grubba)  # Note: The following two are variables: PIKE_CHECK_MYSQL_FUNC(mysql_port) PIKE_CHECK_MYSQL_FUNC(mysql_unix_port)
04b20a2001-02-06Henrik Grubbström (Grubba) 
35a8502001-02-06Henrik Grubbström (Grubba)  if test "$pike_cv_mysql_mysql_fetch_lengths" = "yes"; then
0f1d4b2000-03-23Henrik Grubbström (Grubba)  # # In 3.20.6b mysql_fetch_lengths() returns an uint *. # In 3.20.22 it returns an unsigned int *. # In 3.22.23 it returns an unsigned long *. # AC_MSG_CHECKING([if mysql_fetch_lengths() returns an uint or an ulong]) AC_CACHE_VAL(pike_cv_mysql_fetch_lengths_ret_type, [
359c382000-03-23Henrik Grubbström (Grubba)  for ret_type in "unsigned long long" "unsigned long" "unsigned int" "long long" "long" "int"; do
0f1d4b2000-03-23Henrik Grubbström (Grubba)  AC_TRY_COMPILE([
9a09222003-04-30Henrik Grubbström (Grubba) #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #elif defined(HAVE_WINSOCK_H)
344cde2001-02-07Henrik Grubbström (Grubba) #include <winsock.h> #endif
0f1d4b2000-03-23Henrik Grubbström (Grubba) #ifdef HAVE_MYSQL_H #include <mysql.h> #else #ifdef HAVE_MYSQL_MYSQL_H #include <mysql/mysql.h> #else #error Need mysql.h headerfile! #endif #endif
359c382000-03-23Henrik Grubbström (Grubba)  #ifndef STDCALL #define STDCALL #endif /* STDCALL */ $ret_type * STDCALL mysql_fetch_lengths(MYSQL_RES *mysql)
0f1d4b2000-03-23Henrik Grubbström (Grubba) { return 0; }
359c382000-03-23Henrik Grubbström (Grubba)  ], [], [ pike_cv_mysql_fetch_lengths_ret_type="$ret_type"; break; ])
0f1d4b2000-03-23Henrik Grubbström (Grubba)  done ]) if test "X$pike_cv_mysql_fetch_lengths_ret_type" = "X"; then AC_MSG_RESULT(Unknown -- Defaulting to unsigned long) AC_DEFINE(FETCH_LENGTHS_TYPE, unsigned long) else AC_MSG_RESULT($pike_cv_mysql_fetch_lengths_ret_type)
c6d6e02000-03-23Henrik Grubbström (Grubba)  AC_DEFINE_UNQUOTED(FETCH_LENGTHS_TYPE, $pike_cv_mysql_fetch_lengths_ret_type)
0f1d4b2000-03-23Henrik Grubbström (Grubba)  fi else :; fi
5c44b02003-03-28Marcus Comstedt 
8d17be2006-07-02Martin Stjernholm  # Header checks necessary for PIKE_FUNCS_NEED_DECLS. AC_CHECK_HEADERS(stdio.h io.h)
06b2252007-03-20Henrik Grubbström (Grubba)  AC_CHECK_FUNCS(ldiv open sopen close read fileno puts fgets \ _findfirst _findnext _findclose)
5c44b02003-03-28Marcus Comstedt 
8877692006-11-17Martin Stjernholm  AC_MSG_CHECKING(for the charsetnr member in MYSQL_FIELD) AC_CACHE_VAL(pike_cv_have_mysql_field_charsetnr, [ AC_TRY_LINK([ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #elif defined(HAVE_WINSOCK_H) #include <winsock.h> #endif #ifdef HAVE_MYSQL_H #include <mysql.h> #else #ifdef HAVE_MYSQL_MYSQL_H #include <mysql/mysql.h> #else #error Need mysql.h headerfile! #endif #endif ], [ void *foo__ = &(((MYSQL_FIELD *) 0)->charsetnr); ], [pike_cv_have_mysql_field_charsetnr="yes"], [pike_cv_have_mysql_field_charsetnr="no"]) ]) if test "$pike_cv_have_mysql_field_charsetnr" = yes; then AC_DEFINE(HAVE_MYSQL_FIELD_CHARSETNR) fi AC_MSG_RESULT($pike_cv_have_mysql_field_charsetnr)
1b8ceb2011-08-25Henrik Grubbström (Grubba)  AC_MSG_CHECKING(for the net.vio member in MYSQL) AC_CACHE_VAL(pike_cv_have_mysql_field_net_vio, [ AC_TRY_LINK([ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #elif defined(HAVE_WINSOCK_H) #include <winsock.h> #endif #ifdef HAVE_MYSQL_H #include <mysql.h> #else #ifdef HAVE_MYSQL_MYSQL_H #include <mysql/mysql.h> #else #error Need mysql.h headerfile! #endif #endif ], [ void *foo__ = &(((MYSQL *) 0)->net.vio); ], [pike_cv_have_mysql_field_net_vio="yes"], [pike_cv_have_mysql_field_net_vio="no"]) ]) if test "$pike_cv_have_mysql_field_net_vio" = yes; then AC_DEFINE(HAVE_MYSQL_FIELD_NET_VIO) fi AC_MSG_RESULT($pike_cv_have_mysql_field_net_vio)
ab6aec1997-02-11Fredrik Hübinette (Hubbe)  fi fi AC_OUTPUT(Makefile,echo FOO >stamp-h )