[dovecot-cvs] dovecot configure.in,1.178,1.179

cras at dovecot.org cras at dovecot.org
Fri Jul 30 05:07:49 EEST 2004


Update of /home/cvs/dovecot
In directory talvi:/tmp/cvs-serv24832

Modified Files:
	configure.in 
Log Message:
Better MySQL checking. Patch by John Dennis



Index: configure.in
===================================================================
RCS file: /home/cvs/dovecot/configure.in,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -d -r1.178 -r1.179
--- configure.in	28 Jul 2004 15:39:29 -0000	1.178
+++ configure.in	30 Jul 2004 02:07:47 -0000	1.179
@@ -1119,40 +1119,65 @@
 fi
 
 if test $want_mysql = yes; then
-	mysql_header=mysql.h
-	AC_CHECK_LIB(mysqlclient, mysql_init, [
-		AC_CHECK_HEADER(mysql.h,, [
-			AC_CHECK_HEADER(mysql/mysql.h, [
-				mysql_header=mysql/mysql.h
-				AUTH_CFLAGS="$AUTH_CFLAGS -DHAVE_MYSQL_MYSQL_H"
-			], want_mysql=no)
-		])
-	], want_mysql=no)
+	# based on code from PHP
+	for i in /usr /usr/local /usr/local/mysql; do
+		for j in include include/mysql ""; do
+			if test -r "$i/$j/mysql.h"; then
+				MYSQL_INCLUDE=$i/$j
+			fi
+		done
+		for j in lib lib/mysql ""; do
+			if test -f "$i/$j/libmysqlclient.so" || test -f "$i/$j/libmysqlclient.a"; then
+				MYSQL_LIBDIR=$i/$j
+			fi
+		done
+	done
 
-	if test $want_mysql = yes; then
-		AC_CHECK_LIB(mysqlclient, mysql_ssl_set, [
-			AC_DEFINE(HAVE_MYSQL_SSL,, Define if your MySQL library has SSL functions)
-			if test "x$have_openssl" = "yes"; then
-			  ssl_define="#define HAVE_OPENSSL"
-			else
-			  ssl_define=""
+	old_LIBS=$LIBS
+	if test "$MYSQL_LIBDIR" != ""; then
+		LIBS="$LIBS -L$MYSQL_LIBDIR"
+	fi
+
+	AC_CHECK_LIB(mysqlclient, mysql_init, [
+		old_CPPFLAGS=$CPPFLAGS
+		if test "$MYSQL_INCLUDE" != ""; then
+			CPPFLAGS="$CPPFLAGS -I $MYSQL_INCLUDE"
+		fi
+		AC_CHECK_HEADER(mysql.h, [
+			if test "$MYSQL_INCLUDE" != ""; then
+				AUTH_CFLAGS="$AUTH_CFLAGS -I$MYSQL_INCLUDE"
 			fi
-			AC_TRY_COMPILE([
-			  $ssl_define
-			  #include <$mysql_header>
-			], [
-			  mysql_set_ssl(0, 0, 0, 0, 0, 0);
-			], [
-				AC_DEFINE(HAVE_MYSQL_SSL_CIPHER,, Define if your MySQL library supports setting cipher)
+			if test "$MYSQL_LIBDIR" != ""; then
+				AUTH_LIBS="$AUTH_LIBS -L$MYSQL_LIBDIR"
+			fi
+			AUTH_LIBS="$AUTH_LIBS -lmysqlclient"
+
+			AC_CHECK_LIB(mysqlclient, mysql_ssl_set, [
+				AC_DEFINE(HAVE_MYSQL_SSL,, Define if your MySQL library has SSL functions)
+				if test "x$have_openssl" = "yes"; then
+				  ssl_define="#define HAVE_OPENSSL"
+				else
+				  ssl_define=""
+				fi
+				AC_TRY_COMPILE([
+				  $ssl_define
+				  #include <$mysql_header>
+				], [
+				  mysql_set_ssl(0, 0, 0, 0, 0, 0);
+				], [
+					AC_DEFINE(HAVE_MYSQL_SSL_CIPHER,, Define if your MySQL library supports setting cipher)
+				])
 			])
+			
+			AC_DEFINE(USERDB_MYSQL,, Build with MySQL support)
+			AC_DEFINE(PASSDB_MYSQL,, Build with MySQL support)
+			userdb="$userdb mysql"
+			passdb="$passdb mysql"
 		])
-		AUTH_LIBS="$AUTH_LIBS -lmysqlclient"
+		CPPFLAGS=$old_CPPFLAGS
+	])
 
-        	AC_DEFINE(USERDB_MYSQL,, Build with MySQL support)
-		AC_DEFINE(PASSDB_MYSQL,, Build with MySQL support)
-		userdb="$userdb mysql"
-		passdb="$passdb mysql"
-	fi
+	LIBS=$old_LIBS
 fi
 
 if test $want_vpopmail = yes; then



More information about the dovecot-cvs mailing list