On 03/04/2010 07:34 PM, Török Edwin wrote:
> On 03/04/2010 07:25 PM, Renato Botelho wrote:
>>>> testegw# ldd llvmunittest_ADT
>>>> llvmunittest_ADT:
>>>>         libthr.so.2 => /usr/lib/libthr.so.2 (0x8006e7000)
>>>>         libstdc++.so.6 => /usr/local/lib/gcc42/libstdc++.so.6 (0x8007fe000)
>>>>         libm.so.4 => /lib/libm.so.4 (0x800a0a000)
>>>>         libgcc_s.so.1 => /usr/local/lib/gcc42/libgcc_s.so.1 (0x800b26000)
>>>>         libpthread.so.2 => /lib/libpthread.so.2 (0x800c33000)
>>>>         libc.so.6 => /lib/libc.so.6 (0x800d5e000)
>>> Ouch, how did the linker even allow that?!
>>
>> Yeah, I think we found it:
> 
> Ok that comes from here libclamav/c++/Makefile.am:
> libllvmsystem_la_LDFLAGS=-pthread

Please try the attached patch  (patch -p1 <freebsd.patch from the source
root).
If it works, I'll commit it, and you should have it in tomorrow's snapshot.

> 
> I thought -pthread is the appropriate thing to use (the OpenBSD manpage
> says so at least), guess I should pass @THREAD_LIBS@ from ClamAV's main
> configure to the one in libclamav/c++.
> 
> 
> Best regards,
> --Edwin

diff --git a/libclamav/c++/Makefile.am b/libclamav/c++/Makefile.am
index 0f0b07f..132a4e4 100644
--- a/libclamav/c++/Makefile.am
+++ b/libclamav/c++/Makefile.am
@@ -79,7 +79,7 @@ TBLGENFILES=llvm/include/llvm/Intrinsics.gen X86GenRegisterInfo.h.inc X86GenRegi
 BUILT_SOURCES=
 EXTRA_DIST=$(top_srcdir)/llvm llvmdejagnu.sh $(TBLGENFILES)
 
-libllvmsystem_la_LDFLAGS=-pthread
+libllvmsystem_la_ldfla...@thread_libs@
 libllvmsystem_la_LIBADD=
 libllvmsystem_la_SOURCES=\
 	llvm/lib/System/Alarm.cpp\
@@ -151,7 +151,7 @@ noinst_PROGRAMS = tblgen
 tblgen_CXXFLAGS=$(LLVM_CXXFLAGS)
 tblgen_CFLAGS=
 #TODO: if VERSIONSCRIPT
-tblgen_LDFLAGS=-pthread -Wl,--version-script,@top_srcdir@/llvm/autoconf/ExportMap.map
+tblgen_ldfla...@thread_libs@ -Wl,--version-script,@top_srcdir@/llvm/autoconf/ExportMap.map
 # tblgen needs rtti (for now), and we build everything else with -fno-rtti
 # since tblgen is only a maintainer-mode tool, build these files twice (once for
 # libllvmsupport.la -fno-rtti, and once here, with defaults (rtti)).
diff --git a/libclamav/c++/Makefile.in b/libclamav/c++/Makefile.in
index 45b4375..a0c9574 100644
--- a/libclamav/c++/Makefile.in
+++ b/libclamav/c++/Makefile.in
@@ -841,6 +841,7 @@ SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+THREAD_LIBS = @THREAD_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
@@ -951,7 +952,7 @@ TBLGENFILES = llvm/include/llvm/Intrinsics.gen X86GenRegisterInfo.h.inc X86GenRe
 # LLVM
 BUILT_SOURCES = $(am__append_13) llvm/config.status
 EXTRA_DIST = $(top_srcdir)/llvm llvmdejagnu.sh $(TBLGENFILES)
-libllvmsystem_la_LDFLAGS = -pthread
+libllvmsystem_la_LDFLAGS = @THREAD_LIBS@
 libllvmsystem_la_LIBADD = 
 libllvmsystem_la_SOURCES = llvm/lib/System/Alarm.cpp \
 	llvm/lib/System/Atomic.cpp llvm/lib/System/Disassembler.cpp \
@@ -1012,7 +1013,7 @@ libllvmsupport_la_SOURCES = \
 @maintainer_mode_t...@tblgen_cxxflags = $(LLVM_CXXFLAGS)
 @maintainer_mode_t...@tblgen_cflags = 
 #TODO: if VERSIONSCRIPT
-...@maintainer_mode_true@tblgen_LDFLAGS = -pthread -Wl,--version-script,@top_srcdir@/llvm/autoconf/ExportMap.map
+...@maintainer_mode_true@tblgen_LDFLAGS = @THREAD_LIBS@ -Wl,--version-script,@top_srcdir@/llvm/autoconf/ExportMap.map
 # tblgen needs rtti (for now), and we build everything else with -fno-rtti
 # since tblgen is only a maintainer-mode tool, build these files twice (once for
 # libllvmsupport.la -fno-rtti, and once here, with defaults (rtti)).
diff --git a/libclamav/c++/configure b/libclamav/c++/configure
index d600a8f..35e2332 100755
--- a/libclamav/c++/configure
+++ b/libclamav/c++/configure
@@ -754,6 +754,7 @@ BUILD_PPC_FALSE
 BUILD_PPC_TRUE
 BUILD_X86_FALSE
 BUILD_X86_TRUE
+THREAD_LIBS
 DEBUG_BUILD_FALSE
 DEBUG_BUILD_TRUE
 subdirs
@@ -5080,13 +5081,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:5083: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:5084: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:5086: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:5087: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:5089: output\"" >&5)
+  (eval echo "\"\$as_me:5090: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -6292,7 +6293,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 6295 "configure"' > conftest.$ac_ext
+  echo '#line 6296 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -8348,11 +8349,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8351: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8352: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8355: \$? = $ac_status" >&5
+   echo "$as_me:8356: \$? = $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 other than the usual output.
@@ -8687,11 +8688,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8690: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8691: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8694: \$? = $ac_status" >&5
+   echo "$as_me:8695: \$? = $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 other than the usual output.
@@ -8792,11 +8793,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8795: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8796: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8799: \$? = $ac_status" >&5
+   echo "$as_me:8800: \$? = $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
@@ -8847,11 +8848,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8850: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8851: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8854: \$? = $ac_status" >&5
+   echo "$as_me:8855: \$? = $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
@@ -11231,7 +11232,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11234 "configure"
+#line 11235 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11327,7 +11328,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11330 "configure"
+#line 11331 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13283,11 +13284,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13286: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13287: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13290: \$? = $ac_status" >&5
+   echo "$as_me:13291: \$? = $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 other than the usual output.
@@ -13382,11 +13383,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13385: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13386: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13389: \$? = $ac_status" >&5
+   echo "$as_me:13390: \$? = $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
@@ -13434,11 +13435,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13437: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13438: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13441: \$? = $ac_status" >&5
+   echo "$as_me:13442: \$? = $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
@@ -14536,6 +14537,21 @@ case "$target_cpu" in
 	    build_arm=yes
 	    ;;
 esac
+
+# FreeBSD is only one which needs something else than -pthread,
+# according to the logic in ClamAV's main configure.in.
+case "$target_os" in
+freebsd[45]*)
+    THREAD_LIBS="-pthread -lc_r"
+    ;;
+freebsd*)
+    THREAD_LIBS="-lthr"
+    ;;
+*)
+    THREAD_LIBS="-pthread"
+esac
+
+
 if test "$enable_alltargets" = "yes"; then
 	build_x86=yes
 	build_ppc=yes
diff --git a/libclamav/c++/configure.ac b/libclamav/c++/configure.ac
index c490906..d142789 100644
--- a/libclamav/c++/configure.ac
+++ b/libclamav/c++/configure.ac
@@ -123,6 +123,21 @@ case "$target_cpu" in
 	    build_arm=yes
 	    ;;
 esac
+
+# FreeBSD is only one which needs something else than -pthread,
+# according to the logic in ClamAV's main configure.in.
+case "$target_os" in
+freebsd[[45]]*)
+    THREAD_LIBS="-pthread -lc_r"
+    ;;
+freebsd*)
+    THREAD_LIBS="-lthr"
+    ;;
+*)
+    THREAD_LIBS="-pthread"
+esac
+AC_SUBST([THREAD_LIBS])
+
 if test "$enable_alltargets" = "yes"; then
 	build_x86=yes
 	build_ppc=yes
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net

Reply via email to