git-svn: trunk@3910
Tomasz Kojm authored on 2008/07/05 01:34:30... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Fri Jul 4 18:04:40 CEST 2008 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * configure, clamd: fix compilation error on systems without |
|
4 |
+ pthread_yield() (bb#1058) |
|
5 |
+ |
|
1 | 6 |
Fri Jul 4 14:21:12 CEST 2008 (tk) |
2 | 7 |
---------------------------------- |
3 | 8 |
* libclamav/dlp.c: improve detection of credit card numbers (bb#941) |
... | ... |
@@ -210,6 +210,9 @@ |
210 | 210 |
/* "pragma pack hppa/hp-ux style" */ |
211 | 211 |
#undef HAVE_PRAGMA_PACK_HPPA |
212 | 212 |
|
213 |
+/* Define to 1 if you have the `pthread_yield' function. */ |
|
214 |
+#undef HAVE_PTHREAD_YIELD |
|
215 |
+ |
|
213 | 216 |
/* Define to 1 if you have the <pwd.h> header file. */ |
214 | 217 |
#undef HAVE_PWD_H |
215 | 218 |
|
... | ... |
@@ -228,6 +231,9 @@ |
228 | 228 |
/* Define signed right shift implementation */ |
229 | 229 |
#undef HAVE_SAR |
230 | 230 |
|
231 |
+/* Define to 1 if you have the `sched_yield' function. */ |
|
232 |
+#undef HAVE_SCHED_YIELD |
|
233 |
+ |
|
231 | 234 |
/* Define to 1 if you have the `sendmsg' function. */ |
232 | 235 |
#undef HAVE_SENDMSG |
233 | 236 |
|
... | ... |
@@ -344,8 +344,12 @@ static void *thrmgr_worker(void *arg) |
344 | 344 |
if (job_data) threadpool->handler(job_data); |
345 | 345 |
if (threadpool->state == POOL_STOP) break; |
346 | 346 |
} |
347 |
- |
|
347 |
+ |
|
348 |
+#ifdef HAVE_PTHREAD_YIELD |
|
348 | 349 |
pthread_yield(); /* do not remove on premptive kernel e.g linux 2.6 */ |
350 |
+#elif HAVE_SCHED_YIELD |
|
351 |
+ sched_yield(); |
|
352 |
+#endif |
|
349 | 353 |
pthread_cleanup_pop(1); |
350 | 354 |
return NULL; |
351 | 355 |
} |
... | ... |
@@ -17210,6 +17210,104 @@ fi |
17210 | 17210 |
|
17211 | 17211 |
if test "$have_pthreads" = "yes" |
17212 | 17212 |
then |
17213 |
+ save_LIBS="$LIBS" |
|
17214 |
+ LIBS="$THREAD_LIBS $LIBS" |
|
17215 |
+ |
|
17216 |
+ |
|
17217 |
+for ac_func in sched_yield pthread_yield |
|
17218 |
+do |
|
17219 |
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` |
|
17220 |
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5 |
|
17221 |
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } |
|
17222 |
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then |
|
17223 |
+ echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
17224 |
+else |
|
17225 |
+ cat >conftest.$ac_ext <<_ACEOF |
|
17226 |
+/* confdefs.h. */ |
|
17227 |
+_ACEOF |
|
17228 |
+cat confdefs.h >>conftest.$ac_ext |
|
17229 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
17230 |
+/* end confdefs.h. */ |
|
17231 |
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. |
|
17232 |
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */ |
|
17233 |
+#define $ac_func innocuous_$ac_func |
|
17234 |
+ |
|
17235 |
+/* System header to define __stub macros and hopefully few prototypes, |
|
17236 |
+ which can conflict with char $ac_func (); below. |
|
17237 |
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since |
|
17238 |
+ <limits.h> exists even on freestanding compilers. */ |
|
17239 |
+ |
|
17240 |
+#ifdef __STDC__ |
|
17241 |
+# include <limits.h> |
|
17242 |
+#else |
|
17243 |
+# include <assert.h> |
|
17244 |
+#endif |
|
17245 |
+ |
|
17246 |
+#undef $ac_func |
|
17247 |
+ |
|
17248 |
+/* Override any GCC internal prototype to avoid an error. |
|
17249 |
+ Use char because int might match the return type of a GCC |
|
17250 |
+ builtin and then its argument prototype would still apply. */ |
|
17251 |
+#ifdef __cplusplus |
|
17252 |
+extern "C" |
|
17253 |
+#endif |
|
17254 |
+char $ac_func (); |
|
17255 |
+/* The GNU C library defines this for functions which it implements |
|
17256 |
+ to always fail with ENOSYS. Some functions are actually named |
|
17257 |
+ something starting with __ and the normal name is an alias. */ |
|
17258 |
+#if defined __stub_$ac_func || defined __stub___$ac_func |
|
17259 |
+choke me |
|
17260 |
+#endif |
|
17261 |
+ |
|
17262 |
+int |
|
17263 |
+main () |
|
17264 |
+{ |
|
17265 |
+return $ac_func (); |
|
17266 |
+ ; |
|
17267 |
+ return 0; |
|
17268 |
+} |
|
17269 |
+_ACEOF |
|
17270 |
+rm -f conftest.$ac_objext conftest$ac_exeext |
|
17271 |
+if { (ac_try="$ac_link" |
|
17272 |
+case "(($ac_try" in |
|
17273 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
17274 |
+ *) ac_try_echo=$ac_try;; |
|
17275 |
+esac |
|
17276 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
17277 |
+ (eval "$ac_link") 2>conftest.er1 |
|
17278 |
+ ac_status=$? |
|
17279 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
17280 |
+ rm -f conftest.er1 |
|
17281 |
+ cat conftest.err >&5 |
|
17282 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
17283 |
+ (exit $ac_status); } && { |
|
17284 |
+ test -z "$ac_c_werror_flag" || |
|
17285 |
+ test ! -s conftest.err |
|
17286 |
+ } && test -s conftest$ac_exeext && |
|
17287 |
+ $as_test_x conftest$ac_exeext; then |
|
17288 |
+ eval "$as_ac_var=yes" |
|
17289 |
+else |
|
17290 |
+ echo "$as_me: failed program was:" >&5 |
|
17291 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
17292 |
+ |
|
17293 |
+ eval "$as_ac_var=no" |
|
17294 |
+fi |
|
17295 |
+ |
|
17296 |
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ |
|
17297 |
+ conftest$ac_exeext conftest.$ac_ext |
|
17298 |
+fi |
|
17299 |
+ac_res=`eval echo '${'$as_ac_var'}'` |
|
17300 |
+ { echo "$as_me:$LINENO: result: $ac_res" >&5 |
|
17301 |
+echo "${ECHO_T}$ac_res" >&6; } |
|
17302 |
+if test `eval echo '${'$as_ac_var'}'` = yes; then |
|
17303 |
+ cat >>confdefs.h <<_ACEOF |
|
17304 |
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 |
|
17305 |
+_ACEOF |
|
17306 |
+ |
|
17307 |
+fi |
|
17308 |
+done |
|
17309 |
+ |
|
17310 |
+ LIBS="$save_LIBS" |
|
17213 | 17311 |
|
17214 | 17312 |
cat >>confdefs.h <<\_ACEOF |
17215 | 17313 |
#define BUILD_CLAMD 1 |
... | ... |
@@ -962,6 +962,10 @@ AM_CONDITIONAL([ENABLE_UNRAR],[test "$want_unrar" = "yes"]) |
962 | 962 |
|
963 | 963 |
if test "$have_pthreads" = "yes" |
964 | 964 |
then |
965 |
+ save_LIBS="$LIBS" |
|
966 |
+ LIBS="$THREAD_LIBS $LIBS" |
|
967 |
+ AC_CHECK_FUNCS([sched_yield pthread_yield]) |
|
968 |
+ LIBS="$save_LIBS" |
|
965 | 969 |
AC_DEFINE([BUILD_CLAMD], 1, "build clamd") |
966 | 970 |
fi |
967 | 971 |
|