From 4a2babe80a4190b115a89dc0f29872c0ab147e76 Mon Sep 17 00:00:00 2001 From: mOo Date: Mon, 15 Aug 2005 15:30:16 +0000 Subject: [PATCH] fix mysql_config configuration git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@545 152afb58-edef-0310-8abb-c4023f1b3aa9 --- configure.in | 64 +++++++++++++++++++++++-------------------- src/Makefile.am | 6 ++-- src/mod_mysql_vhost.c | 2 +- 3 files changed, 38 insertions(+), 34 deletions(-) diff --git a/configure.in b/configure.in index 76788e38..3d31c5b4 100644 --- a/configure.in +++ b/configure.in @@ -82,46 +82,50 @@ AC_FUNC_STRFTIME dnl Checks for database. MYSQL_INCLUDE="" +MYSQL_LIBS="" -AC_PATH_PROG(MYSQLCONFIG, mysql_config) 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']), [ - if test "$withval" != "no"; then - if test "$withval" != "yes"; then - withval=$MYSQLCONFIG - fi - - if test -e $withval; then - if $withval | grep -- '--include' > /dev/null ; then - MYSQL_INCLUDE="`$withval --include | sed s/\'//g`" - else - MYSQL_INCLUDE="`$withval --cflags | sed s/\'//g`" - fi - MYSQL_LIBS="`$withval --libs | sed s/\'//g`" - - AC_MSG_RESULT(yes) + WITH_MYSQL=$withval + AC_MSG_RESULT(yes) +],[AC_MSG_RESULT(no)]) - AC_MSG_CHECKING(for MySQL includes at) - AC_MSG_RESULT($MYSQL_INCLUDE) +if test "$WITH_MYSQL" != "no"; then + if test "$WITH_MYSQL" = "yes"; then + AC_PATH_PROG(MYSQL_CONFIG, mysql_config) + else + MYSQL_CONFIG=$WITH_MYSQL + fi - AC_MSG_CHECKING(for MySQL libraries at) - AC_MSG_RESULT($MYSQL_LIBS) - 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 "$MYSQL_CONFIG" = ""; then + AC_MSG_ERROR(mysql_config is not found) + fi + if test \! -x $MYSQL_CONFIG; then + AC_MSG_ERROR(mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config) + fi - AC_DEFINE([HAVE_MYSQL], [1], [mysql support]) - else - AC_MSG_RESULT(no) - fi + if $MYSQL_CONFIG | grep -- '--include' ; then + MYSQL_INCLUDE="`$MYSQL_CONFIG --include | sed s/\'//g`" else - AC_MSG_RESULT(no) + MYSQL_INCLUDE="`$MYSQL_CONFIG --cflags | sed s/\'//g`" fi -],[AC_MSG_RESULT(no)]) + MYSQL_LIBS="`$MYSQL_CONFIG --libs | sed s/\'//g`" + + AC_MSG_CHECKING(for MySQL includes at) + AC_MSG_RESULT($MYSQL_INCLUDE) + + AC_MSG_CHECKING(for MySQL libraries at) + AC_MSG_RESULT($MYSQL_LIBS) +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" + + AC_DEFINE([HAVE_MYSQL], [1], [mysql support]) +fi AC_SUBST(MYSQL_LIBS) AC_SUBST(MYSQL_INCLUDE) diff --git a/src/Makefile.am b/src/Makefile.am index e32c5dbd..efebf6be 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,7 +36,7 @@ common_src=buffer.c log.c \ fdevent_select.c fdevent_linux_rtsig.c \ fdevent_poll.c fdevent_linux_sysepoll.c \ fdevent_solaris_devpoll.c fdevent_freebsd_kqueue.c \ - data_config.c bitset.c configparser.c \ + data_config.c bitset.c \ inet_ntop_cache.c crc32.c \ connections-glue.c \ configfile-glue.c \ @@ -47,7 +47,7 @@ src = server.c response.c connections.c network.c \ network_write.c network_linux_sendfile.c \ network_freebsd_sendfile.c network_writev.c \ network_solaris_sendfilev.c network_openssl.c \ - configfile.c request.c proc_open.c + configfile.c configparser.c request.c proc_open.c spawn_fcgi_SOURCES=spawn-fcgi.c @@ -82,7 +82,7 @@ lib_LTLIBRARIES += mod_mysql_vhost.la mod_mysql_vhost_la_SOURCES = mod_mysql_vhost.c mod_mysql_vhost_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_mysql_vhost_la_LIBADD = $(MYSQL_LIBS) $(common_libadd) -mod_mysql_vhost_la_CPPFLAGS = $(MYSQL_INCLUDES) +mod_mysql_vhost_la_CPPFLAGS = $(MYSQL_INCLUDE) lib_LTLIBRARIES += mod_cgi.la mod_cgi_la_SOURCES = mod_cgi.c diff --git a/src/mod_mysql_vhost.c b/src/mod_mysql_vhost.c index e6da94b6..bfa1ef13 100644 --- a/src/mod_mysql_vhost.c +++ b/src/mod_mysql_vhost.c @@ -10,7 +10,7 @@ #include "stat_cache.h" #ifdef HAVE_MYSQL -#include +#include #endif #ifdef DEBUG_MOD_MYSQL_VHOST #define DEBUG