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