Browse code

add support for HP-UX 11.11

git-svn: trunk@2856

Tomasz Kojm authored on 2007/02/24 12:30:27
Showing 9 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sat Feb 24 02:32:57 CET 2007 (tk)
2
+---------------------------------
3
+  * configure, libclamav: add support for HP-UX 11.11 with native
4
+			  compiler (bb#180), thanks to Edwin
5
+
1 6
 Fri Feb 23 21:42:08 CET 2007 (tk)
2 7
 ---------------------------------
3 8
   * configure: use -pthread also for FreeBSD 6.x
... ...
@@ -189,6 +189,9 @@
189 189
 /* "pragma pack" */
190 190
 #undef HAVE_PRAGMA_PACK
191 191
 
192
+/* "pragma pack hppa/hp-ux style" */
193
+#undef HAVE_PRAGMA_PACK_HPPA
194
+
192 195
 /* readdir_r takes 2 arguments */
193 196
 #undef HAVE_READDIR_R_2
194 197
 
... ...
@@ -21479,6 +21479,8 @@ echo "$as_me: WARNING: ****** stability problems to the ClamAV developers!" >&2;
21479 21479
 
21480 21480
     if test "$ZLIB_HOME" != "/usr"; then
21481 21481
 	CPPFLAGS="$CPPFLAGS -I$ZLIB_HOME/include"
21482
+	save_LDFLAGS="$LDFLAGS"
21483
+	LDFLAGS="$LIBS -L$ZLIB_HOME/lib"
21482 21484
 	{ echo "$as_me:$LINENO: checking for inflateEnd in -lz" >&5
21483 21485
 echo $ECHO_N "checking for inflateEnd in -lz... $ECHO_C" >&6; }
21484 21486
 if test "${ac_cv_lib_z_inflateEnd+set}" = set; then
... ...
@@ -21552,6 +21554,7 @@ echo "$as_me: error: Please install zlib and zlib-devel packages" >&2;}
21552 21552
    { (exit 1); exit 1; }; }
21553 21553
 fi
21554 21554
 
21555
+	LDFLAGS="$save_LDFLAGS"
21555 21556
     else
21556 21557
 	{ echo "$as_me:$LINENO: checking for inflateEnd in -lz" >&5
21557 21558
 echo $ECHO_N "checking for inflateEnd in -lz... $ECHO_C" >&6; }
... ...
@@ -23293,6 +23296,7 @@ cat >>confdefs.h <<\_ACEOF
23293 23293
 #define C_HPUX 1
23294 23294
 _ACEOF
23295 23295
 
23296
+    use_gethostbyname_r="no"
23296 23297
     ;;
23297 23298
 aix*)
23298 23299
     if test "$have_pthreads" = "yes"; then
... ...
@@ -25550,11 +25554,83 @@ fi
25550 25550
 
25551 25551
 	{ echo "$as_me:$LINENO: result: $have_pragma_pack" >&5
25552 25552
 echo "${ECHO_T}$have_pragma_pack" >&6; }
25553
+	if test "$have_pragma_pack" = yes; then
25553 25554
 
25554 25555
 cat >>confdefs.h <<\_ACEOF
25555 25556
 #define HAVE_PRAGMA_PACK 1
25556 25557
 _ACEOF
25557 25558
 
25559
+	else
25560
+		{ echo "$as_me:$LINENO: checking for structure packing via hppa/hp-ux pragma" >&5
25561
+echo $ECHO_N "checking for structure packing via hppa/hp-ux pragma... $ECHO_C" >&6; }
25562
+		if test "${have_pragma_pack_hpux+set}" = set; then
25563
+  echo $ECHO_N "(cached) $ECHO_C" >&6
25564
+else
25565
+
25566
+			if test "$cross_compiling" = yes; then
25567
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
25568
+See \`config.log' for more details." >&5
25569
+echo "$as_me: error: cannot run test program while cross compiling
25570
+See \`config.log' for more details." >&2;}
25571
+   { (exit 1); exit 1; }; }
25572
+else
25573
+  cat >conftest.$ac_ext <<_ACEOF
25574
+/* confdefs.h.  */
25575
+_ACEOF
25576
+cat confdefs.h >>conftest.$ac_ext
25577
+cat >>conftest.$ac_ext <<_ACEOF
25578
+/* end confdefs.h.  */
25579
+
25580
+			/* hppa/hp-ux wants pragma outside of function */
25581
+#pragma pack 1 /* has to be in column 1 ! */
25582
+			struct { char c; long l; } s;
25583
+			    int main(int argc, char **argv) {
25584
+			return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; }
25585
+_ACEOF
25586
+rm -f conftest$ac_exeext
25587
+if { (ac_try="$ac_link"
25588
+case "(($ac_try" in
25589
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25590
+  *) ac_try_echo=$ac_try;;
25591
+esac
25592
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25593
+  (eval "$ac_link") 2>&5
25594
+  ac_status=$?
25595
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
25596
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
25597
+  { (case "(($ac_try" in
25598
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25599
+  *) ac_try_echo=$ac_try;;
25600
+esac
25601
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25602
+  (eval "$ac_try") 2>&5
25603
+  ac_status=$?
25604
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
25605
+  (exit $ac_status); }; }; then
25606
+  have_pragma_pack_hpux=yes
25607
+else
25608
+  echo "$as_me: program exited with status $ac_status" >&5
25609
+echo "$as_me: failed program was:" >&5
25610
+sed 's/^/| /' conftest.$ac_ext >&5
25611
+
25612
+( exit $ac_status )
25613
+have_pragma_pack_hpux=no
25614
+fi
25615
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
25616
+fi
25617
+
25618
+
25619
+
25620
+fi
25621
+
25622
+		{ echo "$as_me:$LINENO: result: $have_pragma_pack_hpux" >&5
25623
+echo "${ECHO_T}$have_pragma_pack_hpux" >&6; }
25624
+
25625
+cat >>confdefs.h <<\_ACEOF
25626
+#define HAVE_PRAGMA_PACK_HPPA 1
25627
+_ACEOF
25628
+
25629
+	fi
25558 25630
 fi
25559 25631
 
25560 25632
 { echo "$as_me:$LINENO: checking for type aligning via __attribute__((aligned))" >&5
... ...
@@ -25610,7 +25686,7 @@ fi
25610 25610
 { echo "$as_me:$LINENO: result: $have_attrib_aligned" >&5
25611 25611
 echo "${ECHO_T}$have_attrib_aligned" >&6; }
25612 25612
 
25613
-if test "$have_attrib_packed" = no -a "$have_pragma_pack" = no ; then
25613
+if test "$have_attrib_packed" = no -a "$have_pragma_pack" = no -a "$have_pragma_pack_hpux" = no; then
25614 25614
 	{ { echo "$as_me:$LINENO: error: Need to know how to pack structures with this compiler" >&5
25615 25615
 echo "$as_me: error: Need to know how to pack structures with this compiler" >&2;}
25616 25616
    { (exit 1); exit 1; }; }
... ...
@@ -124,7 +124,10 @@ else
124 124
 
125 125
     if test "$ZLIB_HOME" != "/usr"; then
126 126
 	CPPFLAGS="$CPPFLAGS -I$ZLIB_HOME/include"
127
+	save_LDFLAGS="$LDFLAGS"
128
+	LDFLAGS="$LIBS -L$ZLIB_HOME/lib"
127 129
 	AC_CHECK_LIB(z, inflateEnd, [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -L$ZLIB_HOME/lib -lz"; AC_DEFINE(HAVE_ZLIB_H,1,zlib installed)], AC_MSG_ERROR(Please install zlib and zlib-devel packages))
130
+	LDFLAGS="$save_LDFLAGS"
128 131
     else
129 132
 	AC_CHECK_LIB(z, inflateEnd, [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lz"; AC_DEFINE(HAVE_ZLIB_H,1,zlib installed)], AC_MSG_ERROR(Please install zlib and zlib-devel packages))
130 133
     fi
... ...
@@ -540,6 +543,7 @@ hpux*)
540 540
 	AC_DEFINE(_REENTRANT,1,[thread safe])
541 541
     fi
542 542
     AC_DEFINE(C_HPUX,1,[os is hpux])
543
+    use_gethostbyname_r="no"
543 544
     ;;
544 545
 aix*)
545 546
     if test "$have_pthreads" = "yes"; then
... ...
@@ -997,7 +1001,23 @@ if test "$have_attrib_packed" = no; then
997 997
 			[have_pragma_pack=no])
998 998
 		])
999 999
 	AC_MSG_RESULT($have_pragma_pack)
1000
-	AC_DEFINE(HAVE_PRAGMA_PACK, 1, "pragma pack")
1000
+	if test "$have_pragma_pack" = yes; then
1001
+		AC_DEFINE(HAVE_PRAGMA_PACK, 1, "pragma pack")
1002
+	else
1003
+		AC_MSG_CHECKING(for structure packing via hppa/hp-ux pragma)
1004
+		AC_CACHE_VAL(have_pragma_pack_hpux,[
1005
+			AC_TRY_RUN([
1006
+			/* hppa/hp-ux wants pragma outside of function */
1007
+#pragma pack 1 /* has to be in column 1 ! */
1008
+			struct { char c; long l; } s;
1009
+			    int main(int argc, char **argv) {
1010
+			return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],
1011
+			[have_pragma_pack_hpux=yes],
1012
+			[have_pragma_pack_hpux=no])
1013
+		])
1014
+		AC_MSG_RESULT($have_pragma_pack_hpux)
1015
+		AC_DEFINE(HAVE_PRAGMA_PACK_HPPA, 1, "pragma pack hppa/hp-ux style")
1016
+	fi
1001 1017
 fi
1002 1018
 
1003 1019
 dnl check for __attribute__((aligned))
... ...
@@ -1010,7 +1030,7 @@ AC_CACHE_VAL(have_attrib_aligned,[
1010 1010
 	])
1011 1011
 AC_MSG_RESULT($have_attrib_aligned)
1012 1012
 
1013
-if test "$have_attrib_packed" = no -a "$have_pragma_pack" = no ; then
1013
+if test "$have_attrib_packed" = no -a "$have_pragma_pack" = no -a "$have_pragma_pack_hpux" = no; then
1014 1014
 	AC_MSG_ERROR(Need to know how to pack structures with this compiler)
1015 1015
 fi
1016 1016
 
... ...
@@ -32,7 +32,7 @@
32 32
 #endif
33 33
 #include <string.h>
34 34
 
35
-#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK)
35
+#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK) || defined(HAVE_PRAGMA_PACK_HPPA)
36 36
 #if HAVE_MMAP
37 37
 #if HAVE_SYS_MMAN_H
38 38
 #include <sys/mman.h>
... ...
@@ -57,6 +57,10 @@
57 57
 #pragma pack(1)
58 58
 #endif
59 59
 
60
+#ifdef HAVE_PRAGMA_PACK_HPPA
61
+#pragma pack 1
62
+#endif
63
+
60 64
 #ifndef	O_BINARY
61 65
 #define	O_BINARY	0
62 66
 #endif
... ...
@@ -151,6 +155,10 @@ typedef struct lzx_content_tag {
151 151
 #pragma pack()
152 152
 #endif
153 153
 
154
+#ifdef HAVE_PRAGMA_PACK_HPPA
155
+#pragma pack
156
+#endif
157
+
154 158
 #define chm_endian_convert_16(x) le16_to_host(x) 
155 159
 #define chm_endian_convert_32(x) le32_to_host(x) 
156 160
 #define chm_endian_convert_64(x) le64_to_host(x)
... ...
@@ -237,7 +245,7 @@ static void itsf_print_header(itsf_header_t *itsf_hdr)
237 237
 
238 238
 static int itsf_read_header(int fd, itsf_header_t *itsf_hdr, unsigned char *m_area, off_t m_length)
239 239
 {
240
-#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK)
240
+#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK) || defined(HAVE_PRAGMA_PACK_HPPA)
241 241
 	if (!chm_read_data(fd, (unsigned char *) itsf_hdr, 0, CHM_ITSF_MIN_LEN,
242 242
 				m_area,	m_length)) {
243 243
 		return FALSE;
... ...
@@ -326,7 +334,7 @@ static void itsp_print_header(itsp_header_t *itsp_hdr)
326 326
 static int itsp_read_header(int fd, itsp_header_t *itsp_hdr, off_t offset,
327 327
 				unsigned char *m_area, off_t m_length)
328 328
 {
329
-#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK)
329
+#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK) || defined(HAVE_PRAGMA_PACK_HPPA)
330 330
 	if (!chm_read_data(fd, (unsigned char *) itsp_hdr, offset, CHM_ITSP_LEN,
331 331
 				m_area,	m_length)) {
332 332
 		return FALSE;
... ...
@@ -529,7 +537,7 @@ static int read_chunk(int fd, off_t offset, uint32_t chunk_len,
529 529
 		return FALSE;
530 530
 	}
531 531
 	
532
-#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK)
532
+#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK) || defined(HAVE_PRAGMA_PACK_HPPA)
533 533
 	/* 8 bytes reads the signature and the free_space */
534 534
 	if (!chm_read_data(fd, chunk_hdr->signature, offset, 8,
535 535
 				m_area,	m_length)) {
... ...
@@ -559,7 +567,7 @@ static int read_chunk(int fd, off_t offset, uint32_t chunk_len,
559 559
 	chunk_hdr->free_space = chm_endian_convert_32(chunk_hdr->free_space);
560 560
 	
561 561
 	if (memcmp(chunk_hdr->signature, "PMGL", 4) == 0) {
562
-#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK)
562
+#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK) || defined(HAVE_PRAGMA_PACK_HPPA)
563 563
 		if (!chm_read_data(fd, (unsigned char *) &chunk_hdr->unknown, offset+8, 12,
564 564
 					m_area,	m_length)) {
565 565
 			goto abort;
... ...
@@ -628,7 +636,7 @@ static lzx_control_t *read_sys_control(int fd, itsf_header_t *itsf_hdr, file_lis
628 628
 	if (!lzx_control) {
629 629
 		return NULL;
630 630
 	}
631
-#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK)
631
+#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK) || defined(HAVE_PRAGMA_PACK_HPPA)
632 632
 	if (!chm_read_data(fd, (unsigned char *) lzx_control, offset, CHM_CONTROL_LEN,
633 633
 				m_area,	m_length)) {
634 634
 		goto abort;
... ...
@@ -750,7 +758,7 @@ static lzx_reset_table_t *read_sys_reset_table(int fd, itsf_header_t *itsf_hdr,
750 750
 	/* Save the entry offset for later use */
751 751
 	lzx_reset_table->rt_offset = offset-4;
752 752
 
753
-#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK)
753
+#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK) || defined(HAVE_PRAGMA_PACK_HPPA)
754 754
 	if (!chm_read_data(fd, (unsigned char *) lzx_reset_table, offset, CHM_RESET_TABLE_LEN,
755 755
 				m_area,	m_length)) {
756 756
 		goto abort;
... ...
@@ -60,6 +60,10 @@
60 60
 #pragma pack(1)
61 61
 #endif
62 62
 
63
+#ifdef HAVE_PRAGMA_PACK_HPPA
64
+#pragma pack 1
65
+#endif
66
+
63 67
 #ifndef	O_BINARY
64 68
 #define	O_BINARY	0
65 69
 #endif
... ...
@@ -123,6 +127,10 @@ typedef struct property_tag
123 123
 #pragma pack()
124 124
 #endif
125 125
 
126
+#ifdef HAVE_PRAGMA_PACK_HPPA
127
+#pragma pack
128
+#endif
129
+
126 130
 static unsigned char magic_id[] = { 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1};
127 131
 
128 132
 static char *get_property_name(char *name, int size)
... ...
@@ -670,7 +678,7 @@ static int handler_writefile(int fd, ole2_header_t *hdr, property_t *prop, const
670 670
 	return TRUE;
671 671
 }
672 672
 
673
-#if !defined(HAVE_ATTRIB_PACKED) && !defined(HAVE_PRAGMA_PACK)
673
+#if !defined(HAVE_ATTRIB_PACKED) && !defined(HAVE_PRAGMA_PACK) && !defined(HAVE_PRAGMA_PACK_HPPA)
674 674
 static int ole2_read_header(int fd, ole2_header_t *hdr)
675 675
 {
676 676
 	int i;
... ...
@@ -764,7 +772,7 @@ int cli_ole2_extract(int fd, const char *dirname, const struct cl_limits *limits
764 764
 #endif
765 765
 
766 766
 	if (hdr.m_area == NULL) {
767
-#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK)
767
+#if defined(HAVE_ATTRIB_PACKED) || defined(HAVE_PRAGMA_PACK) || defined(HAVE_PRAGMA_PACK_HPPA)
768 768
 		if (cli_readn(fd, &hdr, hdr_size) != hdr_size) {
769 769
 			return 0;
770 770
 		}
... ...
@@ -118,6 +118,10 @@ typedef struct mark_header_tag
118 118
 #pragma pack(1)
119 119
 #endif
120 120
 
121
+#ifdef HAVE_PRAGMA_PACK_HPPA
122
+#pragma pack 1
123
+#endif
124
+
121 125
 typedef struct main_header_tag
122 126
 {
123 127
 	uint16_t head_crc __attribute__ ((packed));
... ...
@@ -346,4 +350,8 @@ int decode_number(unpack_data_t *unpack_data, struct Decode *decode);
346 346
 #pragma pack()
347 347
 #endif
348 348
 
349
+#ifdef HAVE_PRAGMA_PACK_HPPA
350
+#pragma pack
351
+#endif
352
+
349 353
 #endif
... ...
@@ -982,8 +982,8 @@ int ppm_decode_char(ppm_data_t *ppm_data, int fd, unpack_data_t *unpack_data)
982 982
 		return -1;
983 983
 	}
984 984
 	if (ppm_data->min_context->num_stats != 1) {
985
-		if (ppm_data->min_context->con_ut.u.stats <= ppm_data->sub_alloc.ptext ||
986
-			ppm_data->min_context->con_ut.u.stats > ppm_data->sub_alloc.heap_end) {
985
+		if ((uint8_t *) ppm_data->min_context->con_ut.u.stats <= ppm_data->sub_alloc.ptext ||
986
+			(uint8_t *) ppm_data->min_context->con_ut.u.stats > ppm_data->sub_alloc.heap_end) {
987 987
 			return -1;
988 988
 		}
989 989
 		if (!ppm_decode_symbol1(ppm_data, ppm_data->min_context)) {
... ...
@@ -42,6 +42,10 @@
42 42
 #pragma pack(1)
43 43
 #endif
44 44
 
45
+#ifdef HAVE_PRAGMA_PACK_HPPA
46
+#pragma pack 1
47
+#endif
48
+
45 49
 /******** Zip format structures *********/
46 50
 
47 51
 /* Local file header */
... ...
@@ -211,4 +215,8 @@ int zip_dir_close(zip_dir *dir);
211 211
 #pragma pack()
212 212
 #endif
213 213
 
214
+#ifdef HAVE_PRAGMA_PACK_HPPA
215
+#pragma pack
216
+#endif
217
+
214 218
 #endif /* __UNZIP_H */