Remove building with NOCRYPTO option
[minix.git] / lib / checkvers
blobebf27ff305476541066f78ac5838cc82cc53d0c3
1 #!/bin/ksh
2 # $NetBSD: checkvers,v 1.7 2008/04/30 13:10:50 martin Exp $
4 # Copyright (c) 1998 The NetBSD Foundation, Inc.
5 # All rights reserved.
7 # This code is derived from software contributed to The NetBSD Foundation
8 # by Eric Haszlakiewicz.
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions
12 # are met:
13 # 1. Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 # 2. Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in the
17 # documentation and/or other materials provided with the distribution.
19 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
32 #--------------------------------------------------------------------#
33 # checkvers [-q] [systemlibdir [library name]]
35 # This is a wrapper script around checkver. It will find
36 # all directories withing the current directory containing
37 # a shlib_version file and call checkver for each.
39 # As with checkver, a list of directories of installed libraries
40 # may be specified. This will replace the default of "/usr/lib"
41 # and search there instead.
43 # A library name may also be specified. However, this script
44 # will not work correctly if it finds shlib_version files
45 # corresponding to a different library.
47 # This script produces no output if all library version are ok.
48 # If the versions aren't ok the header will be displayed once
49 # followed by a list of problematic libraries.
52 # checkvers:
53 # if "-s", build list, pass with -f to checkver.
54 # if "-d", build list, pass with -f to checkver.
55 # if "-f", pass with -f to checkver.
58 # Cleanup on exit.
59 TMP=/tmp/checkvers.$$
60 trap "exit 2" 1 2 3 4 5 6 7 8 10 11 12 13 14 15
61 trap "rm -rf $TMP" 0
63 Usage ( ) {
64 echo "Usage: $1 [-q] -d [installedlibdir [library name]]"
65 echo " $1 [-q] -s [setlistdir [library name]]"
66 echo " $1 [-q] -f liblistfile [library name]"
69 basedir=/usr/src
70 setsdir=$basedir/distrib/sets/lists
71 libdir=/usr/lib
73 error=0
74 quiet=0
75 usedir=0
76 usefile=0
77 usesets=0
78 CWD=`pwd`
79 args=`getopt "df:shq" "$@"`
80 if [ $? -ne 0 ] ; then
81 Usage $0
82 exit 0
85 set -- $args
87 while . ; do
88 case "$1" in
89 -d) usedir=1 ; shift
90 if [ $usefile -eq 1 -o $usesets -eq 1 ]; then
91 Usage $0 ; exit 2
92 fi;;
93 -f) usefile=1 ; arg1=$2 ; shift ; shift
94 if [ $usedir -eq 1 -o $usesets -eq 1 ]; then
95 Usage $0 ; exit 2
96 fi;;
97 -s) usesets=1 ; shift
98 if [ $usedir -eq 1 -o $usefile -eq 1 ]; then
99 Usage $0 ; exit 2
100 fi;;
101 -h) Usage $0 ; exit 0;;
102 -q) quiet=1 ; shift;;
103 --) shift ; break;;
104 esac
105 done
107 if [ $usedir -eq 0 -a $usefile -eq 0 -a $usesets -eq 0 ] ; then
108 Usage $0 ; exit 2
110 if [ $usefile -eq 0 -a $# -gt 2 ] ; then
111 Usage $0 ; exit 2
113 if [ $usefile -eq 1 -a $# -gt 1 ] ; then
114 Usage $0 ; exit 2
117 #-------------------------#
119 QUIET=
120 LIBNAME=
122 # Supress header.
123 if [ quiet -eq 1 ] ; then
124 QUIET="-q"
127 if ! mkdir -m 700 $TMP ; then
128 echo "$0: Unable to create temp directory."
129 exit 2
132 if [ $usefile -eq 1 ] ; then
133 # Just pass the file name to checkver.
134 LIBLIST="$arg1"
135 else
136 LIBLIST=$TMP/libs.lst
139 # Build list from the installed libraries.
140 if [ $usedir -eq 1 ] ; then
141 if [ "X$1" != "X" ] ; then
142 libdir="$1"
144 for f in $libdir ; do
145 ls $f/lib*.so.*.*
146 done > $LIBLIST 2> /dev/null
149 # Build list from set lists. Parameter may be either
150 # the "lists" directory or the top of the source tree.
151 if [ $usesets -eq 1 ] ; then
152 if [ "X$1" != "X" ] ; then
153 setsdir="$1"
154 if [ -d "$setsdir/distrib/sets/lists" ] ; then
155 setsdir="$setsdir/distrib/sets/lists"
158 (cd $setsdir ;
159 cat */[a-z]* | grep '^./usr/lib/lib.*\.so\.[0-9][0-9]*\.[0-9][0-9]*' \
160 | sort -u > $LIBLIST
164 if [ "X$2" != "X" ] ; then
165 LIBNAME="$2"
168 EXECDIR=`eval "(cd \`dirname $0\` ; pwd)"`
170 CWD=`pwd`
171 VERFILES=`find $CWD -name shlib_version -print`
173 for f in $VERFILES ; do
174 # Call checkver. We always have a list of libraries
175 # here, whether given to us or built, so always
176 # pass the -f flag.
177 (cd `dirname $f` ;
178 "sh $EXECDIR"/checkver $QUIET -f "$LIBLIST" "$LIBNAME" ;
179 exit $?)
180 ERR=$?
181 if [ $ERR -eq 2 ] ; then
182 echo "$0: checkver failed. LIBLIST=$LIBLIST $LIBNAME=$LIBNAME"
183 exit 2
185 if [ $ERR -ne 0 ] ; then
186 QUIET="-q"
187 error=1
190 if [ "X$LIBNAME" = "X" ] ; then
191 # Build the library name from the directory it's in.
192 libname=`dirname $f`
193 libname=`basename $libname`
194 if ! echo $libname | grep -q "^lib" ; then
195 libname="lib$libname"
197 else
198 libname="$LIBNAME"
201 if [ -e $TMP/$libname ] ; then
202 echo "Warning: $libname sources encountered multiple times."
203 echo " Previous location: `cat $TMP/$libname`"
204 echo " Current location: `dirname $f`"
206 echo "`dirname $f`" > $TMP/$libname
208 done
210 exit $error