apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Samuelson <pe...@p12n.org>
Subject [PATCH] apr-util: fix dbd.m4 for use with apr_dbd_mysql.c
Date Sun, 07 Jan 2007 10:04:27 GMT

I was pleased to see that apr-util/build/dbd.m4 already accounts for
the externally-available apr_dbd_mysql.c - but it's slightly broken.
This is because the latter expects to see a definition of either
HAVE_MYSQL_H or HAVE_MYSQL_MYSQL_H.  autoheader _should_ be putting
those into include/private/apu_config.h.in, but it doesn't, because....

Well, after some wonderful quality time with autoconf, I discovered to
my infinite delight that autoheader picks up 'AC_CHECK_HEADERS' macros
but ignores 'AC_CHECK_HEADER' macros.

This patch takes that into account, and in the process cleans up dbd.m4
a bit.  Both of the -I flags that I removed (-I{/foo}/include/mysql and
-Iyes/include/myql) are unneeded.

Peter


--- apr-util/build/dbd.m4
+++ apr-util/build/dbd.m4
@@ -77,37 +77,24 @@
   ], [
     apu_have_mysql=0
     if test "$withval" = "yes"; then
-      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/myql])
-        fi
-      fi
-    elif test "$withval" = "no"; then
-      apu_have_mysql=0
-    else
+      AC_CHECK_HEADERS([mysql.h mysql/mysql.h],
+                       AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+    elif test "$withval" != "no"; then
       CPPFLAGS="-I$withval/include"
       LIBS="-L$withval/lib "
 
       AC_MSG_NOTICE(checking for mysql in $withval)
-      AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+      AC_CHECK_HEADERS([mysql.h mysql/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])
       fi
-
-      if test "$apu_have_mysql" != "1"; 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_LDFLAGS, [-L$withval/lib])
-        fi
-      fi
     fi
   ], [
     apu_have_mysql=0
-    AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+    AC_CHECK_HEADERS([mysql.h mysql/mysql.h],
+                     AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
   ])
 
   AC_SUBST(apu_have_mysql)

Mime
View raw message