Mercurial > repos > ktnyt > gembassy
comparison GEMBASSY-1.0.3/m4/mysql.m4 @ 2:8947fca5f715 draft default tip
Uploaded
author | ktnyt |
---|---|
date | Fri, 26 Jun 2015 05:21:44 -0400 |
parents | 84a17b3fad1f |
children |
comparison
equal
deleted
inserted
replaced
1:84a17b3fad1f | 2:8947fca5f715 |
---|---|
1 dnl -*- Autoconf -*- | |
2 ##### http://autoconf-archive.cryp.to/ax_lib_mysql.html | |
3 # | |
4 # SYNOPSIS | |
5 # | |
6 # AX_LIB_MYSQL([MINIMUM-VERSION]) | |
7 # | |
8 # DESCRIPTION | |
9 # | |
10 # This macro provides tests of availability of MySQL 'libmysqlclient' | |
11 # library of particular version or newer. | |
12 # | |
13 # AX_LIB_MYSQL macro takes only one argument which is optional. | |
14 # If there is no required version passed, then macro does not run | |
15 # version test. | |
16 # | |
17 # The --with-mysql option takes one of three possible values: | |
18 # | |
19 # no - do not check for MySQL client library | |
20 # | |
21 # yes - do check for MySQL library in standard locations | |
22 # (mysql_config should be in the PATH) | |
23 # | |
24 # path - complete path to mysql_config utility, use this option if | |
25 # mysql_config can't be found in the PATH | |
26 # | |
27 # This macro calls: | |
28 # | |
29 # AC_SUBST([MYSQL_CFLAGS]) | |
30 # AC_SUBST([MYSQL_CPPFLAGS]) | |
31 # AC_SUBST([MYSQL_LDFLAGS]) | |
32 # AC_SUBST([MYSQL_VERSION]) | |
33 # | |
34 # And sets: | |
35 # | |
36 # HAVE_MYSQL | |
37 # | |
38 # LAST MODIFICATION | |
39 # | |
40 # 2006-07-16 | |
41 # 2007-01-09 MKS: mysql_config --cflags may set gcc -fomit-frame-pointers, | |
42 # which prevents gdb from displaying stack traces. | |
43 # Changed mysql_config --cflags to mysql_config --include | |
44 # 2009-09-23 AJB: Checking for availability of both, include files and | |
45 # library files. | |
46 # 2010-06-14 MKS: Added MYSQL_CPPFLAGS | |
47 # 2011-08-01 MKS: Made test constructs more portable | |
48 # | |
49 # COPYLEFT | |
50 # | |
51 # Copyright (c) 2006 Mateusz Loskot <mateusz@loskot.net> | |
52 # | |
53 # Copying and distribution of this file, with or without | |
54 # modification, are permitted in any medium without royalty provided | |
55 # the copyright notice and this notice are preserved. | |
56 | |
57 AC_DEFUN([AX_LIB_MYSQL], | |
58 [ | |
59 MYSQL_CFLAGS="" | |
60 MYSQL_CPPFLAGS="" | |
61 MYSQL_LDFLAGS="" | |
62 MYSQL_CONFIG="" | |
63 MYSQL_VERSION="" | |
64 | |
65 AC_ARG_WITH([mysql], | |
66 [AS_HELP_STRING([--with-mysql@<:@=ARG@:>@], | |
67 [use MySQL client library @<:@default=yes@:>@, optionally specify path to mysql_config])], | |
68 [ | |
69 AS_IF([test "x${withval}" = "xno"], | |
70 [want_mysql="no"], | |
71 [test "x${withval}" = "xyes"], | |
72 [want_mysql="yes"], | |
73 [ | |
74 want_mysql="yes" | |
75 MYSQL_CONFIG="${withval}" | |
76 ]) | |
77 ], | |
78 [want_mysql="yes"]) | |
79 | |
80 dnl | |
81 dnl Check MySQL libraries (libmysqlclient) | |
82 dnl | |
83 | |
84 AS_IF([test "x${want_mysql}" = "xyes"], | |
85 [ | |
86 AS_IF([test -z "${MYSQL_CONFIG}" -o test], | |
87 [AC_PATH_PROG([MYSQL_CONFIG], [mysql_config], [no])]) | |
88 | |
89 AS_IF([test "x${MYSQL_CONFIG}" != "xno"], | |
90 [ | |
91 AC_MSG_CHECKING([for MySQL libraries]) | |
92 | |
93 MYSQL_CFLAGS="`${MYSQL_CONFIG} --cflags`" | |
94 MYSQL_CPPFLAGS="`${MYSQL_CONFIG} --include`" | |
95 MYSQL_LDFLAGS="`${MYSQL_CONFIG} --libs`" | |
96 | |
97 MYSQL_VERSION=`${MYSQL_CONFIG} --version` | |
98 | |
99 dnl It isn't enough to just test for mysql_config as Fedora | |
100 dnl provides it in the mysql RPM even though mysql-devel may | |
101 dnl not be installed | |
102 | |
103 EMBCPPFLAGS="${CPPFLAGS}" | |
104 EMBLDFLAGS="${LDFLAGS}" | |
105 | |
106 CPPFLAGS="${MYSQL_CPPFLAGS} ${EMBCPPFLAGS}" | |
107 LDFLAGS="${MYSQL_LDFLAGS} ${EMBLDFLAGS}" | |
108 | |
109 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> | |
110 #include "mysql.h"]], | |
111 [[mysql_info(NULL)]])], | |
112 [havemysql="yes"], | |
113 [havemysql="no"]) | |
114 | |
115 CPPFLAGS="${EMBCPPFLAGS}" | |
116 LDFLAGS="${EMBLDFLAGS}" | |
117 | |
118 AS_IF([test "x${havemysql}" = "xyes"], | |
119 [ | |
120 AC_DEFINE([HAVE_MYSQL], [1], | |
121 [Define to 1 if MySQL libraries are available.]) | |
122 found_mysql="yes" | |
123 AC_MSG_RESULT([yes]) | |
124 ], | |
125 [ | |
126 MYSQL_CFLAGS="" | |
127 MYSQL_CPPFLAGS="" | |
128 MYSQL_LDFLAGS="" | |
129 found_mysql="no" | |
130 AC_MSG_RESULT([no]) | |
131 ]) | |
132 ], | |
133 [ | |
134 found_mysql="no" | |
135 ]) | |
136 ]) | |
137 | |
138 dnl | |
139 dnl Check if required version of MySQL is available | |
140 dnl | |
141 | |
142 mysql_version_req=ifelse([$1], [], [], [$1]) | |
143 | |
144 AS_IF([test "x${found_mysql}" = "xyes" -a -n "${mysql_version_req}"], | |
145 [ | |
146 AC_MSG_CHECKING([if MySQL version is >= ${mysql_version_req}]) | |
147 | |
148 dnl Decompose required version string of MySQL | |
149 dnl and calculate its number representation | |
150 | |
151 mysql_version_req_major=`expr ${mysql_version_req} : '\([[0-9]]*\)'` | |
152 mysql_version_req_minor=`expr ${mysql_version_req} : '[[0-9]]*\.\([[0-9]]*\)'` | |
153 mysql_version_req_micro=`expr ${mysql_version_req} : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` | |
154 | |
155 AS_IF([test "x${mysql_version_req_micro}" = "x"], | |
156 [mysql_version_req_micro="0"]) | |
157 | |
158 mysql_version_req_number=`expr ${mysql_version_req_major} \* 1000000 \ | |
159 \+ ${mysql_version_req_minor} \* 1000 \ | |
160 \+ ${mysql_version_req_micro}` | |
161 | |
162 dnl Decompose version string of installed MySQL | |
163 dnl and calculate its number representation | |
164 | |
165 mysql_version_major=`expr ${MYSQL_VERSION} : '\([[0-9]]*\)'` | |
166 mysql_version_minor=`expr ${MYSQL_VERSION} : '[[0-9]]*\.\([[0-9]]*\)'` | |
167 mysql_version_micro=`expr ${MYSQL_VERSION} : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` | |
168 | |
169 AS_IF([test "x${mysql_version_micro}" = "x"], | |
170 [mysql_version_micro="0"]) | |
171 | |
172 mysql_version_number=`expr ${mysql_version_major} \* 1000000 \ | |
173 \+ ${mysql_version_minor} \* 1000 \ | |
174 \+ ${mysql_version_micro}` | |
175 | |
176 mysql_version_check=`expr ${mysql_version_number} \>\= ${mysql_version_req_number}` | |
177 | |
178 AS_IF([test "x${mysql_version_check}" = "x1"], | |
179 [AC_MSG_RESULT([yes])], | |
180 [AC_MSG_RESULT([no])]) | |
181 ]) | |
182 | |
183 AC_SUBST([MYSQL_CFLAGS]) | |
184 AC_SUBST([MYSQL_CPPFLAGS]) | |
185 AC_SUBST([MYSQL_LDFLAGS]) | |
186 AC_SUBST([MYSQL_VERSION]) | |
187 ]) |