Browse code

FreeBSD needs -lthr not -pthread.

Linking with both is nasty: it casues segfault on startup.

Török Edvin authored on 2010/03/05 03:14:22
Showing 4 changed files
... ...
@@ -79,7 +79,7 @@ TBLGENFILES=llvm/include/llvm/Intrinsics.gen X86GenRegisterInfo.h.inc X86GenRegi
79 79
 BUILT_SOURCES=
80 80
 EXTRA_DIST=$(top_srcdir)/llvm llvmdejagnu.sh $(TBLGENFILES)
81 81
 
82
-libllvmsystem_la_LDFLAGS=-pthread
82
+libllvmsystem_la_LDFLAGS=@THREAD_LIBS@
83 83
 libllvmsystem_la_LIBADD=
84 84
 libllvmsystem_la_SOURCES=\
85 85
 	llvm/lib/System/Alarm.cpp\
... ...
@@ -151,7 +151,7 @@ noinst_PROGRAMS = tblgen
151 151
 tblgen_CXXFLAGS=$(LLVM_CXXFLAGS)
152 152
 tblgen_CFLAGS=
153 153
 #TODO: if VERSIONSCRIPT
154
-tblgen_LDFLAGS=-pthread -Wl,--version-script,@top_srcdir@/llvm/autoconf/ExportMap.map
154
+tblgen_LDFLAGS=@THREAD_LIBS@ -Wl,--version-script,@top_srcdir@/llvm/autoconf/ExportMap.map
155 155
 # tblgen needs rtti (for now), and we build everything else with -fno-rtti
156 156
 # since tblgen is only a maintainer-mode tool, build these files twice (once for
157 157
 # libllvmsupport.la -fno-rtti, and once here, with defaults (rtti)).
... ...
@@ -841,6 +841,7 @@ SED = @SED@
841 841
 SET_MAKE = @SET_MAKE@
842 842
 SHELL = @SHELL@
843 843
 STRIP = @STRIP@
844
+THREAD_LIBS = @THREAD_LIBS@
844 845
 VERSION = @VERSION@
845 846
 abs_builddir = @abs_builddir@
846 847
 abs_srcdir = @abs_srcdir@
... ...
@@ -951,7 +952,7 @@ TBLGENFILES = llvm/include/llvm/Intrinsics.gen X86GenRegisterInfo.h.inc X86GenRe
951 951
 # LLVM
952 952
 BUILT_SOURCES = $(am__append_13) llvm/config.status
953 953
 EXTRA_DIST = $(top_srcdir)/llvm llvmdejagnu.sh $(TBLGENFILES)
954
-libllvmsystem_la_LDFLAGS = -pthread
954
+libllvmsystem_la_LDFLAGS = @THREAD_LIBS@
955 955
 libllvmsystem_la_LIBADD = 
956 956
 libllvmsystem_la_SOURCES = llvm/lib/System/Alarm.cpp \
957 957
 	llvm/lib/System/Atomic.cpp llvm/lib/System/Disassembler.cpp \
... ...
@@ -1012,7 +1013,7 @@ libllvmsupport_la_SOURCES = \
1012 1012
 @MAINTAINER_MODE_TRUE@tblgen_CXXFLAGS = $(LLVM_CXXFLAGS)
1013 1013
 @MAINTAINER_MODE_TRUE@tblgen_CFLAGS = 
1014 1014
 #TODO: if VERSIONSCRIPT
1015
-@MAINTAINER_MODE_TRUE@tblgen_LDFLAGS = -pthread -Wl,--version-script,@top_srcdir@/llvm/autoconf/ExportMap.map
1015
+@MAINTAINER_MODE_TRUE@tblgen_LDFLAGS = @THREAD_LIBS@ -Wl,--version-script,@top_srcdir@/llvm/autoconf/ExportMap.map
1016 1016
 # tblgen needs rtti (for now), and we build everything else with -fno-rtti
1017 1017
 # since tblgen is only a maintainer-mode tool, build these files twice (once for
1018 1018
 # libllvmsupport.la -fno-rtti, and once here, with defaults (rtti)).
... ...
@@ -754,6 +754,7 @@ BUILD_PPC_FALSE
754 754
 BUILD_PPC_TRUE
755 755
 BUILD_X86_FALSE
756 756
 BUILD_X86_TRUE
757
+THREAD_LIBS
757 758
 DEBUG_BUILD_FALSE
758 759
 DEBUG_BUILD_TRUE
759 760
 subdirs
... ...
@@ -5080,13 +5081,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
5080 5080
 else
5081 5081
   lt_cv_nm_interface="BSD nm"
5082 5082
   echo "int some_variable = 0;" > conftest.$ac_ext
5083
-  (eval echo "\"\$as_me:5083: $ac_compile\"" >&5)
5083
+  (eval echo "\"\$as_me:5084: $ac_compile\"" >&5)
5084 5084
   (eval "$ac_compile" 2>conftest.err)
5085 5085
   cat conftest.err >&5
5086
-  (eval echo "\"\$as_me:5086: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
5086
+  (eval echo "\"\$as_me:5087: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
5087 5087
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
5088 5088
   cat conftest.err >&5
5089
-  (eval echo "\"\$as_me:5089: output\"" >&5)
5089
+  (eval echo "\"\$as_me:5090: output\"" >&5)
5090 5090
   cat conftest.out >&5
5091 5091
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
5092 5092
     lt_cv_nm_interface="MS dumpbin"
... ...
@@ -6292,7 +6293,7 @@ ia64-*-hpux*)
6292 6292
   ;;
6293 6293
 *-*-irix6*)
6294 6294
   # Find out which ABI we are using.
6295
-  echo '#line 6295 "configure"' > conftest.$ac_ext
6295
+  echo '#line 6296 "configure"' > conftest.$ac_ext
6296 6296
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
6297 6297
   (eval $ac_compile) 2>&5
6298 6298
   ac_status=$?
... ...
@@ -8348,11 +8349,11 @@ else
8348 8348
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
8349 8349
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
8350 8350
    -e 's:$: $lt_compiler_flag:'`
8351
-   (eval echo "\"\$as_me:8351: $lt_compile\"" >&5)
8351
+   (eval echo "\"\$as_me:8352: $lt_compile\"" >&5)
8352 8352
    (eval "$lt_compile" 2>conftest.err)
8353 8353
    ac_status=$?
8354 8354
    cat conftest.err >&5
8355
-   echo "$as_me:8355: \$? = $ac_status" >&5
8355
+   echo "$as_me:8356: \$? = $ac_status" >&5
8356 8356
    if (exit $ac_status) && test -s "$ac_outfile"; then
8357 8357
      # The compiler can only warn and ignore the option if not recognized
8358 8358
      # So say no if there are warnings other than the usual output.
... ...
@@ -8687,11 +8688,11 @@ else
8687 8687
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
8688 8688
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
8689 8689
    -e 's:$: $lt_compiler_flag:'`
8690
-   (eval echo "\"\$as_me:8690: $lt_compile\"" >&5)
8690
+   (eval echo "\"\$as_me:8691: $lt_compile\"" >&5)
8691 8691
    (eval "$lt_compile" 2>conftest.err)
8692 8692
    ac_status=$?
8693 8693
    cat conftest.err >&5
8694
-   echo "$as_me:8694: \$? = $ac_status" >&5
8694
+   echo "$as_me:8695: \$? = $ac_status" >&5
8695 8695
    if (exit $ac_status) && test -s "$ac_outfile"; then
8696 8696
      # The compiler can only warn and ignore the option if not recognized
8697 8697
      # So say no if there are warnings other than the usual output.
... ...
@@ -8792,11 +8793,11 @@ else
8792 8792
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
8793 8793
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
8794 8794
    -e 's:$: $lt_compiler_flag:'`
8795
-   (eval echo "\"\$as_me:8795: $lt_compile\"" >&5)
8795
+   (eval echo "\"\$as_me:8796: $lt_compile\"" >&5)
8796 8796
    (eval "$lt_compile" 2>out/conftest.err)
8797 8797
    ac_status=$?
8798 8798
    cat out/conftest.err >&5
8799
-   echo "$as_me:8799: \$? = $ac_status" >&5
8799
+   echo "$as_me:8800: \$? = $ac_status" >&5
8800 8800
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
8801 8801
    then
8802 8802
      # The compiler can only warn and ignore the option if not recognized
... ...
@@ -8847,11 +8848,11 @@ else
8847 8847
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
8848 8848
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
8849 8849
    -e 's:$: $lt_compiler_flag:'`
8850
-   (eval echo "\"\$as_me:8850: $lt_compile\"" >&5)
8850
+   (eval echo "\"\$as_me:8851: $lt_compile\"" >&5)
8851 8851
    (eval "$lt_compile" 2>out/conftest.err)
8852 8852
    ac_status=$?
8853 8853
    cat out/conftest.err >&5
8854
-   echo "$as_me:8854: \$? = $ac_status" >&5
8854
+   echo "$as_me:8855: \$? = $ac_status" >&5
8855 8855
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
8856 8856
    then
8857 8857
      # The compiler can only warn and ignore the option if not recognized
... ...
@@ -11231,7 +11232,7 @@ else
11231 11231
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
11232 11232
   lt_status=$lt_dlunknown
11233 11233
   cat > conftest.$ac_ext <<_LT_EOF
11234
-#line 11234 "configure"
11234
+#line 11235 "configure"
11235 11235
 #include "confdefs.h"
11236 11236
 
11237 11237
 #if HAVE_DLFCN_H
... ...
@@ -11327,7 +11328,7 @@ else
11327 11327
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
11328 11328
   lt_status=$lt_dlunknown
11329 11329
   cat > conftest.$ac_ext <<_LT_EOF
11330
-#line 11330 "configure"
11330
+#line 11331 "configure"
11331 11331
 #include "confdefs.h"
11332 11332
 
11333 11333
 #if HAVE_DLFCN_H
... ...
@@ -13283,11 +13284,11 @@ else
13283 13283
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
13284 13284
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
13285 13285
    -e 's:$: $lt_compiler_flag:'`
13286
-   (eval echo "\"\$as_me:13286: $lt_compile\"" >&5)
13286
+   (eval echo "\"\$as_me:13287: $lt_compile\"" >&5)
13287 13287
    (eval "$lt_compile" 2>conftest.err)
13288 13288
    ac_status=$?
13289 13289
    cat conftest.err >&5
13290
-   echo "$as_me:13290: \$? = $ac_status" >&5
13290
+   echo "$as_me:13291: \$? = $ac_status" >&5
13291 13291
    if (exit $ac_status) && test -s "$ac_outfile"; then
13292 13292
      # The compiler can only warn and ignore the option if not recognized
13293 13293
      # So say no if there are warnings other than the usual output.
... ...
@@ -13382,11 +13383,11 @@ else
13382 13382
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
13383 13383
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
13384 13384
    -e 's:$: $lt_compiler_flag:'`
13385
-   (eval echo "\"\$as_me:13385: $lt_compile\"" >&5)
13385
+   (eval echo "\"\$as_me:13386: $lt_compile\"" >&5)
13386 13386
    (eval "$lt_compile" 2>out/conftest.err)
13387 13387
    ac_status=$?
13388 13388
    cat out/conftest.err >&5
13389
-   echo "$as_me:13389: \$? = $ac_status" >&5
13389
+   echo "$as_me:13390: \$? = $ac_status" >&5
13390 13390
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
13391 13391
    then
13392 13392
      # The compiler can only warn and ignore the option if not recognized
... ...
@@ -13434,11 +13435,11 @@ else
13434 13434
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
13435 13435
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
13436 13436
    -e 's:$: $lt_compiler_flag:'`
13437
-   (eval echo "\"\$as_me:13437: $lt_compile\"" >&5)
13437
+   (eval echo "\"\$as_me:13438: $lt_compile\"" >&5)
13438 13438
    (eval "$lt_compile" 2>out/conftest.err)
13439 13439
    ac_status=$?
13440 13440
    cat out/conftest.err >&5
13441
-   echo "$as_me:13441: \$? = $ac_status" >&5
13441
+   echo "$as_me:13442: \$? = $ac_status" >&5
13442 13442
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
13443 13443
    then
13444 13444
      # The compiler can only warn and ignore the option if not recognized
... ...
@@ -14536,6 +14537,21 @@ case "$target_cpu" in
14536 14536
 	    build_arm=yes
14537 14537
 	    ;;
14538 14538
 esac
14539
+
14540
+# FreeBSD is only one which needs something else than -pthread,
14541
+# according to the logic in ClamAV's main configure.in.
14542
+case "$target_os" in
14543
+freebsd[45]*)
14544
+    THREAD_LIBS="-pthread -lc_r"
14545
+    ;;
14546
+freebsd*)
14547
+    THREAD_LIBS="-lthr"
14548
+    ;;
14549
+*)
14550
+    THREAD_LIBS="-pthread"
14551
+esac
14552
+
14553
+
14539 14554
 if test "$enable_alltargets" = "yes"; then
14540 14555
 	build_x86=yes
14541 14556
 	build_ppc=yes
... ...
@@ -123,6 +123,21 @@ case "$target_cpu" in
123 123
 	    build_arm=yes
124 124
 	    ;;
125 125
 esac
126
+
127
+# FreeBSD is only one which needs something else than -pthread,
128
+# according to the logic in ClamAV's main configure.in.
129
+case "$target_os" in
130
+freebsd[[45]]*)
131
+    THREAD_LIBS="-pthread -lc_r"
132
+    ;;
133
+freebsd*)
134
+    THREAD_LIBS="-lthr"
135
+    ;;
136
+*)
137
+    THREAD_LIBS="-pthread"
138
+esac
139
+AC_SUBST([THREAD_LIBS])
140
+
126 141
 if test "$enable_alltargets" = "yes"; then
127 142
 	build_x86=yes
128 143
 	build_ppc=yes