yazpp-config: quote some RHS values (that might include blanks)
[yazpp-moved-to-github.git] / yazpp-config.in
index fd52071..d66d4c1 100644 (file)
@@ -1,23 +1,25 @@
 #!/bin/sh
 #!/bin/sh
-# $Id: yazpp-config.in,v 1.2 2006-12-12 14:39:02 marc Exp $
-yazppprefix=@prefix@
-yaz_echo_cflags=no
-yaz_echo_libs=no
-yaz_echo_help=no
-yaz_echo_tabs=no
-yaz_echo_source=yes
-yaz_echo_lalibs=no
-yazpp_src_root=@YAZPP_SRC_ROOT@
-yazpp_build_root=@YAZPP_BUILD_ROOT@
-
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+includedir="@includedir@"
+echo_cflags=no
+echo_libs=no
+echo_help=no
+echo_tabs=no
+echo_source=yes
+echo_lalibs=no
+echo_zoom=no
+src_root="@abs_top_srcdir@"
+build_root="@abs_top_builddir@"
 yazlibs="@YAZLIB@ @LIBS@"
 yazlalibs="@YAZLALIB@ @LIBS@"
 yazlibs="@YAZLIB@ @LIBS@"
 yazlalibs="@YAZLALIB@ @LIBS@"
-YAZPPVERSION=@VERSION@
+VERSION=@VERSION@
 
 usage()
 {
        cat <<EOF
 
 usage()
 {
        cat <<EOF
-Usage: yaz++-config [OPTIONS] [LIBRARIES]
+Usage: yazpp-config [OPTIONS] [LIBRARIES]
 Options:
        [--prefix[=DIR]]
        [--version]
 Options:
        [--prefix[=DIR]]
        [--version]
@@ -29,78 +31,92 @@ EOF
 }
 
 if test $# -eq 0; then
 }
 
 if test $# -eq 0; then
-       yaz_echo_help=yes
+    echo_help=yes
 fi
 
 while test $# -gt 0; do
 fi
 
 while test $# -gt 0; do
-  case "$1" in
-  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-  *) optarg= ;;
-  esac
-
-  case $1 in
-    --prefix=*)
-      yazppprefix=$optarg
-      ;;
-    --prefix)
-      echo $yazppprefix
-      exit 0
-      ;;
-    --version)
-      echo $YAZPPVERSION
-      exit 0
-      ;;
-    --cflags)
-      yaz_echo_cflags=yes
-      ;;
-    --libs)
-      yaz_echo_libs=yes
-      ;;
-    --tabs)
-      yaz_echo_tabs=yes
-      ;;
-    --lalibs)
-      yaz_echo_lalibs=yes
-      ;;
-    -*)
-      yaz_echo_help=yes
-      ;;
-  esac
-  shift
+    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
+           ;;
+       zoom)
+           echo_zoom=yes
+           ;;
+       -*)
+           echo_help=yes
+           ;;
+    esac
+    shift
 done
 
 done
 
-libs_short="-lyazpp -lzoompp"
+YAZPPINC="@YAZINC@"
+YAZPPLALIB="$yazlalibs"
+YAZPPLIB="$yazlibs"
 
 
-if test "$yaz_echo_source" = "yes"; then
-    YAZPPLIB="-L${yazpp_build_root}/src/.libs -lyazpp"
-    YAZPPLIB="$YAZPPLIB -L${yazpp_build_root}/zoom/.libs -lzoompp"
-    YAZPPLIB="$YAZPPLIB $yazlibs"
-    YAZPPLALIB="${yazpp_build_root}/src/libyazpp.la $yazlalibs"
-    YAZPPINC="@YAZINC@ -I${yazpp_src_root}/include"
+if test "$echo_source" = "yes"; then
+    if test "$echo_zoom" = "yes"; then
+        YAZPPLIB="-L${build_root}/zoom/.libs -lzoomzpp $YAZPPLIB"
+        YAZPPLALIB="${build_root}/zoom/libzoompp.la $YAZPPLALIB"
+    else
+        YAZPPLIB="-L${build_root}/src/.libs -lyazpp $YAZPPLIB"
+        YAZPPLALIB="${build_root}/src/libyazpp.la $YAZPPLALIB"
+    fi
+    YAZPPINC="$YAZPPINC -I${src_root}/include"
 else
 else
-
-    if test "$yazppprefix" = "/usr"; then
-       YAZPPLIB="${libs_short} $yazlibs"
+    if test "$echo_zoom" = "yes"; then
+       libs_short="-lzoompp"
     else
     else
-       YAZPPLIB="-L${yazppprefix}/lib ${libs_short} $yazlibs"
+       libs_short="-lyazpp"
     fi
     fi
-    YAZPPLALIB=$YAZPPLIB
-    if test "$yazppprefix" = "/usr"; then
-       YAZPPINC="@YAZINC@"
+    if test "$prefix" = "/usr"; then
+       YAZPPLIB="${libs_short} $YAZPPLIB"
     else
     else
-       YAZPPINC="@YAZINC@ -I${yazppprefix}/include"
+       YAZPPLIB="-L${libdir} ${libs_short} $YAZPPLIB"
+    fi
+    YAZPPLALIB="$YAZPPLIB"
+    if test "$prefix" != "/usr"; then
+       YAZPPINC="$YAZPPINC -I${includedir}"
     fi
 fi
 
     fi
 fi
 
-if test "$yaz_echo_help" = "yes"; then
-       usage 1 1>&2
+if test "$echo_help" = "yes"; then
+    usage 1 1>&2
 fi
 fi
-if test "$yaz_echo_cflags" = "yes"; then
-       echo $YAZPPINC
+if test "$echo_cflags" = "yes"; then
+    echo $YAZPPINC
 fi
 fi
-if test "$yaz_echo_libs" = "yes"; then
-       echo $YAZPPLIB
+if test "$echo_libs" = "yes"; then
+    echo $YAZPPLIB
 fi
 fi
-if test "$yaz_echo_lalibs" = "yes"; then
-       echo $YAZPPLALIB
+if test "$echo_lalibs" = "yes"; then
+    echo $YAZPPLALIB
 fi
 fi
+# Local Variables:
+# mode:shell-script
+# sh-indentation: 2
+# sh-basic-offset: 4
+# End: