diff options
author | grant <grant@pkgsrc.org> | 2003-07-10 23:10:07 +0000 |
---|---|---|
committer | grant <grant@pkgsrc.org> | 2003-07-10 23:10:07 +0000 |
commit | d6cada760dd053467ceced1a87946c34f5752aad (patch) | |
tree | 3383eb45160883fe433f571d5099b1f9ba06a814 | |
parent | eadb4a9c08bcadd7b2399a6c05b56371be960f38 (diff) | |
download | pkgsrc-d6cada760dd053467ceced1a87946c34f5752aad.tar.gz |
define user-visible variable PTHREAD_LDFLAGS that contains options
to link pthreaded code, ala PTHREAD_CFLAGS.
this adds support for systems which have no libpthread, but rather,
have pthreads functions in libc_r, such as FreeBSD 5.x.
export PTHREAD_CFLAGS and PTHREAD_LDFLAGS via MAKE_ENV.
-rw-r--r-- | mk/bsd.pkg.mk | 6 | ||||
-rw-r--r-- | mk/pthread.buildlink2.mk | 25 |
2 files changed, 27 insertions, 4 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 9bacfa67ee7..5d46104320f 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1208 2003/07/09 16:18:06 agc Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1209 2003/07/10 23:10:07 grant Exp $ # # This file is in the public domain. # @@ -313,6 +313,10 @@ MAKE_ENV+= CXX="${CXX}" MAKE_ENV+= CPP="${CPP}" .endif +# export the flags needed to compile and link pthreaded code +MAKE_ENV+= PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" +MAKE_ENV+= PTHREAD_LDFLAGS="${PTHREAD_LDFLAGS}" + .if exists(${ZOULARISBASE}/bin/ftp) # Zoularis FETCH_CMD?= ${ZOULARISBASE}/bin/ftp .else diff --git a/mk/pthread.buildlink2.mk b/mk/pthread.buildlink2.mk index b41dfd034c5..9cfab7d9c8a 100644 --- a/mk/pthread.buildlink2.mk +++ b/mk/pthread.buildlink2.mk @@ -1,4 +1,4 @@ -# $NetBSD: pthread.buildlink2.mk,v 1.10 2003/05/25 19:02:32 jlam Exp $ +# $NetBSD: pthread.buildlink2.mk,v 1.11 2003/07/10 23:10:08 grant Exp $ # # The pthreads strategy for pkgsrc is to "bless" a particular pthread # package as the Official Pthread Replacement (OPR). A package that uses @@ -154,9 +154,27 @@ BUILDLINK_TARGETS+= pthread-buildlink-la BUILDLINK_CFLAGS.pthread= -pthread +# handle systems which have pthreads functions in libc_r such as +# FreeBSD 5.x, or fall back to libc if we don't find libc_r. +# +. if exists(/usr/lib/libpthread.so) || exists(/lib/libpthread.so) +BUILDLINK_LDFLAGS.pthread= -lpthread LIBTOOL_ARCHIVE_UNTRANSFORM_SED+= \ -e "s|${BUILDLINK_PREFIX.pthread}/lib/libpthread.la|-lpthread|g" \ -e "s|${LOCALBASE}/lib/libpthread.la|-lpthread|g" +. else +. if exists(/usr/lib/libc_r.so) +BUILDLINK_LDFLAGS.pthread= -lc_r +LIBTOOL_ARCHIVE_UNTRANSFORM_SED+= \ + -e "s|${BUILDLINK_PREFIX.pthread}/lib/libpthread.la|-lc_r|g" \ + -e "s|${LOCALBASE}/lib/libpthread.la|-lc_r|g" +. else +BUILDLINK_LDFLAGS.pthread= # empty +LIBTOOL_ARCHIVE_UNTRANSFORM_SED+= \ + -e "s|${BUILDLINK_PREFIX.pthread}/lib/libpthread.la||g" \ + -e "s|${LOCALBASE}/lib/libpthread.la||g" +. endif +. endif pthread-buildlink: _BUILDLINK_USE @@ -179,10 +197,11 @@ PKG_FAIL_REASON= "${PKGNAME} needs pthreads, but ${_PKG_PTHREAD_BUILDLINK2_MK} i . endif .endif -# Define user-visible PTHREAD_CFLAGS as compiler options used to -# compile/link pthreaded code. +# Define user-visible PTHREAD_CFLAGS and PTHREAD_LDFLAGS as compiler +# options used to compile/link pthreaded code. # PTHREAD_CFLAGS= ${BUILDLINK_CFLAGS.pthread} +PTHREAD_LDFLAGS=${BUILDLINK_LDFLAGS.pthread} PTHREADBASE= ${BUILDLINK_PREFIX.pthread} CONFIGURE_ENV+= PTHREADBASE=${PTHREADBASE} |