/usr/bin/babel-cc is in libsidl-dev 1.4.0.dfsg-8build3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | #! /bin/sh
#
# Script to compile and link code that depends on Babel.
# It is intended to be a drop-in replacement for compilers
# similar to mpi* front-ends such as mpicc.
prefix="/usr"
exec_prefix="${prefix}"
bindir="${exec_prefix}/bin"
BABELCONFIG="${exec_prefix}/bin/babel-config"
# turns on levels of verbiosity
# 0 => none
# 1 => echo actual command
# 2 => echo debugging info
verbose=0
# dry_run disables the final command being executed
dry_run=false
# Messages (includes errors, warnings, and remarks)
# 2 => display and exit
# 1 => display but do not exit
# 0 => suppress entirely
# note that internal errors are always fatal and cannot be suppresed.
error_msg=2
warning_msg=1
remark_msg=0
# The action may be one of the set {compile, link, preprocess }
action=link
# May be "static", "shared" or "both"
linkage=both
# interpretation of arguments is "strict" at first
# (meaning error messages are produced at unrecognized flags)
# Can be demoted to "scan" when -- argument is encountered
interpret_args=strict
args_all=
# flag to inhibit complete preprocess/compile/assemble/link series
# -E means stop after preprocessing (produces *.i)
# -S preprocess and compile, do not assemble (produces *.s)
# -c preprocess, compile and assemble, do not link (produces *.o)
args_throttle=
# can be "lib" iff -o XXX has a .a, .la, .so suffix
# can be "obj" iff -o XXX has a .o .lo suffix
outtype=exec
args_outfile=
args_optim=
args_defs=
args_incl=
args_libs=
args_else=
# can be set to false... which trys to preserve users arguments
args_munging=true
# set to true if Impl files are detected
# (implies DLL if --shared or !--static)
has_impl=false
# may be set to false
use_libtool=true
# may be empty
quiet_libtool="--quiet"
libtool_opts=
libtool_rpath=unknown
libtool_release=unknown
# the --tag argument for libtool (C++ changes this)
lt_tag=CC
have_mpi=false
internal_error()
{
echo "$self_base: internal error: $1" >&2
exit 1
}
error()
{
if test $error_msg -ge 1; then
echo "$self_base: error: $1" >&2
if test $error_msg -ge 2; then
exit 1
fi
fi
}
warn()
{
if test $warning_msg -ge 1; then
echo "$self_base: warning: $1" >&2
if test $warning_msg -ge 2; then
exit 1
fi
fi
}
remark()
{
if test $remark_msg -ge 1; then
echo "$self_base: remark: $1" >&2
if test $remark_msg -ge 1; then
exit 1
fi
fi
}
# first arg is an integer maching verbiosity
note() {
if test $1 -le $verbose; then
shift
echo $@
fi
}
help_msg()
{
cat <<EOF
Usage: $self_base -c [OPTIONS] [COMPILER_ARGS]
$self_base -o <libsomething.a> [OPTIONS] [COMPILER_ARGS]
Where [OPTIONS] are listed below
--help | -h print this help
--dry-run | -n show what this script would do, but don't do it
--verbose[=n] enable extra verbiage
--no-quiet reveal the command being issued to compiler
(same as --verbose=1)
--no-libtool do not use babel-libtool
--no-quiet-libtool let libtool be more verbose
--libtool-opts comma separated list of libtool options
--installdir=[path] recommended when linking dll's
--release=[version] recommended when linking dll's
--no-munge do not reorder arguments
-- signals that all following arguments are intended
for the compiler
Other useful flags include:
--with-cxx
--with-python
--with-f90
--with-f77
--with-java
--with-mpi
EOF
}
#handle shell problems with quotes and spaces
enquote() {
args=
while test $# -gt 0; do
case "$1" in
*\"*)
qarg="'"$1"'"
args="$args $qarg"
;;
*\'*)
#'# <-- this bit works around emacs colorization confusion
qarg='\"'"$1"'\"'
args="$args $qarg"
;;
*" "*)
qarg="'"$1"'"
args="$args $qarg"
;;
*)
args="$args $1"
;;
esac
shift
done
echo $args
}
echo_libs()
{
constraint=`echo "$1" | sed -e 's/--[_a-zA-Z0-9\+]*-[_a-zA-Z0-9\+]*//'`
shift
Lcommands=
lcommands=
ocommands=
while test $# -gt 0; do
case "$1" in
-L*)
Lcommands="$Lcommands $1"
;;
-l*)
lcommands="$lcommands $1"
;;
*)
ocommands="$ocommands $1"
;;
esac
shift
done
if test -z "$constraint"; then
echo $Lcommands $lcommands $ocommands
elif test "$constraint" = "-L"; then
echo $Lcommands
elif test "$constraint" = "-l"; then
echo $lcommands
else
exit 1
fi
exit 0
}
# strip duplicates out of a list
strip_duplicates() {
args=
while test $# -gt 0; do
add_it=maybe
for i in $args; do
if test "$i" = "$1"; then
add_it=no
fi
done
if test $add_it = maybe; then
args="$args $1"
fi
shift
done
echo $args
}
#reverses a list of arguments
reverse() {
args=
while test $# -gt 0; do
args="$1 $args"
shift
done
echo $args
}
run () {
if test $verbose -gt 0; then
echo $@
fi
if test $dry_run = false; then
eval $@
fi
return $?
}
self=$0
self_base=`basename $self`
# error if ran without arguments:
if test $# -eq 0; then
error "need more arguments (see '$self_base --help')."
fi
while test $# -gt 0; do
# if option has an argument, split it out, else optarg= nothing
case "$1" in
-*=*) optarg=`echo "$1" | sed -e 's/[-_a-zA-Z0-9]*=//'`;;
*) optarg= ;;
esac
# if optarg has a space in it... add some quotes
case "$optarg" in
*" "*) optarg="\'""$optarg""\'" ;;
*);;
esac
case "$1" in
--help | -h )
if test $interpret_args = strict ; then
help_msg && exit 0
else
args_all="$args_all $1"
fi
;;
--dry-run | -n )
if test $interpret_args = strict ; then
if test $verbose -lt 1; then
verbose=1;
fi
dry_run=true;
else
args_all="$args_all $1"
fi
;;
--verbose*)
if test $interpret_args = strict ; then
if test x"$optarg" = x; then
verbose=2
elif test "$optarg" -ge 0 -a "$optarg" -le 3; then
verbose="$optarg";
else
error "Cannot set verboseness to $optarg"
fi
else
args_all="$args_all $1"
fi
;;
-v | -v0 | -v1 | -v2 )
if test $interpret_args = strict ; then
if test "$1" = "-v"; then
verbose=1;
else
verbose=`echo "$1" | sed -e 's/-v//'`
fi
else
args_all="$args_all $1"
fi
;;
--no-quiet)
if test $interpret_args = strict ; then
verbose=1;
else
args_all="$args_all $1"
fi
;;
--no-libtool)
if test $interpret_args = strict ; then
use_libtool=false;
else
args_all="$args_all $1"
fi
;;
--no-quiet-libtool)
if test $interpret_args = strict; then
quiet_libtool="";
else
args_all="$args_all $1"
fi
;;
--libtool-opts*)
if test $interpret_args = strict; then
tmp=`echo ,$optarg | sed 's/\,/ /g;'`
libtool_opts="$libtool_opts $tmp"
else
args_all="$args_all $1"
fi
;;
--installdir*)
if test $interpret_args = strict; then
libtool_rpath=`enquote "$optarg"`
echo "libtool_rpath=$libtool_rpath"
else
args_all="$args_all $1"
fi
;;
--release*)
if test $interpret_args = strict; then
libtool_release=`enquote "$optarg"`
else
args_all="$args_all $1"
fi
;;
--with-cxx)
langs="$langs cxx"
;;
--with-java)
langs="$langs java"
;;
--with-python)
langs="$langs py"
;;
--with-f77)
langs="$langs f77"
;;
--with-f90)
langs="$langs f90"
;;
--with-mpi)
have_mpi=true;
;;
-c | -S ) # overrides default action=link
action=compile
if test -z "$args_throttle"; then
args_throttle="$1"
else
error "$Cannot have $args_throttle and $1 in same invocation"
fi
args_all="$args_all $1"
;;
-E | -M*) # overrides default action=link
action=preprocess
if test -z "$args_throttle"; then
args_throttle="$1"
else
error "$Cannot have $args_throttle and $1 in same invocation"
fi
;;
-o) # assign output file
outfile=`enquote "$2"`
case "$outfile" in
*.la | *.a | *.so ) outtype=lib;;
*.o | *.lo ) outtype=obj;;
* ) outtype=exec ;;
esac
args_outfile="-o $outfile"
args_all="$args_all $1 "`enquote "$2"`
shift
;;
--) # stop strictly interpreting options
shift
args_else=$@
break;
#if test $interpret_args = strict; then
# interpret_args=lax
#else
# warning "encountered '--' a second time '--no-munge' "
#fi
;;
-g | -pg | -O* )
args_optim="$args_optim $1"
args_all="$args_all $1"
;;
-D* | -U* )
args_defs="$args_defs $1"
args_all="$args_all $1"
;;
-I* )
args_incl="$args_incl "`enquote "$1"`
args_all="$args_all "`enquote "$1"`
;;
-L* )
args_libdirs="$args_libdirs "`enquote "$1"`
args_all="$args_all "`enquote "$1"`
;;
-l* )
args_libs="$args_libs "`enquote "$1"`
args_all="$args_all "`enquote "$1"`
;;
-W* | -f* | -b* )
args_misc="$args_misc "`enquote "$1"`
args_all="$args_all "`enquote "$1"`
;;
-shared )
linkage=shared
args_misc="$args_misc "`enquote "$1"`
args_all="$args_all "`enquote "$1"`
;;
-static )
linkage=static
args_misc="$args_misc "`enquote "$1"`
args_all="$args_all "`enquote "$1"`
;;
*.c | *.o | *.lo | *.a | *.so | *.la | *.i | *.s )
args_files="$args_files "`enquote "$1"`
args_all="$args_all "`enquote "$1"`
;;
*)
if test $interpret_args = strict; then
error "unrecognized option $1"
elif test $interpret_args = lax ; then
args_all="$args_all $1"
args_else="$args_else $1"
else
internal_error "interpret_args=$interpret_args is illegal value"
fi
;;
esac
shift
done
CPP=`$BABELCONFIG --query-var=CPP`
CC=`$BABELCONFIG --query-var=CC`
CXX=`$BABELCONFIG --query-var=CXX`
prefix=`$BABELCONFIG --query-var=prefix`
exec_prefix=`$BABELCONFIG --query-var=exec_prefix`
sysconfdir=`$BABELCONFIG --query-var=sysconfdir`
includedir=`$BABELCONFIG --query-var=includedir`
libdir=`$BABELCONFIG --query-var=libdir`
LIBTOOL="$bindir/babel-libtool"
args_incl="$args_incl "`$BABELCONFIG --includes`
args_incl="$args_incl "`$BABELCONFIG --includes-xml2`
args_defs="$args_defs "`$BABELCONFIG --flags-cpp`
args_libdirs="$args_libdirs "`$BABELCONFIG --libs-c-L`
if test $verbose -gt 1; then
quiet_libtool="";
fi
for f in $args_files; do
case $f in
*Impl.lo)
has_impl=true;
break
;;
*)
;;
esac
done
if test $linkage != static -a $action = link -a $outtype = lib ; then
if test $has_impl = true; then
args_misc="$args_misc -module -no-undefined"
else
args_misc="$args_misc -no-undefined"
fi
if test $libtool_rpath = unknown ; then
warn "DLL's can be sensitive to where they exist in the
filesystem (meaning in some cases, a simple copy
or move will break them). Assuming this DLL will remain
in '`pwd`/.libs'. Recommend using
--installdir=<path>
flag if you do not like this assumption."
args_misc="$args_misc -rpath `pwd`/.libs"
else
args_misc="$args_misc -rpath $libtool_rpath"
fi
if test $libtool_release = unknown; then
warn "Trying to avoid versioning requirements on DLL's
(not recommended for deployed code, but can be
convienient for development/tests). Recommend
using the
--release=x.y.z
flag for final distribution."
args_misc="$args_misc -avoid-version"
else
args_misc="$args_misc -release $libtool_release"
fi
fi
for i in $langs; do
case $i in
cxx)
CC=$CXX
lt_tag="CXX"
# C++ linker takes care of the usual includes
#args_defs="$args_defs "`$BABELCONFIG --flags-uc++`
#args_libdirs="$args_libdirs "`$BABELCONFIG --libs-uc++-L`
#args_libs="$args_libs "`$BABELCONFIG --libs-uc++-l`
args_libs="$args_libs -lsidlstub_cxx"
;;
java)
if ! $BABELCONFIG --with-java; then
error "$BABELCONFIG appears to be installed without java support"
fi
args_defs="$args_defs "`$BABELCONFIG --flags-javac`
args_incl="$args_incl "`$BABELCONFIG --includes-jni`
args_libdirs="$args_libdirs "`$BABELCONFIG --libs-java-L`
args_libs=`$BABELCONFIG --libs-java-l`" $args_libs"
args_libs="$args_libs -lsidlstub_java"
;;
py)
if ! $BABELCONFIG --with-python; then
error "$BABELCONFIG appears to be installed without python support"
fi
args_defs="$args_defs "`$BABELCONFIG --flags-python`
args_incl="$args_incl "`$BABELCONFIG --includes-py`
args_libdirs="$args_libdirs "`$BABELCONFIG --libs-python-L`
args_libs=`$BABELCONFIG --libs-python-l`" $args_libs"
;;
f90)
if ! $BABELCONFIG --with-f90; then
error "$BABELCONFIG appears to be installed without F90/95 support"
fi
args_defs="$args_defs "`$BABELCONFIG --flags-f90`
args_incl="$args_incl "`$BABELCONFIG --includes-f90`
args_libdirs="$args_libdirs "`$BABELCONFIG --libs-f90-L`
args_libs="$args_libs "`$BABELCONFIG --libs-f90-l`
args_libs="$args_libs -lsidlstub_f90"
;;
f77)
if ! $BABELCONFIG --with-f77; then
error "$BABELCONFIG appears to be installed without F77 support"
fi
args_defs="$args_defs "`$BABELCONFIG --flags-f77`
args_libdirs="$args_libdirs "`$BABELCONFIG --libs-f77-L`
args_libs="$args_libs "`$BABELCONFIG --libs-f77-l`
args_libs="$args_libs -lsidlstub_f77"
;;
esac
done
if test $have_mpi = true; then
args_defs="$args_defs "`$BABELCONFIG --query-var=MPI_CC_CFLAGS`
args_libdirs="$args_libdirs "`$BABELCONFIG --query-var=MPI_CC_LDFLAGS | echo_libs "-L" `
args_libs="$args_libs "`$BABELCONFIG --query-var=MPI_CC_LDFLAGS | echo_libs "-l"`
fi
args_libdirs="$args_libdirs -L$libdir"
args_libs="$args_libs -lsidl "`$BABELCONFIG --libs-c-l`
case "$action-$use_libtool" in
preprocess-false)
command="$CPP"
args_libdirs=
args_libs=
;;
preprocess-true)
command="$LIBTOOL $quiet_libtool $libtool_opts --tag=$lt_tag --mode=compile $CPP"
args_libdirs=
args_libs=
;;
compile-false)
command="$CC"
args_libdirs=
args_libs=
;;
compile-true)
command="$LIBTOOL $quiet_libtool $libtool_opts --tag=$lt_tag --mode=compile $CC"
args_libdirs=
args_libs=
;;
link-false)
command="$CC"
args_incl=
;;
link-true)
command="$LIBTOOL $quiet_libtool $libtool_opts --tag=$lt_tag --mode=link $CC"
args_incl=
;;
esac
args_incl=`strip_duplicates $args_incl`
args_libdirs=`strip_duplicates $args_libdirs`
args_libs=`reverse $args_libs`
args_libs=`strip_duplicates $args_libs`
args_libs=`reverse $args_libs`
if test $args_munging = true; then
run $command $args_throttle $args_outfile $args_optim $args_misc $args_defs $args_incl $args_libdirs $args_files $args_libs $args_else
else
run $command $args_all
fi
exit $?
|