2
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
# This script reports various configuration settings that may be needed
19
# when using the MySQL client library.
23
IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
34
echo "which: no $file in ($PATH)"
41
# If we can find the given directory relatively to where mysql_config is
42
# we should use this instead of the incompiled one.
43
# This is to ensure that this script also works with the binary MySQL
52
path=$basedir/$filename
65
# if the file is a symlink, try to resolve it
68
file=`ls -l $file | awk '{ print $NF }'`
73
*/*) tmp=`pwd`/$file; echo $tmp | sed -e 's;/\./;/;' ;;
80
basedir=`echo $me | sed -e 's;/bin/mysql_config;;'`
82
ldata='@localstatedir@'
83
execdir='@libexecdir@'
86
# If installed, search for the compiled in directory first (might be "lib64")
87
pkglibdir='@pkglibdir@'
88
pkglibdir_rel=`echo $pkglibdir | sed -e "s;^$basedir/;;"`
89
fix_path pkglibdir $pkglibdir_rel lib/mysql lib
91
pkgincludedir='@pkgincludedir@'
92
fix_path pkgincludedir include/mysql include
95
socket='@MYSQL_UNIX_ADDR@'
96
port='@MYSQL_TCP_PORT@'
100
# We intentionally add a space to the beginning and end of lib strings, simplifies replace later
101
libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
102
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
103
libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
104
embedded_libs=" $ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ "
106
cflags="-I$pkgincludedir @CFLAGS@ " #note: end space!
107
include="-I$pkgincludedir"
109
# Remove some options that a client doesn't have to care about
110
# FIXME until we have a --cxxflags, we need to remove -Xa
111
# and -xstrconst to make --cflags usable for Sun Forte C++
112
for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
113
DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
114
DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
115
Xa xstrconst "xc99=none" \
116
unroll2 ip mp restrict
118
# The first option we might strip will always have a space before it because
119
# we set -I$pkgincludedir as the first option
120
cflags=`echo "$cflags"|sed -e "s/ -$remove */ /g"`
122
cflags=`echo "$cflags"|sed -e 's/ *\$//'`
124
# Same for --libs(_r)
125
for remove in lmtmalloc static-libcxa i-static
127
# We know the strings starts with a space
128
libs=`echo "$libs"|sed -e "s/ -$remove */ /g"`
129
libs_r=`echo "$libs_r"|sed -e "s/ -$remove */ /g"`
130
embedded_libs=`echo "$embedded_libs"|sed -e "s/ -$remove */ /g"`
133
# Strip trailing and ending space if any, and '+' (FIXME why?)
134
libs=`echo "$libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
135
libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
136
embedded_libs=`echo "$embedded_libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
149
--libmysqld-libs [$embedded_libs]
154
if test $# -le 0; then usage; fi
156
while test $# -gt 0; do
158
--cflags) echo "$cflags" ;;
159
--include) echo "$include" ;;
160
--libs) echo "$libs" ;;
161
--libs_r) echo "$libs_r" ;;
162
--socket) echo "$socket" ;;
163
--port) echo "$port" ;;
164
--version) echo "$version" ;;
165
--embedded-libs | --embedded | --libmysqld-libs) echo "$embedded_libs" ;;
172
#echo "ldata: '"$ldata"'"
173
#echo "execdir: '"$execdir"'"
174
#echo "bindir: '"$bindir"'"
175
#echo "pkglibdir: '"$pkglibdir"'"
176
#echo "pkgincludedir: '"$pkgincludedir"'"
177
#echo "version: '"$version"'"
178
#echo "socket: '"$socket"'"
179
#echo "port: '"$port"'"
180
#echo "ldflags: '"$ldflags"'"
181
#echo "client_libs: '"$client_libs"'"