I am porting the FLEX compiler infrastructure (http://flexc.lcs.mit.edu)
to work with GNU classpath, and noticed that classpath was missing
a <foo>-config script (similar to the gtk-config script) that would tell
you where the various libraries have been placed after installation.
So I wrote one; the patch is appended.  This way other applications
can use commands such as:
  java -bootclasspath `classpath-config --classpath` ...
instead of trying to figure out manually where glibj.zip has hidden itself
on this particular platform.  Also 'classpath-config --version' will
report the version number of classpath, which is handy for VMs which would
like to keep up with the changing VM interface of classpath.  [And on that
note, it would be handy if the version number of the copy from CVS were
changed to something other than 0.04 to account for the change in the
Runtime.execInternal contract.]

Comments are welcome; I hope this is something that can be committed in
time for classpath 0.05.  I'm cc'ing John Leuner, maintainer of the
debian package of classpath (actually, I think he's on the classpath@gnu
list, but better safe than sorry) -- I'm actually hoping that this could
be backported to the classpath 0.04 debian package (the patch will apply
to both current CVS and to the 0.04 release) to make it easier to install
my FLEX project on debian machines using the classpath package.

Don't forget to re-run automake && autoconf after patching. =)
  --scott [patch appended after .sig]

ASW Sudan Yakima Mk 48 spy AK-47 Kennedy NORAD Ft. Meade Honduras 
Semtex explosion C4 SLBM overthrow RNC Yeltsin blowfish UKUSA nuclear 
                         ( http://cscott.net/ )

diff -ruHpN classpath-0.04.orig/Makefile.am classpath-0.04/Makefile.am
--- classpath-0.04.orig/Makefile.am     2002-02-07 23:04:55.000000000 -0500
+++ classpath-0.04/Makefile.am  2002-09-05 07:57:54.000000000 -0400
@@ -4,6 +4,8 @@ SUBDIRS = lib native doc resource com gn
 
 native: lib
 
+bin_SCRIPTS = classpath-config
+
 EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath
 
 dist-hook:
diff -ruHpN classpath-0.04.orig/classpath-config.in classpath-0.04/classpath-config.in
--- classpath-0.04.orig/classpath-config.in     1969-12-31 19:00:00.000000000 -0500
+++ classpath-0.04/classpath-config.in  2002-09-05 07:40:23.000000000 -0400
@@ -0,0 +1,134 @@
+#!/bin/sh
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+exec_prefix_set=no
+
+datadir=@datadir@
+libdir=@libdir@
+
+usage()
+{
+       cat <<EOF
+Usage: classpath-config [OPTIONS] [LIBRARIES]
+Options:
+       [--prefix[=DIR]]
+       [--exec-prefix[=DIR]]
+       [--datadir[=DIR]]
+       [--pkgdatadir]
+       [--libdir[=DIR]]
+       [--pkglibdir]
+       [--version]
+       [--libs]
+       [--classpath]
+Libraries:
+       classpath
+EOF
+       exit $1
+}
+
+if test $# -eq 0; then
+       usage 1 1>&2
+fi
+
+lib_classpath=yes
+
+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
+      if test $exec_prefix_set = no ; then
+        exec_prefix=$optarg
+      fi
+      ;;
+    --prefix)
+      echo_prefix=yes
+      ;;
+    --exec-prefix=*)
+      exec_prefix=$optarg
+      exec_prefix_set=yes
+      ;;
+    --exec-prefix)
+      echo_exec_prefix=yes
+      ;;
+    --datadir=*)
+      datadir=$optarg
+      datadir_set=yes
+      ;;
+    --datadir)
+      echo_datadir=yes
+      ;;
+    --pkgdatadir)
+      echo_pkgdatadir=yes
+      ;;
+    --libdir=*)
+      libdir=$optarg
+      libdir_set=yes
+      ;;
+    --libdir)
+      echo_libdir=yes
+      ;;
+    --pkglibdir)
+      echo_pkglibdir=yes
+      ;;
+    --version)
+      echo @VERSION@
+      ;;
+    --classpath)
+      echo_classpath=yes
+      ;;
+    --libs)
+      echo_libs=yes
+      ;;
+    classpath)
+      lib_classpath=yes
+      ;;
+    *)
+      usage 1 1>&2
+      ;;
+  esac
+  shift
+done
+
+pkgdatadir=$datadir/@PACKAGE@
+pkglibdir=$libdir/@PACKAGE@
+
+if test "$echo_prefix" = "yes"; then
+       echo $prefix
+fi
+
+if test "$echo_exec_prefix" = "yes"; then
+       echo $exec_prefix
+fi
+
+if test "$echo_datadir" = "yes"; then
+       echo $datadir
+fi
+
+if test "$echo_pkgdatadir" = "yes"; then
+       echo $pkgdatadir
+fi
+
+if test "$echo_classpath" = "yes"; then
+    # if classpath is ever split up into multiple bytecode archives, list
+    # all of them here, separated by ':' (is this platform-dependent?)
+      echo $pkgdatadir/glibj.zip
+fi
+
+if test "$echo_libs" = "yes"; then
+    # all the libraries needed to link classpath native code w/ a
+    # static executable
+      libdirs=-L$pkglibdir
+      my_libs=
+      for i in javautil gtkpeer javaio javalangreflect javalang javanet ; do
+       # files are in $pkglibdir/lib${i}.so
+       my_libs="$my_libs -l$i"
+      done
+
+      echo $libdirs $my_libs
+fi      
diff -ruHpN classpath-0.04.orig/configure.in classpath-0.04/configure.in
--- classpath-0.04.orig/configure.in    2002-05-06 00:26:19.000000000 -0400
+++ classpath-0.04/configure.in 2002-09-05 08:56:02.000000000 -0400
@@ -374,8 +374,10 @@ vm/reference/java/lang/Makefile
 vm/reference/java/lang/reflect/Makefile
 lib/Makefile
 lib/gen-classlist.sh
-lib/gen_nio.sh,
-[ chmod 755 lib/gen-classlist.sh
+lib/gen_nio.sh
+classpath-config
+doc/classpath-config.1,
+[ chmod 755 lib/gen-classlist.sh classpath-config
 ])
 
 
diff -ruHpN classpath-0.04.orig/doc/Makefile.am classpath-0.04/doc/Makefile.am
--- classpath-0.04.orig/doc/Makefile.am 2001-01-06 23:22:27.000000000 -0500
+++ classpath-0.04/doc/Makefile.am      2002-09-05 07:57:54.000000000 -0400
@@ -1,5 +1,7 @@
 info_TEXINFOS = hacking.texinfo vmintegration.texinfo
 
+man_MANS = classpath-config.1
+
 %.dvi : %.texinfo
        texi2dvi $<
 
diff -ruHpN classpath-0.04.orig/doc/classpath-config.1.in 
classpath-0.04/doc/classpath-config.1.in
--- classpath-0.04.orig/doc/classpath-config.1.in       1969-12-31 19:00:00.000000000 
-0500
+++ classpath-0.04/doc/classpath-config.1.in    2002-09-05 09:04:03.000000000 -0400
@@ -0,0 +1,64 @@
+.TH classpath-config 1 "5 September 2002" Classpath "Version @VERSION@"
+.SH NAME
+classpath-config - Get information about a GNU Classpath installation
+.SH SYNOPSIS
+.B classpath-config
+[\-\-prefix\fI[=DIR]\fP] [\-\-exec\-prefix\fI[=DIR]\fP] [\-\-datadir\fI[=DIR]\fP] 
+[\-\-libdir\fI[=DIR]\fP] [\-\-pkgdatadir] [\-\-pkglibdir] [\-\-version] [\-\-libs] 
+[\-\-classpath]
+.SH DESCRIPTION
+.PP
+\fIclasspath-config\fP is a tool that is used to determine
+the compiler and linker flags that should be used to compile
+and link programs that use GNU \fIClasspath\fP. It may also be used
+internally in macros for GNU autoconf for packages which use
+GNU \fIClasspath\fP.
+.
+.SH OPTIONS
+.l
+\fIclasspath-config\fP accepts the following options:
+.TP 8
+.B  \-\-version
+Print the currently installed version of GNU \fIClasspath\fP on the
+standard output.
+.TP 8
+.B  \-\-libs
+Print the linker flags that are necessary to link the native code in
+GNU \fIClasspath\fP with a static executable.
+.TP 8
+.B  \-\-classpath
+Print the java classpath necessary for a java compiler to compile a
+java program against GNU \fIClasspath\fP.
+.TP 8
+.B  \-\-prefix=PREFIX
+If specified, use PREFIX instead of the installation prefix that 
+GNU \fIClasspath\fP was built with when computing the output for the
+\-\-classpath and \-\-libs options. This option is also used for the
+exec prefix if \-\-exec\-prefix was not specified. This option must be
+specified before any \-\-libs or \-\-classpath options.
+.TP 8
+.B  \-\-exec\-prefix=PREFIX
+If specified, use PREFIX instead of the installation exec prefix that
+GNU \fIClasspath\fP was built with when computing the output for the
+\-\-classpath and \-\-libs options.  This option must be specified before
+any \-\-libs or \-\-classpath options.
+.TP 8
+.B  \-\-datadir=DATADIR
+If specified, use DATADIR instead of the data directory prefix that
+GNU \fIClasspath\fP was built with when computing the output for the
+\-\-classpath and \-\-libs options.  This option must be specified before
+any \-\-libs or \-\-classpath options.
+.TP 8
+.B  \-\-libdir=LIBDIR
+If specified, use LIBDIR instead of the library directory prefix that
+GNU \fIClasspath\fP was built with when computing the output for the
+\-\-classpath and \-\-libs options.  This option must be specified before
+any \-\-libs or \-\-classpath options.
+.SH SEE ALSO
+.BR gtk-config (1)
+.SH COPYRIGHT
+Copyright \(co  2002 C. Scott Ananian
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation.



_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to