-
Notifications
You must be signed in to change notification settings - Fork 12
/
polyorb-config.in
359 lines (308 loc) · 9.21 KB
/
polyorb-config.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
#!/bin/sh
# This script provides tool chain command line switches used to build
# applications that use PolyORB.
# @configure_input@
host=@host@
target=@target@
if [ "$host" = "$target" ]; then
is_cross=false
else
is_cross=true
fi
# Library type
LIBRARY_TYPE=@LIBRARY_TYPE@
# Determine installation prefix
case "$0" in
*/*)
# Already has a directory indication
exec_name="$0"
;;
*)
# Just base filename, retrieve from PATH
exec_name=`which $0`
;;
esac
exec_rel_dir=`dirname "${exec_name}"`
exec_abs_dir=`cd ${exec_rel_dir} && pwd`
exec_prefix=`dirname "${exec_abs_dir}"`
# Translate Cygwin-style path to Windows equivalent
case "$OS" in
Windows_NT)
exec_prefix=`cygpath -w $exec_prefix`
esac
unset tgt_subdir
if $is_cross; then
tgt_subdir=/$target
fi
for candidate_prefix in "${exec_prefix}${tgt_subdir}" "@prefix@${tgt_subdir}"; do
prefix="${candidate_prefix}"
if [ -f "${candidate_prefix}"/include/polyorb/polyorb.ads ]; then
break
fi
done
have_gnatmake_aPdir=@HAVE_GNATMAKE_APDIR@
default_appli="@APPLI_LIST@"
default_proto="@PROTO_LIST@"
default_services="@SERVICE_LIST@"
require_xmlada=false
appli="${default_appli}"
proto="${default_proto}"
services="${default_services}"
# is_in NEEDLE HAY1 HAY2 ...
# True if NEEDLE is equal to any of the HAY*
is_in () {
needle=$1
shift
while [ "$#" != 0 ]; do
if [ "$needle" = "$1" ]; then
return 0
fi
shift
done
return 1
}
# set_components MSG VAR VALUE,VALUE,VALUE
# Set VAR to the listed set of VALUEs, with commas replaced with spaces,
# checking that all VALUEs are present in default_VAR.
# MSG is the user-friendly name of the component being set.
set_components () {
failed=false
values=`echo $3 | tr , ' '`
for value in $values; do
if eval "is_in '$value' \$default_$2"; then
: OK
else
echo "$1 $value not available." 1>&2
failed=true
fi
done
if $failed; then exit 1; fi
eval "$2='$values'"
}
usage() {
cat <<EOF 1>&2
Usage: polyorb-config [OPTIONS]
Options:
No option:
Output all the flags (compiler and linker) required
to compile your program.
[--prefix[=DIR]]
Output the directory in which PolyORB architecture-independent
files are installed, or set this directory to DIR.
[--exec-prefix[=DIR]]
Output the directory in which PolyORB architecture-dependent
files are installed, or set this directory to DIR.
[--version|-v]
Output the version of PolyORB.
[--config]
Output PolyORB's configuration parameters.
[--libs]
Output the linker flags to use for PolyORB.
[--cflags]
Output the compiler flags to use for PolyORB.
[--idls]
Output flags to set up path to CORBA's IDL for idlac.
[--with-appli-perso=P,P,P]
Restrict output to only those flags relevant to the listed
applicative personalities.
[--with-proto-perso=P,P,P]
Restrict output to only those flags relevant to the listed
protocol personalities.
[--with-corba-services=S,S,S]
Restrict output to only those flags relevant to the listed
services.
[--help]
Output this message
EOF
}
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--help|-h)
usage 1>&2
exit 1
;;
--prefix=*)
prefix=$optarg;
if test "x$exec_prefix_set" = x ; then
exec_prefix=$prefix
fi
;;
--prefix)
echo_prefix=true
;;
--exec-prefix=*)
exec_prefix=$optarg
;;
--exec-prefix)
echo_exec_prefix=true
;;
--version|-v)
echo "PolyORB @POLYORB_VERSION@ for ${target}" 1>&2
if $is_cross; then
echo " hosted on ${host}" 1>&2
fi
exit 0
;;
--config)
cat <<EOF 1>&2
Personalities built :
* Application personalities : @APPLI_LIST@
* Protocol personalities : @PROTO_LIST@
* Services : @SERVICE_LIST@
* SSL support : @HAVE_SSL@
EOF
exit 0
;;
--libs)
echo_libs=true
;;
--idls)
echo_idls=true
;;
--cflags)
echo_cflags=true
;;
--with-appli-perso=*)
set_components "Applicative personality" appli "$optarg" ;;
--with-proto-perso=*)
set_components "Protocol personality" proto "$optarg" ;;
--with-corba-services=*)
set_components "Service" services "$optarg" ;;
*)
usage 1>&2
exit 1
;;
esac
shift
done
includedir="@includedir@"
libdir="@libdir@"
polyorb_dir="${includedir}/polyorb"
polyorb_lib="@LDFLAGS@ -L${libdir}/polyorb/static -lpolyorb"
corba_idl_dir="-I${includedir}/polyorb"
for P in $appli; do
polyorb_lib="$polyorb_lib -lpolyorb-${P}"
if [ "x$P" = "xcorba" ]
then
polyorb_lib="$polyorb_lib -lpolyorb-corba-dynamicany -lpolyorb-corba-iop -lpolyorb-corba-messaging -lpolyorb-corba-portableinterceptor -lpolyorb-corba-rtcorba"
for S in $services; do
# In general we have two libraries for each service: cos-${S} for client
# stubs and helpers, and cos-${S}-impl for implementation. A user
# application does not need the impl library in general, and it is
# therefore not included in the default set of libraries we output.
# The interface repository is an exception to this rule, because in this
# case we build a single library with client stubs and implementation.
if [ "${S}" = "ir" ]; then
polyorb_lib="$polyorb_lib -lpolyorb-corba-cos-${S}-impl"
else
polyorb_lib="$polyorb_lib -lpolyorb-corba-cos-${S}"
fi
done
if [ "x@HAVE_SSL@" = "xyes" ]; then
polyorb_lib="$polyorb_lib -lpolyorb-corba-security -lpolyorb-corba-security-gssup"
fi
fi
if [ "x$P" = "xaws" ]
then
polyorb_lib="$polyorb_lib -lpolyorb-web_common"
require_xmlada=true
fi
done
for P in $proto; do
polyorb_lib="$polyorb_lib -lpolyorb-${P}"
case "$P" in
giop)
polyorb_lib="$polyorb_lib -lpolyorb-giop-diop -lpolyorb-giop-iiop -lpolyorb-giop-miop"
if [ "x@HAVE_SSL@" = "xyes" ]
then
polyorb_lib="$polyorb_lib -lpolyorb-giop-iiop-ssliop"
polyorb_lib="$polyorb_lib -lpolyorb-giop-iiop-security -lpolyorb-giop-iiop-security-tls"
fi
;;
soap)
polyorb_lib="$polyorb_lib -lpolyorb-web_common"
require_xmlada=true
;;
dns)
polyorb_lib="$polyorb_lib -lpolyorb-dns-udns -lpolyorb-dns-mdns"
;;
esac
done
if [ "x@HAVE_SSL@" = "xyes" ]
then
polyorb_lib="$polyorb_lib -lpolyorb-ssl"
polyorb_lib="$polyorb_lib -lpolyorb-security -lpolyorb-security-gssup -lpolyorb-security-x509 -lpolyorb-security-tls -lpolyorb-setup-security"
fi
polyorb_lib="$polyorb_lib -lpolyorb-setup"
# Dependencies on XML/Ada are appended at the end of the command line,
# so that they are passed to the linker after any other object, right
# before the dependency on libgnat. This is necessary so that in the case
# of dynamic XML/Ada libraries, an implicit dependency on the dynamic libgnat
# does not take precedence over symbols that are overridden by PolyORB
# (specifically, System.Partition_Interface.*).
if $require_xmlada; then
case $LIBRARY_TYPE in
relocatable) xmlada_libtypeflag=shared ;;
*) xmlada_libtypeflag=static ;;
esac
# first we start with the include dirs
popt="-aI"
xmlada_mflags=""
xmlada_lib=""
xmlada_dir=""
# get all paths for xmlada project, there is 3 sections:
#
# 1. Source Search Path:
# -> paths prepended with -aI
# 2. Object Search Path:
# -> paths prepended with -oI and lib paths with -L
# 3. Project Search Path:
# -> ignored, no path containing xmlada string
gnat ls -v -XXMLADA_BUILD=$xmlada_libtypeflag -Pxmlada > /tmp/gnatls.$$
exec 3<&0 < /tmp/gnatls.$$
while read line; do
if test "$line" = "Object Search Path:" ; then
popt="-aO"
elif test "$line" = "Project Search Path:" ; then
popt=""
fi
xline=`echo "$line" | grep xmlada | tr -d " \n"`
if test -n "$xline" -a -n "$popt"; then
xmlada_mflags="$xmlada_mflags ${popt}$xline"
if test "$popt" = "-aI" ; then
xmlada_dir="$xmlada_dir -I$xline"
elif test "$popt" = "-aO" ; then
xmlada_lib="$xmlada_lib -L$xline"
fi
fi
done
exec <&3 3<&-
rm /tmp/gnatls.$$
# hard code all xmlada libraries here
xmlada_lib="$xmlada_lib -lxmlada_sax -lxmlada_unicode -lxmlada_input_sources -lxmlada_dom -lxmlada_schema"
fi
if test x$have_gnatmake_aPdir = xyes; then
apdir="-aP${prefix}/lib/gnat"
fi
if test ! x"$echo_prefix" = x"true" -a ! x"$echo_exec_prefix" = x"true" -a ! x"$echo_cflags" = x"true" -a ! x"$echo_libs" = x"true" -a ! x"$echo_idls" = x"true"; then
echo ${apdir} -aI${polyorb_dir} -aO${libdir}/polyorb ${xmlada_mflags} -largs ${polyorb_lib} ${xmlada_lib}
fi
if test x"$echo_prefix" = x"true" ; then
echo $prefix
fi
if test x"$echo_exec_prefix" = x"true" ; then
echo $exec_prefix
fi
if test x"$echo_cflags" = x"true"; then
echo -I${polyorb_dir} ${xmlada_dir}
fi
if test x"$echo_libs" = x"true"; then
echo ${polyorb_lib} ${xmlada_lib}
fi
if test x"$echo_idls" = x"true"; then
echo $corba_idl_dir
fi