Browse code

when --disable-gcc-vcheck is set, set CFLAGS to O0 and append -broken-compiler to the VERSION (bb #684) introduce VERSION_SUFFIX for easier handling, and convert -exp to use it

git-svn: trunk@4239

Török Edvin authored on 2008/10/09 18:00:26
Showing 9 changed files
... ...
@@ -1,3 +1,22 @@
1
+Thu Oct  9 12:17:45 EEST 2008 (edwin)
2
+-------------------------------------
3
+ * ChangeLog, clamav-config.h.in, configure, configure.in,
4
+ freshclam/manager.c, libclamav/readdb.c, libclamav/version.c,
5
+ shared/misc.c, unit_tests/check_clamav.c: when --disable-gcc-vcheck
6
+ is set, set CFLAGS to O0 and append -broken-compiler to the VERSION
7
+ (bb #684) introduce VERSION_SUFFIX for easier handling, and convert
8
+ -exp to use it
9
+
10
+Thu Oct  9 12:07:03 EEST 2008 (edwin)
11
+-------------------------------------
12
+
13
+ * clamav-config.h.in, configure, configure.in, freshclam/manager.c,
14
+ libclamav/readdb.c, libclamav/version.c, shared/misc.c,
15
+ unit_tests/check_clamav.c: when --disable-gcc-vcheck is set, set
16
+ CFLAGS to O0 and append -broken-compiler to the VERSION (bb #684)
17
+ introduce VERSION_SUFFIX for easier handling, and convert -exp to
18
+ use it
19
+
1 20
 Wed Oct  8 11:16:34 CEST 2008 (acab)
2 21
 ------------------------------------
3 22
   * doc/signatures.*: make a note about using regexes in [zr]md's
... ...
@@ -383,6 +383,9 @@
383 383
 /* Version number of package */
384 384
 #undef VERSION
385 385
 
386
+/* Version suffix for package */
387
+#undef VERSION_SUFFIX
388
+
386 389
 /* tcpwrappers support */
387 390
 #undef WITH_TCPWRAP
388 391
 
... ...
@@ -12178,7 +12178,7 @@ fi
12178 12178
 
12179 12179
 
12180 12180
 msg_gcc_check="use --disable-gcc-vcheck to disable this check. Before reporting any bugs check with a supported version of gcc"
12181
-
12181
+VERSION_SUFFIX=
12182 12182
 if test "$gcc_check" = "yes"; then
12183 12183
 	if test "x$ac_compiler_gnu" = "xyes"; then
12184 12184
 		{ echo "$as_me:$LINENO: checking for a supported version of gcc" >&5
... ...
@@ -12198,9 +12198,13 @@ echo "${ECHO_T}ok (${gcc_version})" >&6; }
12198 12198
 				;;
12199 12199
 	esac
12200 12200
 	fi
12201
+else
12202
+	CFLAGS="$CFLAGS -O0"
12203
+	VERSION_SUFFIX="$VERSION_SUFFIX-broken-compiler"
12201 12204
 fi
12202 12205
 
12203 12206
 
12207
+
12204 12208
 { echo "$as_me:$LINENO: checking for gcc bug PR27603" >&5
12205 12209
 echo $ECHO_N "checking for gcc bug PR27603... $ECHO_C" >&6; }
12206 12210
 if test "$cross_compiling" = yes; then
... ...
@@ -13249,6 +13253,7 @@ cat >>confdefs.h <<\_ACEOF
13249 13249
 #define CL_EXPERIMENTAL 1
13250 13250
 _ACEOF
13251 13251
 
13252
+  VERSION_SUFFIX="$VERSION_SUFFIX-exp"
13252 13253
 fi
13253 13254
 
13254 13255
 { echo "$as_me:$LINENO: checking for bind in -lsocket" >&5
... ...
@@ -20986,6 +20991,12 @@ echo "${ECHO_T}disabled" >&6; }
20986 20986
 fi
20987 20987
 
20988 20988
 
20989
+
20990
+cat >>confdefs.h <<_ACEOF
20991
+#define VERSION_SUFFIX "$VERSION_SUFFIX"
20992
+_ACEOF
20993
+
20994
+
20989 20995
 ac_config_files="$ac_config_files libclamunrar/Makefile libclamunrar_iface/Makefile libclamav/Makefile libclamav/lzma/Makefile clamscan/Makefile database/Makefile docs/Makefile clamd/Makefile clamdscan/Makefile clamav-milter/Makefile freshclam/Makefile sigtool/Makefile clamconf/Makefile etc/Makefile test/Makefile unit_tests/Makefile Makefile clamav-config libclamav.pc docs/man/clamav-milter.8 docs/man/clamconf.1 docs/man/clamd.8 docs/man/clamd.conf.5 docs/man/clamdscan.1 docs/man/clamscan.1 docs/man/freshclam.1 docs/man/freshclam.conf.5 docs/man/sigtool.1"
20990 20996
 
20991 20997
 cat >confcache <<\_ACEOF
... ...
@@ -23392,7 +23403,23 @@ if test "$no_create" != yes; then
23392 23392
 fi
23393 23393
 
23394 23394
 
23395
-if test "x$cross_compiling" != "xno" || test "x$gcc_check" = "xno" || test "x$zlib_check" = "xno" ; then
23395
+# Yep, downgrading the compiler avoids the bug too:
23396
+# 4.0.x, and 4.1.0 are the known buggy versions
23397
+# 3.4 doesn't have the bug
23398
+if test "x$gcc_check" != "xyes"; then
23399
+	{ echo "$as_me:$LINENO: WARNING:
23400
+****** Optimizations disabled to avoid compiler bugs
23401
+****** The resulting binaries will be slow!
23402
+****** It is recommended to either upgrade or downgrade your compiler
23403
+" >&5
23404
+echo "$as_me: WARNING:
23405
+****** Optimizations disabled to avoid compiler bugs
23406
+****** The resulting binaries will be slow!
23407
+****** It is recommended to either upgrade or downgrade your compiler
23408
+" >&2;}
23409
+fi
23410
+
23411
+if test "x$cross_compiling" != "xno" || test "x$gcc_check" != "xyes" || test "x$zlib_check" = "xno" ; then
23396 23412
 { echo "$as_me:$LINENO: WARNING:
23397 23413
 ****** WARNING:
23398 23414
 ****** You are either cross compiling to a different host or
... ...
@@ -80,7 +80,7 @@ AC_ARG_ENABLE([gcc-vcheck],
80 80
 gcc_check=$enableval, gcc_check="yes")
81 81
 
82 82
 msg_gcc_check="use --disable-gcc-vcheck to disable this check. Before reporting any bugs check with a supported version of gcc"
83
-
83
+VERSION_SUFFIX=
84 84
 dnl Check for gcc-4.1.0
85 85
 if test "$gcc_check" = "yes"; then
86 86
 	if test "x$ac_compiler_gnu" = "xyes"; then
... ...
@@ -96,8 +96,12 @@ if test "$gcc_check" = "yes"; then
96 96
 				;;
97 97
 	esac
98 98
 	fi
99
+else
100
+	CFLAGS="$CFLAGS -O0"
101
+	VERSION_SUFFIX="$VERSION_SUFFIX-broken-compiler"
99 102
 fi
100 103
 
104
+
101 105
 dnl Checks if compiler produces valid code, regardless of compiler
102 106
 dnl we do these checks here to avoid receiving endless bugreports about
103 107
 dnl breakages due to compiler bugs.
... ...
@@ -308,6 +312,7 @@ enable_experimental=$enableval, enable_experimental="no")
308 308
 
309 309
 if test "$enable_experimental" = "yes"; then
310 310
   AC_DEFINE([CL_EXPERIMENTAL],1,[enable experimental code])
311
+  VERSION_SUFFIX="$VERSION_SUFFIX-exp"
311 312
 fi
312 313
 
313 314
 AC_CHECK_LIB([socket], [bind], [LIBS="$LIBS -lsocket"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lsocket"; CLAMD_LIBS="$CLAMD_LIBS -lsocket"])
... ...
@@ -1493,6 +1498,8 @@ AC_MSG_RESULT([$have_signed_rightshift_extended]);
1493 1493
 
1494 1494
 AC_C_FDPASSING
1495 1495
 
1496
+AC_DEFINE_UNQUOTED([VERSION_SUFFIX],"$VERSION_SUFFIX",[Version suffix for package])
1497
+
1496 1498
 AC_OUTPUT([
1497 1499
 libclamunrar/Makefile
1498 1500
 libclamunrar_iface/Makefile
... ...
@@ -1524,7 +1531,18 @@ docs/man/freshclam.conf.5
1524 1524
 docs/man/sigtool.1
1525 1525
 ])
1526 1526
 
1527
-if test "x$cross_compiling" != "xno" || test "x$gcc_check" = "xno" || test "x$zlib_check" = "xno" ; then
1527
+# Yep, downgrading the compiler avoids the bug too:
1528
+# 4.0.x, and 4.1.0 are the known buggy versions
1529
+# 3.4 doesn't have the bug
1530
+if test "x$gcc_check" != "xyes"; then
1531
+	AC_MSG_WARN([
1532
+****** Optimizations disabled to avoid compiler bugs
1533
+****** The resulting binaries will be slow!
1534
+****** It is recommended to either upgrade or downgrade your compiler
1535
+])
1536
+fi
1537
+
1538
+if test "x$cross_compiling" != "xno" || test "x$gcc_check" != "xyes" || test "x$zlib_check" = "xno" ; then
1528 1539
 AC_MSG_WARN([
1529 1540
 ****** WARNING:
1530 1541
 ****** You are either cross compiling to a different host or
... ...
@@ -1430,7 +1430,7 @@ int downloadmanager(const struct cfgstruct *copt, const struct optstruct *opt, c
1430 1430
 		    logg("*Software version from DNS: %s\n", newver);
1431 1431
 		    strncpy(vstr, get_version(), 32);
1432 1432
 		    vstr[31] = 0;
1433
-		    if((pt = strstr(vstr, "-exp")))
1433
+		    if((pt = strstr(vstr, "-exp")) || (pt = strstr(vstr,"-broken")))
1434 1434
 			*pt = 0;
1435 1435
 
1436 1436
 		    if(vwarning && !strstr(vstr, "devel") && !strstr(vstr, "rc")) {
... ...
@@ -329,11 +329,7 @@ int cli_initengine(struct cl_engine **engine, unsigned int options)
329 329
 
330 330
 
331 331
     if(!*engine) {
332
-#ifdef CL_EXPERIMENTAL
333
-	cli_dbgmsg("Initializing the engine (%s-exp)\n", cl_retver());
334
-#else
335 332
 	cli_dbgmsg("Initializing the engine (%s)\n", cl_retver());
336
-#endif
337 333
 
338 334
 	*engine = (struct cl_engine *) cli_calloc(1, sizeof(struct cl_engine));
339 335
 	if(!*engine) {
... ...
@@ -11,5 +11,5 @@
11 11
 /* libclamav's version is always the SVN revision (if available) */
12 12
 const char *cl_retver(void)
13 13
 {
14
-	return REPO_VERSION;
14
+	return REPO_VERSION""VERSION_SUFFIX;
15 15
 }
... ...
@@ -54,19 +54,13 @@
54 54
 #define REPO_VERSION "exported"
55 55
 #endif
56 56
 
57
-#ifdef CL_EXPERIMENTAL
58
-#define EXP_VER "-exp"
59
-#else
60
-#define EXP_VER
61
-#endif
62
-
63 57
 const char *get_version(void)
64 58
 {
65 59
 	if(!strncmp("devel-",VERSION,6) && strcmp("exported",REPO_VERSION)) {
66
-		return REPO_VERSION""EXP_VER;
60
+		return REPO_VERSION""VERSION_SUFFIX;
67 61
 	}
68 62
 	/* it is a release, or we have nothing better */
69
-	return VERSION""EXP_VER;
63
+	return VERSION""VERSION_SUFFIX;
70 64
 }
71 65
 /* CL_NOLIBCLAMAV means to omit functions that depends on libclamav */
72 66
 #ifndef CL_NOLIBCLAMAV
... ...
@@ -71,7 +71,7 @@ END_TEST
71 71
 START_TEST (test_cl_retver)
72 72
 {
73 73
     const char *ver = cl_retver();
74
-    fail_unless(!strcmp(REPO_VERSION, ver),"cl_retver");
74
+    fail_unless(!strcmp(REPO_VERSION""VERSION_SUFFIX, ver),"cl_retver");
75 75
     fail_unless(strcspn(ver,"012345789") < strlen(ver),
76 76
 		    "cl_retver must have a number");
77 77
 }