Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Nov 2006 14:53:08 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Norikatsu Shigemura <nork@FreeBSD.org>
Cc:        current@FreeBSD.org, David Xu <davidxu@FreeBSD.org>
Subject:   Re: PTHREAD_CFLAGS/PTHREAD_LIBS clean test (Re: libpthread vs libthr.)
Message-ID:  <20061126115308.GB26446@rambler-co.ru>
In-Reply-To: <20061126115311.37d0aa08.nork@FreeBSD.org>
References:  <20061110151247.GA64530@zone3000.net> <20061110173526.GA22441@rambler-co.ru> <20061126115311.37d0aa08.nork@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--n2Pv11Ogg/Ox8ay5
Content-Type: multipart/mixed; boundary="oTHb8nViIGeoXxdp"
Content-Disposition: inline


--oTHb8nViIGeoXxdp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Nov 26, 2006 at 11:53:11AM +0900, Norikatsu Shigemura wrote:
> On Fri, 10 Nov 2006 20:35:26 +0300
> Ruslan Ermilov <ru@freebsd.org> wrote:
> > To make user's life easier, I suggest the following simple patch.
> > Its effect on platforms where libpthread is available is to (sym)link
> > libthr to libpthread if WITHOUT_LIBPTHREAD is set in /etc/src.conf.
> > This would allow more people interested in libthr testing to more
> > easily do it.  (Of course already linked applications wouldn't
> > magically start using libthr without also patching /etc/libmap.conf.)
> > %%%
> > Index: Makefile
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > RCS file: /home/ncvs/src/lib/libthr/Makefile,v
> > retrieving revision 1.20
> > diff -u -p -r1.20 Makefile
> > --- Makefile	22 Aug 2006 07:51:06 -0000	1.20
> > +++ Makefile	10 Nov 2006 17:27:40 -0000
> > @@ -42,7 +42,7 @@ PRECIOUSLIB=3D
> >  .include "${.CURDIR}/sys/Makefile.inc"
> >  .include "${.CURDIR}/thread/Makefile.inc"
> > =20
> > -.if ${MACHINE_ARCH} =3D=3D "sparc64"
> > +.if ${MACHINE_ARCH} =3D=3D "sparc64" || ${MK_LIBPTHREAD} =3D=3D "no"
> >  SYMLINKS+=3Dlib${LIB}.a ${LIBDIR}/libpthread.a
> >  .if !defined(NO_PIC)
> >  SYMLINKS+=3Dlib${LIB}.so ${LIBDIR}/libpthread.so
> > %%%
>=20
> 	In the case you said (echo WITHOUT_LIBPTHREAD=3Dyes >> /etc/src.conf),
> 	we cannot get libkse.*.  Because lib/libpthread is omitted in
> 	lib/Makefile:-(.
>=20
On sparc64, yes.  On other arches, there's no libkse at all.
Why is it a problem?  We don't want to hear about libkse.

> 	I'm trying to test PTHREAD_CFLAGS/PTHREAD_LIBS.  So I prepared
> 	following environment.
>=20
> 	x libpthread.* (removed as passible as)
> 	o libkse.*
> 	o libthr.*
>=20
> 	But WITHOUT_LIBPTHREAD (MK_LIBPTHREAD=3Dno) option is too danger.
>=20
> $ cd /usr/src
> $ fgrep -r MK_LIBPTHREAD .
> ./lib/Makefile:.if ${MK_LIBPTHREAD} !=3D "no"
> ./sbin/ggate/Makefile:.elif ${MK_LIBPTHREAD} !=3D "no"
> ./share/man/man3/Makefile:.if ${MK_LIBPTHREAD} !=3D "no" || ${MK_LIBTHR} =
!=3D "no"
> ./tools/build/mk/OptionalObsoleteFiles.inc:#.if ${MK_LIBPTHREAD} =3D=3D no
> ./usr.bin/Makefile:.elif ${MK_LIBPTHREAD} !=3D "no"
> ./usr.sbin/Makefile:.if ${MK_LIBPTHREAD} !=3D "no"
> ./usr.sbin/Makefile:.if ${MK_LIBPTHREAD} !=3D "no"
> ./usr.sbin/Makefile:.if ${MK_LIBPTHREAD} !=3D "no"
>=20

[...]
> 	ng  In case of sbin/ggate/Makefile, ggatec and ggated will not be
> 	    installed.
>=20
The conditional should be changed to

=2Eelif ${MK_LIBPTHREAD} !=3D "no" || ${MK_LIBTHR} !=3D "no"

so it benefits from my patch to libthr/Makefile.

> 	ng  In case of usr.bin/Makefile, csup will not be installed.
> 	ng  In case of usr.sbin/Makefile, pppctl will not be installed.
>=20
The same change here.

> 	And usr.sbin/cached/Makefile and usr.sbin/ngctl/Makefile is not
> 	good WITHOUT_LIBPTHREAD.  I couldn't compile them.  I think that
> 	these should be omitted in usr.sbin/Makefile like pppctl case.
>=20
You mean without my patch and with WITHOUT_LIBPTHREAD, and with my
patch and wit both WITHOUT_LIBPTHREAD and WITHOUT_LIBTHR?  Yes, these
need to be fixed (see the patch).

> 	And FreeBSD src tree don't have PTHREAD_CFLAGS/PTHREAD_LIBS clean
> 	mechanism.  I think that there are some way to adopt PTHREAD_CFLAGS/
> 	PTHREAD_LIBS to src tree, maybe.  But I don't know how do I do
> 	anyway.
>=20
Why?  Just using ${LIBPTHREAD} in DPADD and -lpthread in LDADD should
work.  If it doesn't work, we will fix it.

> 	1. force lib/libpthread install libkse.* to /usr/lib, and symlink
> 	   to /lib/libpthread.*.  I don't know KEYWORD to symlink to /lib/
> 	   libpthread.* from libkse.*/libthr.*.
>=20
I don't see a reason for this; yet, this is a bad idea because binaries
will record libkse.so.X in them.

> 	2. Fix like following in usr.bin/Makefile and usr.sbin/Makefile:
> .if ${MK_LIBPTHREAD} !=3D "no"
> .....
> 	:
>=20
> 	to
>=20
> .if ${MK_LIBPTHREAD} !=3D "no" || ${MK_LIBTHR} !=3D "no"
>=20
Yes.

> .....
> 	:
> 	   And compile force lib/libpthread.
>=20
Like I said, I fail to see a reason for this.

>          And in case of
> 	   MK_LIBPTHREAD=3Dno, symlink libthr.* to libpthread.*.
>=20
This is what my patch to libthr/Makefile does.  BTW, I'm testing
the attached patch now that should fix issues you mentioned.


Cheers,
--=20
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer

--oTHb8nViIGeoXxdp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=p
Content-Transfer-Encoding: quoted-printable

Index: lib/libthr/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/lib/libthr/Makefile,v
retrieving revision 1.20
diff -u -r1.20 Makefile
--- lib/libthr/Makefile	22 Aug 2006 07:51:06 -0000	1.20
+++ lib/libthr/Makefile	26 Nov 2006 11:22:17 -0000
@@ -42,7 +42,7 @@
 .include "${.CURDIR}/sys/Makefile.inc"
 .include "${.CURDIR}/thread/Makefile.inc"
=20
-.if ${MACHINE_ARCH} =3D=3D "sparc64"
+.if ${MACHINE_ARCH} =3D=3D "sparc64" || ${MK_LIBPTHREAD} =3D=3D "no"
 SYMLINKS+=3Dlib${LIB}.a ${LIBDIR}/libpthread.a
 .if !defined(NO_PIC)
 SYMLINKS+=3Dlib${LIB}.so ${LIBDIR}/libpthread.so
Index: sbin/ggate/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sbin/ggate/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- sbin/ggate/Makefile	22 Aug 2006 07:51:09 -0000	1.6
+++ sbin/ggate/Makefile	26 Nov 2006 11:41:15 -0000
@@ -6,12 +6,8 @@
 	${_ggated} \
 	ggatel
=20
-.if ${MACHINE_ARCH} =3D=3D "sparc64"
-.if ${MK_LIBTHR} !=3D "no"
-_ggatec=3D	ggatec
-_ggated=3D	ggated
-.endif
-.elif ${MK_LIBPTHREAD} !=3D "no"
+.if ${MK_LIBTHR} !=3D "no" || \
+    (${MACHINE_ARCH} !=3D "sparc64" && ${MK_LIBPTHREAD} !=3D "no")  =20
 _ggatec=3D	ggatec
 _ggated=3D	ggated
 .endif
Index: usr.bin/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/usr.bin/Makefile,v
retrieving revision 1.296
diff -u -r1.296 Makefile
--- usr.bin/Makefile	22 Aug 2006 03:22:17 -0000	1.296
+++ usr.bin/Makefile	26 Nov 2006 11:41:25 -0000
@@ -262,11 +262,8 @@
 .if ${MK_OPENSSL} !=3D "no"
 _chkey=3D		chkey
 _newkey=3D	newkey
-.if ${MACHINE_ARCH} =3D=3D "sparc64"
-.if ${MK_LIBTHR} !=3D "no"
-_csup=3D		csup
-.endif
-.elif ${MK_LIBPTHREAD} !=3D "no"
+.if ${MK_LIBTHR} !=3D "no" || \
+    (${MACHINE_ARCH} !=3D "sparc64" && ${MK_LIBPTHREAD} !=3D "no")  =20
 _csup=3D		csup
 .endif
 .endif
Index: usr.sbin/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/usr.sbin/Makefile,v
retrieving revision 1.364
diff -u -r1.364 Makefile
--- usr.sbin/Makefile	15 Nov 2006 14:57:05 -0000	1.364
+++ usr.sbin/Makefile	26 Nov 2006 11:41:46 -0000
@@ -105,7 +105,7 @@
 	${_ndp} \
 	newsyslog \
 	nfsd \
-	ngctl \
+	${_ngctl} \
 	nghook \
 	nologin \
 	ntp \
@@ -226,10 +226,6 @@
 _bluetooth=3D	bluetooth
 .endif
=20
-.if ${MK_NS_CACHING} !=3D "no"
-_cached=3D       cached
-.endif
-
 .if ${MK_OPENSSL} !=3D "no"
 _keyserv=3D	keyserv
 .endif
@@ -267,10 +263,22 @@
 _authpf=3D	authpf
 .endif
=20
+.if ${MK_LIBTHR} !=3D "no" || \
+    (${MACHINE_ARCH} !=3D "sparc64" && ${MK_LIBPTHREAD} !=3D "no")
+_ngctl=3D		ngctl
+.endif
+
 .if ${MK_LPR} !=3D "no"
 _lpr=3D		lpr
 .endif
=20
+.if ${MK_NS_CACHING} !=3D "no"
+.if ${MK_LIBTHR} !=3D "no" || \
+    (${MACHINE_ARCH} !=3D "sparc64" && ${MK_LIBPTHREAD} !=3D "no")
+_cached=3D	cached
+.endif
+.endif
+
 .if ${MK_SENDMAIL} !=3D "no"
 _editmap=3D	editmap
 _mailstats=3D	mailstats
@@ -305,7 +313,7 @@
 _mptable=3D	mptable
 _ndiscvt=3D	ndiscvt
 _pnpinfo=3D	pnpinfo
-.if ${MK_LIBPTHREAD} !=3D "no"
+.if ${MK_LIBPTHREAD} !=3D "no" || ${MK_LIBTHR} !=3D "no"
 _pppctl=3D	pppctl
 .endif
 _sicontrol=3D	sicontrol
@@ -341,7 +349,7 @@
 _mount_smbfs=3D	mount_smbfs
 _mptable=3D	mptable
 _ndiscvt=3D	ndiscvt
-.if ${MK_LIBPTHREAD} !=3D "no"
+.if ${MK_LIBPTHREAD} !=3D "no" || ${MK_LIBTHR} !=3D "no"
 _pppctl=3D	pppctl
 .endif
 _sicontrol=3D	sicontrol
@@ -355,7 +363,7 @@
 .endif
 _kgmon=3D		kgmon
 _mount_smbfs=3D	mount_smbfs
-.if ${MK_LIBPTHREAD} !=3D "no"
+.if ${MK_LIBPTHREAD} !=3D "no" || ${MK_LIBTHR} !=3D "no"
 _pppctl=3D	pppctl
 .endif
 _zzz=3D		zzz
Index: usr.sbin/cached/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/usr.sbin/cached/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- usr.sbin/cached/Makefile	28 Apr 2006 12:03:37 -0000	1.1
+++ usr.sbin/cached/Makefile	26 Nov 2006 11:12:41 -0000
@@ -1,19 +1,17 @@
 # $FreeBSD: src/usr.sbin/cached/Makefile,v 1.1 2006/04/28 12:03:37 ume Exp=
 $
=20
-PROG=3Dcached
-PROGNAME=3Dcached
-MAN=3Dcached.conf.5 cached.8
+PROG=3D	cached
+MAN=3D	cached.conf.5 cached.8
=20
-WARNS?=3D2
-SRCS=3D agent.c cached.c cachedcli.c cachelib.c cacheplcs.c debug.c log.c \
+WARNS?=3D	2
+SRCS=3D	agent.c cached.c cachedcli.c cachelib.c cacheplcs.c debug.c log.c \
 	config.c query.c mp_ws_query.c mp_rs_query.c singletons.c protocol.c \
 	parser.c
 CFLAGS+=3D -DCONFIG_PATH=3D"\"${PREFIX}/etc/cached.conf\""
-DPADD+=3D${LIBM} ${LIBPTHREAD} ${LIBUTIL}
-LDADD+=3D${LIBM} ${LIBPTHREAD} ${LIBUTIL}
-LDFLAGS+=3D -Xlinker --export-dynamic
+DPADD=3D	${LIBM} ${LIBPTHREAD} ${LIBUTIL}
+LDADD=3D	-lm -lpthread -lutil
+#LDFLAGS+=3D -Xlinker --export-dynamic
=20
-.PATH:	${.CURDIR}/agents
-.include "agents/Makefile.inc"
-.include "../Makefile.inc"
+.PATH: ${.CURDIR}/agents
+.include "${.CURDIR}/agents/Makefile.inc"
 .include <bsd.prog.mk>

--oTHb8nViIGeoXxdp--

--n2Pv11Ogg/Ox8ay5
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFFaYAkqRfpzJluFF4RAr8zAJ4t33yRy/XU4S3B9eT3WIJ8CoURTgCfXCkU
kB8lZXjWi2iZiSswxaGeUsM=
=ZMrz
-----END PGP SIGNATURE-----

--n2Pv11Ogg/Ox8ay5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061126115308.GB26446>