245af98
#!/bin/sh
245af98
245af98
prefix=@prefix@
245af98
245af98
major_version=@MOD_MAJOR_VERSION@
245af98
minor_version=@MOD_MINOR_VERSION@
245af98
patch_version=@MOD_PATCH_VERSION@
245af98
245af98
usage()
245af98
{
245af98
	cat <
245af98
Usage: nss-config [OPTIONS] [LIBRARIES]
245af98
Options:
245af98
	[--prefix[=DIR]]
245af98
	[--exec-prefix[=DIR]]
245af98
	[--includedir[=DIR]]
245af98
	[--libdir[=DIR]]
245af98
	[--version]
245af98
	[--libs]
245af98
	[--cflags]
245af98
Dynamic Libraries:
245af98
	nss
6c84820
	nssutil
245af98
	ssl
245af98
	smime
245af98
EOF
245af98
	exit $1
245af98
}
245af98
245af98
if test $# -eq 0; then
245af98
	usage 1 1>&2
245af98
fi
245af98
245af98
lib_ssl=yes
245af98
lib_smime=yes
245af98
lib_nss=yes
6c84820
lib_nssutil=yes
245af98
245af98
while test $# -gt 0; do
245af98
  case "$1" in
245af98
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
245af98
  *) optarg= ;;
245af98
  esac
245af98
245af98
  case $1 in
245af98
    --prefix=*)
245af98
      prefix=$optarg
245af98
      ;;
245af98
    --prefix)
245af98
      echo_prefix=yes
245af98
      ;;
245af98
    --exec-prefix=*)
245af98
      exec_prefix=$optarg
245af98
      ;;
245af98
    --exec-prefix)
245af98
      echo_exec_prefix=yes
245af98
      ;;
245af98
    --includedir=*)
245af98
      includedir=$optarg
245af98
      ;;
245af98
    --includedir)
245af98
      echo_includedir=yes
245af98
      ;;
245af98
    --libdir=*)
245af98
      libdir=$optarg
245af98
      ;;
245af98
    --libdir)
245af98
      echo_libdir=yes
245af98
      ;;
245af98
    --version)
245af98
      echo ${major_version}.${minor_version}.${patch_version}
245af98
      ;;
245af98
    --cflags)
245af98
      echo_cflags=yes
245af98
      ;;
245af98
    --libs)
245af98
      echo_libs=yes
245af98
      ;;
245af98
    ssl)
245af98
      lib_ssl=yes
245af98
      ;;
245af98
    smime)
245af98
      lib_smime=yes
245af98
      ;;
245af98
    nss)
245af98
      lib_nss=yes
245af98
      ;;
6c84820
    nssutil)
6c84820
      lib_nssutil=yes
6c84820
      ;;
245af98
    *)
245af98
      usage 1 1>&2
245af98
      ;;
245af98
  esac
245af98
  shift
245af98
done
245af98
245af98
# Set variables that may be dependent upon other variables
245af98
if test -z "$exec_prefix"; then
2bb335b
    exec_prefix=`pkg-config --variable=exec_prefix nss`
245af98
fi
245af98
if test -z "$includedir"; then
2bb335b
    includedir=`pkg-config --variable=includedir nss`
245af98
fi
245af98
if test -z "$libdir"; then
2bb335b
    libdir=`pkg-config --variable=libdir nss`
245af98
fi
245af98
245af98
if test "$echo_prefix" = "yes"; then
245af98
    echo $prefix
245af98
fi
245af98
245af98
if test "$echo_exec_prefix" = "yes"; then
245af98
    echo $exec_prefix
245af98
fi
245af98
245af98
if test "$echo_includedir" = "yes"; then
245af98
    echo $includedir
245af98
fi
245af98
245af98
if test "$echo_libdir" = "yes"; then
245af98
    echo $libdir
245af98
fi
245af98
245af98
if test "$echo_cflags" = "yes"; then
245af98
    echo -I$includedir
245af98
fi
245af98
245af98
if test "$echo_libs" = "yes"; then
6c84820
      libdirs="-Wl,-rpath-link,$libdir -L$libdir"
245af98
      if test -n "$lib_ssl"; then
245af98
	libdirs="$libdirs -lssl${major_version}"
245af98
      fi
245af98
      if test -n "$lib_smime"; then
245af98
	libdirs="$libdirs -lsmime${major_version}"
245af98
      fi
245af98
      if test -n "$lib_nss"; then
245af98
	libdirs="$libdirs -lnss${major_version}"
245af98
      fi
6c84820
      if test -n "$lib_nssutil"; then
6c84820
	libdirs="$libdirs -lnssutil${major_version}"
6c84820
      fi
245af98
      echo $libdirs
245af98
fi      
245af98