Hi,

I have tried to compile ... with the native Sun compiler (cc: Sun C 5.6 
2004/07/15) which resulted in the following error message:

 cc -DHAVE_CONFIG_H -I. -I. -I.. -I../src/PCSC -I../src -I/usr/local/include 
-g -D_REENTRANT -c debuglog.c  -KPIC -DPIC -o .libs/debuglog.o
"debuglog.c", line 217: syntax error before or at: (
"debuglog.c", line 217: warning: old-style declaration or incorrect type for: 
__attribute__
"debuglog.c", line 239: cannot recover from previous errors
cc: acomp failed for debuglog.c
make[3]: *** [debuglog.lo] Error 1
make[3]: Leaving directory `/home/nardmann/pcsc-lite-1.2.9-beta8/src'

Line 217 is this one:

INTERNAL int DebugLogSetCategory(const int dbginfo)

So the problem is with the definition of INTERNAL in src/misc.h:

#define INTERNAL __attribute__ ((visibility("hidden")))

The Sun native compiler does not support this syntax. So this part should be 
protected by some configure check. Sun Studio cc uses '__hidden' for this.
For my part I changed the INTERNAL definition to

#if defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
#define INTERNAL __attribute__ ((visibility("hidden")))
#else
#define INTERNAL __hidden
#endif

A similar problem is in src/PCSC/reader.h, line 122-124; I changed the pack 
attribute stuff to

#if !defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
#pragma pack(n)
#endif

for every instance (before and after each to be packed structure).

The same with src/musclecard.c: I changed the constructor attribute part to

#if defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
void __attribute__ ((constructor)) musclecard_init(void)
#else
#pragma init (musclecard_init)
void musclecard_init(void)
#endif

and destructor attribute to:

#if defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
void __attribute__ ((destructor)) musclecard_fini(void)
#else
#pragma fini (musclecard_fini)
void musclecard_fini(void)
#endif

But this is not really the correct way to solve the problem - just my quick 
hack for it.

The summary patch is attached ('patch -p1 < ../pcsc.patch' inside source dir).

-- 
Heiko Nardmann (Dipl.-Ing. Technische Informatik)
secunet Security Networks AG - Sicherheit in Netzwerken (www.secunet.de),
Weidenauer Str. 223-225, D-57076 Siegen
Tel. : +49 271 48950-13, Fax  : +49 271 48950-50
diff -urN pcsc-lite-1.2.9-beta8.orig/libmusclecard/src/musclecard.c pcsc-lite-1.2.9-beta8.new/libmusclecard/src/musclecard.c
--- pcsc-lite-1.2.9-beta8.orig/libmusclecard/src/musclecard.c	Mon Aug  8 21:58:21 2005
+++ pcsc-lite-1.2.9-beta8.new/libmusclecard/src/musclecard.c	Fri Sep 16 14:06:56 2005
@@ -65,11 +65,21 @@
 
 /* Library constructor and deconstructor function for UNIX */
 #ifndef WIN32
+#if defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
 void __attribute__ ((constructor)) musclecard_init(void)
+#else
+#pragma init (musclecard_init)
+void musclecard_init(void)
+#endif
 {
 }
 	
+#if defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
 void __attribute__ ((destructor)) musclecard_fini(void)
+#else
+#pragma fini (musclecard_fini)
+void musclecard_fini(void)
+#endif
 {
 	if (localHContext != 0)
 		SCardReleaseContext(localHContext);
diff -urN pcsc-lite-1.2.9-beta8.orig/src/PCSC/reader.h.in pcsc-lite-1.2.9-beta8.new/src/PCSC/reader.h.in
--- pcsc-lite-1.2.9-beta8.orig/src/PCSC/reader.h.in	Sun Aug 21 12:51:40 2005
+++ pcsc-lite-1.2.9-beta8.new/src/PCSC/reader.h.in	Fri Sep 16 14:14:49 2005
@@ -117,17 +117,32 @@
 
 #include <inttypes.h>
 /* the structure must be 6-bytes long */
+#if !defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
+#pragma pack()
+#endif
 typedef struct
 {
+#if defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
 	int8_t tag __attribute__ ((__packed__));
 	int8_t length __attribute__ ((__packed__));
 	int32_t value __attribute__ ((__packed__));
+#else
+	int8_t tag;
+	int8_t length;
+	int32_t value;
+#endif
 } PCSC_TLV_STRUCTURE;
+#if !defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
+#pragma pack()
+#endif
 
 /* the wLangId and wPINMaxExtraDigit are 16 bits so are subject to byte
  * ordering */
 #define HOST_TO_CCID(x) @host_to_ccid@
 
+#if !defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
+#pragma pack()
+#endif
 typedef struct
 {
 	int8_t bTimerOut;	/* timeout is seconds (00 means use default timeout) */
@@ -150,8 +165,18 @@
 	int8_t bTeoPrologue[3]; /* T=1 block prologue field to use (fill with 00) */
 	int8_t ulDataLength; /* length of Data to be sent to the ICC */
 	int8_t abData[1]; /* Data to send to the ICC */
+#if defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
 } __attribute__ ((__packed__)) PIN_VERIFY_STRUCTURE;
+#else
+} PIN_VERIFY_STRUCTURE;
+#endif
+#if !defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
+#pragma pack()
+#endif
 
+#if !defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
+#pragma pack()
+#endif
 typedef struct
 {
 	int8_t bTimerOut;	/* timeout is seconds (00 means use default timeout) */
@@ -182,7 +207,14 @@
 	int8_t bTeoPrologue[3]; /* T=1 block prologue field to use (fill with 00) */
 	int8_t ulDataLength; /* length of Data to be sent to the ICC */
 	int8_t abData[1]; /* Data to send to the ICC */
+#if defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
 } __attribute__ ((__packed__)) PIN_MODIFY_STRUCTURE;
+#else
+} PIN_MODIFY_STRUCTURE;
+#endif
+#if !defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
+#pragma pack()
+#endif
 
 #endif
 
diff -urN pcsc-lite-1.2.9-beta8.orig/src/misc.h pcsc-lite-1.2.9-beta8.new/src/misc.h
--- pcsc-lite-1.2.9-beta8.orig/src/misc.h	Mon Aug  8 21:58:19 2005
+++ pcsc-lite-1.2.9-beta8.new/src/misc.h	Fri Sep 16 13:39:53 2005
@@ -23,7 +23,11 @@
  *
  * see http://gcc.gnu.org/onlinedocs/gcc-3.3.5/gcc/Function-Attributes.html#Function-Attributes
  */
+#if defined(HAS_COMPILER_ATTRIBUTE_SUPPORT)
 #define INTERNAL __attribute__ ((visibility("hidden")))
+#else
+#define INTERNAL __hidden
+#endif
 
 #ifdef __cplusplus
 }

Attachment: pgpAPK2wv3Hor.pgp
Description: PGP signature

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to