1 | #! /bin/sh |
---|
2 | |
---|
3 | prefix=@prefix@ |
---|
4 | exec_prefix=@exec_prefix@ |
---|
5 | exec_prefix_set=no |
---|
6 | includedir=@includedir@/orbit-1.0 |
---|
7 | libdir=@libdir@ |
---|
8 | |
---|
9 | usage() |
---|
10 | { |
---|
11 | cat <<EOF |
---|
12 | Usage: orbit-config [OPTION]... [TARGET]... |
---|
13 | |
---|
14 | Known values for OPTION are: |
---|
15 | |
---|
16 | --prefix=DIR change ORBit prefix [default $prefix] |
---|
17 | --exec-prefix=DIR change ORBit executable prefix [default $exec_prefix] |
---|
18 | --libs print library linking information |
---|
19 | --cflags print pre-processor and compiler flags |
---|
20 | --help display this help and exit |
---|
21 | --version output version information |
---|
22 | |
---|
23 | --use-service=SRVC the service SRVC will be used |
---|
24 | |
---|
25 | Known values for SRVC are: |
---|
26 | |
---|
27 | name module CosNaming, interfaces LNameComponent, LName |
---|
28 | |
---|
29 | Known values for TARGET are: |
---|
30 | |
---|
31 | client (calls glib-config) |
---|
32 | server (calls glib-config) |
---|
33 | EOF |
---|
34 | |
---|
35 | exit $1 |
---|
36 | } |
---|
37 | |
---|
38 | if test $# -eq 0; then |
---|
39 | usage 1 |
---|
40 | fi |
---|
41 | |
---|
42 | cflags=false |
---|
43 | libs=false |
---|
44 | |
---|
45 | while test $# -gt 0; do |
---|
46 | case "$1" in |
---|
47 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; |
---|
48 | *) optarg= ;; |
---|
49 | esac |
---|
50 | |
---|
51 | case "$1" in |
---|
52 | --prefix=*) |
---|
53 | prefix=$optarg |
---|
54 | if test $exec_prefix_set = no ; then |
---|
55 | exec_prefix=$optarg |
---|
56 | fi |
---|
57 | ;; |
---|
58 | |
---|
59 | --prefix) |
---|
60 | echo $prefix |
---|
61 | ;; |
---|
62 | |
---|
63 | --exec-prefix=*) |
---|
64 | exec_prefix=$optarg |
---|
65 | exec_prefix_set=yes |
---|
66 | ;; |
---|
67 | |
---|
68 | --exec-prefix) |
---|
69 | echo $exec_prefix |
---|
70 | ;; |
---|
71 | |
---|
72 | --version) |
---|
73 | echo @PACKAGE@ @ORBIT_VERSION@ |
---|
74 | exit 0 |
---|
75 | ;; |
---|
76 | |
---|
77 | --help) |
---|
78 | usage 0 |
---|
79 | ;; |
---|
80 | |
---|
81 | --cflags) |
---|
82 | cflags=true |
---|
83 | ;; |
---|
84 | |
---|
85 | --libs) |
---|
86 | libs=true |
---|
87 | ;; |
---|
88 | |
---|
89 | client|server) |
---|
90 | the_libs="$the_libs -L$libdir -lORBit -lIIOP -lORBitutil `glib-config --libs` @LIBS@ -lm" |
---|
91 | the_flags="$the_flags `glib-config --cflags` " |
---|
92 | test "x$includedir" = "x/usr/include" \ |
---|
93 | || the_flags="$the_flags -I$includedir " |
---|
94 | ;; |
---|
95 | |
---|
96 | --use-service=*) |
---|
97 | case $optarg in |
---|
98 | name) |
---|
99 | services="$services -lORBitCosNaming" |
---|
100 | ;; |
---|
101 | *) |
---|
102 | usage |
---|
103 | exit 1 |
---|
104 | ;; |
---|
105 | esac |
---|
106 | ;; |
---|
107 | |
---|
108 | *) |
---|
109 | usage |
---|
110 | exit 1 |
---|
111 | ;; |
---|
112 | esac |
---|
113 | shift |
---|
114 | done |
---|
115 | |
---|
116 | if $cflags; then |
---|
117 | all_flags="$the_flags" |
---|
118 | fi |
---|
119 | |
---|
120 | if $libs; then |
---|
121 | all_flags="$all_flags $services $the_libs" |
---|
122 | fi |
---|
123 | |
---|
124 | if test -z "$all_flags" || test "x$all_flags" = "x "; then |
---|
125 | exit 1 |
---|
126 | fi |
---|
127 | |
---|
128 | # Straight out any possible duplicates, but be careful to |
---|
129 | # get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz' |
---|
130 | other_flags= |
---|
131 | rev_libs= |
---|
132 | for i in $all_flags; do |
---|
133 | case "$i" in |
---|
134 | # a library, save it for later, in reverse order |
---|
135 | -l*) rev_libs="$i $rev_libs" ;; |
---|
136 | *) |
---|
137 | case " $other_flags " in |
---|
138 | *\ $i\ *) ;; # already there |
---|
139 | *) other_flags="$other_flags $i" ;; # add it to output |
---|
140 | esac ;; |
---|
141 | esac |
---|
142 | done |
---|
143 | |
---|
144 | ord_libs= |
---|
145 | for i in $rev_libs; do |
---|
146 | case " $ord_libs " in |
---|
147 | *\ $i\ *) ;; # already there |
---|
148 | *) ord_libs="$i $ord_libs" ;; # add it to output in reverse order |
---|
149 | esac |
---|
150 | done |
---|
151 | |
---|
152 | echo $other_flags $ord_libs |
---|
153 | |
---|
154 | exit 0 |
---|