Author: wyoung
Date: Fri Dec 30 07:21:26 2016
New Revision: 2783
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2783&view=rev
Log:
Rewrote the MySQL C API library detection autoconf macro so that it uses
the linker to probe for the directory to use instead of looking at the
filesystem, which makes the macro dependent on library file naming
rules.
This change addresses a Stack Overflow question where someone ran into
a build error because Cygwin had changed how it names its DLL import
libraries since the last time we tried building MySQL++ under Cygwin,
but that's no reason to add Cygwin-specific knowledge to the macro.
We shouldn't have been doing it that way in the first place.
Modified:
trunk/config/mysql_loc.m4
Modified: trunk/config/mysql_loc.m4
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/config/mysql_loc.m4?rev=2783&r1=2782&r2=2783&view=diff
==============================================================================
--- trunk/config/mysql_loc.m4 (original)
+++ trunk/config/mysql_loc.m4 Fri Dec 30 07:21:26 2016
@@ -10,7 +10,7 @@
dnl --with-mysql-lib: Same as --with-mysql, but for library only.
dnl --with-mysql-include: Same as --with-mysql, but for headers
only.
dnl
-dnl @version 1.4, 2009/05/28
+dnl @version 1.5, 2016/12/29
dnl @author Warren Young <[email protected]>
AC_DEFUN([MYSQL_C_API_LOCATION],
[
@@ -30,6 +30,7 @@
[ --with-mysql-include=<path> directory path of MySQL header
installation],
[MYSQL_inc_check="$with_mysql_include
$with_mysql_include/include $with_mysql_include/include/mysql"])
+
#
# Decide which C API library to use, based on thread support
#
@@ -39,43 +40,6 @@
else
MYSQL_C_LIB_NAME=mysqlclient
fi
-
- #
- # Look for MySQL C API library
- #
- AC_MSG_CHECKING([for MySQL library directory])
- MYSQL_C_LIB_DIR=
- for m in $MYSQL_lib_check
- do
- if test -d "$m" && \
- (test -f "$m/lib$MYSQL_C_LIB_NAME.so" || \
- test -f "$m/lib$MYSQL_C_LIB_NAME.a")
- then
- MYSQL_C_LIB_DIR=$m
- break
- fi
- done
-
- if test -z "$MYSQL_C_LIB_DIR"
- then
- AC_MSG_ERROR([Didn't find $MYSQL_C_LIB_NAME library in
'$MYSQL_lib_check'])
- fi
-
- case "$MYSQL_C_LIB_DIR" in
- /* ) ;;
- * ) AC_MSG_ERROR([The MySQL library directory
($MYSQL_C_LIB_DIR) must be an absolute path.]) ;;
- esac
-
- AC_MSG_RESULT([$MYSQL_C_LIB_DIR])
-
- case "$MYSQL_C_LIB_DIR" in
- /usr/lib)
- MYSQL_C_LIB_DIR=
- ;;
- *)
- LDFLAGS="$LDFLAGS -L${MYSQL_C_LIB_DIR}"
- ;;
- esac
#
@@ -106,30 +70,60 @@
CPPFLAGS="$CPPFLAGS -I${MYSQL_C_INC_DIR}"
- AC_MSG_CHECKING([if we can link to MySQL C API library directly])
+
+ #
+ # Look for MySQL C API library
+ #
+ AC_MSG_CHECKING([for MySQL C API library directory])
save_LIBS=$LIBS
- LIBS="$LIBS -l$MYSQL_C_LIB_NAME $MYSQLPP_EXTRA_LIBS"
- AC_TRY_LINK(
- [ #include <mysql.h> ],
- [ mysql_store_result(0); ],
- AC_MSG_RESULT([yes]),
- [ AC_MSG_RESULT([no])
- LIBS="$save_LIBS"
- AC_CHECK_HEADERS(zlib.h, AC_CHECK_LIB(z, gzread, [],
- [ AC_MSG_ERROR([zlib not found]) ]))
- AC_MSG_CHECKING([whether adding -lz will let MySQL C API link
succeed])
- MYSQLPP_EXTRA_LIBS="$MYSQLPP_EXTRA_LIBS -lz"
- LIBS="$save_LIBS -l$MYSQL_C_LIB_NAME $MYSQLPP_EXTRA_LIBS"
- AC_TRY_LINK(
- [ #include <mysql.h> ],
- [ mysql_store_result(0); ],
- AC_MSG_RESULT([yes]),
- [ AC_MSG_RESULT([no])
- AC_MSG_ERROR([Unable to link to MySQL client library!])
- ]
- )
- ])
+ MYSQL_C_LIB_DIR=
+ for m in $MYSQL_lib_check
+ do
+ LIBS="$save_LIBS -l$MYSQL_C_LIB_NAME"
+ AC_TRY_LINK(
+ [ #include <mysql.h> ],
+ [ mysql_store_result(0); ],
+ [ AC_MSG_RESULT([$m])
+ MYSQL_C_LIB_DIR=$m
+ break
+ ],
+ [ AC_CHECK_HEADERS(zlib.h, AC_CHECK_LIB(z, gzread, [],
+ [ AC_MSG_ERROR([zlib not found]) ]))
+ AC_MSG_CHECKING([whether adding -lz will let the link
succeed])
+ LIBS="$save_LIBS -l$MYSQL_C_LIB_NAME -lz"
+ AC_TRY_LINK(
+ [ #include <mysql.h> ],
+ [ mysql_store_result(0); ],
+ [ AC_MSG_RESULT([$m])
+ MYSQLPP_EXTRA_LIBS="$MYSQLPP_EXTRA_LIBS -lz"
+ MYSQL_C_LIB_DIR=$m
+ break
+ ],
+ [ ]
+ )
+ ])
+ done
LIBS=$save_LIBS
+
+ if test -z "$MYSQL_C_LIB_DIR"
+ then
+ AC_MSG_RESULT([no joy])
+ AC_MSG_ERROR([Didn't find $MYSQL_C_LIB_NAME library in
'$MYSQL_lib_check'])
+ fi
+
+ case "$MYSQL_C_LIB_DIR" in
+ /* ) ;;
+ * ) AC_MSG_ERROR([The MySQL library directory
($MYSQL_C_LIB_DIR) must be an absolute path.]) ;;
+ esac
+
+ case "$MYSQL_C_LIB_DIR" in
+ /usr/lib)
+ MYSQL_C_LIB_DIR=
+ ;;
+ *)
+ LDFLAGS="$LDFLAGS -L${MYSQL_C_LIB_DIR}"
+ ;;
+ esac
AC_SUBST(MYSQL_C_INC_DIR)
AC_SUBST(MYSQL_C_LIB_DIR)
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits