b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder# Licensed to the Apache Software Foundation (ASF) under one or more
ece3b1a5353a9af3c966a1d5453594ed35334f7bJonathan von Schroeder# contributor license agreements. See the NOTICE file distributed with
ece3b1a5353a9af3c966a1d5453594ed35334f7bJonathan von Schroeder# this work for additional information regarding copyright ownership.
ece3b1a5353a9af3c966a1d5453594ed35334f7bJonathan von Schroeder# The ASF licenses this file to You under the Apache License, Version 2.0
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder# (the "License"); you may not use this file except in compliance with
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu Prodescu# the License. You may obtain a copy of the License at
6820f0de92751e29d73d64db48e776591f529a76Christian Maeder# http://www.apache.org/licenses/LICENSE-2.0
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder# Unless required by applicable law or agreed to in writing, software
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder# distributed under the License is distributed on an "AS IS" BASIS,
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder# See the License for the specific language governing permissions and
6820f0de92751e29d73d64db48e776591f529a76Christian Maeder# limitations under the License.
6820f0de92751e29d73d64db48e776591f529a76Christian Maeder# instdso.sh - install Apache DSO modules
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder# we use this instead of libtool --install because:
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder# 1) on a few platforms libtool doesn't install DSOs exactly like we'd
6820f0de92751e29d73d64db48e776591f529a76Christian Maeder# want (weird names, doesn't remove DSO first)
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder# 2) we never want the .la files copied, so we might as well copy
6820f0de92751e29d73d64db48e776591f529a76Christian Maeder# the .so files ourselves
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder echo "too few arguments to instdso.sh"
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder echo "Usage: instdso.sh SH_LIBTOOL-value dso-name [dso-name [...]] path-to-modules"
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von SchroederSH_LIBTOOL=`echo $1 | sed -e 's/^SH_LIBTOOL=//'`
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder DSOARCHIVES="$DSOARCHIVES $TARGETDIR"
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder # on AIX, shared libraries remain in storage even when
c56a356d3fcc5e123efa790aab320781d94df3c7Jonathan von Schroeder # all processes using them have exited; standard practice
c56a356d3fcc5e123efa790aab320781d94df3c7Jonathan von Schroeder # prior to installing a shared library is to rm -f first
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder DSOBASE=`basename $DSOARCHIVE|sed -e 's/\.la$//'`
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder type install >/dev/null 2>&1 && INSTALL_CMD=install || INSTALL_CMD=cp
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von SchroederCMD="$SH_LIBTOOL --mode=install $INSTALL_CMD $DSOARCHIVES $TARGETDIR/"
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder # on OS/2, aplibtool --install doesn't copy the .la files & we can't
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder # rename DLLs to have a .so extension or they won't load so none of the
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder # steps below make sense.
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von SchroederDSOARCHIVE_BASENAME=`basename $DSOARCHIVE`
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von SchroederDSOBASE=`echo $DSOARCHIVE_BASENAME | sed -e 's/\.la$//'`
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroederif test -s "$TARGETDIR/$DSOARCHIVE_BASENAME"
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder DLNAME=`sed -n "/^dlname=/{s/.*='\([^']*\)'/\1/;p;}" $TARGETDIR/$DSOARCHIVE_BASENAME`
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder LIBRARY_NAMES=`sed -n "/^library_names/{s/library_names='\([^']*\)'/\1/;p;}" $TARGETDIR/$DSOARCHIVE_BASENAME`
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder LIBRARY_NAMES=`echo $LIBRARY_NAMES | sed -e "s/ *$DLNAME//g"`
ece3b1a5353a9af3c966a1d5453594ed35334f7bJonathan von Schroeder echo "Warning! dlname not found in $TARGETDIR/$DSOARCHIVE_BASENAME."
b35e053c2c5a5ea0f13decfd0303894861d82b4dJonathan von Schroeder echo "Assuming installing a .so rather than a libtool archive."