[kaffe] CVS kaffe (dalibor): Support for invocation API

Kaffe CVS cvs-commits at kaffe.org
Sat Jun 19 14:42:03 PDT 2004


PatchSet 4851 
Date: 2004/06/19 21:13:42
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Support for invocation API

2004-06-17  Julian Scheid  <julian at sektor37.de>

        * configure.ac,
        Makefile.am,
        kaffe/kaffevm/Makefile.am:
        Merged BinReloc: http://www.autopackage.org/docs/binreloc/

        * Makefile.am:
        Inserted kaffe/kaffevm into SUBDIRS to make sure libkaffevm.la is built
        before libnative.la.

        * libraries/clib/native/Makefile.am:
        Added libkaffevm.la to libnative_la_DEPENDENCIES.

        * kaffe/kaffevm/findInJar.c:
        (initClasspath) If both bootclasspath and classhome are NULL, use
        discoverClassHome() to find Kaffe .jar files.
        (discoverClassHome) Added.

        * kaffe/kaffevm/jni.c:
        Changed initial bootclasspath in Kaffe_JavaVMInitArgs to NULL.

Members: 
	ChangeLog:1.2418->1.2419 
	Makefile.am:1.66->1.67 
	Makefile.in:1.157->1.158 
	aclocal.m4:1.102->1.103 
	configure:1.331->1.332 
	configure.ac:1.30->1.31 
	binreloc/ChangeLog:INITIAL->1.1 
	binreloc/Makefile:INITIAL->1.1 
	binreloc/README:INITIAL->1.1 
	binreloc/libtest.c:INITIAL->1.1 
	binreloc/prefix.c:INITIAL->1.1 
	binreloc/prefix.h:INITIAL->1.1 
	binreloc/test.c:INITIAL->1.1 
	config/Makefile.in:1.131->1.132 
	developers/autogen.sh:1.39->1.40 
	include/Makefile.in:1.161->1.162 
	kaffe/Makefile.in:1.112->1.113 
	kaffe/jvmpi/Makefile.in:1.34->1.35 
	kaffe/kaffe/Makefile.in:1.128->1.129 
	kaffe/kaffeh/Makefile.in:1.110->1.111 
	kaffe/kaffevm/Makefile.am:1.59->1.60 
	kaffe/kaffevm/Makefile.in:1.153->1.154 
	kaffe/kaffevm/findInJar.c:1.58->1.59 
	kaffe/kaffevm/jni.c:1.114->1.115 
	kaffe/kaffevm/gcj/Makefile.in:1.92->1.93 
	kaffe/kaffevm/intrp/Makefile.in:1.98->1.99 
	kaffe/kaffevm/jit/Makefile.in:1.104->1.105 
	kaffe/kaffevm/jit3/Makefile.in:1.75->1.76 
	kaffe/kaffevm/systems/Makefile.in:1.100->1.101 
	kaffe/kaffevm/systems/beos-native/Makefile.in:1.91->1.92 
	kaffe/kaffevm/systems/oskit-pthreads/Makefile.in:1.97->1.98 
	kaffe/kaffevm/systems/unix-jthreads/Makefile.in:1.100->1.101 
	kaffe/kaffevm/systems/unix-pthreads/Makefile.in:1.71->1.72 
	kaffe/man/Makefile.in:1.98->1.99 
	kaffe/scripts/Makefile.in:1.135->1.136 
	kaffe/scripts/bat/Makefile.in:1.91->1.92 
	kaffe/scripts/compat/Makefile.in:1.116->1.117 
	kaffe/xprof/Makefile.in:1.66->1.67 
	libraries/Makefile.in:1.95->1.96 
	libraries/clib/Makefile.in:1.104->1.105 
	libraries/clib/awt/Makefile.in:1.108->1.109 
	libraries/clib/awt/X/Makefile.in:1.98->1.99 
	libraries/clib/awt/qt/Makefile.in:1.53->1.54 
	libraries/clib/io/Makefile.in:1.102->1.103 
	libraries/clib/libxmlj/Makefile.in:1.7->1.8 
	libraries/clib/management/Makefile.in:1.110->1.111 
	libraries/clib/math/Makefile.in:1.106->1.107 
	libraries/clib/native/Makefile.am:1.33->1.34 
	libraries/clib/native/Makefile.in:1.138->1.139 
	libraries/clib/net/Makefile.in:1.114->1.115 
	libraries/clib/nio/Makefile.in:1.29->1.30 
	libraries/clib/security/Makefile.in:1.76->1.77 
	libraries/clib/sound/Makefile.in:1.4->1.5 
	libraries/clib/sound/alsa/Makefile.in:1.4->1.5 
	libraries/clib/sound/common/Makefile.in:1.4->1.5 
	libraries/clib/sound/esd/Makefile.in:1.4->1.5 
	libraries/clib/zip/Makefile.in:1.108->1.109 
	libraries/extensions/Makefile.in:1.87->1.88 
	libraries/extensions/comm/Makefile.in:1.81->1.82 
	libraries/extensions/comm/javalib/Makefile.in:1.81->1.82 
	libraries/extensions/microsoft/Makefile.in:1.73->1.74 
	libraries/extensions/microsoft/clib/Makefile.in:1.76->1.77 
	libraries/extensions/microsoft/javalib/Makefile.in:1.74->1.75 
	libraries/extensions/pjava/Makefile.in:1.81->1.82 
	libraries/extensions/pjava/javalib/Makefile.in:1.81->1.82 
	libraries/extensions/servlet/Makefile.in:1.81->1.82 
	libraries/extensions/servlet/javalib/Makefile.in:1.81->1.82 
	libraries/javalib/Makefile.in:1.262->1.263 
	m4/binreloc.m4:INITIAL->1.1 
	replace/Makefile.in:1.46->1.47 
	test/Makefile.in:1.101->1.102 
	test/internal/Makefile.in:1.59->1.60 
	test/regression/Makefile.in:1.170->1.171 
	test/regression/compile_time/Makefile.in:1.32->1.33 
	test/regression/compiler/Makefile.in:1.13->1.14 
	test/regression/run_time/Makefile.in:1.31->1.32 
	tools/Makefile.in:1.5->1.6 
	tools/gjdoc/Makefile.in:1.5->1.6 
	tools/gjdoc/javalib/Makefile.in:1.7->1.8 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2418 kaffe/ChangeLog:1.2419
--- kaffe/ChangeLog:1.2418	Thu Jun 17 17:20:58 2004
+++ kaffe/ChangeLog	Sat Jun 19 21:13:42 2004
@@ -1,3 +1,25 @@
+2004-06-17  Julian Scheid  <julian at sektor37.de>
+
+	* configure.ac,	
+	Makefile.am, 
+	kaffe/kaffevm/Makefile.am:
+	Merged BinReloc: http://www.autopackage.org/docs/binreloc/
+	
+	* Makefile.am:
+	Inserted kaffe/kaffevm into SUBDIRS to make sure libkaffevm.la is built
+	before libnative.la.
+
+	* libraries/clib/native/Makefile.am:
+	Added libkaffevm.la to libnative_la_DEPENDENCIES.
+
+	* kaffe/kaffevm/findInJar.c:
+	(initClasspath) If both bootclasspath and classhome are NULL, use
+	discoverClassHome() to find Kaffe .jar files.
+	(discoverClassHome) Added.
+
+	* kaffe/kaffevm/jni.c:
+	Changed initial bootclasspath in Kaffe_JavaVMInitArgs to NULL.
+
 2004-06-17  Guilhem Lavaux <guilhem at kaffe.org>
 
 	* libraries/javalib/essential.files: Added
Index: kaffe/Makefile.am
diff -u kaffe/Makefile.am:1.66 kaffe/Makefile.am:1.67
--- kaffe/Makefile.am:1.66	Tue Jun  1 17:45:31 2004
+++ kaffe/Makefile.am	Sat Jun 19 21:13:43 2004
@@ -14,7 +14,7 @@
 
 AUTOMAKE_OPTIONS = foreign 1.3e
 
-SUBDIRS = . config include replace libltdl libraries/clib libraries/extensions kaffe libraries/javalib tools test po
+SUBDIRS = . config include replace libltdl kaffe/kaffevm libraries/clib libraries/extensions kaffe libraries/javalib tools test po
 
 DIST_SUBDIRS = . config include replace libltdl kaffe libraries tools test po
 
Index: kaffe/Makefile.in
diff -u kaffe/Makefile.in:1.157 kaffe/Makefile.in:1.158
--- kaffe/Makefile.in:1.157	Sun Jun  6 12:48:37 2004
+++ kaffe/Makefile.in	Sat Jun 19 21:13:43 2004
@@ -59,15 +59,16 @@
 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
 	$(top_srcdir)/m4/alsa.m4 \
 	$(top_srcdir)/m4/ax_cflags_gcc_option.m4 \
-	$(top_srcdir)/m4/esd.m4 $(top_srcdir)/m4/gcc_attribute.m4 \
-	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gnu-crypto.m4 \
-	$(top_srcdir)/m4/gwqt.m4 $(top_srcdir)/m4/herrno.m4 \
-	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/in6addr.m4 \
-	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/libxml.m4 $(top_srcdir)/m4/libxslt.m4 \
-	$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
-	$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/sockaddrin6.m4 \
+	$(top_srcdir)/m4/binreloc.m4 $(top_srcdir)/m4/esd.m4 \
+	$(top_srcdir)/m4/gcc_attribute.m4 $(top_srcdir)/m4/gettext.m4 \
+	$(top_srcdir)/m4/gnu-crypto.m4 $(top_srcdir)/m4/gwqt.m4 \
+	$(top_srcdir)/m4/herrno.m4 $(top_srcdir)/m4/iconv.m4 \
+	$(top_srcdir)/m4/in6addr.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/libxml.m4 \
+	$(top_srcdir)/m4/libxslt.m4 $(top_srcdir)/m4/nls.m4 \
+	$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+	$(top_srcdir)/m4/sockaddrin6.m4 \
 	$(top_srcdir)/m4/sockinttypes.m4 \
 	$(top_srcdir)/m4/solarispthread.m4 $(top_srcdir)/m4/valist.m4 \
 	$(top_srcdir)/configure.ac
@@ -116,6 +117,7 @@
 AWT_DIR = @AWT_DIR@
 AWT_LIBS = @AWT_LIBS@
 BCEL_JAR = @BCEL_JAR@
+BINRELOC_CFLAGS = @BINRELOC_CFLAGS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CCLD = @CCLD@
@@ -346,7 +348,7 @@
 with_engine = @with_engine@
 ACLOCAL_AMFLAGS = -I m4
 AUTOMAKE_OPTIONS = foreign 1.3e
-SUBDIRS = . config include replace libltdl libraries/clib libraries/extensions kaffe libraries/javalib tools test po
+SUBDIRS = . config include replace libltdl kaffe/kaffevm libraries/clib libraries/extensions kaffe libraries/javalib tools test po
 DIST_SUBDIRS = . config include replace libltdl kaffe libraries tools test po
 EXTRA_DIST = \
 	ChangeLog.1 \
Index: kaffe/aclocal.m4
diff -u kaffe/aclocal.m4:1.102 kaffe/aclocal.m4:1.103
--- kaffe/aclocal.m4:1.102	Sun Jun  6 12:48:37 2004
+++ kaffe/aclocal.m4	Sat Jun 19 21:13:44 2004
@@ -988,6 +988,7 @@
 m4_include([m4/acx_pthread.m4])
 m4_include([m4/alsa.m4])
 m4_include([m4/ax_cflags_gcc_option.m4])
+m4_include([m4/binreloc.m4])
 m4_include([m4/esd.m4])
 m4_include([m4/gcc_attribute.m4])
 m4_include([m4/gettext.m4])
Index: kaffe/configure
diff -u kaffe/configure:1.331 kaffe/configure:1.332
--- kaffe/configure:1.331	Sun Jun 13 17:19:59 2004
+++ kaffe/configure	Sat Jun 19 21:13:44 2004
@@ -490,7 +490,7 @@
 #endif"
 
 ac_subdirs_all="$ac_subdirs_all libltdl"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT abssrcdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBTOOL_DEPS LIBLTDL CCLD MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB REGEN_FORWARD CONFIG_MD_H CONFIG_CALLKAFFEEXCEPTION_H KAFFEVM_MD_C CONFIG_JIT_MD_H KAFFEVM_JIT_DEF KAFFEVM_ICODE_H HAVE_CONFIG_JIT_MD_H USE_JIT_TRUE USE_JIT_FALSE ENGINE_NAME BCEL_JAR HAVE_BCEL_TRUE HAVE_BCEL_FALSE ENABLE_JVMPI_TRUE ENABLE_JVMPI_FALSE DNSJAVA_JAR HAVE_DNSJAVA_TRUE HAVE_DNSJAVA_FALSE ENABLE_XPROF_TRUE ENABLE_XPROF_FALSE CONFIG_XPROFILE_MD_H JAVAC_FLAGS NEED_LIBXPROF_TRUE NEED_LIBXPROF_FALSE SUN_COMPAT_TRUE SUN_COMPAT_FALSE THREAD_DIR JIKESPROG JIKES KAFFEVM_TRAMPOLINES_C JAVA_LIBS with_engine THREAD_SYSTEM KPREFIX KAFFE_ARCHOS ZIP MKTEMP JASMIN HAVE_ZIP_TRUE HAVE_ZIP_FALSE HAVE_JIKES_TRUE HAVE_JIKES_FALSE HAVE_MKTEMP_TRUE HAVE_MKTEMP_FALSE HAVE_JASMIN_TRUE HAVE_JASMIN_FALSE KAFFE_LIBS M_LIBS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS VM_LIBS NET_LIBS ZIP_LIBS MATH_LIBS SECURITY_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS AWT_LIBS HAVE_GCJ_SUPPORT_TRUE HAVE_GCJ_SUPPORT_FALSE LIBOBJS USE_COMPAT_IFADDRS_TRUE USE_COMPAT_IFADDRS_FALSE MOC UIC QEMBED QT_CXXFLAGS QT_LDADD QT_GUILINK AWT_DIR ALSA_CFLAGS ALSA_LIBS ESD_CONFIG ESD_CFLAGS ESD_LIBS COND_SOUND_ALSA_TRUE COND_SOUND_ALSA_FALSE COND_SOUND_ESD_TRUE COND_SOUND_ESD_FALSE COND_PURE_JAVA_MATH_TRUE COND_PURE_JAVA_MATH_FALSE MATH_LIB INCLUDED_EXTENSIONS GNU_CRYPTO_HOME GNU_CRYPTO_JAR JAVAX_CRYPTO_JAR JAVAX_SECURITY_JAR USER_WANT_GNU_CRYPTO_TRUE USER_WANT_GNU_CRYPTO_FALSE PROFILE XML2_CONFIG XML_CFLAGS XML_LIBS XSLT_CONFIG XSLT_CFLAGS XSLT_LIBS COND_LIBXMLJ_TRUE COND_LIBXMLJ_FALSE USE_PRECOMPILED_RT_JAR_TRUE USE_PRECOMPILED_RT_JAR_FALSE PATH_TO_RT_JAR DLOPEN_JAVA_LIBS KLIBFLAGS KVMBINFLAGS KVMLIBFLAGS KAFFEH MAKE_KAFFEH toolslibdir jredir jrebindir jrelibdir nativedir securitydir PATHSEP DIRSEP kaffe_TRANSF kaffeh_TRANSF kaffebin_TRANSF CFLAGS_WITHOUT_PG subdirs LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT abssrcdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBTOOL_DEPS LIBLTDL CCLD MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB REGEN_FORWARD CONFIG_MD_H CONFIG_CALLKAFFEEXCEPTION_H KAFFEVM_MD_C CONFIG_JIT_MD_H KAFFEVM_JIT_DEF KAFFEVM_ICODE_H HAVE_CONFIG_JIT_MD_H USE_JIT_TRUE USE_JIT_FALSE ENGINE_NAME BCEL_JAR HAVE_BCEL_TRUE HAVE_BCEL_FALSE ENABLE_JVMPI_TRUE ENABLE_JVMPI_FALSE DNSJAVA_JAR HAVE_DNSJAVA_TRUE HAVE_DNSJAVA_FALSE ENABLE_XPROF_TRUE ENABLE_XPROF_FALSE CONFIG_XPROFILE_MD_H JAVAC_FLAGS NEED_LIBXPROF_TRUE NEED_LIBXPROF_FALSE SUN_COMPAT_TRUE SUN_COMPAT_FALSE THREAD_DIR JIKESPROG JIKES KAFFEVM_TRAMPOLINES_C JAVA_LIBS with_engine THREAD_SYSTEM KPREFIX KAFFE_ARCHOS ZIP MKTEMP JASMIN HAVE_ZIP_TRUE HAVE_ZIP_FALSE HAVE_JIKES_TRUE HAVE_JIKES_FALSE HAVE_MKTEMP_TRUE HAVE_MKTEMP_FALSE HAVE_JASMIN_TRUE HAVE_JASMIN_FALSE KAFFE_LIBS M_LIBS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS VM_LIBS NET_LIBS ZIP_LIBS MATH_LIBS SECURITY_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS AWT_LIBS HAVE_GCJ_SUPPORT_TRUE HAVE_GCJ_SUPPORT_FALSE LIBOBJS USE_COMPAT_IFADDRS_TRUE USE_COMPAT_IFADDRS_FALSE MOC UIC QEMBED QT_CXXFLAGS QT_LDADD QT_GUILINK AWT_DIR ALSA_CFLAGS ALSA_LIBS ESD_CONFIG ESD_CFLAGS ESD_LIBS COND_SOUND_ALSA_TRUE COND_SOUND_ALSA_FALSE COND_SOUND_ESD_TRUE COND_SOUND_ESD_FALSE COND_PURE_JAVA_MATH_TRUE COND_PURE_JAVA_MATH_FALSE MATH_LIB INCLUDED_EXTENSIONS GNU_CRYPTO_HOME GNU_CRYPTO_JAR JAVAX_CRYPTO_JAR JAVAX_SECURITY_JAR USER_WANT_GNU_CRYPTO_TRUE USER_WANT_GNU_CRYPTO_FALSE PROFILE XML2_CONFIG XML_CFLAGS XML_LIBS XSLT_CONFIG XSLT_CFLAGS XSLT_LIBS COND_LIBXMLJ_TRUE COND_LIBXMLJ_FALSE USE_PRECOMPILED_RT_JAR_TRUE USE_PRECOMPILED_RT_JAR_FALSE PATH_TO_RT_JAR DLOPEN_JAVA_LIBS KLIBFLAGS KVMBINFLAGS KVMLIBFLAGS BINRELOC_CFLAGS KAFFEH MAKE_KAFFEH toolslibdir jredir jrebindir jrelibdir nativedir securitydir PATHSEP DIRSEP kaffe_TRANSF kaffeh_TRANSF kaffebin_TRANSF CFLAGS_WITHOUT_PG subdirs LTLIBOBJS'
 ac_subst_files='cpu_os_frag cpu_frag engine_frag threads_frag'
 
 # Initialize some variables set by options.
@@ -1088,6 +1088,8 @@
   --enable-libxmlj        Enable building of libxmlj
   --disable-xmltest       Do not try to compile and run a test LIBXML program
   --disable-xslttest       Do not try to compile and run a test LIBXSLT program
+  --enable-binreloc       compile with binary relocation support
+                          (default=enable when available)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -8923,7 +8925,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 8926 "configure"' > conftest.$ac_ext
+  echo '#line 8928 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -10273,7 +10275,7 @@
 
 
 # Provide some information about the compiler.
-echo "$as_me:10276:" \
+echo "$as_me:10278:" \
      "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -11311,11 +11313,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11314: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11316: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11318: \$? = $ac_status" >&5
+   echo "$as_me:11320: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -11544,11 +11546,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11547: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11549: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11551: \$? = $ac_status" >&5
+   echo "$as_me:11553: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -11604,11 +11606,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11607: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11609: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:11611: \$? = $ac_status" >&5
+   echo "$as_me:11613: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -13788,7 +13790,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 13791 "configure"
+#line 13793 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13886,7 +13888,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 13889 "configure"
+#line 13891 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16069,11 +16071,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16072: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16074: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16076: \$? = $ac_status" >&5
+   echo "$as_me:16078: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -16129,11 +16131,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16132: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16134: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16136: \$? = $ac_status" >&5
+   echo "$as_me:16138: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -17490,7 +17492,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 17493 "configure"
+#line 17495 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17588,7 +17590,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 17591 "configure"
+#line 17593 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18415,11 +18417,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:18418: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:18420: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:18422: \$? = $ac_status" >&5
+   echo "$as_me:18424: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -18475,11 +18477,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:18478: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:18480: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:18482: \$? = $ac_status" >&5
+   echo "$as_me:18484: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -20513,11 +20515,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:20516: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:20518: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:20520: \$? = $ac_status" >&5
+   echo "$as_me:20522: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -20746,11 +20748,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:20749: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:20751: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:20753: \$? = $ac_status" >&5
+   echo "$as_me:20755: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -20806,11 +20808,11 @@
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:20809: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:20811: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:20813: \$? = $ac_status" >&5
+   echo "$as_me:20815: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -22990,7 +22992,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 22993 "configure"
+#line 22995 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -23088,7 +23090,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 23091 "configure"
+#line 23093 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -30927,6 +30929,8 @@
 
 
 	VMLIBS="$VM_LIBS $PTHREAD_LIBS"
+ else
+        CPPFLAGS="$CPPFLAGS -DBR_PTHREADS=0"
 fi
 
 
@@ -54033,6 +54037,82 @@
 
 
 
+
+# Check whether --enable-binreloc or --disable-binreloc was given.
+if test "${enable_binreloc+set}" = set; then
+  enableval="$enable_binreloc"
+  enable_binreloc=$enableval
+else
+  enable_binreloc=auto
+fi;
+BINRELOC_CFLAGS=
+
+echo "$as_me:$LINENO: checking whether binary relocation support should be enabled" >&5
+echo $ECHO_N "checking whether binary relocation support should be enabled... $ECHO_C" >&6
+if test "$enable_binreloc" = "yes"; then
+	echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+	echo "$as_me:$LINENO: checking for linker mappings at /proc/self/maps" >&5
+echo $ECHO_N "checking for linker mappings at /proc/self/maps... $ECHO_C" >&6
+	if test -e /proc/self/maps; then
+		echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+		BINRELOC_CFLAGS=-DENABLE_BINRELOC
+	else
+		echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+		{ { echo "$as_me:$LINENO: error: /proc/self/maps is not available. Binary relocation cannot be enabled." >&5
+echo "$as_me: error: /proc/self/maps is not available. Binary relocation cannot be enabled." >&2;}
+   { (exit 1); exit 1; }; }
+	fi
+
+elif test "$enable_binreloc" = "auto"; then
+	echo "$as_me:$LINENO: result: yes when available" >&5
+echo "${ECHO_T}yes when available" >&6
+	echo "$as_me:$LINENO: checking for linker mappings at /proc/self/maps" >&5
+echo $ECHO_N "checking for linker mappings at /proc/self/maps... $ECHO_C" >&6
+	if test -e /proc/self/maps; then
+		echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+		enable_binreloc=yes
+
+		echo "$as_me:$LINENO: checking whether everything is installed to the same prefix" >&5
+echo $ECHO_N "checking whether everything is installed to the same prefix... $ECHO_C" >&6
+		if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
+			"$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
+			"$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
+		then
+			BINRELOC_CFLAGS=-DENABLE_BINRELOC
+			echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+		else
+			echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+			{ echo "$as_me:$LINENO: Binary relocation support will be disabled." >&5
+echo "$as_me: Binary relocation support will be disabled." >&6;}
+			enable_binreloc=no
+		fi
+
+	else
+		echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+		enable_binreloc=no
+	fi
+
+elif test "$enable_binreloc" = "no"; then
+	echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+else
+	echo "$as_me:$LINENO: result: no (unknown value \"$enable_binreloc\")" >&5
+echo "${ECHO_T}no (unknown value \"$enable_binreloc\")" >&6
+	enable_binreloc=no
+fi
+
+
+
+CFLAGS="$CFLAGS \$(BINRELOC_CFLAGS)"
+
+
 if test x"$cross_compiling" = x"yes"; then
       if test x"${ac_cv_c_bigendian+set}" != x"set"; then
     { echo "$as_me:$LINENO: WARNING: when cross compiling, you may want to set ac_cv_c_bigendian to yes or no" >&5
@@ -54402,7 +54482,7 @@
 
 
 
-CPPFLAGS="-I$abssrcdir/kaffe/kaffevm -I$abssrcdir/kaffe/kaffevm/$with_engine -I$abssrcdir/kaffe/kaffevm/systems/$with_threads -I\$(top_srcdir)/config -I\$(top_srcdir)/include $CPPFLAGS"
+CPPFLAGS="-I$abssrcdir/kaffe/kaffevm -I$abssrcdir/kaffe/kaffevm/$with_engine -I$abssrcdir/kaffe/kaffevm/systems/$with_threads -I\$(top_srcdir)/binreloc -I\$(top_srcdir)/config -I\$(top_srcdir)/include $CPPFLAGS"
 LIBS="$LIBS $LTLIBS"
 
 CFLAGS_WITHOUT_PG=""
@@ -55690,6 +55770,7 @@
 s, at KLIBFLAGS@,$KLIBFLAGS,;t t
 s, at KVMBINFLAGS@,$KVMBINFLAGS,;t t
 s, at KVMLIBFLAGS@,$KVMLIBFLAGS,;t t
+s, at BINRELOC_CFLAGS@,$BINRELOC_CFLAGS,;t t
 s, at KAFFEH@,$KAFFEH,;t t
 s, at MAKE_KAFFEH@,$MAKE_KAFFEH,;t t
 s, at toolslibdir@,$toolslibdir,;t t
Index: kaffe/configure.ac
diff -u kaffe/configure.ac:1.30 kaffe/configure.ac:1.31
--- kaffe/configure.ac:1.30	Sun Jun 13 17:20:06 2004
+++ kaffe/configure.ac	Sat Jun 19 21:13:50 2004
@@ -871,6 +871,8 @@
 	KAFFE_LIB_SOLARIS_PTHREAD
 
 	VMLIBS="$VM_LIBS $PTHREAD_LIBS"
+ else
+        CPPFLAGS="$CPPFLAGS -DBR_PTHREADS=0"
 fi
 
 AC_SUBST(VM_LIBS)
@@ -1806,6 +1808,13 @@
 AC_SUBST(KVMLIBFLAGS)
 
 dnl =========================================================================
+dnl Configure Binreloc support
+dnl -------------------------------------------------------------------------
+
+AM_BINRELOC
+CFLAGS="$CFLAGS \$(BINRELOC_CFLAGS)"
+
+dnl =========================================================================
 dnl Set up for local build of kaffeh when cross-compiling
 dnl -------------------------------------------------------------------------
 
@@ -1900,7 +1909,7 @@
 AC_SUBST(kaffebin_TRANSF)
 
 dnl These are not to be used during configuration, only during build.
-CPPFLAGS="-I$abssrcdir/kaffe/kaffevm -I$abssrcdir/kaffe/kaffevm/$with_engine -I$abssrcdir/kaffe/kaffevm/systems/$with_threads -I\$(top_srcdir)/config -I\$(top_srcdir)/include $CPPFLAGS"
+CPPFLAGS="-I$abssrcdir/kaffe/kaffevm -I$abssrcdir/kaffe/kaffevm/$with_engine -I$abssrcdir/kaffe/kaffevm/systems/$with_threads -I\$(top_srcdir)/binreloc -I\$(top_srcdir)/config -I\$(top_srcdir)/include $CPPFLAGS"
 LIBS="$LIBS $LTLIBS"
 
 dnl Avoid GNU Make $(filter-out -pg, at CFLAGS@) in kaffe/xprof/Makefile.am
===================================================================
Checking out kaffe/binreloc/ChangeLog
RCS:  /home/cvs/kaffe/kaffe/binreloc/ChangeLog,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/binreloc/ChangeLog	Sat Jun 19 21:20:28 2004
@@ -0,0 +1,71 @@
+2004-04-13  Hongli Lai <h.lai at chello.nl>
+	* Guard prefix.[ch] with 'extern "C"'.
+
+2004-04-??  Hongli Lai <h.lai at chello.nl>
+	* Forgot what date I modified this stuff. :/
+	* Made it easier to add your own namespace to BinReloc functions.
+	* Make the code C++ compliant.
+
+2004-02-19  Mike Hearn  <mike at linux.littlegreen>
+	* Makefile: bump version
+
+2004-02-15  Mike Hearn  <mike at linux.littlegreen>
+	* USAGE: Replace string manipulation with DATADIR() macro, much simpler
+
+2004-02-10  Hongli Lai <h.lai at chello.nl>
+
+	* Removed dladdr() dependancy.
+	* Removed support for _DYNAMIC because it doesn't always
+	  return an absolute path.
+
+2003-09-28  Mike Hearn <mike at theoretic.com>
+	* Bump version to 1.1, we can't release 0.9 after 1.0
+
+2003-09-05  Hognli Lai  <h.lai at chelo.nl>
+
+	* Rename *_BR macros to BR_*.
+	* New function: br_extract_dir().
+	* Wrote fallback function that uses _DYNAMIC.
+	* Updated README and USAGE about portability and API.
+
+2003-09-04  Hongli Lai  <h.lai at chello.nl>
+
+	* Added 'dist' target to Makefile.
+	* Added *_BR macros to prefix.h.
+	* Restructured prefix.c.
+	* Remove glibc check from test.c; doesn't work on newer glibc
+	  systems.
+
+2003-08-31  Hongli Lai  <h.lai at chello.nl>
+
+	* Moved code from prefix.c to prefix.h and made them static.
+	* Added libtest.c and made test.c link to libtest.
+	* Add USAGE.
+	* Move code from header back to source.
+	* Add more macros.
+
+2003-08-29  Hongli Lai  <h.lai at chello.nl>
+
+	* Further cleanup. Documentation updates. Removed some redundant
+	  functions.
+
+2003-08-29  Hongli Lai  <h.lai at chello.nl>
+
+	* Rewritten README.
+	* Big cleanup of prefix.c and prefix.h. Added inline documentation.
+	* More tests in test.c.
+	* Replace compile script with Makefile.
+
+2003-08-29  Mike Hearn  <mike at theoretic.com>
+
+	* prefix.c: removed bogus comments garbage, added LIBDIR macro as
+	well as DATADIR
+
+	* prefix.c: removed static declaration, created new
+	_thread_local_store function based on pthreads. If pthreads are
+	not used, the prefix macros will not be thread safe.
+
+	* prefix.c: made functions static, removed _thread_local_store
+
+	* CVS/: Initial import
+
===================================================================
Checking out kaffe/binreloc/Makefile
RCS:  /home/cvs/kaffe/kaffe/binreloc/Makefile,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/binreloc/Makefile	Sat Jun 19 21:20:29 2004
@@ -0,0 +1,30 @@
+CC=gcc
+AR=ar
+RANLIB=randlib
+BINRELOC=-DENABLE_BINRELOC
+CFLAGS=-Wall -g $(BINRELOC) -DBR_PTHREADS=0
+
+PACKAGE=binreloc
+VERSION=1.3
+
+.PHONY: clean test dist distdir
+
+test: test.c prefix.c prefix.h libtest.so
+	$(CC) $(CFLAGS) test.c prefix.c -o test -ldl -L. -ltest
+
+libtest.so: libtest.c prefix.c prefix.h
+	$(CC) $(CFLAGS) libtest.c prefix.c -o libtest.so -fPIC -shared -ldl
+
+clean:
+	rm -f test libtest.so
+
+distdir:
+	rm -rf $(PACKAGE)-$(VERSION)
+	mkdir $(PACKAGE)-$(VERSION)
+	cp README ChangeLog Makefile prefix.c prefix.h libtest.c test.c binreloc.m4 $(PACKAGE)-$(VERSION)/
+
+dist: distdir
+	rm -f $(PACKAGE)-$(VERSION).tar.gz
+	tar -cf $(PACKAGE)-$(VERSION).tar $(PACKAGE)-$(VERSION)
+	gzip --best $(PACKAGE)-$(VERSION).tar
+	rm -rf $(PACKAGE)-$(VERSION)
===================================================================
Checking out kaffe/binreloc/README
RCS:  /home/cvs/kaffe/kaffe/binreloc/README,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/binreloc/README	Sat Jun 19 21:20:29 2004
@@ -0,0 +1,37 @@
+Short description
+-----------------
+BinReloc is a Linux library for creating relocatable applications and
+libraries.
+
+
+The problem
+-----------
+The Autopackage project (http://autopackage.org) supports relocation. This
+means that a package can be installed to any location, like how Win32
+installers let you choose a directory.
+However, most applications are not relocatable. The paths where in they
+search for data files are usually hardcoded at compile time.
+
+On Win32, applications and libraries are easily relocatable because
+argv[0] is always a full path to the executable. For libraries, the
+DllMain() DLL initialization function provides a unique DLL handle. One
+can use that handle to obtain the DLL's full path.
+
+On Linux however, no easy mechanisms exist. argv[0] is not a full path,
+but equals what the user typed at the command prompt.
+For executables, you can still find your full location by resolving the
+symlink /proc/self/exe, but that won't work for libraries.
+
+
+The solution
+------------
+This is why BinReloc is created. BinReloc provides an easy-to-use API
+that uses all kinds of dynamic linker and kernel magic to find out the
+full path of your executable or library. BinReloc is meant to be
+statically included in your project and adds no non-system dependancies.
+
+BinReloc is the successor of libprefixdb, Autopackage's previous solution
+to the relocation problem. BinReloc is more automatic and easier to use.
+
+
+Please go to http://autopackage.org/docs/binreloc/ for a complete guide.
===================================================================
Checking out kaffe/binreloc/libtest.c
RCS:  /home/cvs/kaffe/kaffe/binreloc/libtest.c,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/binreloc/libtest.c	Sat Jun 19 21:20:29 2004
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define SELFPATH "/usr/local"
+#include "prefix.h"
+
+
+void libtest_start ()
+{
+	printf ("libfoo is located at: %s\n", SELFPATH);
+}
===================================================================
Checking out kaffe/binreloc/prefix.c
RCS:  /home/cvs/kaffe/kaffe/binreloc/prefix.c,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/binreloc/prefix.c	Sat Jun 19 21:20:29 2004
@@ -0,0 +1,436 @@
+/*
+ * BinReloc - a library for creating relocatable executables
+ * Written by: Mike Hearn <mike at theoretic.com>
+ *             Hongli Lai <h.lai at chello.nl>
+ * http://autopackage.org/
+ * 
+ * This source code is public domain. You can relicense this code
+ * under whatever license you want.
+ *
+ * NOTE: if you're using C++ and are getting "undefined reference
+ * to br_*", try renaming prefix.c to prefix.cpp
+ */
+
+/* WARNING, BEFORE YOU MODIFY PREFIX.C:
+ *
+ * If you make changes to any of the functions in prefix.c, you MUST
+ * change the BR_NAMESPACE macro (in prefix.h).
+ * This way you can avoid symbol table conflicts with other libraries
+ * that also happen to use BinReloc.
+ *
+ * Example:
+ * #define BR_NAMESPACE(funcName) foobar_ ## funcName
+ * --> expands br_locate to foobar_br_locate
+ */
+
+#ifndef _PREFIX_C_
+#define _PREFIX_C_
+
+#ifndef BR_PTHREADS
+	/* Change 1 to 0 if you don't want pthread support */
+	#define BR_PTHREADS 1
+#endif /* BR_PTHREADS */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <pthread.h>
+#include <limits.h>
+#include <string.h>
+#include "prefix.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#undef NULL
+#define NULL ((void *) 0)
+
+#ifdef __GNUC__
+	#define br_return_val_if_fail(expr,val) if (!(expr)) {fprintf (stderr, "** BinReloc (%s): assertion %s failed\n", __PRETTY_FUNCTION__, #expr); return val;}
+#else
+	#define br_return_val_if_fail(expr,val) if (!(expr)) return val
+#endif /* __GNUC__ */
+
+
+#ifdef ENABLE_BINRELOC
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <unistd.h>
+
+
+/**
+ * br_locate:
+ * symbol: A symbol that belongs to the app/library you want to locate.
+ * Returns: A newly allocated string containing the full path of the
+ *	    app/library that func belongs to, or NULL on error. This
+ *	    string should be freed when not when no longer needed.
+ *
+ * Finds out to which application or library symbol belongs, then locate
+ * the full path of that application or library.
+ * Note that symbol cannot be a pointer to a function. That will not work.
+ *
+ * Example:
+ * --> main.c
+ * #include "prefix.h"
+ * #include "libfoo.h"
+ *
+ * int main (int argc, char *argv[]) {
+ *	printf ("Full path of this app: %s\n", br_locate (&argc));
+ *	libfoo_start ();
+ *	return 0;
+ * }
+ *
+ * --> libfoo.c starts here
+ * #include "prefix.h"
+ *
+ * void libfoo_start () {
+ *	--> "" is a symbol that belongs to libfoo (because it's called
+ *	--> from libfoo_start()); that's why this works.
+ *	printf ("libfoo is located in: %s\n", br_locate (""));
+ * }
+ */
+char *
+br_locate (void *symbol)
+{
+	char line[5000];
+	FILE *f;
+	char *path;
+
+	br_return_val_if_fail (symbol != NULL, NULL);
+
+	f = fopen ("/proc/self/maps", "r");
+	if (!f)
+		return NULL;
+
+	while (!feof (f))
+	{
+		unsigned int start, end;
+
+		if (!fgets (line, sizeof (line), f))
+			continue;
+		if (!strstr (line, " r-xp ") || !strchr (line, '/'))
+			continue;
+
+		sscanf (line, "%x-%x ", &start, &end);
+		if (((unsigned int) symbol) >= start && ((unsigned int) symbol) < end)
+		{
+			char *tmp;
+			size_t len;
+
+			/* Extract the filename; it is always an absolute path */
+			path = strchr (line, '/');
+
+			/* Get rid of the newline */
+			tmp = strrchr (path, '\n');
+			if (tmp) *tmp = 0;
+
+			/* Get rid of "(deleted)" */
+			len = strlen (path);
+			if (len > 10 && strcmp (path + len - 10, " (deleted)") == 0)
+			{
+				tmp = path + len - 10;
+				*tmp = 0;
+			}
+
+			fclose(f);
+			return strdup (path);
+		}
+	}
+
+	fclose (f);
+	return NULL;
+}
+
+
+/**
+ * br_locate_prefix:
+ * symbol: A symbol that belongs to the app/library you want to locate.
+ * Returns: A prefix. This string should be freed when no longer needed.
+ *
+ * Locates the full path of the app/library that symbol belongs to, and return
+ * the prefix of that path, or NULL on error.
+ * Note that symbol cannot be a pointer to a function. That will not work.
+ *
+ * Example:
+ * --> This application is located in /usr/bin/foo
+ * br_locate_prefix (&argc);   --> returns: "/usr"
+ */
+char *
+br_locate_prefix (void *symbol)
+{
+	char *path, *prefix;
+
+	br_return_val_if_fail (symbol != NULL, NULL);
+
+	path = br_locate (symbol);
+	if (!path) return NULL;
+
+	prefix = br_extract_prefix (path);
+	free (path);
+	return prefix;
+}
+
+
+/**
+ * br_prepend_prefix:
+ * symbol: A symbol that belongs to the app/library you want to locate.
+ * path: The path that you want to prepend the prefix to.
+ * Returns: The new path, or NULL on error. This string should be freed when no
+ *	    longer needed.
+ *
+ * Gets the prefix of the app/library that symbol belongs to. Prepend that prefix to path.
+ * Note that symbol cannot be a pointer to a function. That will not work.
+ *
+ * Example:
+ * --> The application is /usr/bin/foo
+ * br_prepend_prefix (&argc, "/share/foo/data.png");   --> Returns "/usr/share/foo/data.png"
+ */
+char *
+br_prepend_prefix (void *symbol, char *path)
+{
+	char *tmp, *newpath;
+
+	br_return_val_if_fail (symbol != NULL, NULL);
+	br_return_val_if_fail (path != NULL, NULL);
+
+	tmp = br_locate_prefix (symbol);
+	if (!tmp) return NULL;
+
+	if (strcmp (tmp, "/") == 0)
+		newpath = strdup (path);
+	else
+		newpath = br_strcat (tmp, path);
+
+	/* Get rid of compiler warning ("br_prepend_prefix never used") */
+	if (0) br_prepend_prefix (NULL, NULL);
+
+	free (tmp);
+	return newpath;
+}
+
+#endif /* ENABLE_BINRELOC */
+
+
+/* Pthread stuff for thread safetiness */
+#if BR_PTHREADS
+
+static pthread_key_t br_thread_key;

*** Patch too long, truncated ***




More information about the kaffe mailing list