Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
1 #!/bin/sh
2 ##
3 ## rpm-config -- OpenPKG RPM Library Build Utility
4 ## Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
5 ##
6 ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
7 ## All rights reserved. Licenses which grant limited permission to use,
8 ## copy, modify and distribute this software are available from the
9 ## OpenPKG GmbH.
10 ##
11 ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
12 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
15 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
17 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
21 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22 ## SUCH DAMAGE.
23 ##
24 ## rpm-config.sh: program
25 ##
27 rpm_version="@l_version@"
28 rpm_cc="@l_cc@"
29 rpm_cppflags="@l_cppflags@"
30 rpm_cflags="@l_cflags@"
31 rpm_ldflags="@l_ldflags@"
32 rpm_libs="@l_libs@"
34 usage="rpm-config"
35 usage="$usage [--cc] [--cppflags] [--cflags] [--ldflags] [--libs]"
36 usage="$usage [--help] [--version]"
37 if [ $# -eq 0 ]; then
38 echo "rpm-config:Error: Invalid option" 1>&2
39 echo "rpm-config:Usage: $usage" 1>&2
40 exit 1
41 fi
43 output=''
44 prev=''
45 for option
46 do
47 if [ ".$prev" != . ]; then
48 eval "$prev=\$option"
49 prev=''
50 continue
51 fi
52 case "$option" in
53 -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
54 *) optarg='' ;;
55 esac
56 case "$option" in
57 --help|-h)
58 echo "Usage: $usage"
59 exit 0
60 ;;
61 --version|-v)
62 echo "OpenPKG RPM $rpm_version"
63 exit 0
64 ;;
65 --cc)
66 output="$output $rpm_cc"
67 ;;
68 --cppflags)
69 output="$output $rpm_cppflags"
70 ;;
71 --cflags)
72 output="$output $rpm_cflags"
73 ;;
74 --ldflags)
75 output="$output $rpm_ldflags"
76 ;;
77 --libs)
78 output="$output $rpm_libs"
79 ;;
80 * )
81 echo "rpm-config:Error: Invalid option" 1>&2
82 echo "rpm-config:Usage: $usage" 1>&2
83 exit 1;
84 ;;
85 esac
86 done
87 if [ ".$prev" != . ]; then
88 echo "rpm-config:Error: missing argument to --`echo $prev | sed 's/_/-/g'`" 1>&2
89 exit 1
90 fi
92 if [ ".$output" != . ]; then
93 echo "$output" | sed -e 's/^ *//' -e 's/ *$//'
94 fi