1 | #! /bin/sh |
---|
2 | |
---|
3 | prefix=@prefix@ |
---|
4 | exec_prefix=@exec_prefix@ |
---|
5 | exec_prefix_set=no |
---|
6 | includedir=@includedir@ |
---|
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` -I$includedir " |
---|
92 | ;; |
---|
93 | |
---|
94 | --use-service=*) |
---|
95 | case $optarg in |
---|
96 | name) |
---|
97 | services="$services -lORBitCosNaming" |
---|
98 | ;; |
---|
99 | *) |
---|
100 | usage |
---|
101 | exit 1 |
---|
102 | ;; |
---|
103 | esac |
---|
104 | ;; |
---|
105 | |
---|
106 | *) |
---|
107 | usage |
---|
108 | exit 1 |
---|
109 | ;; |
---|
110 | esac |
---|
111 | shift |
---|
112 | done |
---|
113 | |
---|
114 | if $cflags; then |
---|
115 | all_flags="$the_flags" |
---|
116 | fi |
---|
117 | |
---|
118 | if $libs; then |
---|
119 | all_flags="$all_flags $services $the_libs" |
---|
120 | fi |
---|
121 | |
---|
122 | if test -z "$all_flags" || test "x$all_flags" = "x "; then |
---|
123 | exit 1 |
---|
124 | fi |
---|
125 | |
---|
126 | # Straight out any possible duplicates, but be careful to |
---|
127 | # get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz' |
---|
128 | other_flags= |
---|
129 | rev_libs= |
---|
130 | for i in $all_flags; do |
---|
131 | case "$i" in |
---|
132 | # a library, save it for later, in reverse order |
---|
133 | -l*) rev_libs="$i $rev_libs" ;; |
---|
134 | *) |
---|
135 | case " $other_flags " in |
---|
136 | *\ $i\ *) ;; # already there |
---|
137 | *) other_flags="$other_flags $i" ;; # add it to output |
---|
138 | esac ;; |
---|
139 | esac |
---|
140 | done |
---|
141 | |
---|
142 | ord_libs= |
---|
143 | for i in $rev_libs; do |
---|
144 | case " $ord_libs " in |
---|
145 | *\ $i\ *) ;; # already there |
---|
146 | *) ord_libs="$i $ord_libs" ;; # add it to output in reverse order |
---|
147 | esac |
---|
148 | done |
---|
149 | |
---|
150 | echo $other_flags $ord_libs |
---|
151 | |
---|
152 | exit 0 |
---|