Add metaproxy-config
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 15 Sep 2010 08:46:47 +0000 (10:46 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 15 Sep 2010 08:46:47 +0000 (10:46 +0200)
Makefile.am
configure.ac
debian/libmetaproxy3-dev.install
metaproxy-config.in [new file with mode: 0644]
metaproxy.spec
src/Makefile.am

index 04ba163..d9d5071 100644 (file)
@@ -9,7 +9,7 @@ AUTOMAKE_OPTIONS = foreign
 
 EXTRA_DIST = Doxyfile.in NEWS README LICENSE \
              m4/yazpp.m4 m4/yaz.m4 m4/ax_boost.m4 \
-             buildconf.sh metaproxy.spec
+             buildconf.sh metaproxy.spec metaproxy-config.in
 
 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure 
 
index e8f8a98..24c0745 100644 (file)
@@ -61,6 +61,7 @@ fi
 AC_DEFINE_UNQUOTED([VERSION_SHA1], "$SHA1", [SHA-1 from Git])
 
 AC_CONFIG_FILES([
+       metaproxy-config
         Doxyfile
        Makefile
        include/Makefile include/metaproxy/Makefile
@@ -73,6 +74,9 @@ AC_CONFIG_FILES([
         doc/common/Makefile
        doc/common/print.dsl
        etc/Makefile
+],[
+        sed s%echo_source=yes%echo_source=no%g < metaproxy-config > src/metaproxy-config && chmod +x metaproxy-config src/metaproxy-config
+
 ])
 
 AC_OUTPUT
index f1c58d2..e272241 100644 (file)
@@ -1,3 +1,4 @@
 debian/tmp/usr/include/metaproxy
 debian/tmp/usr/lib/libmetaproxy*.a
 debian/tmp/usr/lib/libmetaproxy*.so
+debian/tmp/usr/bin/metaproxy-config
diff --git a/metaproxy-config.in b/metaproxy-config.in
new file mode 100644 (file)
index 0000000..9a4bb8c
--- /dev/null
@@ -0,0 +1,99 @@
+#!/bin/sh
+prefix=@prefix@
+echo_cflags=no
+echo_libs=no
+echo_help=no
+echo_tabs=no
+echo_source=yes
+echo_lalibs=no
+src_root=@abs_top_srcdir@
+build_root=@abs_top_builddir@
+
+libs="@YAZPPLIB@ @LIBS@"
+lalibs="@YAZPPLALIB@ @LIBS@"
+VERSION=@VERSION@
+
+usage()
+{
+       cat <<EOF
+Usage: metaproxy-config [OPTIONS] [LIBRARIES]
+Options:
+       [--prefix[=DIR]]
+       [--version]
+       [--libs]
+       [--lalibs]
+       [--cflags]
+EOF
+       exit $1
+}
+
+if test $# -eq 0; then
+       echo_help=yes
+fi
+
+while test $# -gt 0; do
+  case "$1" in
+  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  case $1 in
+    --prefix=*)
+      prefix=$optarg
+      ;;
+    --prefix)
+      echo $prefix
+      exit 0
+      ;;
+    --version)
+      echo $VERSION
+      exit 0
+      ;;
+    --cflags)
+      echo_cflags=yes
+      ;;
+    --libs)
+      echo_libs=yes
+      ;;
+    --tabs)
+      echo_tabs=yes
+      ;;
+    --lalibs)
+      echo_lalibs=yes
+      ;;
+    -*)
+      echo_help=yes
+      ;;
+  esac
+  shift
+done
+
+INC="@YAZPPINC@"
+
+if test "$echo_source" = "yes"; then
+    LIB="-L${build_root}/src/.libs -lmetaproxy $libs"
+    LALIB="${build_root}/src/libmetaproxy.la $lalibs"
+    INC="-I${src_root}/include $INC"
+else
+    LIB="-lmetaproxy $libs"
+    if test "$prefix" != "/usr"; then
+       LIB="-L${prefix}/lib $LIB"
+    fi
+    LALIB=$LIB
+    if test "$prefix" != "/usr"; then
+       INC="-I${prefix}/include $INC"
+    fi
+fi
+
+if test "$echo_help" = "yes"; then
+       usage 1 1>&2
+fi
+if test "$echo_cflags" = "yes"; then
+    echo $INC
+fi
+if test "$echo_libs" = "yes"; then
+    echo $LIB
+fi
+if test "$echo_lalibs" = "yes"; then
+    echo $LALIB
+fi
index dc541c5..6cd4f02 100644 (file)
@@ -83,6 +83,7 @@ rm -fr ${RPM_BUILD_ROOT}
 %{_includedir}/metaproxy
 %{_libdir}/*.so
 %{_libdir}/*.a
+%{_bindir}/metaproxy-config
 
 %files doc
 %defattr(-,root,root)
index ee24046..7f6756f 100644 (file)
@@ -9,6 +9,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include
 
 AM_LDFLAGS =
 
+bin_SCRIPTS = metaproxy-config
+
 # Rules for the library..
 
 lib_LTLIBRARIES = libmetaproxy.la