I would have attempted to create a real patch here but I couldn't
access the readonly cvs at cvs.kaffe.org because the name wasn't
resolving for me.

I've attached a text file which is just a simple script to be created
by autoconf at configure time and included in the scripts to be
installed in bindir.  It is useful for determining how Kaffe was
compiled and where libraries and headers are located.

Place the file in kaffe/scripts/ and call it kaffe-config.in.  Add the
file to Makefile.am in the same directory and to configure.in to have
kaffe-config generated.

I've tested this with kaffe-1.0.5.

Thanks,
Brian
-- 
Brian Jones <[EMAIL PROTECTED]>

#!/bin/sh
#
# Similar to japhar-config.  Makes integration easier.
#

PACKAGE="@PACKAGE@"
scriptname="@PACKAGE@-config"

prefix="@prefix@"
exec_prefix="@exec_prefix@"

includedir="@includedir@"
mandir="@mandir@"
infodir="@infodir@"
libdir="@libdir@"
localstatedir="@localstatedir@"
sysconfdir="@sysconfdir@"
datadir="@datadir@"
libexecdir="@libexecdir@"
sbindir="@sbindir@"
bindir="@bindir@"
#${prefix}
#exec_prefix_set=no
srcdir="@srcdir@"
top_srcdir="@top_srcdir@"

pkgincludedir="${includedir}/@PACKAGE@"
pkgdatadir="${datadir}/@PACKAGE@"
pkglibdir="${libdir}/@PACKAGE@"

kaffe_cflags="-I${includedir} -I${pkgincludedir}"
LIBS="@M_LIBS@"
LINK_LIBS="-L${libdir} -L${pkglibdir}"

AWT_LIBS="@AWT_LIBS@"
KAFFE_LIBS="@KAFFE_LIBS@"
MATH_LIBS="@MATH_LIBS@"
NET_LIBS="@NET_LIBS@"
SECURITY_LIBS="@SECURITY_LIBS@"
VM_LIBS="@VM_LIBS@"
ZIP_LIBS="@ZIP_LIBS@"

# need LINK_LIBS to be the combination of several variables
for i in $KAFFE_LIBS $MATH_LIBS $NET_LIBS $SECURITY_LIBS $VM_LIBS $ZIP_LIBS ; do
  add_to_lib=1
  for j in ${LINK_LIBS}; do
    if test $i = $j || test $i = "-L${libdir}" || test $i = "-L${pkglibdir}" ; then
      add_to_lib=0
    fi
  done
  if test $add_to_lib -eq 1; then
    LINK_LIBS="${LINK_LIBS} $i"
  fi
done

usage="\
Usage: \n\
  $scriptname --version         - show installed script and Kaffe version\n\
  $scriptname --help            - show usage info (this message)          \n\
  $scriptname --help SUBCOMMAND - show help for SUBCOMMAND                \n\
  $scriptname link              - print libraries to link with            \n\
  $scriptname compile           - print C compiler flags to compile with  \n\
  $scriptname info [VAR]        - print Kaffe build directories          \n\
  \n\
Compatibility options to mimic other *-config programs\n\
  $scriptname --prefix\n\
  $scriptname --exec-prefix\n\
  $scriptname --libs\n\
  $scriptname --cflags\n"

if test $# -eq 0; then
      echo -e "${usage}" 1>&2
      exit 1
fi

if test $# -gt 0; then
  case $1 in
    --version)
      echo @VERSION@
      ;;
    --help)
      if test $# -eq 1; then
        echo -e "${usage}" 1>&2
      elif test $# -eq 2; then
        case $2 in 
          link|--libs)
            echo "Usage: $0 link"
            echo "  Print linker flags for building the \`$PACKAGE' executable."
            echo "  Print the linker command-line flags necessary to link against"
            echo "  the Kaffe JNI library, and any other libraries it requires."
            ;;
          compile|--cflags)
            echo "Usage: $0 compile"
            echo "  Print C compiler flags for compiling code that uses Kaffe JNI."
            echo "  This includes any \`-I' flags needed to find Kaffe's header files."
            ;;
          info)
            echo "Usage: $0 info [VAR]"
            echo "  Display the value of the Makefile variable VAR used when Kaffe"
            echo "  was built.  If VAR is omitted, display all Makefile variables."
            echo "  Use this command to find out where Kaffe was installed,"
            echo "  where it installed its class library, etc."
            ;;
        esac
      else
        echo -e "${usage}" 1>&2
      fi
      exit 1
      ;;
    link|--libs)
      echo "${LINK_LIBS} ${LIBS}"
      ;;
    compile|--cflags)
      unique_cflags="-I${includedir}"
      for i in $kaffe_cflags; do
        cflags_add="yes"
        for j in $unique_cflags; do
          if test $i == $j; then
            cflags_add="no"
          fi
        done
        if test "$cflags_add" == "yes"; then
          unique_cflags="${unique_cflags} $i"
        fi
      done
      echo ${unique_cflags}
      ;;
    info)
      if test $# -eq 1; then
        echo "LIBS = ${LIBS}"
#        echo "pkgincludedir = ${pkgincludedir}"
#        echo "pkglibdir = ${pkglibdir}"
        echo "includedir = ${includedir}"
        echo "mandir = ${mandir}"
        echo "infodir = ${infodir}"
        echo "libdir = ${libdir}"
        echo "localstatedir = ${localstatedir}"
        echo "sysconfdir = ${sysconfdir}"
        echo "datadir = ${datadir}"
        echo "libexecdir = ${libexecdir}"
        echo "sbindir = ${sbindir}"
        echo "bindir = ${bindir}"
        echo "prefix = ${prefix}"
        echo "exec_prefix = ${exec_prefix}"
#        echo "srcdir = ${srcdir}"
#        echo "top_srcdir = ${top_srcdir}"
      elif test $# -eq 2; then
        case $2 in
          LIBS)
            echo ${LIBS}
            ;;
          pkgincludedir)
            echo ${pkgincludedir}
            ;;
          pkglibdir)
            echo ${pkglibdir}
            ;;
          pkgdatadir)
            echo ${pkgdatadir}
            ;;
          includedir)
            echo ${includedir}
            ;;
          mandir)
            echo ${mandir}
            ;;
          infodir)
            echo ${infodir}
            ;;
          libdir)
            echo ${libdir}
            ;;
          localstatedir)
            echo ${localstatedir}
            ;;
          sharedstatedir)
            echo ${sharedstatedir}
            ;;
          sysconfdir)
            echo ${sysconfdir}
            ;;
          datadir)
            echo ${datadir}
            ;;
          libexecdir)
            echo ${libexecdir}
            ;;
          sbindir)
            echo ${sbindir}
            ;;
          bindir)
            echo ${bindir}
            ;;
          exec_prefix)
            echo ${exec_prefix}
            ;;
          prefix)
            echo ${prefix}
            ;;
#          top_srcdir)
#            echo ${top_srcdir}
#            ;;
#          srcdir)
#            echo ${srcdir}
#            ;;
          *)
            echo -e "${usage}" 1>&2
            ;;
        esac          
      fi
      ;;
    --prefix)
      echo ${prefix}
      ;;
    --exec-prefix)
      echo ${exec_prefix}
      ;;
    *)
      echo -e "${usage}" 1>&2
      exit 1
      ;;
  esac
fi


Reply via email to