$NetBSD: patch-ab,v 1.23 2012/04/03 09:08:33 obache Exp $

--- configure.orig	2010-11-04 17:28:14.000000000 +0000
+++ configure
@@ -11414,7 +11414,7 @@ else
   esac
 fi
 
- if test -z "$VERSION_SCRIPT_FLAGS"; then
+ if test \! -z "$VERSION_SCRIPT_FLAGS"; then
   USE_VERSION_SCRIPT_TRUE=
   USE_VERSION_SCRIPT_FALSE='#'
 else
@@ -13364,7 +13364,7 @@ fi
 fi
 
 
-XML_LIBDIR='-L${libdir}'
+XML_LIBDIR='-Wl,-R${libdir} -L${libdir}'
 XML_INCLUDEDIR='-I${includedir}/libxml2'
 
 XML_CFLAGS=""
@@ -13815,13 +13815,13 @@ else
         if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
         ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
 if test "x$ac_cv_header_pthread_h" = x""yes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in -lpthread" >&5
-$as_echo_n "checking for pthread_join in -lpthread... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in ${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}" >&5
+$as_echo_n "checking for pthread_join in ${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}... " >&6; }
 if test "${ac_cv_lib_pthread_pthread_join+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread  $LIBS"
+LIBS="${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13853,7 +13853,7 @@ fi
 $as_echo "$ac_cv_lib_pthread_pthread_join" >&6; }
 if test "x$ac_cv_lib_pthread_pthread_join" = x""yes; then :
 
-	       THREAD_LIBS="-lpthread"
+	       THREAD_LIBS="${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}"
 
 $as_echo "#define HAVE_LIBPTHREAD /**/" >>confdefs.h
 
@@ -13879,7 +13879,7 @@ fi
        *beos*) WITH_THREADS="1"
 	   THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
        ;;
-       *linux*)
+       *linux* | *openbsd* | *mirbsd*)
            if test "${GCC}" = "yes" ; then
 	       GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
 	       GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
@@ -13901,6 +13901,10 @@ fi
 	       fi
 	   fi
        ;;
+       *freebsd* | *netbsd* | *dragonfly*)
+	   THREAD_LIBS=""
+	   BASE_THREAD_LIBS="${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}"
+       ;;
     esac
     if test "$WITH_THREADS" = "1" ; then
 	THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
@@ -14582,10 +14586,10 @@ $as_echo "#define snprintf _snprintf" >>
 
 $as_echo "#define vsnprintf _vsnprintf" >>confdefs.h
 
- if test "${PYTHON}" != ""
- then
-   WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython${PYTHON_VERSION//./}"
- fi
+# if test "${PYTHON}" != ""
+# then
+#   WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython${PYTHON_VERSION//./}"
+# fi
  ;;
  *-*-cygwin*)
  CYGWIN_EXTRA_LDFLAGS="-no-undefined"
