Author: wyoung
Date: Sun Nov 22 18:38:05 2009
New Revision: 2583
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2583&view=rev
Log:
Rewrote MySQL++ library- and header-finding autoconf macro to be in more
modern style, and to fix a problem related to cached test results.
Modified:
trunk/config/mysql++.m4
Modified: trunk/config/mysql++.m4
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/config/mysql%2B%2B.m4?rev=2583&r1=2582&r2=2583&view=diff
==============================================================================
--- trunk/config/mysql++.m4 (original)
+++ trunk/config/mysql++.m4 Sun Nov 22 18:38:05 2009
@@ -37,16 +37,14 @@
dnl set up for building programs against the MySQL C API. The mysql.m4
dnl macro in this directory fits this bill; run it first.
dnl
-dnl @version 1.2, 2009/05/28
+dnl @version 1.3, 2009/11/22
dnl @author Warren Young <[email protected]>
AC_DEFUN([MYSQLPP_DEVEL],
[
-AC_CACHE_CHECK([for MySQL++ devel stuff], ac_cv_mysqlpp_devel,
-[
- #
- # Set up configure script macros
- #
+ dnl
+ dnl Set up configure script macros
+ dnl
AC_ARG_WITH(mysqlpp,
[ --with-mysqlpp=<path> path containing MySQL++ header and
library subdirs],
[MYSQLPP_lib_check="$with_mysqlpp/lib64 $with_mysqlpp/lib
$with_mysqlpp/lib64/mysql++ $with_mysqlpp/lib/mysql++"
@@ -60,75 +58,74 @@
[ --with-mysqlpp-include=<path> directory path of MySQL++
headers],
[MYSQLPP_inc_check="$with_mysqlpp_include
$with_mysqlpp_include/include $with_mysqlpp_include/include/mysql"])
- #
- # Look for MySQL++ library
- #
- MYSQLPP_LIB_DIR=
- for dir in $MYSQLPP_lib_check
- do
- if test -d "$dir" && \
- ( test -f "$dir/libmysqlpp.so" ||
- test -f "$dir/libmysqlpp.a" )
+ dnl
+ dnl Look for MySQL++ library
+ dnl
+ AC_CACHE_CHECK([for MySQL++ library location], [ac_cv_mysqlpp_lib],
+ [
+ for dir in $MYSQLPP_lib_check
+ do
+ if test -d "$dir" && \
+ ( test -f "$dir/libmysqlpp.so" ||
+ test -f "$dir/libmysqlpp.a" )
+ then
+ ac_cv_mysqlpp_lib=$dir
+ break
+ fi
+ done
+
+ if test -z "$ac_cv_mysqlpp_lib"
then
- MYSQLPP_LIB_DIR=$dir
- break
+ AC_MSG_ERROR([Didn't find the MySQL++ library dir in
'$MYSQLPP_lib_check'])
fi
- done
- if test -z "$MYSQLPP_LIB_DIR"
- then
- AC_MSG_ERROR([Didn't find the MySQL++ library dir in
'$MYSQLPP_lib_check'])
- fi
+ case "$ac_cv_mysqlpp_lib" in
+ /* ) ;;
+ * ) AC_MSG_ERROR([The MySQL++ library directory
($ac_cv_mysqlpp_lib) must be an absolute path.]) ;;
+ esac
+ ])
+ AC_SUBST([MYSQLPP_LIB_DIR],[$ac_cv_mysqlpp_lib])
- case "$MYSQLPP_LIB_DIR" in
- /* ) ;;
- * ) AC_MSG_ERROR([The MySQL++ library directory
($MYSQLPP_LIB_DIR) must be an absolute path.]) ;;
+ dnl
+ dnl Look for MySQL++ header file directory
+ dnl
+ AC_CACHE_CHECK([for MySQL++ include path], [ac_cv_mysqlpp_inc],
+ [
+ for dir in $MYSQLPP_inc_check
+ do
+ if test -d "$dir" && test -f "$dir/mysql++.h"
+ then
+ ac_cv_mysqlpp_inc=$dir
+ break
+ fi
+ done
+
+ if test -z "$ac_cv_mysqlpp_inc"
+ then
+ AC_MSG_ERROR([Didn't find the MySQL++ header dir in
'$MYSQLPP_inc_check'])
+ fi
+
+ case "$ac_cv_mysqlpp_inc" in
+ /* ) ;;
+ * ) AC_MSG_ERROR([The MySQL++ header directory
($ac_cv_mysqlpp_inc) must be an absolute path.]) ;;
+ esac
+ ])
+ AC_SUBST([MYSQLPP_INC_DIR],[$ac_cv_mysqlpp_inc])
+
+ dnl
+ dnl Now check that the above checks resulted in -I and -L flags that
+ dnl let us build actual programs against MySQL++.
+ dnl
+ case "$ac_cv_mysqlpp_lib" in
+ /usr/lib) ;;
+ *) LDFLAGS="$LDFLAGS -L${ac_cv_mysqlpp_lib}" ;;
esac
-
- AC_MSG_RESULT([lib in $MYSQLPP_LIB_DIR])
-
- case "$MYSQLPP_LIB_DIR" in
- /usr/lib) ;;
- *) LDFLAGS="$LDFLAGS -L${MYSQLPP_LIB_DIR}" ;;
- esac
-
-
- #
- # Look for MySQL++ headers
- #
- AC_MSG_CHECKING([for MySQL++ header directory])
- MYSQLPP_INC_DIR=
- for dir in $MYSQLPP_inc_check
- do
- if test -d "$dir" && test -f "$dir/mysql++.h"
- then
- MYSQLPP_INC_DIR=$dir
- break
- fi
- done
-
- if test -z "$MYSQLPP_INC_DIR"
- then
- AC_MSG_ERROR([Didn't find the MySQL++ header dir in
'$MYSQLPP_inc_check'])
- fi
-
- case "$MYSQLPP_INC_DIR" in
- /* ) ;;
- * ) AC_MSG_ERROR([The MySQL++ header directory
($MYSQLPP_INC_DIR) must be an absolute path.]) ;;
- esac
-
- AC_MSG_RESULT([$MYSQLPP_INC_DIR])
-
- CPPFLAGS="$CPPFLAGS -I${MYSQLPP_INC_DIR} -I${MYSQL_C_INC_DIR}"
-
+ CPPFLAGS="$CPPFLAGS -I${ac_cv_mysqlpp_inc} -I${MYSQL_C_INC_DIR}"
AC_MSG_CHECKING([that we can build MySQL++ programs])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <mysql++.h>],
- [mysqlpp::Connection c(false)])],
- ac_cv_mysqlpp_devel=yes,
- AC_MSG_ERROR(no))
+ [mysqlpp::Connection c(false)])],
+ AC_MSG_RESULT([yes]),
+ AC_MSG_ERROR([no]))
+]) dnl End MYSQLPP_DEVEL
- AC_SUBST(MYSQLPP_INC_DIR)
- AC_SUBST(MYSQLPP_LIB_DIR)
-])]) dnl End MYSQLPP_DEVEL
-
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits