Sorry abuot those $$ in the previous patch. Not sure how that got in... :-(

--
Bojan
Index: build/dbd.m4
===================================================================
--- build/dbd.m4	(revision 408512)
+++ build/dbd.m4	(working copy)
@@ -77,24 +77,40 @@
   ], [
     apu_have_mysql=0
     if test "$withval" = "yes"; then
+      AC_PATH_PROG([mysqlconfig],[mysql_config])
+      if test "x$mysqlconfig" != "x"; then
+        CPPFLAGS="`$mysqlconfig --include`"
+        LDFLAGS="`$mysqlconfig --libs_r`"
+      fi
       AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
       if test "$apu_have_mysql" == "0"; then
         AC_CHECK_HEADER(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
         if test "$apu_have_mysql" != "0"; then
-          APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/mysql])
+          APR_ADDTO(APRUTIL_INCLUDES, [-I/usr/include/mysql])
         fi
+      else
+        if test "x$mysqlconfig" != "x"; then
+          APR_ADDTO(APRUTIL_INCLUDES, [$CPPFLAGS])
+          APR_ADDTO(APRUTIL_LDFLAGS, [$LDFLAGS])
+        fi
       fi
     elif test "$withval" = "no"; then
       apu_have_mysql=0
     else
-      CPPFLAGS="-I$withval/include"
-      LDFLAGS="-L$withval/lib "
+      AC_PATH_PROG([mysqlconfig],[mysql_config],,[$withval/bin])
+      if test "x$mysqlconfig" != "x"; then
+        CPPFLAGS="`$mysqlconfig --include`"
+        LDFLAGS="`$mysqlconfig --libs_r`"
+      else
+        CPPFLAGS="-I$withval/include"
+        LDFLAGS="-L$withval/lib "
+      fi
 
       AC_MSG_NOTICE(checking for mysql in $withval)
       AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
       if test "$apu_have_mysql" != "0"; then
-        APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
-        APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
+        APR_ADDTO(APRUTIL_INCLUDES, [$CPPFLAGS])
+        APR_ADDTO(APRUTIL_LDFLAGS, [$LDFLAGS])
       fi
 
       if test "$apu_have_mysql" != "1"; then
@@ -107,7 +123,18 @@
     fi
   ], [
     apu_have_mysql=0
+    AC_PATH_PROG([mysqlconfig],[mysql_config])
+    if test "x$mysqlconfig" != "x"; then
+      CPPFLAGS="`$mysqlconfig --include`"
+      LDFLAGS="`$mysqlconfig --libs_r`"
+    fi
     AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+    if test "$apu_have_mysql" != "0"; then
+      if test "x$mysqlconfig" != "x"; then
+        APR_ADDTO(APRUTIL_INCLUDES, [$CPPFLAGS])
+        APR_ADDTO(APRUTIL_LDFLAGS, [$LDFLAGS])
+      fi
+    fi
   ])
 
   AC_SUBST(apu_have_mysql)

Reply via email to