forked from coin3d/sogui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsogui-config.in
377 lines (367 loc) · 9.82 KB
/
sogui-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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
#! /bin/sh
# **************************************************************************
# so@gui@-config -- a utility for retrieving configuration information about
# the installed So@Gui@ library.
#
# Authors:
# Lars J. Aas <[email protected]>
# Morten Eriksen <[email protected]>
program="$0"
me=`echo "$0" | sed 's,^.*[/\\],,g'`
wd=`echo "$0" | sed 's,/[^/]*$,,'`
prefix=`cd "$wd"/..; pwd`
hello=`echo hello | fmt -t -w70 2>&1`
if test x"$hello" = x"hello"; then
# 'fmt -t' works
preformat="fmt -t -w76"
sedformat='$ q; s/$/ \\/'
else
# sed script replacing "fmt -w76 | sed '2,$ s/^/ /g; $ q; 1,$ s/$/ \\/'"
preformat="cat"
sedformat='/^............................................................................./ {
G
s/^\([^\
]\{1,76\}\) \(.*\)\(\
\)/\1 \\\3 \2/
P
D
}'
if test xhello != x"`echo hello | sed -e $sedformat 2>&1`"; then
sedformat="s/a/a/"
fi
fi
usage="\
Usage: $me [OPTIONS]
Options:
--alternate=<string>
--prefix
--cppflags
--cflags
--cxxflags
--ldflags
--libs
--msvcrt
--datadir
--includedir
--frameworkdir
--ac-subst <string> | <sourcefile.in>
--ac-desubst <sourcefile>
--compile <sourcefile> [<sourcefile>]...
--link <program> <object> [<object>]...
--build <program> <sourcefile> [<sourcefile>]...
--setup | --setup-front
--header <classname>
--version
--usage | --help"
alternate=default
for arg
do
case $arg in
--usage | --help)
echo "$usage"
exit 0
;;
--alternate=*)
alternate=`echo $arg | cut -d= -f2-`
;;
--debug)
alternate=debug
;;
esac
done
if test -f "$prefix/share/Coin/conf/so@gui@-$alternate.cfg"; then
configfile="$prefix/share/Coin/conf/so@gui@-$alternate.cfg"
. "$configfile"
elif test -f "$prefix/share/Coin/conf/so@[email protected]"; then
configfile="$prefix/share/Coin/conf/so@[email protected]"
. "$configfile"
else
echo >&2 "$me: no default So@Gui@ config available in \"$prefix/share/Coin/conf/\""
exit 1
fi
# Remove gcc system directories includes from the include path
if test x"$compiler_is_gcc" = x"yes"; then
sim_ac_save_cpp=$CPP
CPP="cpp"
case `uname -s` in
Darwin) CPP="cpp3"
;;
esac
cpp_sys_dirs=`$CPP -v <<EOF 2>&1 | sed -n -e \
'/#include <...> search starts here:/,/End of search list./{
/#include <...> search starts here:/b
/End of search list./b
s/ /-I/
p
}'
EOF`
result=
for inc_path in $cppflags; do
additem=true
for sys_dir in $cpp_sys_dirs; do
if test x$inc_path = x$sys_dir; then
additem=false
break
fi
done
$additem && result="$result $inc_path"
done
cppflags=$result
CPP=$sim_ac_save_cpp
fi
while test $# -gt 0
do
case $1 in
--version) echo "$version" ;;
--prefix) echo "$prefix" ;;
--cppflags) echo "$cppflags" ;;
--cflags) echo "$cflags" ;;
--cxxflags) echo "$cxxflags" ;;
--ldflags) echo "$ldflags" ;;
--libs) echo "$libs" ;;
--msvcrt) echo "$msvcrt" ;;
--datadir) echo "$datadir" ;;
--includedir) echo "$includedir" ;;
--frameworkdir) echo "$frameworkdir" ;;
--ac-subst)
shift
if test $# -eq 1; then
case $1 in
*\.in)
echo $me --ac-subst $1
outfile=`echo $1 | sed -e 's/\.in$//'`
sedscript=/tmp/ac_subst_$$.sed
grep "^AC_SUBST_" $configfile \
| sed -e 's/^AC_SUBST_\([^=]*\)="\([^"]*\)"$/s\/@\1@\/\2\/g;/g' \
>$sedscript
rm -f $outfile
case `echo "$compiler" | sed 's/ .*//g'` in
gcc | g++)
echo "# 1 \"$1\"" >$outfile
;;
wrapmsvc | wrapmsvc.exe | msvccc)
echo "#line 1 \"$1\"" >$outfile
;;
esac
sed -f $sedscript <$1 >>$outfile
rm -f $sedscript
;;
*)
eval "VAL=\${AC_SUBST_$1}"
echo "$VAL"
;;
esac
else
for arg in $@; do
$program --alternate="$alternate" --ac-subst $arg
retval=$?
test $retval -ne 0 && exit $retval
done
fi
exit 0
;;
--ac-desubst)
shift
echo $me --ac-desubst $1
outfile="$1.in"
sedscript=/tmp/ac_subst_$$.sed
grep "^AC_SUBST_" $configfile \
| sed -e 's/^AC_SUBST_\([^=]*\)="\([^"]*\)"$/s\/\2\/@\1@\/g;/g' \
>$sedscript
sed -f $sedscript <$1 >$outfile
rm -f $sedscript
;;
--compile)
shift
if test $# -eq 1; then
case $1 in
*\.in)
outfile=`echo $1 | sed -e 's/\.in$//'`
$program --alternate="$alternate" --ac-subst $1
$program --alternate="$alternate" --compile $outfile
retval=$?
test $retval -ne 0 && exit $retval
;;
*)
basename=`echo "$1" | sed -e 's/\.[^\.]*$//'` # strip off extension
echo $compiler $CPPFLAGS $cppflags $CXXFLAGS $cxxflags -c $1 -o $basename.@OBJEXT@ \
| $preformat | sed "$sedformat"
$compiler \
$CPPFLAGS $cppflags \
$CXXFLAGS $cxxflags \
-c $1 -o $basename.@OBJEXT@
retval=$?
test $retval -ne 0 && exit $retval
;;
esac
else
for arg in $@; do
$program --alternate="$alternate" --compile $arg
retval=$?
test $retval -ne 0 && exit $retval
done
fi
exit 0
;;
--link)
shift
progname=$1
shift
echo $compiler $LDFLAGS $ldflags -o $progname $@ $libs $LIBS \
| $preformat | sed "$sedformat"
$compiler \
$LDFLAGS $ldflags \
-o $progname $@ \
$libs $LIBS
retval=$?
test $retval -ne 0 && exit $retval
case $host in
*-darwin*)
echo "$me: making Mac OS X application \"$progname.app\""
mkdir $progname.app 2>/dev/null
mkdir $progname.app/Contents 2>/dev/null
mkdir $progname.app/Contents/MacOS 2>/dev/null
if test -d $progname.app/Contents/MacOS &&
mv -f $progname $progname.app/Contents/MacOS/ &&
echo "APPL????" >$progname.app/Contents/PkgInfo; then
:
else
echo >&2 "$me: failed to make Mac OS X application"
echo >&2 " - problem is probably user permission or disk space related"
exit 1
fi
;;
esac
exit 0
;;
--build)
shift
progname=$1
objs=
extraldflags=
extralibs=
shift
for arg in $@; do
case $arg in
*.h.in)
$program --alternate="$alternate" --ac-subst $arg
;;
*.c.in | *.cpp.in | *.cxx.in | *.cc.in)
outfile=`echo "$arg" | sed -e 's/\.in$//'`
basename=`echo "$outfile" | sed -e 's/\.[^\.]*$//'` # strip off extension
$program --alternate="$alternate" --ac-subst $arg
$program --alternate="$alternate" --compile $outfile
retval=$?
test $retval -ne 0 && exit $retval
objs="$objs $basename.@OBJEXT@"
;;
*.c | *.cpp | *.cxx | *.cc)
basename=`echo "$arg" | sed -e 's/\.[^\.]*$//'` # strip off extension
$program --alternate="$alternate" --compile $arg
retval=$?
test $retval -ne 0 && exit $retval
objs="$objs $basename.@OBJEXT@"
;;
-L*)
extraldflags="$extraldflags $arg"
;;
-l*)
extralibs="$extralibs $arg"
;;
esac
done
if test -z "$objs"; then
echo >&2 "$usage"
echo >&2 ""
echo >&2 "$me: no object files"
exit 1
fi
echo $compiler $CPPFLAGS $cppflags $CXXFLAGS $cxxflags \
$LDFLAGS $ldflags $extraldflags \
-o $progname $objs $extralibs $libs $LIBS \
| $preformat | sed "$sedformat"
$compiler \
$CPPFLAGS $cppflags \
$CXXFLAGS $cxxflags \
$LDFLAGS $ldflags $extraldflags \
-o $progname $objs \
$extralibs $libs $LIBS
retval=$?
test $retval -ne 0 && exit $retval
exit 0
;;
--build-app)
case $host in
*-darwin*)
shift
progname=$1
shift
if test $@; then
$program --alternate="$alternate" --build $progname $@ || exit $?
fi
echo "$me: making Mac OS X application \"$progname.app\""
mkdir $progname.app 2>/dev/null
mkdir $progname.app/Contents 2>/dev/null
mkdir $progname.app/Contents/MacOS 2>/dev/null
if test -d $progname.app/Contents/MacOS &&
mv -f $progname $progname.app/Contents/MacOS/ &&
echo "APPL????" >$progname.app/Contents/PkgInfo &&
cat > $progname.app/Contents/Info.plist <<EOF ; then
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1
.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>$progname</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>
EOF
:
else
echo >&2 "$me: failed to make Mac OS X application"
echo >&2 " - problem is probably user permission or disk space related"
exit 1
fi
;;
esac
exit 0
;;
--setup)
# FIXME: scan variables and only modify variables that need modification
echo "PATH=\$PATH:$prefix/bin"
echo "LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$prefix/lib"
echo "export PATH LD_LIBRARY_PATH"
exit 0
;;
--setup-front)
# FIXME: scan variables and only modify variables that need modification
echo "PATH=$prefix/bin:\$PATH"
echo "LD_LIBRARY_PATH=$prefix/lib:\$LD_LIBRARY_PATH"
echo "export PATH LD_LIBRARY_PATH"
exit 0
;;
--header)
shift
classname=$1
for header in `find ${prefix}/include/Inventor/@Gui@ -type f | xargs grep -n "^class SO@GUI@_DLL_API ${classname}\>" | cut -d: -f1`; do
echo "FILE: ${header}"
cat "${header}"
done
exit 0
;;
# ignore some options
--alternate=*) ;;
--debug) ;;
# args not caught until now are invalid
*)
echo >&2 "$me: Invalid option: \"$1\""
echo >&2 "$usage"
exit 1
;;
esac
shift
done
exit 0