#!/bin/bash
# Directory of this script.
DIR=`dirname $0`
# Create symlink to PCRE library if it's not a Debian based distribution.
if [ ! -e /etc/debian_version ]; then
    LOCAL=$DIR/lib/libpcre.so.3
    # Symlink does not exist.
    if [ ! -e $LOCAL ]; then
        # Search for PCRE library and symlink it if found.
        for dir in /lib32 /lib /usr/lib32 /usr/lib; do
            if [ -e $dir/libpcre.so.0 ]; then
                ln -s $dir/libpcre.so.0 $LOCAL
                break
            elif [ -e $dir/libpcreposix.so.0 ]; then
                ln -s $dir/libpcreposix.so.0 $LOCAL
                break
            fi
        done
    fi
fi
# Launch.
LD_LIBRARY_PATH=$DIR/lib $DIR/lib/mj-bin $DIR/lib $DIR/res 
