[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Fix --enable-dso for Darwin/Mac OS X

From: Eric Gillespie <epg_at_pretzelnet.org>
Date: 2005-02-13 00:55:02 CET

This has been bothering me for a while, so i finally worked up a
solution. No doubt this still leaves --enable-dso broken on some
platforms, but it leaves us no worse off while fixing Darwin and
marking a path to fixing it for other systems.

One problem though: Testing on NetBSD (where --enable-dso already
works), the tests pass with --enable-dso without this patch but
fail with it. I didn't go farther than ra-local-test:

START: ra-local-test
assertion "&VTBL == vtable" failed: file "subversion/libsvn_ra/wrapper_template.h", line 311, function "svn_ra_local_init"
END: ra-local-test

I don't understand why, though. It obviously works fine:

0 trunk% ./subversion/svnadmin/svnadmin create --fs-type bdb bdb
0 trunk% ./subversion/svnadmin/svnadmin create --fs-type fsfs fsfs
0 trunk% svn log file://$PWD/bdb
------------------------------------------------------------------------
0 trunk% svn log file://$PWD/fsfs
------------------------------------------------------------------------

Any help on that appreciated. Log message and patch follow.

Fix --enable-dso for Darwin/Mac OS X.

* configure.in
  (SVN_LIBDIR): New svn_private_config.h macro representing libdir,
    just like SVN_BINDIR.
  (SVN_DSO_SUFFIX): New svn_private_config.h macro representing the
    suffix of DSO files for fs-loader.c and ra_loader.c. This is
    '.dylib' for Darwin and '.so' for everyone else.

  Pass libdir along to svn_private_config.h as SVN_LIBDIR, just like
  SVN_BINDIR. Pass SVN_DSO_SUFFIX to svn_private_config.h as .dylib

* subversion/libsvn_fs/fs-loader.c
  (load_module): Use SVN_LIBDIR and SVN_DSO_SUFFIX to find DSO files.

* subversion/libsvn_ra/ra_loader.c
  (load_ra_module): Use SVN_LIBDIR and SVN_DSO_SUFFIX to find DSO
    files.

=== configure.in
==================================================================
--- configure.in (/trunk) (revision 1754)
+++ configure.in (/local/darwin-dso) (revision 1754)
@@ -148,6 +148,30 @@
 AC_DEFINE_UNQUOTED(SVN_BINDIR, "${SVN_BINDIR}",
         [Defined to be the path to the installed binaries])
 
+dnl Create SVN_LIBDIR for proper substitution
+if test "${libdir}" = '${exec_prefix}/lib'; then
+ if test "${exec_prefix}" = "NONE"; then
+ if test "${prefix}" = "NONE"; then
+ SVN_LIBDIR="${ac_default_prefix}/lib"
+ else
+ SVN_LIBDIR="${prefix}/lib"
+ fi
+ else
+ SVN_LIBDIR="${exec_prefix}/lib"
+ fi
+else
+ SVN_LIBDIR="${libdir}"
+fi
+
+dnl fully evaluate this value. when we substitute it into our tool scripts,
+dnl they will not have things such as ${libdir} available
+SVN_LIBDIR="`eval echo ${SVN_LIBDIR}`"
+AC_SUBST(SVN_LIBDIR)
+
+dnl provide ${libdir} in svn_private.h for use in compiled code
+AC_DEFINE_UNQUOTED(SVN_LIBDIR, "${SVN_LIBDIR}",
+ [Defined to be the path to the installed libraries])
+
 dnl This purposely does *not* allow for multiple parallel installs.
 dnl However, it is compatible with most gettext usages.
 localedir='${datadir}/locale'
@@ -659,7 +683,19 @@
 AC_SUBST(SVN_FS_LIB_INSTALL_DEPS)
 AC_SUBST(SVN_FS_LIB_LINK)
 
+dnl Find out the DSO filename suffix for fs-loader.c and ra_loader.c.
+case ${host_os} in
+darwin*)
+ SVN_DSO_SUFFIX='.dylib'
+ ;;
+*)
+ SVN_DSO_SUFFIX='.so'
+ ;;
+esac
+AC_DEFINE_UNQUOTED(SVN_DSO_SUFFIX, "${SVN_DSO_SUFFIX}",
+ [Defined to be the suffix of DSO filenames])
 
+
 dnl Possibly compile JavaHL (experimental)
 do_javahl_build=no
 AC_ARG_ENABLE(javahl,
=== subversion/libsvn_ra/ra_loader.c
==================================================================
--- subversion/libsvn_ra/ra_loader.c (/trunk) (revision 1754)
+++ subversion/libsvn_ra/ra_loader.c (/local/darwin-dso) (revision 1754)
@@ -116,8 +116,8 @@
     const char *compat_funcname;
     apr_status_t status;
 
- libname = apr_psprintf (pool, "libsvn_ra_%s-%d.so.0",
- ra_name, SVN_VER_MAJOR);
+ libname = apr_psprintf (pool, "%s/libsvn_ra_%s-%d%s",
+ SVN_LIBDIR, ra_name, SVN_VER_MAJOR, SVN_DSO_SUFFIX);
     funcname = apr_psprintf (pool, "svn_ra_%s__init", ra_name);
     compat_funcname = apr_psprintf (pool, "svn_ra_%s_init", ra_name);
 
=== subversion/libsvn_fs/fs-loader.c
==================================================================
--- subversion/libsvn_fs/fs-loader.c (/trunk) (revision 1754)
+++ subversion/libsvn_fs/fs-loader.c (/local/darwin-dso) (revision 1754)
@@ -82,8 +82,8 @@
     const char *funcname;
     apr_status_t status;
 
- libname = apr_psprintf (pool, "libsvn_fs_%s-%d.so.0",
- name, SVN_VER_MAJOR);
+ libname = apr_psprintf (pool, "%s/libsvn_fs_%s-%d%s",
+ SVN_LIBDIR, name, SVN_VER_MAJOR, SVN_DSO_SUFFIX);
     funcname = apr_psprintf (pool, "svn_fs_%s__init", name);
 
     /* Find/load the specified library. If we get an error, assume

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Feb 13 00:56:10 2005

This is an archived mail posted to the Subversion Dev mailing list.