Subject: pkg/12570: www/libwww build is broken when pkgsrc openssl is installed
To: None <gnats-bugs@gnats.netbsd.org>
From: None <iwamoto@sat.t.u-tokyo.ac.jp>
List: netbsd-bugs
Date: 04/08/2001 04:04:59
>Number:         12570
>Category:       pkg
>Synopsis:       www/libwww build is broken when pkgsrc openssl is installed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 07 12:06:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     IWAMOTO Toshihiro
>Release:        pkgsrc is less than a day old
>Organization:

>Environment:
	
System: NetBSD kiku.my.domain 1.5K NetBSD 1.5K (KIKU) #112: Mon Nov 27 19:03:55 JST 2000 toshii@kiku.my.domain:/usr/src/syssrc/sys/arch/i386/compile/KIKU i386
Architecture: i386
Machine: i386
>Description:
	When /usr/pkg/lib/libcrypto.so is present,
	libwww shared objects are linked against /usr/pkg/lib/libcrypto.so
	without the -R/usr/pkg/lib linker option.
	This causes a broken package.

>How-To-Repeat:
	$ (cd /usr/pkgsrc/security/openssl; make install)
	$ (cd /usr/pkgsrc/www/libwww; make install)
	$ ldd /usr/pkg/lib/libwww*.so |grep openssl

	You'll see many unresolved references to -lcrypto.1.
>Fix:
	I tried to make libwww refer only to /usr/lib/libcrypto.so with the
	following diff, but some modules in libwww still refer to
	/usr/pkg/lib/libcrypto.so with this diff.
	Anyway, this "fixed" my problem.

	Another approach (which would be easier) is to stick to
	/usr/pkg/lib/libcrypto.so when present, which is probably a bad idea.

	The attached diff is meant to be replaced with patch-ab.

--- configure.in.orig	Thu Dec 14 20:49:06 2000
+++ configure.in
@@ -90,10 +90,10 @@
 if test -n "$have_tn3270" ; then
   AC_DEFINE_UNQUOTED(TN3270_PROGRAM, "$have_tn3270")
 fi
-AC_CHECK_PROGS(have_perl, perl)
-if test ! -n "$have_perl" ; then
-   AC_MSG_ERROR("Perl needs to be installed in order to compile libwww")
-fi
+dnl AC_CHECK_PROGS(have_perl, perl)
+dnl if test ! -n "$have_perl" ; then
+dnl   AC_MSG_ERROR("Perl needs to be installed in order to compile libwww")
+dnl fi
 
 AC_PATH_PROG(RM, rm, rm)
 AC_PATH_PROG(AR, ar, ar)
@@ -307,7 +307,10 @@
     AC_MSG_RESULT(yes)
     AC_DEFINE(HT_POSIX_REGEX)
     if test "x$withval" = "xyes"; then
-      AC_CHECK_LIB(rx, regexec, [ LIBS="-lrx $LIBS" ] )
+      AC_TRY_LINK([],
+	          [ regexec(); ],
+		  [],
+		  [ AC_CHECK_LIB(rx, regexec, [ LIBS="-lrx $LIBS" ] ) ] )
     else
       AC_ADDLIB($withval)
       AC_TRY_LINK([],
@@ -535,13 +538,19 @@
 dnl Checks for libwww and OpenSSL:
 AC_MSG_CHECKING(whether we can find OpenSSL)
 dnl find the ssl library dir (empirical)
-if test -d '/usr/local/ssl/lib'; then
+if test -f /usr/include/openssl/ssl.h; then
+  ssllib="-L/usr/lib -lssl -lcrypto"
+elif test -f "${prefix}/lib/libssl.a" -a -f "${prefix}/lib/libcrypto.a"; then
+  ssllib="-L${prefix}/lib -Wl,-R${prefix}/lib -lssl -lcrypto"
+elif test -d '/usr/local/ssl/lib'; then
   ssllib="-L/usr/local/ssl/lib -lssl -lcrypto"
 else
   ssllib="-L/usr/lib -lssl -lcrypto"
 fi
 dnl find the ssl include dir (empirical)
-if test -d '/usr/local/ssl/include'; then
+if test -d "${prefix}/include/openssl"; then
+  sslinc="-I${prefix}/include -I${prefix}/include/openssl"
+elif test -d '/usr/local/ssl/include'; then
   sslinc="-I/usr/local/ssl/include"
 elif test -d '/usr/local/openssl/include'; then
   sslinc="-I/usr/local/openssl/include"


--- configure.orig	Wed Dec 20 20:00:17 2000
+++ configure
@@ -2405,48 +2405,11 @@
 EOF
 
 fi
-for ac_prog in perl
-do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2414: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_have_perl'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$have_perl"; then
-  ac_cv_prog_have_perl="$have_perl" # Let the user override the test.
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_have_perl="$ac_prog"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-have_perl="$ac_cv_prog_have_perl"
-if test -n "$have_perl"; then
-  echo "$ac_t""$have_perl" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-test -n "$have_perl" && break
-done
-
-if test ! -n "$have_perl" ; then
-   { echo "configure: error: "Perl needs to be installed in order to compile libwww"" 1>&2; exit 1; }
-fi
 
 # Extract the first word of "rm", so it can be a program name with args.
 set dummy rm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2450: checking for $ac_word" >&5
+echo "configure:2413: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6790,8 +6753,22 @@
 EOF
 
     if test "x$withval" = "xyes"; then
-      echo $ac_n "checking for regexec in -lrx""... $ac_c" 1>&6
-echo "configure:6795: checking for regexec in -lrx" >&5
+      cat > conftest.$ac_ext <<EOF
+#line 6758 "configure"
+#include "confdefs.h"
+
+int main() {
+ regexec(); 
+; return 0; }
+EOF
+if { (eval echo configure:6765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  :
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+   echo $ac_n "checking for regexec in -lrx""... $ac_c" 1>&6
+echo "configure:6772: checking for regexec in -lrx" >&5
 ac_lib_var=`echo rx'_'regexec | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6799,7 +6776,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lrx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6803 "configure"
+#line 6780 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6810,7 +6787,7 @@
 regexec()
 ; return 0; }
 EOF
-if { (eval echo configure:6814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6829,24 +6806,26 @@
 else
   echo "$ac_t""no" 1>&6
 fi
-
+  
+fi
+rm -f conftest*
     else
        echo $ac_n "checking for $withval""... $ac_c" 1>&6
-echo "configure:6836: checking for $withval" >&5
+echo "configure:6815: checking for $withval" >&5
   LP=`dirname $withval`
   LN=`basename $withval | sed 's/lib\(.*\)\.a/\1/g'`
   echo "$ac_t""-L$LP -l$LN" 1>&6
   LIBS="$LIBS -L$LP -l$LN"
 
       cat > conftest.$ac_ext <<EOF
-#line 6843 "configure"
+#line 6822 "configure"
 #include "confdefs.h"
 
 int main() {
  regexec(); 
 ; return 0; }
 EOF
-if { (eval echo configure:6850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -7270,13 +7249,19 @@
 
 
 echo $ac_n "checking whether we can find OpenSSL""... $ac_c" 1>&6
-echo "configure:7274: checking whether we can find OpenSSL" >&5
-if test -d '/usr/local/ssl/lib'; then
+echo "configure:7253: checking whether we can find OpenSSL" >&5
+if test -f /usr/include/openssl/ssl.h; then
+  ssllib="-L/usr/lib -lssl -lcrypto"
+elif test -f "${prefix}/lib/libssl.a" -a -f "${prefix}/lib/libcrypto.a"; then
+  ssllib="-L${prefix}/lib -Wl,-R${prefix}/lib -lssl -lcrypto"
+elif test -d '/usr/local/ssl/lib'; then
   ssllib="-L/usr/local/ssl/lib -lssl -lcrypto"
 else
   ssllib="-L/usr/lib -lssl -lcrypto"
 fi
-if test -d '/usr/local/ssl/include'; then
+if test -d "${prefix}/include/openssl"; then
+  sslinc="-I${prefix}/include -I${prefix}/include/openssl"
+elif test -d '/usr/local/ssl/include'; then
   sslinc="-I/usr/local/ssl/include"
 elif test -d '/usr/local/openssl/include'; then
   sslinc="-I/usr/local/openssl/include"
@@ -7309,14 +7294,14 @@
     fi
     LIBS="$LIBS $withval"
     cat > conftest.$ac_ext <<EOF
-#line 7313 "configure"
+#line 7298 "configure"
 #include "confdefs.h"
 
 int main() {
  SSL_library_init(); 
 ; return 0; }
 EOF
-if { (eval echo configure:7320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   :
 else
   echo "configure: failed program was:" >&5
>Release-Note:
>Audit-Trail:
>Unformatted: