Skip to content

Commit

Permalink
Resolving Issue #76 and Configure Issue
Browse files Browse the repository at this point in the history
* Spine unhandled exception signal
* Have configure detect mariadb or mysql and adjust library name
  • Loading branch information
cigamit committed Mar 29, 2019
1 parent 3b8f035 commit 97b039d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
The Cacti Group | spine

1.2.3
-issue#76: Spine unhandled exception signal
-issue: More recent versions of MariaDB require different client library

1.2.2
-feature: release to match Cacti release

Expand Down
15 changes: 11 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ fi
AC_CHECK_LIB(nls, gethostbyname_r)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(m, floor)
AC_CHECK_LIB(dl, dlclose)
AC_CHECK_LIB(pthread, pthread_exit)

# Some builds of MySQL require libz - try to detect
Expand Down Expand Up @@ -259,21 +260,27 @@ for i in $MYSQL_DIR /usr /usr/local /opt /opt/mysql /usr/pkg /usr/local/mysql; d
MYSQL_LIB_CHK($i/lib/mysql)
done

AC_PATH_PROG([MARIADB], [mariadb_config], [])

if test -n "$MYSQL_LIB_DIR" ; then
LDFLAGS="-L$MYSQL_LIB_DIR $LDFLAGS"
fi
CFLAGS="-I$MYSQL_INC_DIR $CFLAGS"

if test $MYSQL_REENTRANT = 1 ; then
LIBS="-lmysqlclient_r $LIBS"
LIBS="-lmysqlclient_r -lm -ldl $LIBS"
else
if test -f $MYSQL_LIB_DIR/libmysqlclient_r.a -o -f $MYSQL_LIB_DIR/libmysqlclient_r.$ShLib; then
LIBS="-lmysqlclient_r $LIBS"
LIBS="-lmysqlclient_r -lm -ldl $LIBS"
else
if test -f $MYSQL_LIB_DIR/libmysqlclient_r.a -o -f $MYSQL_LIB_DIR/libmysqlclient_r.$ShLib ; then
LIBS="-lmysqlclient_r $LIBS"
LIBS="-lmysqlclient_r -lm -ldl $LIBS"
else
LIBS="-lmysqlclient $LIBS"
if test "x$MARIADB" != "x"; then
LIBS="-lmariadbclient -lm -ldl $LIBS"
else
LIBS="-lmysqlclient -lm -ldl $LIBS"
fi
fi
fi
fi
Expand Down
4 changes: 3 additions & 1 deletion sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,9 @@ void db_connect(int type, MYSQL *mysql) {
*
*/
void db_disconnect(MYSQL *mysql) {
mysql_close(mysql);
if (mysql != NULL) {
mysql_close(mysql);
}
}

/*! \fn int append_hostrange(char *obuf, const char *colname, const config_t *set)
Expand Down

0 comments on commit 97b039d

Please sign in to comment.