[patch] Don't add PTH include path to gpgme's CFLAGS globally

Michael Nottebrock <[email protected]> Sat, 10 Feb 2007 01:11:02 +0100
Newsgroups gmane.comp.encryption.gpg.gpa.devel
Message-ID <[email protected]>
In FreeBSD 6 and later, sys/types.h now also defines the basic pthread types 
in order to comply with IEEE Std 1003.1-2004.

This causes a compile error in gpgme due to conflicting types for pthread_* if 
pth-support is enabled, since the pth include directory is globally added to 
CFLAGS and ath-pthread.c picks up the pth-supplied pthread.h header instead 
of the system include:

cc -DHAVE_CONFIG_H -I. -I. -I.. -I../assuan -I/usr/local/include 
-I/usr/local/include/pth -I/usr/local/include/pth 
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -O2 
-pipe -O2 -fno-strict-aliasing -Wall -Wcast-align 
-Wshadow -Wstrict-prototypes -MT ath-pthread.lo -MD -MP -MF 
.deps/ath-pthread.Tpo -c ath-pthread.c  -fPIC -DPIC -o .libs/ath-pthread.o
In file included from ath-pthread.c:36:
/usr/local/include/pth/pthread.h:285: error: conflicting types for 
'pthread_t'
/usr/include/sys/_pthreadtypes.h:64: error: previous declaration of 
'pthread_t' was here
/usr/local/include/pth/pthread.h:286: error: conflicting types for 
'pthread_attr_t'
/usr/include/sys/_pthreadtypes.h:65: error: previous declaration of 
'pthread_attr_t' was here
/usr/local/include/pth/pthread.h:288: error: conflicting types for 
'pthread_once_t'
/usr/include/sys/_pthreadtypes.h:71: error: previous declaration of 
'pthread_once_t' was here
/usr/local/include/pth/pthread.h:289: error: conflicting types for 
'pthread_mutexattr_t'
/usr/include/sys/_pthreadtypes.h:67: error: previous declaration of 
'pthread_mutexattr_t' was here
/usr/local/include/pth/pthread.h:290: error: conflicting types for 
'pthread_mutex_t'
/usr/include/sys/_pthreadtypes.h:66: error: previous declaration of 
'pthread_mutex_t' was here
/usr/local/include/pth/pthread.h:291: error: conflicting types for 
'pthread_condattr_t'
/usr/include/sys/_pthreadtypes.h:69: error: previous declaration of 
'pthread_condattr_t' was here
/usr/local/include/pth/pthread.h:292: error: conflicting types for 
'pthread_cond_t'
/usr/include/sys/_pthreadtypes.h:68: error: previous declaration of 
'pthread_cond_t' was here
/usr/local/include/pth/pthread.h:293: error: conflicting types for 
'pthread_rwlockattr_t'
/usr/include/sys/_pthreadtypes.h:73: error: previous declaration of 
'pthread_rwlockattr_t' was here
/usr/local/include/pth/pthread.h:294: error: conflicting types for 
'pthread_rwlock_t'
/usr/include/sys/_pthreadtypes.h:72: error: previous declaration of 
'pthread_rwlock_t' was here

The attached patch changes the Makefile template in the gpgme subdir so that 
PTH_CFLAGS are only added to the include path where needed.


Cheers,
-- 
   ,_,   | Michael Nottebrock               | [email protected]
 (/^ ^\) | FreeBSD - The Power to Serve     | http://www.freebsd.org
   \u/   | K Desktop Environment on FreeBSD | http://freebsd.kde.org

_______________________________________________
Gpa-dev mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gpa-dev
gpgme.diff (text/x-diff, 737 B)
--- gpgme/Makefile.am
+++ gpgme/Makefile.am
@@ -109,8 +109,8 @@
 
 # We use a global CFLAGS and CPPFLAGS setting for all library
 # versions, because then every object file is only compiled once.
-AM_CPPFLAGS = $(assuan_cppflags) @GPG_ERROR_CFLAGS@ @PTH_CPPFLAGS@
-AM_CFLAGS = @PTH_CFLAGS@ @GLIB_CFLAGS@
+AM_CPPFLAGS = $(assuan_cppflags) @GPG_ERROR_CFLAGS@
+AM_CFLAGS = @GLIB_CFLAGS@
 
 if HAVE_W32_SYSTEM
 
@@ -161,6 +161,7 @@
 libgpgme_pthread_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
 	-lpthread @GPG_ERROR_LIBS@ @NETLIBS@
 
+libgpgme_pth_la_CFLAGS = ${CFLAGS} @PTH_CFLAGS@
 libgpgme_pth_la_LDFLAGS = @PTH_LDFLAGS@ \
 	$(libgpgme_version_script_cmd) -version-info \
 	@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
signature.asc (application/pgp-signature, 187 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)

iD8DBQBFzQ2ZXhc68WspdLARAm5iAKCnS0ur6G75MXzD/AhloO0dYq3oOwCgmId9
A2ZEUHDdnlR1EePCWMn9ozI=
=fTZ+
-----END PGP SIGNATURE-----