From 0564234d7c272db10a75180a973f3c098ea2cb43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edvin?= Date: Thu, 4 Mar 2010 20:14:22 +0200 Subject: [PATCH] FreeBSD needs -lthr not -pthread. Linking with both is nasty: it casues segfault on startup. --- libclamav/c++/Makefile.am | 4 +-- libclamav/c++/Makefile.in | 5 ++-- libclamav/c++/configure | 56 ++++++++++++++++++++++++-------------- libclamav/c++/configure.ac | 15 ++++++++++ 4 files changed, 56 insertions(+), 24 deletions(-) diff --git a/libclamav/c++/Makefile.am b/libclamav/c++/Makefile.am index 0f0b07fb7..132a4e460 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_LDFLAGS=@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_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++/Makefile.in b/libclamav/c++/Makefile.in index 45b437562..a0c9574bb 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_TRUE@tblgen_CXXFLAGS = $(LLVM_CXXFLAGS) @MAINTAINER_MODE_TRUE@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 d600a8f4c..35e233261 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 c4909060d..d142789ac 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