summaryrefslogtreecommitdiff
path: root/tools/sane-config.in
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sane-config.in')
-rw-r--r--tools/sane-config.in91
1 files changed, 91 insertions, 0 deletions
diff --git a/tools/sane-config.in b/tools/sane-config.in
new file mode 100644
index 0000000..8e4b52a
--- /dev/null
+++ b/tools/sane-config.in
@@ -0,0 +1,91 @@
+#!/bin/sh
+#
+# This script is part of SANE, <URL:http://www.sane-project.org/>
+#
+# Send bugreports and other requests to sane-devel@lists.alioth.debian.org
+
+PACKAGE="@PACKAGE@"
+scriptname="sane-config"
+
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+
+# using our installed *.pc only - neither default nor user paths
+export PKG_CONFIG_LIBDIR="@libdir@/pkgconfig"
+export PKG_CONFIG_PATH=""
+
+pkgconfig_package=sane-backends
+
+usage ()
+{
+ echo "Usage: " 1>&2
+ echo "$scriptname --version - show installed script and SANE version" 1>&2
+ echo "$scriptname --ldflags - linker flags required to link with SANE" 1>&2
+ echo "$scriptname --libs - libraries required to link with SANE" 1>&2
+ echo "$scriptname --cflags - compiler flags required to find SANE headers" 1>&2
+ echo "$scriptname --help - show usage info (this message) " 1>&2
+ echo "$scriptname --help SUBCOMMAND - show help for SUBCOMMAND " 1>&2
+ echo "$scriptname --prefix - prefix used during SANE compile" 1>&2
+ echo "$scriptname --exec-prefix - exec-prefix used during SANE compile" 1>&2
+}
+
+if test $# -eq 0; then
+ usage
+ exit 1
+fi
+
+if test $# -gt 0; then
+ case $1 in
+ --version)
+ echo @NUMBER_VERSION@
+ ;;
+ --help)
+ if test $# -eq 1; then
+ usage
+ elif test $# -eq 2; then
+ case $2 in
+ --cflags)
+ echo "Usage: $0 --cflags"
+ echo " Print C compiler flags for compiling code that uses SANE."
+ echo " This includes any \`-I' flags needed to find Sane's header files."
+ ;;
+ --ldflags)
+ echo "Usage: $0 --ldflags"
+ echo " Print linker flags for building the \`$PACKAGE' executable."
+ echo " Print the linker command-line flags necessary to link against"
+ echo " the SANE library. The libraries are listed with --libs."
+ ;;
+ --libs)
+ echo "Usage: $0 --libs"
+ echo " Print linker flags for building the \`$PACKAGE' executable."
+ echo " Print the linker command-line flags necessary to link against"
+ echo " the SANE library, and any other libraries it requires."
+ ;;
+ esac
+ else
+ usage
+ fi
+ exit 1
+ ;;
+ --ldflags)
+ pkg-config --libs-only-L "$pkgconfig_package"
+ ;;
+ --libs)
+ pkg-config --libs "$pkgconfig_package"
+ ;;
+ --cflags)
+ pkg-config --cflags "$pkgconfig_package"
+ ;;
+ --prefix)
+ echo "${prefix}"
+ ;;
+ --exec-prefix)
+ echo "${exec_prefix}"
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+fi
+