aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-30 08:24:46 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-30 08:24:46 +0000
commit368a12c7be6f451b60a567e5e6b78a2af9d4fee6 (patch)
treee631831fdee6c6f152b31719bfa8006119052df8
parent5cc6fb52cbf3caa98c64171cc94281cc9e5c2c86 (diff)
downloadpaludis-368a12c7be6f451b60a567e5e6b78a2af9d4fee6.tar.gz
paludis-368a12c7be6f451b60a567e5e6b78a2af9d4fee6.tar.xz
Use boost for tr1 if necessary
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac17
-rw-r--r--doc/programmingwithpaludis.html.skel3
-rw-r--r--tr1/Makefile.am29
-rw-r--r--tr1/tr1_memory.hh39
5 files changed, 87 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index 5dc8de3..bb4127c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,7 @@ MAINTAINERCLEANFILES = Makefile.in configure config/* aclocal.m4 \
config.h config.h.in INSTALL COPYING
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip std-options
EXTRA_DIST = autogen.bash automake-deps-dist-hack.tmp
-SUBDIRS = misc test paludis cran ebuild ruby src doc hooks eselect bash-completion zsh-completion
+SUBDIRS = misc tr1 test paludis cran ebuild ruby src doc hooks eselect bash-completion zsh-completion
DISTCHECK_CONFIGURE_FLAGS = --enable-qa --enable-ruby --enable-glsa \
--with-ruby-install-dir='$${DESTDIR}$${prefix}/ruby_dir' \
diff --git a/configure.ac b/configure.ac
index 2be5f29..87f9c13 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,6 +198,7 @@ AC_SUBST([HAVE_STD_HASHES])
dnl }}}
dnl {{{ tr1 shared pointers
+need_pointer_wrappers=no
AC_MSG_CHECKING([for std::tr1::shared_ptr<>])
AC_COMPILE_IFELSE([
#include <tr1/memory>
@@ -209,7 +210,20 @@ int main(int, char *[])
],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
- AC_MSG_ERROR([Your compiler doesn't support std::tr1])])
+ AC_MSG_CHECKING([for boost::shared_ptr<>])
+ AC_COMPILE_IFELSE([
+#include <boost/shared_ptr.hpp>
+int main(int, char *[])
+{
+ boost::shared_ptr<int> x(new int(10));
+ return *x;
+}
+],
+ [AC_MSG_RESULT([yes])
+ need_pointer_wrappers=yes],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Your compiler doesn't support tr1 and boost is not installed])])])
+AM_CONDITIONAL([NEED_POINTER_WRAPPERS], test x$need_pointer_wrappers = "xyes")
dnl }}}
need_xml_check=
@@ -907,6 +921,7 @@ AC_OUTPUT(
src/clients/qualudis/Makefile
src/clients/adjutrix/Makefile
test/Makefile
+ tr1/Makefile
zsh-completion/Makefile
)
dnl }}}
diff --git a/doc/programmingwithpaludis.html.skel b/doc/programmingwithpaludis.html.skel
index eccd7f6..74eb30c 100644
--- a/doc/programmingwithpaludis.html.skel
+++ b/doc/programmingwithpaludis.html.skel
@@ -39,7 +39,8 @@ and library code is in paludis/ .</p>
</pre>
<p>Compile this using <code>g++ -Wall -lpaludis
- -lpaludisdefaultenvironment</code>.</p>
+ -lpaludisdefaultenvironment</code>. If your compiler lacks tr1 support, you
+may also need <code>-I/usr/include/paludis/compat</code>.</p>
<p>The same application written in Ruby will look something like:</p>
diff --git a/tr1/Makefile.am b/tr1/Makefile.am
new file mode 100644
index 0000000..17bdd8d
--- /dev/null
+++ b/tr1/Makefile.am
@@ -0,0 +1,29 @@
+CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda memory
+MAINTAINERCLEANFILES = Makefile.in
+
+AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
+DEFS= \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DLIBEXECDIR=\"$(libexecdir)\" \
+ -DDATADIR=\"$(datadir)\" \
+ -DLIBDIR=\"$(libdir)\"
+
+paludis_compat_tr1dir = $(libdir)/paludis/compat/tr1
+
+if NEED_POINTER_WRAPPERS
+
+paludis_compat_tr1_HEADERS = memory tr1_memory.hh
+
+endif
+
+memory : tr1_memory.hh
+ cp $(srcdir)/tr1_memory.hh $@
+
+EXTRA_DIST = tr1_memory.hh
+BUILT_SOURCES = memory
+SUBDIRS = .
+
+built-sources : $(BUILT_SOURCES)
+ for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
+
+
diff --git a/tr1/tr1_memory.hh b/tr1/tr1_memory.hh
new file mode 100644
index 0000000..099d3c0
--- /dev/null
+++ b/tr1/tr1_memory.hh
@@ -0,0 +1,39 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_TR1_TR1_MEMORY_HH
+#define PALUDIS_GUARD_TR1_TR1_MEMORY_HH 1
+
+/*
+ * Used if we have boost but not std::tr1::shared_ptr<>.
+ */
+
+#include <boost/shared_ptr.hpp>
+
+namespace std
+{
+ namespace tr1
+ {
+ using boost::shared_ptr;
+ using boost::static_pointer_cast;
+ using boost::enable_shared_from_this;
+ }
+}
+
+#endif