]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
configure: Add check for MySQL client bool and my_bool type usage.
authorJoshua C. Colp <jcolp@sangoma.com>
Mon, 16 Dec 2019 12:35:31 +0000 (08:35 -0400)
committerJoshua C. Colp <jcolp@sangoma.com>
Mon, 16 Dec 2019 16:39:12 +0000 (10:39 -0600)
Instead of trying to use the defined MySQL client version from the
header use a configure check to determine whether the bool or my_bool
type should be used for defining a boolean.

ASTERISK-28604

Change-Id: Id2225b3785115de074c50c123ff1a68005b4a9c7

addons/cdr_mysql.c
configure
configure.ac
include/asterisk/autoconfig.h.in

index b613844f8f63dcaae7f63a7f8c665946cabbd9d7..268ce53e9252efe6107ad4a1f976ce6dc90c444b 100644 (file)
@@ -180,9 +180,9 @@ static int mysql_log(struct ast_cdr *cdr)
 {
        struct ast_str *sql1 = ast_str_thread_get(&sql1_buf, 1024), *sql2 = ast_str_thread_get(&sql2_buf, 1024);
        int retries = 5;
-#if MYSQL_VERSION_ID >= 80001
+#ifdef HAVE_MYSQLCLIENT_BOOL
        bool my_bool_true = 1;
-#elif MYSQL_VERSION_ID >= 50013
+#elif HAVE_MYSQLCLIENT_MY_BOOL
        my_bool my_bool_true = 1;
 #endif
 
@@ -480,9 +480,9 @@ static int my_load_module(int reload)
        MYSQL_ROW row;
        MYSQL_RES *result;
        char sqldesc[128];
-#if MYSQL_VERSION_ID >= 80001
+#ifdef HAVE_MYSQLCLIENT_BOOL
        bool my_bool_true = 1;
-#elif MYSQL_VERSION_ID >= 50013
+#elif HAVE_MYSQLCLIENT_MY_BOOL
        my_bool my_bool_true = 1;
 #endif
 
index bb7baa399ad094586029f9f087d7f69f80ec5894..f26d03cd68a81b4a9706a4a490a12c7ba0463fdc 100755 (executable)
--- a/configure
+++ b/configure
@@ -23149,6 +23149,7 @@ fi
 fi
 
 
+
                if test "x${PBX_MYSQLCLIENT}" != "x1" -a "${USE_MYSQLCLIENT}" != "no"; then
                PBX_MYSQLCLIENT=0
                if test -n "$ac_tool_prefix"; then
@@ -23268,6 +23269,61 @@ $as_echo "#define HAVE_MYSQLCLIENT 1" >>confdefs.h
        fi
 
 
+if test "${PBX_MYSQLCLIENT}" = 1; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MySQL client bool support" >&5
+$as_echo_n "checking for MySQL client bool support... " >&6; }
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <mysql/mysql.h>
+int
+main ()
+{
+bool test = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_MYSQLCLIENT_BOOL 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MySQL client my_bool support" >&5
+$as_echo_n "checking for MySQL client my_bool support... " >&6; }
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <mysql/mysql.h>
+int
+main ()
+{
+my_bool test = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_MYSQLCLIENT_MY_BOOL 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+
 
 if test "x${PBX_NBS}" != "x1" -a "${USE_NBS}" != "no"; then
    pbxlibdir=""
index 9b7451715d33c1bfbff0c6284c090777b6d39105..ad8a679fb30127bb83211c2ec34f7a344d10a5ff 100644 (file)
@@ -2264,8 +2264,28 @@ if test "${PBX_MISDN}" = 1; then
    AC_CHECK_MEMBER([Q931_info_t.redirect_dn], [], [PBX_MISDN=0], [#include <mISDNuser/mISDNlib.h>])
 fi
 
+
 AST_EXT_TOOL_CHECK([MYSQLCLIENT], [mysql_config])
 
+if test "${PBX_MYSQLCLIENT}" = 1; then
+   AC_MSG_CHECKING(for MySQL client bool support)
+   AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM([#include <mysql/mysql.h>],
+                   [bool test = 1;])],
+           AC_MSG_RESULT(yes)
+           AC_DEFINE(HAVE_MYSQLCLIENT_BOOL, 1, [Define to 1 if mysql/mysql.h has bool defined.]),
+           AC_MSG_RESULT(no)
+   )
+   AC_MSG_CHECKING(for MySQL client my_bool support)
+   AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM([#include <mysql/mysql.h>],
+                   [my_bool test = 1;])],
+           AC_MSG_RESULT(yes)
+           AC_DEFINE(HAVE_MYSQLCLIENT_MY_BOOL, 1, [Define to 1 if mysql/mysql.h has my_bool defined.]),
+           AC_MSG_RESULT(no)
+   )
+fi
+
 AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
 
 AST_EXT_TOOL_CHECK([NEON], [neon-config])
index 1d036d7216a2c758049a816bc58c0531194a7081..5cf7a10d508ca770e07a5ae99fbfbb52336a113d 100644 (file)
 /* Define if your system has the MYSQLCLIENT libraries. */
 #undef HAVE_MYSQLCLIENT
 
+/* Define to 1 if mysql/mysql.h has bool defined. */
+#undef HAVE_MYSQLCLIENT_BOOL
+
+/* Define to 1 if mysql/mysql.h has my_bool defined. */
+#undef HAVE_MYSQLCLIENT_MY_BOOL
+
 /* Define to 1 if you have the Network Broadcast Sound library. */
 #undef HAVE_NBS