diff options
Diffstat (limited to 'scripts/mysql_config.sh')
-rw-r--r-- | scripts/mysql_config.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh index b2a09173760..31e3ed42e0a 100644 --- a/scripts/mysql_config.sh +++ b/scripts/mysql_config.sh @@ -18,11 +18,62 @@ # This script reports various configuration settings that may be needed # when using the MySQL client library. +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" +} + +# +# 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 + +fix_path () +{ + var=$1 + shift + for filename + do + path=$basedir/$filename + if [ -d "$path" ] ; + then + eval "$var"=$path + return + fi + done +} + +abs_path=`expr \( substr $0 1 1 \) = '/'` +if [ "x$abs_path" = "x1" ] ; then + me=$0 +else + me=`which $0` +fi + +basedir=`echo $me | sed -e 's;/bin/mysql_config;;'` + ldata='@localstatedir@' execdir='@libexecdir@' bindir='@bindir@' pkglibdir='@pkglibdir@' +fix_path pkglibdir lib/mysql lib pkgincludedir='@pkgincludedir@' +fix_path pkgincludedir include/mysql include version='@VERSION@' socket='@MYSQL_UNIX_ADDR@' port='@MYSQL_TCP_PORT@' |