diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-03-17 14:07:34 (GMT) |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-03-17 14:07:34 (GMT) |
commit | 2db2f402a3bb0c948667c1401b733014fe90a718 (patch) | |
tree | d389192fa3385893f2c4492a98db6ef4790efd32 /configure.in | |
parent | 2b10c19323e2415433db55ac4bfa0604294fa43d (diff) | |
download | monitoring-plugins-2db2f402a3bb0c948667c1401b733014fe90a718.tar.gz |
mysql detection cleanup: fixes runtime linking, autodetection of main
locations, detection of lib64 and different layouts
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1327 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 87 |
1 files changed, 56 insertions, 31 deletions
diff --git a/configure.in b/configure.in index d1ef954..e02dc89 100644 --- a/configure.in +++ b/configure.in | |||
@@ -253,49 +253,72 @@ else | |||
253 | fi | 253 | fi |
254 | LIBS="$_SAVEDLIBS" | 254 | LIBS="$_SAVEDLIBS" |
255 | 255 | ||
256 | |||
257 | dnl Check for mysql libraries | 256 | dnl Check for mysql libraries |
258 | _SAVEDLIBS="$LIBS" | 257 | _SAVEDLIBS="$LIBS" |
259 | _SAVEDCPPFLAGS="$CPPFLAGS" | 258 | _SAVEDCPPFLAGS="$CPPFLAGS" |
259 | FOUNDMYSQL="no" | ||
260 | AC_ARG_WITH(mysql, | 260 | AC_ARG_WITH(mysql, |
261 | ACX_HELP_STRING([--with-mysql=DIR], | 261 | ACX_HELP_STRING([--with-mysql=DIR], |
262 | [sets path to mysql installation (assumes lib/mysql and include subdirs]), | 262 | [sets path to mysql installation (assumes lib/lib64 and include subdirs)]), |
263 | MYSQL=$withval,) | 263 | MYSQL=$withval,) |
264 | # Find the mysql client libs | ||
264 | if test -n "$MYSQL"; then | 265 | if test -n "$MYSQL"; then |
266 | MYSQLLIBDIR=$MYSQL/lib | ||
267 | MYSQLLIB64DIR=$MYSQL/lib64 | ||
268 | elif test -f /usr/lib/libmysqlclient.so -o -f /usr/lib/libmysqlclient.a ; then | ||
269 | MYSQL="/usr" | ||
270 | MYSQLLIBDIR=$MYSQL/lib | ||
271 | MYSQLLIB64DIR=$MYSQL/lib64 | ||
272 | elif test -f /usr/lib/mysql/libmysqlclient.so -o -f /usr/lib/mysql/libmysqlclient.a ; then | ||
273 | MYSQL="/usr" | ||
265 | MYSQLLIBDIR=$MYSQL/lib/mysql | 274 | MYSQLLIBDIR=$MYSQL/lib/mysql |
266 | CPPFLAGS="-I$MYSQL/include" | 275 | MYSQLLIB64DIR=$MYSQL/lib64/mysql |
267 | AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR " check_mysql_query_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz) | 276 | elif test -f /usr/local/lib/libmysqlclient.so -o -f /usr/local/lib/libmysqlclient.a ; then |
268 | AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient") | 277 | MYSQL="/usr/local" |
269 | elif test -f /usr/lib/libmysqlclient.so; then | 278 | MYSQLLIBDIR=$MYSQL/lib |
270 | AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz) | 279 | MYSQLLIB64DIR=$MYSQL/lib64 |
271 | AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient") | 280 | elif test -f /usr/local/lib/mysql/libmysqlclient.so -o -f /usr/local/lib/mysql/libmysqlclient.a ; then |
272 | elif test -f /usr/lib/libmysqlclient.a; then | 281 | MYSQL="/usr/local" |
282 | MYSQLLIBDIR=$MYSQL/lib/mysql | ||
283 | MYSQLLIB64DIR=$MYSQL/lib64/mysql | ||
284 | elif test -f /usr/local/mysql/lib/libmysqlclient.so -o -f /usr/local/mysql/lib/libmysqlclient.a ; then | ||
285 | MYSQL="/usr/local/mysql" | ||
286 | MYSQLLIBDIR=$MYSQL/lib | ||
287 | MYSQLLIB64DIR=$MYSQL/lib64 | ||
288 | fi | ||
289 | |||
290 | # Check libs okay | ||
291 | if test -n "$MYSQL" ; then | ||
292 | CPPFLAGS="-L$MYSQLLIBDIR -L$MYSQLLIB64DIR" | ||
273 | AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz) | 293 | AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz) |
274 | AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient") | 294 | AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient") |
275 | elif test -f /usr/lib/mysql/libmysqlclient.so; then | ||
276 | AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql" check_mysql_query_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz) | ||
277 | AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql" check_mysql_query_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql) | ||
278 | elif test -f /usr/lib/mysql/libmysqlclient.a; then | ||
279 | AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L/usr/lib/mysql" check_mysql_query_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql -lz) | ||
280 | AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql" check_mysql_query_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql) | ||
281 | fi | 295 | fi |
296 | |||
297 | # Check headers okay | ||
282 | if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then | 298 | if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then |
283 | AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" ) | 299 | CPPFLAGS="-I$MYSQL/include" |
284 | if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then | 300 | AC_CHECK_HEADERS(mysql.h errmsg.h, FOUNDMYSQL="yes" MYSQLINCLUDE="-I$MYSQL/include") |
285 | EXTRAS="$EXTRAS check_mysql check_mysql_query" | 301 | if test x"$FOUNDMYSQL" != x"yes" ; then |
286 | AC_SUBST(MYSQLINCLUDE) | 302 | AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, FOUNDMYSQL="yes" MYSQLINCLUDE="-I$MYSQL/include/mysql") |
287 | AC_SUBST(MYSQLLIBS) | 303 | fi |
288 | AC_SUBST(check_mysql_LDFLAGS) | 304 | fi |
289 | AC_SUBST(check_mysql_query_LDFLAGS) | 305 | |
290 | else | 306 | # Setup mysql plugins |
291 | AC_MSG_WARN([Skipping mysql plugin]) | 307 | if test $FOUNDMYSQL = "yes" ; then |
292 | AC_MSG_WARN([install mysql client headers to compile this plugin (see REQUIREMENTS).]) | 308 | EXTRAS="$EXTRAS check_mysql check_mysql_query" |
309 | if test -d $MYSQLLIB64DIR ; then | ||
310 | MYSQLLIBS="-L$MYSQLLIB64DIR -rpath $MYSQLLIB64DIR $MYSQLLIBS" | ||
311 | fi | ||
312 | if test -d $MYSQLLIBDIR ; then | ||
313 | MYSQLLIBS="-L$MYSQLLIBDIR -rpath $MYSQLLIBDIR $MYSQLLIBS" | ||
293 | fi | 314 | fi |
315 | AC_SUBST(MYSQLINCLUDE) | ||
316 | AC_SUBST(MYSQLLIBS) | ||
294 | else | 317 | else |
295 | AC_MSG_WARN([Skipping mysql plugin]) | 318 | AC_MSG_WARN([Skipping mysql plugin]) |
296 | AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).]) | 319 | AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).]) |
297 | fi | 320 | fi |
298 | CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE" | 321 | CPPFLAGS="$_SAVEDCPPFLAGS" |
299 | LIBS="$_SAVEDLIBS" | 322 | LIBS="$_SAVEDLIBS" |
300 | 323 | ||
301 | AC_CHECK_HEADERS(unistd.h) | 324 | AC_CHECK_HEADERS(unistd.h) |
@@ -442,7 +465,7 @@ fi | |||
442 | 465 | ||
443 | 466 | ||
444 | dnl openssl detection/configuration | 467 | dnl openssl detection/configuration |
445 | if ! test "$with_openssl" = "no"; then | 468 | if ! test x"$with_openssl" = x"no"; then |
446 | dnl Check for OpenSSL location if it wasn't already specified | 469 | dnl Check for OpenSSL location if it wasn't already specified |
447 | if ! test -d "$with_openssl"; then | 470 | if ! test -d "$with_openssl"; then |
448 | for d in $OPENSSL_DIRS; do | 471 | for d in $OPENSSL_DIRS; do |
@@ -456,18 +479,20 @@ if ! test "$with_openssl" = "no"; then | |||
456 | _SAVEDLDFLAGS="$LDFLAGS" | 479 | _SAVEDLDFLAGS="$LDFLAGS" |
457 | dnl Check for OpenSSL header files | 480 | dnl Check for OpenSSL header files |
458 | unset FOUNDINCLUDE | 481 | unset FOUNDINCLUDE |
459 | CPPFLAGS="$CPPFLAGS -I$OPENSSL/include" | 482 | if test x"$with_openssl" != x"/usr" ; then |
460 | LDFLAGS="$LDFLAGS -R$OPENSSL/lib" | 483 | CPPFLAGS="$CPPFLAGS -I$with_openssl/include" |
484 | LDFLAGS="$LDFLAGS -R$with_openssl/lib" | ||
485 | fi | ||
461 | 486 | ||
462 | dnl check for openssl in $dir/include/openssl | 487 | dnl check for openssl in $dir/include/openssl |
463 | AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h, | 488 | AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h, |
464 | SSLINCLUDE="-I$OPENSSL/include" | 489 | SSLINCLUDE="-I$with_openssl/include" |
465 | FOUNDINCLUDE=yes, | 490 | FOUNDINCLUDE=yes, |
466 | FOUNDINCLUDE=no) | 491 | FOUNDINCLUDE=no) |
467 | dnl else check to see if $dir/include has it | 492 | dnl else check to see if $dir/include has it |
468 | if test "$FOUNDINCLUDE" = "no"; then | 493 | if test "$FOUNDINCLUDE" = "no"; then |
469 | AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h, | 494 | AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h, |
470 | SSLINCLUDE="-I$OPENSSL/include" | 495 | SSLINCLUDE="-I$with_openssl/include" |
471 | FOUNDINCLUDE=yes, | 496 | FOUNDINCLUDE=yes, |
472 | FOUNDINCLUDE=no) | 497 | FOUNDINCLUDE=no) |
473 | fi | 498 | fi |