2
# Copyright (C) 2000-2006 MySQL AB
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; version 2 of the License.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
# This script reports various configuration settings that may be needed
18
# when using the MySQL client library.
22
IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
33
echo "which: no $file in ($PATH)"
40
# If we can find the given directory relatively to where mysql_config is
41
# we should use this instead of the incompiled one.
42
# This is to ensure that this script also works with the binary MySQL
51
path=$basedir/$filename
64
# if the file is a symlink, try to resolve it
67
file=`ls -l $file | awk '{ print $NF }'`
72
*/*) tmp=`pwd`/$file; echo $tmp | sed -e 's;/\./;/;' ;;
79
basedir=`echo $me | sed -e 's;/bin/mysql_config;;'`
81
ldata='@localstatedir@'
82
execdir='@libexecdir@'
85
# If installed, search for the compiled in directory first (might be "lib64")
86
pkglibdir='@pkglibdir@'
87
pkglibdir_rel=`echo $pkglibdir | sed -e "s;^$basedir/;;"`
88
fix_path pkglibdir $pkglibdir_rel lib/mysql lib
90
plugindir='@pkgplugindir@'
92
pkgincludedir='@pkgincludedir@'
93
fix_path pkgincludedir include/mysql include
96
socket='@MYSQL_UNIX_ADDR@'
99
if [ @MYSQL_TCP_PORT_DEFAULT@ -eq 0 ]; then
102
port=@MYSQL_TCP_PORT@
106
# We intentionally add a space to the beginning and end of lib strings, simplifies replace later
107
libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
108
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
109
libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
110
embedded_libs=" $ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ "
112
if [ -r "$pkglibdir/libmygcc.a" ]; then
113
# When linking against the static library with a different version of GCC
114
# from what was used to compile the library, some symbols may not be defined
115
# automatically. We package the libmygcc.a from the build host, to provide
116
# definitions for those. Bugs 4921, 19561, 19817, 21158, etc.
117
libs="$libs -lmygcc "
118
libs_r="$libs_r -lmygcc "
119
embedded_libs="$embedded_libs -lmygcc "
122
cflags="-I$pkgincludedir @CFLAGS@ " #note: end space!
123
include="-I$pkgincludedir"
125
# Remove some options that a client doesn't have to care about
126
# FIXME until we have a --cxxflags, we need to remove -Xa
127
# and -xstrconst to make --cflags usable for Sun Forte C++
128
# FIXME until we have a --cxxflags, we need to remove -AC99
129
# to make --cflags usable for HP C++ (aCC)
130
for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
131
DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
132
DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
133
'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \
134
Xa xstrconst "xc99=none" AC99 \
135
unroll2 ip mp restrict
137
# The first option we might strip will always have a space before it because
138
# we set -I$pkgincludedir as the first option
139
cflags=`echo "$cflags"|sed -e "s/ -$remove */ /g"`
141
cflags=`echo "$cflags"|sed -e 's/ *\$//'`
143
# Same for --libs(_r)
144
for remove in lmtmalloc static-libcxa i-static static-intel
146
# We know the strings starts with a space
147
libs=`echo "$libs"|sed -e "s/ -$remove */ /g"`
148
libs_r=`echo "$libs_r"|sed -e "s/ -$remove */ /g"`
149
embedded_libs=`echo "$embedded_libs"|sed -e "s/ -$remove */ /g"`
152
# Strip trailing and ending space if any, and '+' (FIXME why?)
153
libs=`echo "$libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
154
libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
155
embedded_libs=`echo "$embedded_libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
165
--plugindir [$plugindir]
169
--libmysqld-libs [$embedded_libs]
174
if test $# -le 0; then usage; fi
176
while test $# -gt 0; do
178
--cflags) echo "$cflags" ;;
179
--include) echo "$include" ;;
180
--libs) echo "$libs" ;;
181
--libs_r) echo "$libs_r" ;;
182
--plugindir) echo "$plugindir" ;;
183
--socket) echo "$socket" ;;
184
--port) echo "$port" ;;
185
--version) echo "$version" ;;
186
--embedded-libs | --embedded | --libmysqld-libs) echo "$embedded_libs" ;;
193
#echo "ldata: '"$ldata"'"
194
#echo "execdir: '"$execdir"'"
195
#echo "bindir: '"$bindir"'"
196
#echo "pkglibdir: '"$pkglibdir"'"
197
#echo "pkgincludedir: '"$pkgincludedir"'"
198
#echo "version: '"$version"'"
199
#echo "socket: '"$socket"'"
200
#echo "port: '"$port"'"
201
#echo "ldflags: '"$ldflags"'"
202
#echo "client_libs: '"$client_libs"'"