Yavor Goulishev | e9a6831 | 2011-05-23 11:58:06 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | prefix=@prefix@ |
| 4 | exec_prefix=@exec_prefix@ |
| 5 | includedir=@includedir@ |
| 6 | libdir=@libdir@ |
| 7 | exec_prefix_set=no |
| 8 | |
| 9 | usage() |
| 10 | { |
| 11 | cat <<EOF |
| 12 | Usage: libusb-config [OPTIONS] [LIBRARIES] |
| 13 | Options: |
| 14 | [--prefix[=DIR]] |
| 15 | [--exec-prefix[=DIR]] |
| 16 | [--version] |
| 17 | [--libs] |
| 18 | [--cflags] |
| 19 | EOF |
| 20 | exit $1 |
| 21 | } |
| 22 | |
| 23 | if test $# -eq 0; then |
| 24 | usage 1 1>&2 |
| 25 | fi |
| 26 | |
| 27 | while test $# -gt 0; do |
| 28 | case "$1" in |
| 29 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; |
| 30 | *) optarg= ;; |
| 31 | esac |
| 32 | |
| 33 | case $1 in |
| 34 | --prefix=*) |
| 35 | prefix=$optarg |
| 36 | if test $exec_prefix_set = no ; then |
| 37 | exec_prefix=$optarg |
| 38 | fi |
| 39 | ;; |
| 40 | --prefix) |
| 41 | echo_prefix=yes |
| 42 | ;; |
| 43 | --exec-prefix=*) |
| 44 | exec_prefix=$optarg |
| 45 | exec_prefix_set=yes |
| 46 | ;; |
| 47 | --exec-prefix) |
| 48 | echo_exec_prefix=yes |
| 49 | ;; |
| 50 | --version) |
| 51 | echo @LIBUSB01_VERSION@ |
| 52 | exit 0 |
| 53 | ;; |
| 54 | --cflags) |
| 55 | if test "$includedir" != /usr/include ; then |
| 56 | includes="-I$includedir" |
| 57 | fi |
| 58 | echo_cflags=yes |
| 59 | ;; |
| 60 | --libs) |
| 61 | echo_libs=yes |
| 62 | ;; |
| 63 | *) |
| 64 | usage 1 1>&2 |
| 65 | ;; |
| 66 | esac |
| 67 | shift |
| 68 | done |
| 69 | |
| 70 | if test "$echo_prefix" = "yes"; then |
| 71 | echo $prefix |
| 72 | fi |
| 73 | if test "$echo_exec_prefix" = "yes"; then |
| 74 | echo $exec_prefix |
| 75 | fi |
| 76 | if test "$echo_cflags" = "yes"; then |
| 77 | echo $includes |
| 78 | fi |
| 79 | if test "$echo_libs" = "yes"; then |
| 80 | echo -L$libdir -lusb |
| 81 | fi |