2000-07-31 21:29:14 +02:00
#!/bin/sh
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# This script reports various configuration settings that may be needed
# when using the MySQL client library.
2001-12-02 03:37:30 +01:00
which ( )
{
IFS = " ${ IFS = } " ; save_ifs = " $IFS " ; IFS = ':'
for file
do
for dir in $PATH
do
if test -f $dir /$file
then
echo " $dir / $file "
continue 2
fi
done
echo " which: no $file in ( $PATH ) "
exit 1
done
IFS = " $save_ifs "
}
2001-12-05 22:56:56 +01:00
#
# If we can find the given directory relatively to where mysql_config is
# we should use this instead of the incompiled one.
# This is to ensure that this script also works with the binary MySQL
# version
2001-12-02 03:37:30 +01:00
fix_path ( )
{
2001-12-05 22:56:56 +01:00
var = $1
shift
for filename
do
path = $basedir /$filename
if [ -d " $path " ] ;
then
eval " $var " = $path
return
fi
done
2001-12-02 03:37:30 +01:00
}
2002-01-17 23:43:50 +01:00
get_full_path ( )
{
case $1 in
/*) echo " $1 " ; ;
2003-09-28 21:35:47 +02:00
./*) tmp = ` pwd ` /$1 ; echo $tmp | sed -e 's;/\./;/;' ; ;
2002-01-17 23:43:50 +01:00
*) which $1 ; ;
esac
}
me = ` get_full_path $0 `
2001-12-02 03:37:30 +01:00
basedir = ` echo $me | sed -e 's;/bin/mysql_config;;' `
2000-07-31 21:29:14 +02:00
ldata = '@localstatedir@'
execdir = '@libexecdir@'
bindir = '@bindir@'
pkglibdir = '@pkglibdir@'
2001-12-05 22:56:56 +01:00
fix_path pkglibdir lib/mysql lib
2000-07-31 21:29:14 +02:00
pkgincludedir = '@pkgincludedir@'
2001-12-05 22:56:56 +01:00
fix_path pkgincludedir include/mysql include
2000-07-31 21:29:14 +02:00
version = '@VERSION@'
socket = '@MYSQL_UNIX_ADDR@'
port = '@MYSQL_TCP_PORT@'
ldflags = '@LDFLAGS@'
client_libs = '@CLIENT_LIBS@'
2003-09-23 12:36:01 +02:00
# Create options, without end space
libs = " $ldflags -L $pkglibdir -lmysqlclient $client_libs "
libs = ` echo " $libs " | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;' `
libs_r = " $ldflags -L $pkglibdir -lmysqlclient_r @LIBS@ @openssl_libs@ "
libs_r = ` echo " $libs_r " | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;' `
cflags = " -I $pkgincludedir @CFLAGS@ "
include = " -I $pkgincludedir "
2003-11-16 00:37:54 +01:00
embedded_libs = " $ldflags -L $pkglibdir -lmysqld @LIBS@ @WRAPLIBS@ @innodb_system_libs@ "
2003-09-23 12:36:01 +02:00
embedded_libs = ` echo " $embedded_libs " | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;' `
# Remove some options that a client doesn't have to care about
cflags = ` echo " $cflags " | sed -e 's;\(-DDBUG_OFF\|-DSAFEMALLOC\|-USAFEMALLOC\|-DSAFE_MUTEX\|-DPEDANTIC_SAFEMALLOC\|-DUNIV_MUST_NOT_INLINE\|-DFORCE_INIT_OF_VARS\|-DEXTRA_DEBUG\|-DHAVE_purify\|-O[0-9]\|-W[-A-Za-z]*\) *;;g' | sed -e 's; *\$;;' `
2000-07-31 21:29:14 +02:00
usage ( ) {
cat <<EOF
Usage: $0 [ OPTIONS]
Options:
2001-10-08 03:58:07 +02:00
--cflags [ $cflags ]
2003-09-23 12:36:01 +02:00
--include [ $include ]
2001-10-08 03:58:07 +02:00
--libs [ $libs ]
2003-09-23 12:36:01 +02:00
--libs_r [ $libs_r ]
2001-10-08 03:58:07 +02:00
--socket [ $socket ]
--port [ $port ]
--version [ $version ]
--libmysqld-libs [ $embedded_libs ]
2000-07-31 21:29:14 +02:00
EOF
exit 1
}
2001-05-28 01:45:19 +02:00
if test $# -le 0; then usage; fi
2000-07-31 21:29:14 +02:00
while test $# -gt 0; do
case $1 in
--cflags) echo " $cflags " ; ;
2003-09-23 12:36:01 +02:00
--include) echo " $include " ; ;
2000-07-31 21:29:14 +02:00
--libs) echo " $libs " ; ;
2003-09-23 12:36:01 +02:00
--libs_r) echo " $libs_r " ; ;
2000-07-31 21:29:14 +02:00
--socket) echo " $socket " ; ;
--port) echo " $port " ; ;
--version) echo " $version " ; ;
2002-08-14 10:05:38 +02:00
--embedded-libs | --embedded | --libmysqld-libs) echo " $embedded_libs " ; ;
2000-07-31 21:29:14 +02:00
*) usage ; ;
esac
shift
done
#echo "ldata: '"$ldata"'"
#echo "execdir: '"$execdir"'"
#echo "bindir: '"$bindir"'"
#echo "pkglibdir: '"$pkglibdir"'"
#echo "pkgincludedir: '"$pkgincludedir"'"
#echo "version: '"$version"'"
#echo "socket: '"$socket"'"
#echo "port: '"$port"'"
#echo "ldflags: '"$ldflags"'"
#echo "client_libs: '"$client_libs"'"
exit 0