xref: /AOO41X/main/solenv/bin/checkdll.sh (revision fce70c9b1863fe300e8801c2641199f45790049a)
1#! /bin/sh
2#**************************************************************
3#
4#  Licensed to the Apache Software Foundation (ASF) under one
5#  or more contributor license agreements.  See the NOTICE file
6#  distributed with this work for additional information
7#  regarding copyright ownership.  The ASF licenses this file
8#  to you under the Apache License, Version 2.0 (the
9#  "License"); you may not use this file except in compliance
10#  with the License.  You may obtain a copy of the License at
11#
12#    http://www.apache.org/licenses/LICENSE-2.0
13#
14#  Unless required by applicable law or agreed to in writing,
15#  software distributed under the License is distributed on an
16#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17#  KIND, either express or implied.  See the License for the
18#  specific language governing permissions and limitations
19#  under the License.
20#
21#**************************************************************
22# checkdll.sh - execute checkdll with all -L arguments to this script
23#               prepended to LD_LIBRARY_PATH
24
25set -- `getopt "L:" "$@"` ||  {
26    echo "Usage: `basename $0` [-L library_path] <shared_library>" 1>&2
27    exit 1
28}
29
30checkdll="$SOLARVERSION/$INPATH/bin$UPDMINOREXT/checkdll"
31
32if [ -x $checkdll ]; then
33    while :
34    do
35    case $1 in
36        -L) shift; option=$1;;
37        --) break;;
38    esac
39    case "${libpath:+X}" in
40        X) libpath=$libpath:$option;;
41        *) libpath=$option;;
42    esac
43    shift
44    done
45    shift  # remove the trailing ---
46
47    case `uname -s` in
48    Darwin) case "${DYLD_LIBRARY_PATH:+X}" in
49        X) DYLD_LIBRARY_PATH=$libpath:$DYLD_LIBRARY_PATH;;
50        *) DYLD_LIBRARY_PATH=$libpath;;
51        esac
52        export DYLD_LIBRARY_PATH;;
53    *)  case "${LD_LIBRARY_PATH:+X}" in
54        X) LD_LIBRARY_PATH=$libpath:$LD_LIBRARY_PATH;;
55        *) LD_LIBRARY_PATH=$libpath;;
56        esac
57        export LD_LIBRARY_PATH;;
58    esac
59
60    $checkdll "$@"
61    if [ $? -ne 0 ]; then exit 1 ; fi
62
63    for parameter in $*; do
64        library=$parameter;
65    done
66    realname=`echo $library | sed "s/check_//"`
67    if [ $library != $realname ]; then
68        LD_LIBRARY_PATH=
69        export LD_LIBRARY_PATH
70        mv $library $realname
71    fi
72else
73    echo "WARNING: checkdll not found!" 1>&2
74fi
75
76exit 0
77
78