• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# This script is part of SANE, <URL:http://www.sane-project.org/>
4#
5# Send bugreports and other requests to sane-devel@alioth-lists.debian.net
6
7PACKAGE="@PACKAGE@"
8scriptname="sane-config"
9
10prefix="@prefix@"
11exec_prefix="@exec_prefix@"
12
13# using our installed *.pc only - neither default nor user paths
14export PKG_CONFIG_LIBDIR="@libdir@/pkgconfig"
15export PKG_CONFIG_PATH=""
16
17pkgconfig_package=sane-backends
18
19usage ()
20{
21  echo "Usage: "  1>&2
22  echo "$scriptname --version         - show installed script and SANE version"  1>&2
23  echo "$scriptname --ldflags         - linker flags required to link with SANE"  1>&2
24  echo "$scriptname --libs            - libraries required to link with SANE"  1>&2
25  echo "$scriptname --cflags          - compiler flags required to find SANE headers"  1>&2
26  echo "$scriptname --help            - show usage info (this message)          "  1>&2
27  echo "$scriptname --help SUBCOMMAND - show help for SUBCOMMAND                "  1>&2
28  echo "$scriptname --prefix          - prefix used during SANE compile"  1>&2
29  echo "$scriptname --exec-prefix     - exec-prefix used during SANE compile"  1>&2
30}
31
32if test $# -eq 0; then
33      usage
34      exit 1
35fi
36
37if test $# -gt 0; then
38  case $1 in
39    --version)
40      echo @V_MAJOR@.@V_MINOR@.@V_REV@
41      ;;
42    --help)
43      if test $# -eq 1; then
44        usage
45      elif test $# -eq 2; then
46        case $2 in
47          --cflags)
48            echo "Usage: $0 --cflags"
49            echo "  Print C compiler flags for compiling code that uses SANE."
50            echo "  This includes any \`-I' flags needed to find Sane's header files."
51            ;;
52          --ldflags)
53            echo "Usage: $0 --ldflags"
54            echo "  Print linker flags for building the \`$PACKAGE' executable."
55            echo "  Print the linker command-line flags necessary to link against"
56            echo "  the SANE library.  The libraries are listed with --libs."
57            ;;
58          --libs)
59            echo "Usage: $0 --libs"
60            echo "  Print linker flags for building the \`$PACKAGE' executable."
61            echo "  Print the linker command-line flags necessary to link against"
62            echo "  the SANE library, and any other libraries it requires."
63            ;;
64        esac
65      else
66        usage
67      fi
68      exit 1
69      ;;
70    --ldflags)
71      pkg-config --libs-only-L "$pkgconfig_package"
72      ;;
73    --libs)
74      pkg-config --libs "$pkgconfig_package"
75      ;;
76    --cflags)
77      pkg-config --cflags "$pkgconfig_package"
78      ;;
79    --prefix)
80      echo "${prefix}"
81      ;;
82    --exec-prefix)
83      echo "${exec_prefix}"
84      ;;
85    *)
86      usage
87      exit 1
88      ;;
89  esac
90fi
91