diff -up cvs-1.12.13.1/configure.in.orig cvs-1.12.13.1/configure.in
--- cvs-1.12.13.1/configure.in.orig	2006-06-29 09:13:10.006815744 -0600
+++ cvs-1.12.13.1/configure.in	2012-05-02 20:46:57.544735232 -0600
@@ -541,7 +541,7 @@ CVS_FUNC_PRINTF_PTR
 
 # Try to find connect and gethostbyname.
 AC_CHECK_LIB(nsl, main)
-AC_SEARCH_LIBS(connect, xnet socket inet,
+AC_SEARCH_LIBS(connect, xnet network socket inet,
   AC_DEFINE(HAVE_CONNECT, 1,
 [Define if you have the connect function.]))
 dnl no need to search nsl for gethostbyname here since we should have
diff -up cvs-1.12.13.1/configure.orig cvs-1.12.13.1/configure
--- cvs-1.12.13.1/configure.orig	2006-07-07 15:31:08.010485760 -0600
+++ cvs-1.12.13.1/configure	2012-05-02 20:56:54.292290560 -0600
@@ -9566,7 +9566,7 @@ return getaddrinfo ();
   return 0;
 }
 _ACEOF
-for ac_lib in '' nsl socket; do
+for ac_lib in '' nsl network socket; do
   if test -z "$ac_lib"; then
     ac_res="none required"
   else
@@ -10083,7 +10083,7 @@ return getservbyname ();
   return 0;
 }
 _ACEOF
-for ac_lib in '' inet nsl socket xnet; do
+for ac_lib in '' inet nsl network socket xnet; do
   if test -z "$ac_lib"; then
     ac_res="none required"
   else
@@ -21471,7 +21471,7 @@ return getaddrinfo ();
   return 0;
 }
 _ACEOF
-for ac_lib in '' nsl socket; do
+for ac_lib in '' nsl network socket; do
   if test -z "$ac_lib"; then
     ac_res="none required"
   else
@@ -21988,7 +21988,7 @@ return getservbyname ();
   return 0;
 }
 _ACEOF
-for ac_lib in '' inet nsl socket xnet; do
+for ac_lib in '' inet nsl network socket xnet; do
   if test -z "$ac_lib"; then
     ac_res="none required"
   else
@@ -45920,7 +45920,7 @@ return connect ();
   return 0;
 }
 _ACEOF
-for ac_lib in '' xnet socket inet; do
+for ac_lib in '' xnet network socket inet; do
   if test -z "$ac_lib"; then
     ac_res="none required"
   else
diff -up cvs-1.12.13.1/src/cvs.h.orig cvs-1.12.13.1/src/cvs.h
--- cvs-1.12.13.1/src/cvs.h.orig	2006-04-25 14:01:47.044302336 -0600
+++ cvs-1.12.13.1/src/cvs.h	2012-05-02 20:46:57.547356672 -0600
@@ -181,8 +181,13 @@ char *strerror (int);
 #define CVSRFLPAT	"#cvs.rfl.*"	/* wildcard expr to match read locks */
 #define	CVSEXT_LOG	",t"
 #define	CVSPREFIX	",,"
+#ifdef __HAIKU__
+#define CVSDOTIGNORE	"cvsignore"
+#define CVSDOTWRAPPER   "cvswrappers"
+#else
 #define CVSDOTIGNORE	".cvsignore"
 #define CVSDOTWRAPPER   ".cvswrappers"
+#endif
 
 /* Command attributes -- see function lookup_command_attribute(). */
 #define CVS_CMD_IGNORE_ADMROOT        1
diff -up cvs-1.12.13.1/src/cvsrc.c.orig cvs-1.12.13.1/src/cvsrc.c
--- cvs-1.12.13.1/src/cvsrc.c.orig	2006-03-31 14:54:57.034603008 -0700
+++ cvs-1.12.13.1/src/cvsrc.c	2012-05-02 20:46:57.549715968 -0600
@@ -20,7 +20,11 @@
 /* this file is to be found in the user's home directory */
 
 #ifndef	CVSRC_FILENAME
-#define	CVSRC_FILENAME	".cvsrc"
+# ifdef __HAIKU__
+#  define	CVSRC_FILENAME "cvsrc"
+# else
+#  define	CVSRC_FILENAME	".cvsrc"
+# endif
 #endif
 char cvsrc[] = CVSRC_FILENAME;
 
@@ -64,7 +68,7 @@ read_cvsrc (int *argc, char ***argv, con
 
     /* determine filename for ~/.cvsrc */
 
-    homedir = get_homedir ();
+    homedir = get_rcdir ();
     /* If we can't find a home directory, ignore ~/.cvsrc.  This may
        make tracking down problems a bit of a pain, but on the other
        hand it might be obnoxious to complain when CVS will function
diff -up cvs-1.12.13.1/src/filesubr.c.orig cvs-1.12.13.1/src/filesubr.c
--- cvs-1.12.13.1/src/filesubr.c.orig	2006-07-05 20:14:08.035913728 -0600
+++ cvs-1.12.13.1/src/filesubr.c	2012-05-02 20:46:57.553385984 -0600
@@ -32,6 +32,11 @@
 /* CVS */
 #include "cvs.h"
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <StorageDefs.h>
+#endif
+
 static int deep_remove_dir (const char *path);
 
 
@@ -859,6 +864,36 @@ get_homedir (void)
     return home;
 }
 
+/* Compose a path to the settings directory for systems that don't store data
+ * in $HOME. Returns a pointer to storage managed by this function or its
+ * callees.  This function will return the same thing every time it is called.
+ * Returns NULL if there is no rc directory.
+ */
+char *
+get_rcdir (void)
+{
+    static char *rcdir = NULL;
+
+    if (rcdir == NULL)
+    {
+#ifdef __HAIKU__
+    char path[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
+    dev_t volume = dev_for_path("/boot");
+
+    if (find_directory(B_USER_SETTINGS_DIRECTORY, volume, true, path, sizeof(path)) != B_OK)
+    return 0;
+
+    rcdir = Xasprintf ("%s/cvs", &path);
+
+    mkdir_if_needed(rcdir);
+#else
+    rcdir = get_homedir();
+#endif
+    }
+
+	return rcdir;
+}
+
 /* Compose a path to a file in the home directory.  This is necessary because
  * of different behavior on UNIX and VMS.  See the notes in vms/filesubr.c.
  *
diff -up cvs-1.12.13.1/src/filesubr.h.orig cvs-1.12.13.1/src/filesubr.h
--- cvs-1.12.13.1/src/filesubr.h.orig	2006-07-05 20:14:08.035913728 -0600
+++ cvs-1.12.13.1/src/filesubr.h	2012-05-02 20:46:57.554696704 -0600
@@ -33,6 +33,7 @@ bool isreadable (const char *file);
 bool iswritable (const char *file);
 bool isaccessible (const char *file, const int mode);
 char *get_homedir (void);
+char *get_rcdir (void);
 char *strcat_filename_onto_homedir (const char *, const char *);
 char *cvs_temp_name (void);
 FILE *cvs_temp_file (char **filename);
diff -up cvs-1.12.13.1/src/history.c.orig cvs-1.12.13.1/src/history.c
--- cvs-1.12.13.1/src/history.c.orig	2006-06-09 15:28:17.036700160 -0600
+++ cvs-1.12.13.1/src/history.c	2012-05-02 20:46:57.558891008 -0600
@@ -807,7 +807,7 @@ history_write (int type, const char *upd
     {
 	char *pwdir;
 
-	pwdir = get_homedir ();
+	pwdir = get_rcdir ();
 	PrCurDir = CurDir;
 	if (pwdir != NULL)
 	{
diff -up cvs-1.12.13.1/src/ignore.c.orig cvs-1.12.13.1/src/ignore.c
--- cvs-1.12.13.1/src/ignore.c.orig	2006-04-24 12:50:26.036700160 -0600
+++ cvs-1.12.13.1/src/ignore.c	2012-05-02 20:46:57.561512448 -0600
@@ -98,7 +98,7 @@ ign_setup (void)
     }
 
     /* Then add entries found in home dir, (if user has one) and file exists */
-    home_dir = get_homedir ();
+    home_dir = get_rcdir ();
     /* If we can't find a home directory, ignore ~/.cvsignore.  This may
        make tracking down problems a bit of a pain, but on the other
        hand it might be obnoxious to complain when CVS will function
diff -up cvs-1.12.13.1/src/login.c.orig cvs-1.12.13.1/src/login.c
--- cvs-1.12.13.1/src/login.c.orig	2006-06-28 08:25:26.037748736 -0600
+++ cvs-1.12.13.1/src/login.c	2012-05-02 20:46:57.563871744 -0600
@@ -28,7 +28,11 @@
 
 
 #ifndef CVS_PASSWORD_FILE 
-#define CVS_PASSWORD_FILE ".cvspass"
+# ifdef __HAIKU__
+#  define CVS_PASSWORD_FILE "cvspass"
+# else
+#  define CVS_PASSWORD_FILE ".cvspass"
+# endif
 #endif
 
 /* If non-NULL, get_cvs_password() will just return this. */
@@ -49,7 +53,7 @@ construct_cvspass_filename (void)
 
     /* Construct absolute pathname to user's password file. */
     /* todo: does this work under OS/2 ? */
-    homedir = get_homedir ();
+    homedir = get_rcdir ();
     if (! homedir)
     {
 	/* FIXME?  This message confuses a lot of users, at least
diff -up cvs-1.12.13.1/src/wrapper.c.orig cvs-1.12.13.1/src/wrapper.c
--- cvs-1.12.13.1/src/wrapper.c.orig	2006-04-24 12:50:27.043778048 -0600
+++ cvs-1.12.13.1/src/wrapper.c	2012-05-02 20:46:57.566493184 -0600
@@ -125,7 +125,7 @@ void wrap_setup(void)
 
     /* Then add entries found in home dir, (if user has one) and file
        exists.  */
-    homedir = get_homedir ();
+    homedir = get_rcdir ();
     /* If we can't find a home directory, ignore ~/.cvswrappers.  This may
        make tracking down problems a bit of a pain, but on the other
        hand it might be obnoxious to complain when CVS will function
diff --git a/contrib/Makefile.in b/contrib/Makefile.in
index ed473e5..fccaa02 100644
--- a/contrib/Makefile.in
+++ b/contrib/Makefile.in
@@ -767,7 +767,7 @@ install-data-local:
 	    echo "test ! -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
 	    echo "  && cd $(DESTDIR)$(bindir) && $(LN_S) ../share/$(PACKAGE)/contrib/`echo $$p|sed '$(transform)'` ."; \
 	    (test ! -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'` \
-	        && cd $(DESTDIR)$(bindir) && $(LN_S) ../share/$(PACKAGE)/contrib/`echo $$p|sed '$(transform)'` .) \
+	        && cd $(DESTDIR)$(bindir) && $(LN_S) ${datarootdir}/$(PACKAGE)/contrib/`echo $$p|sed '$(transform)'` .) \
 	      || (echo "Link creation failed" && if test -f $$p; then \
 	           echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
 	           $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
